HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_SolverEnableParms.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 <SIM/SIM_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 1; }
26 
28  {
29  myEnableSolvers = 0;
30  myEnableObjects = ""_UTsh;
31  myEnableAttribClass = 0;
32  myEnableAttrib = ""_UTsh;
33  myEnableData = ""_UTsh;
34  myEnableDataMode = 0;
35  myEnableAttribMode = 0;
36  myEnableField = ""_UTsh;
37  myEnableFieldMode = 0;
38  myEnableFieldTest = 0;
39 
40  }
41 
42  explicit SIM_SolverEnableParms(const SIM_SolverEnableParms &) = default;
43  SIM_SolverEnableParms &operator=(const SIM_SolverEnableParms &) = default;
44  SIM_SolverEnableParms(SIM_SolverEnableParms &&) noexcept = default;
45  SIM_SolverEnableParms &operator=(SIM_SolverEnableParms &&) noexcept = default;
46 
48 
50  {
51  if (myEnableSolvers != src.myEnableSolvers) return false;
52  if (myEnableObjects != src.myEnableObjects) return false;
53  if (myEnableAttribClass != src.myEnableAttribClass) return false;
54  if (myEnableAttrib != src.myEnableAttrib) return false;
55  if (myEnableData != src.myEnableData) return false;
56  if (myEnableDataMode != src.myEnableDataMode) return false;
57  if (myEnableAttribMode != src.myEnableAttribMode) return false;
58  if (myEnableField != src.myEnableField) return false;
59  if (myEnableFieldMode != src.myEnableFieldMode) return false;
60  if (myEnableFieldTest != src.myEnableFieldTest) return false;
61 
62  return true;
63  }
65  {
66  return !operator==(src);
67  }
68 
69 
70  class Query : public SIM_Query
71  {
72  public:
73  explicit Query(const SIM_Data *owner, const SIM_SolverEnableParms &parms)
74  : SIM_Query(owner)
75  , myParms(parms)
76  { }
77  ~Query() override {}
78 
79  protected:
80  bool isMyRecord(const char *recordtype) const
81  { return !strcmp(recordtype, "Params"); }
82 
83  int getNumRecordTypesSubclass() const override { return 1; }
84  const char *getRecordTypeNameSubclass(int recordtypenum) const override
85  {
86  if (recordtypenum == 0) return "Params";
87  return 0;
88  }
89  int getNumRecordsSubclass(const char *recordtype) const override
90  {
91  if (isMyRecord(recordtype)) return 1;
92  return 0;
93  }
94  int getNumFieldsSubclass(const char *recordtype) const override
95  {
96  if (isMyRecord(recordtype))
97  return 10;
98  return 0;
99  }
100 
101  const char *getFieldNameSubclass(const char *recordtype,
102  int fieldnum) const override
103  {
104  if (!isMyRecord(recordtype))
105  return 0;
106 
107  switch (fieldnum)
108  {
109  case 0:
110  return "enable";
111  case 1:
112  return "enableobjects";
113  case 2:
114  return "enableattribclass";
115  case 3:
116  return "enableattrib";
117  case 4:
118  return "enabledata";
119  case 5:
120  return "enabledatamode";
121  case 6:
122  return "enableattribmode";
123  case 7:
124  return "enablefield";
125  case 8:
126  return "enablefieldmode";
127  case 9:
128  return "enablefieldtest";
129 
130  }
131  return 0;
132  }
133  UT_OptionType getFieldTypeSubclass(const char *recordtype,
134  int fieldnum) const override
135  {
136  if (!isMyRecord(recordtype))
137  return UT_OPTION_INVALID;
138 
139  switch (fieldnum)
140  {
141  case 0:
142  return UT_OPTION_INT;
143  case 1:
144  return UT_OPTION_STRING;
145  case 2:
146  return UT_OPTION_INT;
147  case 3:
148  return UT_OPTION_STRING;
149  case 4:
150  return UT_OPTION_STRING;
151  case 5:
152  return UT_OPTION_INT;
153  case 6:
154  return UT_OPTION_INT;
155  case 7:
156  return UT_OPTION_STRING;
157  case 8:
158  return UT_OPTION_INT;
159  case 9:
160  return UT_OPTION_INT;
161 
162  }
163  return UT_OPTION_INVALID;
164  }
165 
166  bool getFieldRawSubclass(const char *recordtype,
167  int recordnum,
168  const char *fieldname,
169  UT_OptionEntryPtr &result) const override
170  {
171  if (!isMyRecord(recordtype))
172  return false;
173  if (recordnum != 0)
174  return false;
175  // This is less optimal, but if we are in SIM_Query
176  // land we have already given up on performance.
177  if (!strcmp(fieldname, "enable"))
178  {
179  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableSolvers);
180  return true;
181  }
182  if (!strcmp(fieldname, "enableobjects"))
183  {
184  result = UTmakeUnique<UT_OptionString>(myParms.myEnableObjects);
185  return true;
186  }
187  if (!strcmp(fieldname, "enableattribclass"))
188  {
189  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableAttribClass);
190  return true;
191  }
192  if (!strcmp(fieldname, "enableattrib"))
193  {
194  result = UTmakeUnique<UT_OptionString>(myParms.myEnableAttrib);
195  return true;
196  }
197  if (!strcmp(fieldname, "enabledata"))
198  {
199  result = UTmakeUnique<UT_OptionString>(myParms.myEnableData);
200  return true;
201  }
202  if (!strcmp(fieldname, "enabledatamode"))
203  {
204  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableDataMode);
205  return true;
206  }
207  if (!strcmp(fieldname, "enableattribmode"))
208  {
209  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableAttribMode);
210  return true;
211  }
212  if (!strcmp(fieldname, "enablefield"))
213  {
214  result = UTmakeUnique<UT_OptionString>(myParms.myEnableField);
215  return true;
216  }
217  if (!strcmp(fieldname, "enablefieldmode"))
218  {
219  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableFieldMode);
220  return true;
221  }
222  if (!strcmp(fieldname, "enablefieldtest"))
223  {
224  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableFieldTest);
225  return true;
226  }
227 
228  // Failed to find
229  return false;
230  }
231 
233  };
234 
235  SIM_Query *createQueryObject(const SIM_Data *owner) const
236  { return new Query(owner, *this); }
237 
238 
239 
240 
241  // Boiler plate to load individual types.
242  static void loadData(UT_IStream &is, int64 &v)
243  { is.bread(&v, 1); }
244  static void loadData(UT_IStream &is, bool &v)
245  { int64 iv; is.bread(&iv, 1); v = iv; }
246  static void loadData(UT_IStream &is, fpreal64 &v)
247  { is.bread<fpreal64>(&v, 1); }
248  static void loadData(UT_IStream &is, UT_Vector2D &v)
249  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
250  static void loadData(UT_IStream &is, UT_Vector3D &v)
251  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
252  is.bread<fpreal64>(&v.z(), 1); }
253  static void loadData(UT_IStream &is, UT_Vector4D &v)
254  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
255  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
256  static void loadData(UT_IStream &is, UT_Matrix2D &v)
257  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
258  static void loadData(UT_IStream &is, UT_Matrix3D &v)
259  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
260  static void loadData(UT_IStream &is, UT_Matrix4D &v)
261  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
262  static void loadData(UT_IStream &is, UT_Vector2I &v)
263  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
264  static void loadData(UT_IStream &is, UT_Vector3I &v)
265  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
266  is.bread<int64>(&v.z(), 1); }
267  static void loadData(UT_IStream &is, UT_Vector4I &v)
268  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
269  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
271  { is.bread(v); }
273  { UT_StringHolder rampdata;
274  loadData(is, rampdata);
275  if (rampdata.isstring())
276  {
277  v.reset(new UT_Ramp());
278  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
279  v->load(istr);
280  }
281  else v.reset();
282  }
285  loadData(is, data);
286  if (data.isstring())
287  {
288  // Find the data type.
289  const char *colon = UT_StringWrap(data).findChar(':');
290  if (colon)
291  {
292  int typelen = colon - data.buffer();
294  type.strncpy(data.buffer(), typelen);
295  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
296 
297  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
298  }
299  }
300  else v.reset();
301  }
302 
303  static void saveData(std::ostream &os, int64 v)
304  { UTwrite(os, &v); }
305  static void saveData(std::ostream &os, bool v)
306  { int64 iv = v; UTwrite(os, &iv); }
307  static void saveData(std::ostream &os, fpreal64 v)
308  { UTwrite<fpreal64>(os, &v); }
309  static void saveData(std::ostream &os, UT_Vector2D v)
310  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
311  static void saveData(std::ostream &os, UT_Vector3D v)
312  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
313  UTwrite<fpreal64>(os, &v.z()); }
314  static void saveData(std::ostream &os, UT_Vector4D v)
315  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
316  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
317  static void saveData(std::ostream &os, UT_Matrix2D v)
319  static void saveData(std::ostream &os, UT_Matrix3D v)
321  static void saveData(std::ostream &os, UT_Matrix4D v)
323  static void saveData(std::ostream &os, UT_StringHolder s)
324  { UT_StringWrap(s).saveBinary(os); }
325  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
327  UT_OStringStream ostr;
328  if (s) s->save(ostr);
329  result = ostr.str();
330  saveData(os, result);
331  }
332  static void saveData(std::ostream &os, PRM_DataItemHandle s)
334  UT_OStringStream ostr;
335  if (s)
336  {
337  ostr << s->getDataTypeToken();
338  ostr << ":";
339  s->saveBinary(ostr);
340  }
341  result = ostr.str();
342  saveData(os, result);
343  }
344 
345 
346  void save(std::ostream &os) const
347  {
348  int32 v = version();
349  UTwrite(os, &v);
350  saveData(os, myEnableSolvers);
351  saveData(os, myEnableObjects);
352  saveData(os, myEnableAttribClass);
353  saveData(os, myEnableAttrib);
354  saveData(os, myEnableData);
355  saveData(os, myEnableDataMode);
356  saveData(os, myEnableAttribMode);
357  saveData(os, myEnableField);
358  saveData(os, myEnableFieldMode);
359  saveData(os, myEnableFieldTest);
360 
361  }
362 
363  bool load(UT_IStream &is)
364  {
365  int32 v;
366  is.bread(&v, 1);
367  if (version() != v)
368  {
369  // Fail incompatible versions
370  return false;
371  }
372  loadData(is, myEnableSolvers);
373  loadData(is, myEnableObjects);
374  loadData(is, myEnableAttribClass);
375  loadData(is, myEnableAttrib);
376  loadData(is, myEnableData);
377  loadData(is, myEnableDataMode);
378  loadData(is, myEnableAttribMode);
379  loadData(is, myEnableField);
380  loadData(is, myEnableFieldMode);
381  loadData(is, myEnableFieldTest);
382 
383  return true;
384  }
385 
386  int64 getEnableSolvers() const { return myEnableSolvers; }
387  void setEnableSolvers(int64 val) { myEnableSolvers = val; }
388  const UT_StringHolder & getEnableObjects() const { return myEnableObjects; }
389  void setEnableObjects(const UT_StringHolder & val) { myEnableObjects = val; }
390  int64 getEnableAttribClass() const { return myEnableAttribClass; }
391  void setEnableAttribClass(int64 val) { myEnableAttribClass = val; }
392  const UT_StringHolder & getEnableAttrib() const { return myEnableAttrib; }
393  void setEnableAttrib(const UT_StringHolder & val) { myEnableAttrib = val; }
394  const UT_StringHolder & getEnableData() const { return myEnableData; }
395  void setEnableData(const UT_StringHolder & val) { myEnableData = val; }
396  int64 getEnableDataMode() const { return myEnableDataMode; }
397  void setEnableDataMode(int64 val) { myEnableDataMode = val; }
398  int64 getEnableAttribMode() const { return myEnableAttribMode; }
399  void setEnableAttribMode(int64 val) { myEnableAttribMode = val; }
400  const UT_StringHolder & getEnableField() const { return myEnableField; }
401  void setEnableField(const UT_StringHolder & val) { myEnableField = val; }
402  int64 getEnableFieldMode() const { return myEnableFieldMode; }
403  void setEnableFieldMode(int64 val) { myEnableFieldMode = val; }
404  int64 getEnableFieldTest() const { return myEnableFieldTest; }
405  void setEnableFieldTest(int64 val) { myEnableFieldTest = val; }
406 
407 private:
408  int64 myEnableSolvers;
409  UT_StringHolder myEnableObjects;
410  int64 myEnableAttribClass;
411  UT_StringHolder myEnableAttrib;
412  UT_StringHolder myEnableData;
413  int64 myEnableDataMode;
414  int64 myEnableAttribMode;
415  UT_StringHolder myEnableField;
416  int64 myEnableFieldMode;
417  int64 myEnableFieldTest;
418 
419 };
void setEnableAttrib(const UT_StringHolder &val)
static void saveData(std::ostream &os, UT_Matrix4D v)
static void saveData(std::ostream &os, UT_Matrix3D v)
int int32
Definition: SYS_Types.h:39
const SIM_SolverEnableParms & myParms
const UT_StringHolder & getEnableField() const
static void saveData(std::ostream &os, UT_Vector3D v)
exint bread(int32 *buffer, exint asize=1)
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
bool operator!=(const SIM_SolverEnableParms &src) const
Query(const SIM_Data *owner, const SIM_SolverEnableParms &parms)
const UT_StringHolder & getEnableData() const
UT_OptionType
Definition: UT_Options.h:44
SIM_Query * createQueryObject(const SIM_Data *owner) const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, fpreal64 v)
GLdouble s
Definition: glad.h:3009
An output stream object that owns its own string buffer storage.
**But if you need a result
Definition: thread.h:613
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
const UT_StringHolder & getEnableObjects() const
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void saveData(std::ostream &os, bool v)
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
const char * getRecordTypeNameSubclass(int recordtypenum) const override
static void loadData(UT_IStream &is, fpreal64 &v)
exint length() const
static void loadData(UT_IStream &is, UT_StringHolder &v)
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_Vector4I &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
bool isMyRecord(const char *recordtype) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void saveData(std::ostream &os, UT_Vector4D v)
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, int64 &v)
void save(std::ostream &os) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, int64 v)
bool operator==(const SIM_SolverEnableParms &src) const
long long int64
Definition: SYS_Types.h:116
void setEnableField(const UT_StringHolder &val)
const UT_StringHolder & getEnableAttrib() const
static void loadData(UT_IStream &is, bool &v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
int getNumFieldsSubclass(const char *recordtype) const override
static void saveData(std::ostream &os, UT_Vector2D v)
GT_API const UT_StringHolder version
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
int getNumRecordTypesSubclass() const override
UT_OptionType getFieldTypeSubclass(const char *recordtype, int fieldnum) const override
Utility class for containing a color ramp.
Definition: UT_Ramp.h:88
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
#define SIM_API
Definition: SIM_API.h:12
GLuint GLfloat * val
Definition: glcorearb.h:1608
static void saveData(std::ostream &os, UT_StringHolder s)
void setEnableData(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector2I &v)
bool getFieldRawSubclass(const char *recordtype, int recordnum, const char *fieldname, UT_OptionEntryPtr &result) const override
const char * findChar(int c) const
Definition: UT_String.h:1385
GLboolean r
Definition: glcorearb.h:1222
const char * getFieldNameSubclass(const char *recordtype, int fieldnum) const override
void setEnableObjects(const UT_StringHolder &val)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
static void loadData(UT_IStream &is, UT_Matrix2D &v)
type
Definition: core.h:1059
int getNumRecordsSubclass(const char *recordtype) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
SYS_FORCE_INLINE bool isstring() const
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