HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_OpenCLEnforceBoundaryParms.proto.h
Go to the documentation of this file.
1 /* Automagically Generated by generate_proto.py
2  * Do not Edit
3  */
4 #pragma once
5 
6 #include <SIMZ/SIMZ_API.h>
7 #include <SIM/SIM_Query.h>
8 #include <OP/OP_Utils.h>
9 #include <PRM/PRM_Parm.h>
10 #include <UT/UT_IStream.h>
11 #include <UT/UT_NTStreamUtil.h>
12 #include <UT/UT_Ramp.h>
13 #include <UT/UT_SharedPtr.h>
14 #include <UT/UT_StringHolder.h>
15 #include <UT/UT_StringStream.h>
16 #include <UT/UT_VectorTypes.h>
17 #include <UT/UT_EnvControl.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 
25 {
26 public:
27  static int version() { return 0; }
28 
30  {
31  myColliderType = 0;
32  myField = ""_sh;
33  myVelField = ""_sh;
34  myColliderGeo = ""_sh;
35  mySurfaceVDB = ""_sh;
36  myVelocityVDB = ""_sh;
37  myVDBNameSuffix = ""_sh;
38  myUseInstances = false;
39  myInstanceGeo = ""_sh;
40 
41  }
42 
44 
46 
48  {
49  if (myColliderType != src.myColliderType) return false;
50  if (myField != src.myField) return false;
51  if (myVelField != src.myVelField) return false;
52  if (myColliderGeo != src.myColliderGeo) return false;
53  if (mySurfaceVDB != src.mySurfaceVDB) return false;
54  if (myVelocityVDB != src.myVelocityVDB) return false;
55  if (myVDBNameSuffix != src.myVDBNameSuffix) return false;
56  if (myUseInstances != src.myUseInstances) return false;
57  if (myInstanceGeo != src.myInstanceGeo) return false;
58 
59  return true;
60  }
62  {
63  return !operator==(src);
64  }
65 
66 
67  class Query : public SIM_Query
68  {
69  public:
70  explicit Query(const SIM_Data *owner, const SIM_OpenCLEnforceBoundaryParms &parms)
71  : SIM_Query(owner)
72  , myParms(parms)
73  { }
74  ~Query() override {}
75 
76  protected:
77  bool isMyRecord(const char *recordtype) const
78  { return !strcmp(recordtype, "Params"); }
79 
80  int getNumRecordTypesSubclass() const override { return 1; }
81  const char *getRecordTypeNameSubclass(int recordtypenum) const override
82  {
83  if (recordtypenum == 0) return "Params";
84  return 0;
85  }
86  int getNumRecordsSubclass(const char *recordtype) const override
87  {
88  if (isMyRecord(recordtype)) return 1;
89  return 0;
90  }
91  int getNumFieldsSubclass(const char *recordtype) const override
92  {
93  if (isMyRecord(recordtype))
94  return 9;
95  return 0;
96  }
97 
98  const char *getFieldNameSubclass(const char *recordtype,
99  int fieldnum) const override
100  {
101  if (!isMyRecord(recordtype))
102  return 0;
103 
104  switch (fieldnum)
105  {
106  case 0:
107  return "collidertype";
108  case 1:
109  return "field";
110  case 2:
111  return "velocity";
112  case 3:
113  return "collidergeo";
114  case 4:
115  return "surfvdb";
116  case 5:
117  return "velvdb";
118  case 6:
119  return "vdbsuffix";
120  case 7:
121  return "useinst";
122  case 8:
123  return "instgeo";
124 
125  }
126  return 0;
127  }
128  UT_OptionType getFieldTypeSubclass(const char *recordtype,
129  int fieldnum) const override
130  {
131  if (!isMyRecord(recordtype))
132  return UT_OPTION_INVALID;
133 
134  switch (fieldnum)
135  {
136  case 0:
137  return UT_OPTION_INT;
138  case 1:
139  return UT_OPTION_STRING;
140  case 2:
141  return UT_OPTION_STRING;
142  case 3:
143  return UT_OPTION_STRING;
144  case 4:
145  return UT_OPTION_STRING;
146  case 5:
147  return UT_OPTION_STRING;
148  case 6:
149  return UT_OPTION_STRING;
150  case 7:
151  return UT_OPTION_BOOL;
152  case 8:
153  return UT_OPTION_STRING;
154 
155  }
156  return UT_OPTION_INVALID;
157  }
158 
159  bool getFieldRawSubclass(const char *recordtype,
160  int recordnum,
161  const char *fieldname,
162  UT_OptionEntryPtr &result) const override
163  {
164  if (!isMyRecord(recordtype))
165  return false;
166  if (recordnum != 0)
167  return false;
168  // This is less optimal, but if we are in SIM_Query
169  // land we have already given up on performance.
170  if (!strcmp(fieldname, "collidertype"))
171  {
172  result = UTmakeUnique<UT_OptionInt>(myParms.myColliderType);
173  return true;
174  }
175  if (!strcmp(fieldname, "field"))
176  {
177  result = UTmakeUnique<UT_OptionString>(myParms.myField);
178  return true;
179  }
180  if (!strcmp(fieldname, "velocity"))
181  {
182  result = UTmakeUnique<UT_OptionString>(myParms.myVelField);
183  return true;
184  }
185  if (!strcmp(fieldname, "collidergeo"))
186  {
187  result = UTmakeUnique<UT_OptionString>(myParms.myColliderGeo);
188  return true;
189  }
190  if (!strcmp(fieldname, "surfvdb"))
191  {
192  result = UTmakeUnique<UT_OptionString>(myParms.mySurfaceVDB);
193  return true;
194  }
195  if (!strcmp(fieldname, "velvdb"))
196  {
197  result = UTmakeUnique<UT_OptionString>(myParms.myVelocityVDB);
198  return true;
199  }
200  if (!strcmp(fieldname, "vdbsuffix"))
201  {
202  result = UTmakeUnique<UT_OptionString>(myParms.myVDBNameSuffix);
203  return true;
204  }
205  if (!strcmp(fieldname, "useinst"))
206  {
207  result = UTmakeUnique<UT_OptionBool>(myParms.myUseInstances);
208  return true;
209  }
210  if (!strcmp(fieldname, "instgeo"))
211  {
212  result = UTmakeUnique<UT_OptionString>(myParms.myInstanceGeo);
213  return true;
214  }
215 
216  // Failed to find
217  return false;
218  }
219 
221  };
222 
223  SIM_Query *createQueryObject(const SIM_Data *owner) const
224  { return new Query(owner, *this); }
225 
226 
227 
228 
229  // Boiler plate to load individual types.
230  static void loadData(UT_IStream &is, int64 &v)
231  { is.bread(&v, 1); }
232  static void loadData(UT_IStream &is, bool &v)
233  { int64 iv; is.bread(&iv, 1); v = iv; }
234  static void loadData(UT_IStream &is, fpreal64 &v)
235  { is.bread<fpreal64>(&v, 1); }
236  static void loadData(UT_IStream &is, UT_Vector2D &v)
237  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
238  static void loadData(UT_IStream &is, UT_Vector3D &v)
239  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
240  is.bread<fpreal64>(&v.z(), 1); }
241  static void loadData(UT_IStream &is, UT_Vector4D &v)
242  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
243  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
244  static void loadData(UT_IStream &is, UT_Matrix2D &v)
245  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
246  static void loadData(UT_IStream &is, UT_Matrix3D &v)
247  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
248  static void loadData(UT_IStream &is, UT_Matrix4D &v)
249  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
250  static void loadData(UT_IStream &is, UT_Vector2I &v)
251  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
252  static void loadData(UT_IStream &is, UT_Vector3I &v)
253  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
254  is.bread<int64>(&v.z(), 1); }
255  static void loadData(UT_IStream &is, UT_Vector4I &v)
256  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
257  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
259  { is.bread(v); }
261  { UT_StringHolder rampdata;
262  loadData(is, rampdata);
263  if (rampdata.isstring())
264  {
265  v.reset(new UT_Ramp());
266  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
267  v->load(istr);
268  }
269  else v.reset();
270  }
273  loadData(is, data);
274  if (data.isstring())
275  {
276  // Find the data type.
277  const char *colon = UT_StringWrap(data).findChar(':');
278  if (colon)
279  {
280  int typelen = colon - data.buffer();
282  type.strncpy(data.buffer(), typelen);
283  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
284 
285  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
286  }
287  }
288  else v.reset();
289  }
290 
291  static void saveData(std::ostream &os, int64 v)
292  { UTwrite(os, &v); }
293  static void saveData(std::ostream &os, bool v)
294  { int64 iv = v; UTwrite(os, &iv); }
295  static void saveData(std::ostream &os, fpreal64 v)
296  { UTwrite<fpreal64>(os, &v); }
297  static void saveData(std::ostream &os, UT_Vector2D v)
298  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
299  static void saveData(std::ostream &os, UT_Vector3D v)
300  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
301  UTwrite<fpreal64>(os, &v.z()); }
302  static void saveData(std::ostream &os, UT_Vector4D v)
303  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
304  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
305  static void saveData(std::ostream &os, UT_Matrix2D v)
307  static void saveData(std::ostream &os, UT_Matrix3D v)
309  static void saveData(std::ostream &os, UT_Matrix4D v)
311  static void saveData(std::ostream &os, UT_StringHolder s)
312  { UT_StringWrap(s).saveBinary(os); }
313  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
315  UT_OStringStream ostr;
316  if (s) s->save(ostr);
317  result = ostr.str();
318  saveData(os, result);
319  }
320  static void saveData(std::ostream &os, PRM_DataItemHandle s)
322  UT_OStringStream ostr;
323  if (s)
324  {
325  ostr << s->getDataTypeToken();
326  ostr << ":";
327  s->saveBinary(ostr);
328  }
329  result = ostr.str();
330  saveData(os, result);
331  }
332 
333 
334  void save(std::ostream &os) const
335  {
336  int32 v = version();
337  UTwrite(os, &v);
338  saveData(os, myColliderType);
339  saveData(os, myField);
340  saveData(os, myVelField);
341  saveData(os, myColliderGeo);
342  saveData(os, mySurfaceVDB);
343  saveData(os, myVelocityVDB);
344  saveData(os, myVDBNameSuffix);
345  saveData(os, myUseInstances);
346  saveData(os, myInstanceGeo);
347 
348  }
349 
350  bool load(UT_IStream &is)
351  {
352  int32 v;
353  is.bread(&v, 1);
354  if (version() != v)
355  {
356  // Fail incompatible versions
357  return false;
358  }
359  loadData(is, myColliderType);
360  loadData(is, myField);
361  loadData(is, myVelField);
362  loadData(is, myColliderGeo);
363  loadData(is, mySurfaceVDB);
364  loadData(is, myVelocityVDB);
365  loadData(is, myVDBNameSuffix);
366  loadData(is, myUseInstances);
367  loadData(is, myInstanceGeo);
368 
369  return true;
370  }
371 
372  int64 getColliderType() const { return myColliderType; }
373  void setColliderType(int64 val) { myColliderType = val; }
374  const UT_StringHolder & getField() const { return myField; }
375  void setField(const UT_StringHolder & val) { myField = val; }
376  const UT_StringHolder & getVelField() const { return myVelField; }
377  void setVelField(const UT_StringHolder & val) { myVelField = val; }
378  const UT_StringHolder & getColliderGeo() const { return myColliderGeo; }
379  void setColliderGeo(const UT_StringHolder & val) { myColliderGeo = val; }
380  const UT_StringHolder & getSurfaceVDB() const { return mySurfaceVDB; }
381  void setSurfaceVDB(const UT_StringHolder & val) { mySurfaceVDB = val; }
382  const UT_StringHolder & getVelocityVDB() const { return myVelocityVDB; }
383  void setVelocityVDB(const UT_StringHolder & val) { myVelocityVDB = val; }
384  const UT_StringHolder & getVDBNameSuffix() const { return myVDBNameSuffix; }
385  void setVDBNameSuffix(const UT_StringHolder & val) { myVDBNameSuffix = val; }
386  bool getUseInstances() const { return myUseInstances; }
387  void setUseInstances(bool val) { myUseInstances = val; }
388  const UT_StringHolder & getInstanceGeo() const { return myInstanceGeo; }
389  void setInstanceGeo(const UT_StringHolder & val) { myInstanceGeo = val; }
390 
391 private:
392  int64 myColliderType;
393  UT_StringHolder myField;
394  UT_StringHolder myVelField;
395  UT_StringHolder myColliderGeo;
396  UT_StringHolder mySurfaceVDB;
397  UT_StringHolder myVelocityVDB;
398  UT_StringHolder myVDBNameSuffix;
399  bool myUseInstances;
400  UT_StringHolder myInstanceGeo;
401 
402 };
#define SIMZ_API
Definition: SIMZ_API.h:10
bool operator==(const SIM_OpenCLEnforceBoundaryParms &src) const
UT_OptionType getFieldTypeSubclass(const char *recordtype, int fieldnum) const override
void setColliderGeo(const UT_StringHolder &val)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
int int32
Definition: SYS_Types.h:39
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
exint bread(int32 *buffer, exint asize=1)
static void saveData(std::ostream &os, bool v)
const GLfloat * c
Definition: glew.h:16631
UT_OptionType
Definition: UT_Options.h:44
int getNumFieldsSubclass(const char *recordtype) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:657
SYS_FORCE_INLINE const char * buffer() const
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
GLenum src
Definition: glcorearb.h:1793
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, fpreal64 v)
const UT_StringHolder & getSurfaceVDB() const
const UT_StringHolder & getVelocityVDB() const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
double fpreal64
Definition: SYS_Types.h:201
static void loadData(UT_IStream &is, UT_Vector2I &v)
bool operator!=(const SIM_OpenCLEnforceBoundaryParms &src) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void saveData(std::ostream &os, UT_Vector3D v)
const UT_StringHolder & getVDBNameSuffix() const
GLuint64EXT * result
Definition: glew.h:14311
static void saveData(std::ostream &os, int64 v)
const char * getRecordTypeNameSubclass(int recordtypenum) const override
exint length() const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
const GLdouble * v
Definition: glcorearb.h:837
static void loadData(UT_IStream &is, UT_Vector4D &v)
long long int64
Definition: SYS_Types.h:116
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
static void saveData(std::ostream &os, UT_Vector2D v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:287
GT_API const UT_StringHolder version
static void loadData(UT_IStream &is, UT_Vector4I &v)
GLboolean * data
Definition: glcorearb.h:131
static void saveData(std::ostream &os, UT_Matrix3D v)
GLuint GLfloat * val
Definition: glcorearb.h:1608
int getNumRecordsSubclass(const char *recordtype) const override
void setVDBNameSuffix(const UT_StringHolder &val)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
const UT_StringHolder & getColliderGeo() const
static void saveData(std::ostream &os, UT_StringHolder s)
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setVelocityVDB(const UT_StringHolder &val)
static void loadData(UT_IStream &is, bool &v)
void setSurfaceVDB(const UT_StringHolder &val)
const char * findChar(int c) const
Definition: UT_String.h:1372
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, UT_Vector4D v)
const UT_StringHolder & getInstanceGeo() const
type
Definition: core.h:1059
GLboolean r
Definition: glcorearb.h:1222
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:655
void setInstanceGeo(const UT_StringHolder &val)
GLdouble s
Definition: glew.h:1395
const char * getFieldNameSubclass(const char *recordtype, int fieldnum) const override
static void loadData(UT_IStream &is, UT_Vector3D &v)
Query(const SIM_Data *owner, const SIM_OpenCLEnforceBoundaryParms &parms)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr
SYS_FORCE_INLINE bool isstring() const
static void saveData(std::ostream &os, UT_Matrix2D v)
SIM_Query * createQueryObject(const SIM_Data *owner) const
bool getFieldRawSubclass(const char *recordtype, int recordnum, const char *fieldname, UT_OptionEntryPtr &result) const override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:653