HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_PropertyLookupList.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: OP_PropertyLookupList.h ( OP Library, C++)
7  *
8  * COMMENTS: Class used to perform batch lookup of parameters/properties.
9  * The list should be initialized with the parameter names.
10  * Calling OP_Parameters::lookupParameterOrProperties() will fill
11  * out the objects and parameter information.
12  */
13 
14 #ifndef __OP_PropertyLookupList__
15 #define __OP_PropertyLookupList__
16 
17 #include "OP_API.h"
18 
19 #include <UT/UT_ValArray.h>
20 
21 class OP_Node;
22 class PRM_Parm;
23 
25 public:
28 
29  void reserve(int size) // Reserve space for parameters
30  {
31  myNames.setCapacityIfNeeded(size);
32  mySrcNodes.setCapacityIfNeeded(size);
33  myNodes.setCapacityIfNeeded(size);
34  myParmPtrs.setCapacityIfNeeded(size);
35  myLookupData.setCapacityIfNeeded(size);
36  }
37  void clear()
38  {
39  myNames.entries(0);
40  mySrcNodes.entries(0);
41  myNodes.entries(0);
42  myParmPtrs.entries(0);
43  myLookupData.entries(0);
44  }
45 
46  // The names are passed by reference and must be maintained by the caller.
47  // The strings are *not* duplicated in this list.
48  void addParm(const char *name, OP_Node *src, int data)
49  {
50  myNames.append(name);
51  mySrcNodes.append(src);
52  myNodes.append((OP_Node *)0);
53  myParmPtrs.append((PRM_Parm *)0);
54  myLookupData.append(data);
55  }
56  int entries() const { return myNames.entries(); }
57  const char *getName(int i) const { return myNames(i); }
58  OP_Node *getSourceNode(int i) const { return mySrcNodes(i); }
59 
60  // After the lookup has been performed, the following methods may be called
61  bool isFound(int i) const { return myNodes(i) != 0; }
62  OP_Node *getNode(int i) const { return myNodes(i); }
63  PRM_Parm *getParmPtr(int i) const { return myParmPtrs(i); }
64  int getLookupData(int i) const { return myLookupData(i); }
65 
66  // The following method is
67  void setLookupInfo(int i, OP_Node *node, PRM_Parm *parm)
68  {
69  UT_ASSERT(i >= 0 && i < myNodes.entries());
70  myNodes(i) = node;
71  myParmPtrs(i) = parm;
72  }
73 
74 private:
76  UT_ValArray<OP_Node *> mySrcNodes;
78  UT_ValArray<PRM_Parm *> myParmPtrs;
79  UT_ValArray<int> myLookupData;
80 };
81 
82 #endif
myNodes
Definition: UT_RTreeImpl.h:708
PRM_Parm * getParmPtr(int i) const
OP_Node * getNode(int i) const
void setLookupInfo(int i, OP_Node *node, PRM_Parm *parm)
GLuint const GLchar * name
Definition: glcorearb.h:786
const char * getName(int i) const
GLsizeiptr size
Definition: glcorearb.h:664
bool isFound(int i) const
#define OP_API
Definition: OP_API.h:10
OP_Node * getSourceNode(int i) const
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
int getLookupData(int i) const
Definition: format.h:895
void addParm(const char *name, OP_Node *src, int data)
GLenum src
Definition: glcorearb.h:1793