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 class DEP_MicroNode;
21 
23 {
24 public:
25  static int version() { return 0; }
26 
28  {
29  myColliderType = 0;
30  myField = ""_UTsh;
31  myVelField = ""_UTsh;
32  myWindVelocity = 0;
33  myColliderGeo = ""_UTsh;
34  mySurfaceVDB = ""_UTsh;
35  myVelocityVDB = ""_UTsh;
36  myVDBNameSuffix = ""_UTsh;
37  myUseInstances = false;
38  myInstanceGeo = ""_UTsh;
39 
40  }
41 
45  SIM_OpenCLEnforceBoundaryParms &operator=(SIM_OpenCLEnforceBoundaryParms &&) noexcept = default;
46 
48 
50  {
51  if (myColliderType != src.myColliderType) return false;
52  if (myField != src.myField) return false;
53  if (myVelField != src.myVelField) return false;
54  if (myWindVelocity != src.myWindVelocity) return false;
55  if (myColliderGeo != src.myColliderGeo) return false;
56  if (mySurfaceVDB != src.mySurfaceVDB) return false;
57  if (myVelocityVDB != src.myVelocityVDB) return false;
58  if (myVDBNameSuffix != src.myVDBNameSuffix) return false;
59  if (myUseInstances != src.myUseInstances) return false;
60  if (myInstanceGeo != src.myInstanceGeo) return false;
61 
62 
63  return true;
64  }
66  {
67  return !operator==(src);
68  }
69 
70 
71  class Query : public SIM_Query
72  {
73  public:
74  explicit Query(const SIM_Data *owner, const SIM_OpenCLEnforceBoundaryParms &parms)
75  : SIM_Query(owner)
76  , myParms(parms)
77  { }
78  ~Query() override {}
79 
80  protected:
81  bool isMyRecord(const char *recordtype) const
82  { return !strcmp(recordtype, "Params"); }
83 
84  int getNumRecordTypesSubclass() const override { return 1; }
85  const char *getRecordTypeNameSubclass(int recordtypenum) const override
86  {
87  if (recordtypenum == 0) return "Params";
88  return 0;
89  }
90  int getNumRecordsSubclass(const char *recordtype) const override
91  {
92  if (isMyRecord(recordtype)) return 1;
93  return 0;
94  }
95  int getNumFieldsSubclass(const char *recordtype) const override
96  {
97  if (isMyRecord(recordtype))
98  return 10;
99  return 0;
100  }
101 
102  const char *getFieldNameSubclass(const char *recordtype,
103  int fieldnum) const override
104  {
105  if (!isMyRecord(recordtype))
106  return 0;
107 
108  switch (fieldnum)
109  {
110  case 0:
111  return "collidertype";
112  case 1:
113  return "field";
114  case 2:
115  return "velocity";
116  case 3:
117  return "wind";
118  case 4:
119  return "collidergeo";
120  case 5:
121  return "surfvdb";
122  case 6:
123  return "velvdb";
124  case 7:
125  return "vdbsuffix";
126  case 8:
127  return "useinst";
128  case 9:
129  return "instgeo";
130 
131  }
132  return 0;
133  }
134  UT_OptionType getFieldTypeSubclass(const char *recordtype,
135  int fieldnum) const override
136  {
137  if (!isMyRecord(recordtype))
138  return UT_OPTION_INVALID;
139 
140  switch (fieldnum)
141  {
142  case 0:
143  return UT_OPTION_INT;
144  case 1:
145  return UT_OPTION_STRING;
146  case 2:
147  return UT_OPTION_STRING;
148  case 3:
149  return UT_OPTION_VECTOR3;
150  case 4:
151  return UT_OPTION_STRING;
152  case 5:
153  return UT_OPTION_STRING;
154  case 6:
155  return UT_OPTION_STRING;
156  case 7:
157  return UT_OPTION_STRING;
158  case 8:
159  return UT_OPTION_BOOL;
160  case 9:
161  return UT_OPTION_STRING;
162 
163  }
164  return UT_OPTION_INVALID;
165  }
166 
167  bool getFieldRawSubclass(const char *recordtype,
168  int recordnum,
169  const char *fieldname,
170  UT_OptionEntryPtr &result) const override
171  {
172  if (!isMyRecord(recordtype))
173  return false;
174  if (recordnum != 0)
175  return false;
176  // This is less optimal, but if we are in SIM_Query
177  // land we have already given up on performance.
178  if (!strcmp(fieldname, "collidertype"))
179  {
180  result = UTmakeUnique<UT_OptionInt>(myParms.myColliderType);
181  return true;
182  }
183  if (!strcmp(fieldname, "field"))
184  {
185  result = UTmakeUnique<UT_OptionString>(myParms.myField);
186  return true;
187  }
188  if (!strcmp(fieldname, "velocity"))
189  {
190  result = UTmakeUnique<UT_OptionString>(myParms.myVelField);
191  return true;
192  }
193  if (!strcmp(fieldname, "wind"))
194  {
195  result = UTmakeUnique<UT_OptionVector3>(myParms.myWindVelocity);
196  return true;
197  }
198  if (!strcmp(fieldname, "collidergeo"))
199  {
200  result = UTmakeUnique<UT_OptionString>(myParms.myColliderGeo);
201  return true;
202  }
203  if (!strcmp(fieldname, "surfvdb"))
204  {
205  result = UTmakeUnique<UT_OptionString>(myParms.mySurfaceVDB);
206  return true;
207  }
208  if (!strcmp(fieldname, "velvdb"))
209  {
210  result = UTmakeUnique<UT_OptionString>(myParms.myVelocityVDB);
211  return true;
212  }
213  if (!strcmp(fieldname, "vdbsuffix"))
214  {
215  result = UTmakeUnique<UT_OptionString>(myParms.myVDBNameSuffix);
216  return true;
217  }
218  if (!strcmp(fieldname, "useinst"))
219  {
220  result = UTmakeUnique<UT_OptionBool>(myParms.myUseInstances);
221  return true;
222  }
223  if (!strcmp(fieldname, "instgeo"))
224  {
225  result = UTmakeUnique<UT_OptionString>(myParms.myInstanceGeo);
226  return true;
227  }
228 
229  // Failed to find
230  return false;
231  }
232 
234  };
235 
236  SIM_Query *createQueryObject(const SIM_Data *owner) const
237  { return new Query(owner, *this); }
238 
239 
240 
241 
242  // Boiler plate to load individual types.
243  static void loadData(UT_IStream &is, int64 &v)
244  { is.bread(&v, 1); }
245  static void loadData(UT_IStream &is, bool &v)
246  { int64 iv; is.bread(&iv, 1); v = iv; }
247  static void loadData(UT_IStream &is, fpreal64 &v)
248  { is.bread<fpreal64>(&v, 1); }
249  static void loadData(UT_IStream &is, UT_Vector2D &v)
250  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
251  static void loadData(UT_IStream &is, UT_Vector3D &v)
252  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
253  is.bread<fpreal64>(&v.z(), 1); }
254  static void loadData(UT_IStream &is, UT_Vector4D &v)
255  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
256  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
257  static void loadData(UT_IStream &is, UT_Matrix2D &v)
258  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
259  static void loadData(UT_IStream &is, UT_Matrix3D &v)
260  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
261  static void loadData(UT_IStream &is, UT_Matrix4D &v)
262  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
263  static void loadData(UT_IStream &is, UT_Vector2I &v)
264  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
265  static void loadData(UT_IStream &is, UT_Vector3I &v)
266  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
267  is.bread<int64>(&v.z(), 1); }
268  static void loadData(UT_IStream &is, UT_Vector4I &v)
269  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
270  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
272  { is.bread(v); }
274  { UT_StringHolder rampdata;
275  loadData(is, rampdata);
276  if (rampdata.isstring())
277  {
278  v.reset(new UT_Ramp());
279  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
280  v->load(istr);
281  }
282  else v.reset();
283  }
286  loadData(is, data);
287  if (data.isstring())
288  {
289  // Find the data type.
290  const char *colon = UT_StringWrap(data).findChar(':');
291  if (colon)
292  {
293  int typelen = colon - data.buffer();
295  type.strncpy(data.buffer(), typelen);
296  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
297 
298  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
299  }
300  }
301  else v.reset();
302  }
303 
304  static void saveData(std::ostream &os, int64 v)
305  { UTwrite(os, &v); }
306  static void saveData(std::ostream &os, bool v)
307  { int64 iv = v; UTwrite(os, &iv); }
308  static void saveData(std::ostream &os, fpreal64 v)
309  { UTwrite<fpreal64>(os, &v); }
310  static void saveData(std::ostream &os, UT_Vector2D v)
311  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
312  static void saveData(std::ostream &os, UT_Vector3D v)
313  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
314  UTwrite<fpreal64>(os, &v.z()); }
315  static void saveData(std::ostream &os, UT_Vector4D v)
316  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
317  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
318  static void saveData(std::ostream &os, UT_Matrix2D v)
320  static void saveData(std::ostream &os, UT_Matrix3D v)
322  static void saveData(std::ostream &os, UT_Matrix4D v)
324  static void saveData(std::ostream &os, UT_StringHolder s)
325  { UT_StringWrap(s).saveBinary(os); }
326  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
328  UT_OStringStream ostr;
329  if (s) s->save(ostr);
330  result = ostr.str();
331  saveData(os, result);
332  }
333  static void saveData(std::ostream &os, PRM_DataItemHandle s)
335  UT_OStringStream ostr;
336  if (s)
337  {
338  ostr << s->getDataTypeToken();
339  ostr << ":";
340  s->saveBinary(ostr);
341  }
342  result = ostr.str();
343  saveData(os, result);
344  }
345 
346 
347  void save(std::ostream &os) const
348  {
349  int32 v = version();
350  UTwrite(os, &v);
351  saveData(os, myColliderType);
352  saveData(os, myField);
353  saveData(os, myVelField);
354  saveData(os, myWindVelocity);
355  saveData(os, myColliderGeo);
356  saveData(os, mySurfaceVDB);
357  saveData(os, myVelocityVDB);
358  saveData(os, myVDBNameSuffix);
359  saveData(os, myUseInstances);
360  saveData(os, myInstanceGeo);
361 
362  }
363 
364  bool load(UT_IStream &is)
365  {
366  int32 v;
367  is.bread(&v, 1);
368  if (version() != v)
369  {
370  // Fail incompatible versions
371  return false;
372  }
373  loadData(is, myColliderType);
374  loadData(is, myField);
375  loadData(is, myVelField);
376  loadData(is, myWindVelocity);
377  loadData(is, myColliderGeo);
378  loadData(is, mySurfaceVDB);
379  loadData(is, myVelocityVDB);
380  loadData(is, myVDBNameSuffix);
381  loadData(is, myUseInstances);
382  loadData(is, myInstanceGeo);
383 
384  return true;
385  }
386 
387  int64 getColliderType() const { return myColliderType; }
388  void setColliderType(int64 val) { myColliderType = val; }
389  const UT_StringHolder & getField() const { return myField; }
390  void setField(const UT_StringHolder & val) { myField = val; }
391  const UT_StringHolder & getVelField() const { return myVelField; }
392  void setVelField(const UT_StringHolder & val) { myVelField = val; }
393  UT_Vector3D getWindVelocity() const { return myWindVelocity; }
394  void setWindVelocity(UT_Vector3D val) { myWindVelocity = val; }
395  const UT_StringHolder & getColliderGeo() const { return myColliderGeo; }
396  void setColliderGeo(const UT_StringHolder & val) { myColliderGeo = val; }
397  const UT_StringHolder & getSurfaceVDB() const { return mySurfaceVDB; }
398  void setSurfaceVDB(const UT_StringHolder & val) { mySurfaceVDB = val; }
399  const UT_StringHolder & getVelocityVDB() const { return myVelocityVDB; }
400  void setVelocityVDB(const UT_StringHolder & val) { myVelocityVDB = val; }
401  const UT_StringHolder & getVDBNameSuffix() const { return myVDBNameSuffix; }
402  void setVDBNameSuffix(const UT_StringHolder & val) { myVDBNameSuffix = val; }
403  bool getUseInstances() const { return myUseInstances; }
404  void setUseInstances(bool val) { myUseInstances = val; }
405  const UT_StringHolder & getInstanceGeo() const { return myInstanceGeo; }
406  void setInstanceGeo(const UT_StringHolder & val) { myInstanceGeo = val; }
407 
408 private:
409  int64 myColliderType;
410  UT_StringHolder myField;
411  UT_StringHolder myVelField;
412  UT_Vector3D myWindVelocity;
413  UT_StringHolder myColliderGeo;
414  UT_StringHolder mySurfaceVDB;
415  UT_StringHolder myVelocityVDB;
416  UT_StringHolder myVDBNameSuffix;
417  bool myUseInstances;
418  UT_StringHolder myInstanceGeo;
419 
420 };
type
Definition: core.h:556
#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)
GLboolean * data
Definition: glcorearb.h:131
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
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:667
SYS_FORCE_INLINE const char * buffer() const
GLdouble s
Definition: glad.h:3009
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)
**But if you need a result
Definition: thread.h:622
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)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
static void loadData(UT_IStream &is, UT_Vector2I &v)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
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
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
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
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:303
GT_API const UT_StringHolder version
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, UT_Matrix3D v)
GA_API const UT_StringHolder parms
int getNumRecordsSubclass(const char *recordtype) const override
void setVDBNameSuffix(const UT_StringHolder &val)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
const UT_StringHolder & getColliderGeo() const
static void saveData(std::ostream &os, UT_StringHolder s)
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
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:1406
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GLboolean r
Definition: glcorearb.h:1222
static void saveData(std::ostream &os, UT_Vector4D v)
const UT_StringHolder & getInstanceGeo() const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
void setInstanceGeo(const UT_StringHolder &val)
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)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
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)
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663