HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_QueryArrays.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  */
7 
8 #ifndef __SIM_QueryArrays_h__
9 #define __SIM_QueryArrays_h__
10 
11 #include "SIM_API.h"
12 #include <UT/UT_IntArray.h>
13 #include <UT/UT_StringArray.h>
14 #include "SIM_Query.h"
15 
16 class UT_BitArray;
17 
18 /// This class provides an interface between a SIM_Data and the Houdini
19 /// expression language. It also helps in building the tree view of a
20 /// simulation.
22 {
23 public:
24  /// Constructor which takes a const SIM_Data as our owner.
25  explicit SIM_QueryArrays(const SIM_Data *owner);
26  /// Destructor for this class.
27  virtual ~SIM_QueryArrays();
28 
29  void addArray(const char *recordtype,
30  const char *fieldname,
31  const UT_BitArray *array);
32  void addArray(const char *recordtype,
33  const char *fieldname,
34  const UT_IntArray *array);
35  void addArray(const char *recordtype,
36  const char *fieldname,
37  const UT_FloatArray *array);
38  void addArray(const char *recordtype,
39  const char *fieldname,
40  const UT_StringArray *array);
41  void addArray(const char *recordtype,
42  const char *fieldname,
43  const UT_Vector2Array *array);
44  void addArray(const char *recordtype,
45  const char *fieldname,
46  const UT_Vector3Array *array);
47  void addArray(const char *recordtype,
48  const char *fieldname,
49  const UT_Vector4Array *array);
50 
51 protected:
52  virtual int getNumRecordTypesSubclass() const;
53  virtual const char *getRecordTypeNameSubclass(
54  int recordtypenum) const;
55 
56  virtual int getNumRecordsSubclass(
57  const char *recordtype) const;
58  virtual int getNumFieldsSubclass(
59  const char *recordtype) const;
60  virtual const char *getFieldNameSubclass(
61  const char *recordtype,
62  int fieldnum) const;
64  const char *recordtype,
65  int fieldnum) const;
66  virtual bool getFieldRawSubclass(
67  const char *recordtype,
68  int recordnum,
69  const char *fieldname,
70  UT_OptionEntry *&result) const;
71 
72 #if defined(SOLARIS)
73 public:
74 #else
75 private:
76 #endif
77  class SIM_QueryArrayField
78  {
79  public:
80  SIM_QueryArrayField(
81  const UT_BitArray *array);
82  SIM_QueryArrayField(
83  const UT_IntArray *array);
84  SIM_QueryArrayField(
85  const UT_FloatArray *array);
86  SIM_QueryArrayField(
87  const UT_StringArray *array);
88  SIM_QueryArrayField(
89  const UT_Vector2Array *array);
90  SIM_QueryArrayField(
91  const UT_Vector3Array *array);
92  SIM_QueryArrayField(
93  const UT_Vector4Array *array);
94  ~SIM_QueryArrayField();
95 
96  UT_OptionType getFieldType() const;
97  int getNumEntries() const;
98  bool getValueRaw(int entrynum,
99  UT_OptionEntry *&result) const;
100 
101  private:
102  void initialize();
103 
104  UT_OptionType myFieldType;
105  const UT_BitArray *myBitArray;
106  const UT_IntArray *myIntArray;
107  const UT_FloatArray *myFloatArray;
108  const UT_StringArray *myStringArray;
109  const UT_Vector2Array *myVector2Array;
110  const UT_Vector3Array *myVector3Array;
111  const UT_Vector4Array *myVector4Array;
112  };
113 
114  class SIM_QueryArrayRecord
115  {
116  public:
117  SIM_QueryArrayRecord();
118  ~SIM_QueryArrayRecord();
119 
120  void addField(const char *fieldname,
121  SIM_QueryArrayField *field);
122  int getNumFields() const;
123  const char *getFieldName(int fieldnum) const;
124  UT_OptionType getFieldType(int fieldnum) const;
125  const SIM_QueryArrayField *getField(int fieldnum) const;
126  int getNumEntries() const;
127  bool getValueRaw(const char *fieldname,
128  int entrynum,
129  UT_OptionEntry *&result) const;
130 
131  private:
132  UT_StringArray myFieldNames;
134  };
135 #if defined(SOLARIS)
136 private:
137 #endif
138 
139  SIM_QueryArrayRecord *getRecord(const char *recordtype);
140 
141  UT_StringArray myRecordNames;
143 };
144 
145 #endif
146 
UT_OptionType
virtual int getNumRecordsSubclass(const char *recordtype) const
virtual bool getFieldRawSubclass(const char *recordtype, int recordnum, const char *fieldname, UT_OptionEntry *&result) const
virtual int getNumRecordTypesSubclass() const
OPENVDB_API void initialize()
Global registration of basic types.
Definition: logging.h:316
virtual const char * getFieldNameSubclass(const char *recordtype, int fieldnum) const
virtual int getNumFieldsSubclass(const char *recordtype) const
virtual UT_OptionType getFieldTypeSubclass(const char *recordtype, int fieldnum) const
#define SIM_API
Definition: SIM_API.h:10
virtual const char * getRecordTypeNameSubclass(int recordtypenum) const