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  ~SIM_QueryArrays() override;
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  int getNumRecordTypesSubclass() const override;
53  const char *getRecordTypeNameSubclass(
54  int recordtypenum) const override;
55 
57  const char *recordtype) const override;
59  const char *recordtype) const override;
60  const char *getFieldNameSubclass(
61  const char *recordtype,
62  int fieldnum) const override;
64  const char *recordtype,
65  int fieldnum) const override;
67  const char *recordtype,
68  int recordnum,
69  const char *fieldname,
71  ) const override;
72 
73 private:
74  class SIM_QueryArrayField
75  {
76  public:
77  SIM_QueryArrayField(
78  const UT_BitArray *array);
79  SIM_QueryArrayField(
80  const UT_IntArray *array);
81  SIM_QueryArrayField(
82  const UT_FloatArray *array);
83  SIM_QueryArrayField(
84  const UT_StringArray *array);
85  SIM_QueryArrayField(
86  const UT_Vector2Array *array);
87  SIM_QueryArrayField(
88  const UT_Vector3Array *array);
89  SIM_QueryArrayField(
90  const UT_Vector4Array *array);
91  ~SIM_QueryArrayField();
92 
93  UT_OptionType getFieldType() const;
94  int getNumEntries() const;
95  bool getValueRaw(int entrynum,
96  UT_OptionEntryPtr &result) const;
97 
98  private:
99  void initialize();
100 
101  UT_OptionType myFieldType;
102  const UT_BitArray *myBitArray;
103  const UT_IntArray *myIntArray;
104  const UT_FloatArray *myFloatArray;
105  const UT_StringArray *myStringArray;
106  const UT_Vector2Array *myVector2Array;
107  const UT_Vector3Array *myVector3Array;
108  const UT_Vector4Array *myVector4Array;
109  };
110 
111  class SIM_QueryArrayRecord
112  {
113  public:
114  SIM_QueryArrayRecord();
115  ~SIM_QueryArrayRecord();
116 
117  void addField(const char *fieldname,
118  SIM_QueryArrayField *field);
119  int getNumFields() const;
120  const char *getFieldName(int fieldnum) const;
121  UT_OptionType getFieldType(int fieldnum) const;
122  const SIM_QueryArrayField *getField(int fieldnum) const;
123  int getNumEntries() const;
124  bool getValueRaw(const char *fieldname,
125  int entrynum,
126  UT_OptionEntryPtr &result) const;
127 
128  private:
129  UT_StringArray myFieldNames;
131  };
132 
133  SIM_QueryArrayRecord *getRecord(const char *recordtype);
134 
135  UT_StringArray myRecordNames;
137 };
138 
139 #endif
140 
UT_OptionType
Definition: UT_Options.h:44
**But if you need a result
Definition: thread.h:613
virtual int getNumRecordsSubclass(const char *recordtype) const
virtual int getNumRecordTypesSubclass() const
virtual bool getFieldRawSubclass(const char *recordtype, int recordnum, const char *fieldname, UT_OptionEntryPtr &result) const
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
Definition: logging.h:294
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:12
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr
virtual const char * getRecordTypeNameSubclass(int recordtypenum) const