HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 private:
73  class SIM_QueryArrayField
74  {
75  public:
76  SIM_QueryArrayField(
77  const UT_BitArray *array);
78  SIM_QueryArrayField(
79  const UT_IntArray *array);
80  SIM_QueryArrayField(
81  const UT_FloatArray *array);
82  SIM_QueryArrayField(
83  const UT_StringArray *array);
84  SIM_QueryArrayField(
85  const UT_Vector2Array *array);
86  SIM_QueryArrayField(
87  const UT_Vector3Array *array);
88  SIM_QueryArrayField(
89  const UT_Vector4Array *array);
90  ~SIM_QueryArrayField();
91 
92  UT_OptionType getFieldType() const;
93  int getNumEntries() const;
94  bool getValueRaw(int entrynum,
95  UT_OptionEntry *&result) const;
96 
97  private:
98  void initialize();
99 
100  UT_OptionType myFieldType;
101  const UT_BitArray *myBitArray;
102  const UT_IntArray *myIntArray;
103  const UT_FloatArray *myFloatArray;
104  const UT_StringArray *myStringArray;
105  const UT_Vector2Array *myVector2Array;
106  const UT_Vector3Array *myVector3Array;
107  const UT_Vector4Array *myVector4Array;
108  };
109 
110  class SIM_QueryArrayRecord
111  {
112  public:
113  SIM_QueryArrayRecord();
114  ~SIM_QueryArrayRecord();
115 
116  void addField(const char *fieldname,
117  SIM_QueryArrayField *field);
118  int getNumFields() const;
119  const char *getFieldName(int fieldnum) const;
120  UT_OptionType getFieldType(int fieldnum) const;
121  const SIM_QueryArrayField *getField(int fieldnum) const;
122  int getNumEntries() const;
123  bool getValueRaw(const char *fieldname,
124  int entrynum,
125  UT_OptionEntry *&result) const;
126 
127  private:
128  UT_StringArray myFieldNames;
130  };
131 
132  SIM_QueryArrayRecord *getRecord(const char *recordtype);
133 
134  UT_StringArray myRecordNames;
136 };
137 
138 #endif
139 
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:318
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