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 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 
25 {
26 public:
27  static int version() { return 1; }
28 
30  {
31  myEnableSolvers = 0;
32  myEnableObjects = ""_sh;
33  myEnableAttribClass = 0;
34  myEnableAttrib = ""_sh;
35  myEnableData = ""_sh;
36  myEnableDataMode = 0;
37  myEnableAttribMode = 0;
38 
39  }
40 
41  explicit SIM_SolverEnableParms(const SIM_SolverEnableParms &) = default;
42 
44 
46  {
47  if (myEnableSolvers != src.myEnableSolvers) return false;
48  if (myEnableObjects != src.myEnableObjects) return false;
49  if (myEnableAttribClass != src.myEnableAttribClass) return false;
50  if (myEnableAttrib != src.myEnableAttrib) return false;
51  if (myEnableData != src.myEnableData) return false;
52  if (myEnableDataMode != src.myEnableDataMode) return false;
53  if (myEnableAttribMode != src.myEnableAttribMode) return false;
54 
55  return true;
56  }
58  {
59  return !operator==(src);
60  }
61 
62 
63  class Query : public SIM_Query
64  {
65  public:
66  explicit Query(const SIM_Data *owner, const SIM_SolverEnableParms &parms)
67  : SIM_Query(owner)
68  , myParms(parms)
69  { }
70  ~Query() override {}
71 
72  protected:
73  bool isMyRecord(const char *recordtype) const
74  { return !strcmp(recordtype, "Params"); }
75 
76  int getNumRecordTypesSubclass() const override { return 1; }
77  const char *getRecordTypeNameSubclass(int recordtypenum) const override
78  {
79  if (recordtypenum == 0) return "Params";
80  return 0;
81  }
82  int getNumRecordsSubclass(const char *recordtype) const override
83  {
84  if (isMyRecord(recordtype)) return 1;
85  return 0;
86  }
87  int getNumFieldsSubclass(const char *recordtype) const override
88  {
89  if (isMyRecord(recordtype))
90  return 7;
91  return 0;
92  }
93 
94  const char *getFieldNameSubclass(const char *recordtype,
95  int fieldnum) const override
96  {
97  if (!isMyRecord(recordtype))
98  return 0;
99 
100  switch (fieldnum)
101  {
102  case 0:
103  return "enable";
104  case 1:
105  return "enableobjects";
106  case 2:
107  return "enableattribclass";
108  case 3:
109  return "enableattrib";
110  case 4:
111  return "enabledata";
112  case 5:
113  return "enabledatamode";
114  case 6:
115  return "enableattribmode";
116 
117  }
118  return 0;
119  }
120  UT_OptionType getFieldTypeSubclass(const char *recordtype,
121  int fieldnum) const override
122  {
123  if (!isMyRecord(recordtype))
124  return UT_OPTION_INVALID;
125 
126  switch (fieldnum)
127  {
128  case 0:
129  return UT_OPTION_INT;
130  case 1:
131  return UT_OPTION_STRING;
132  case 2:
133  return UT_OPTION_INT;
134  case 3:
135  return UT_OPTION_STRING;
136  case 4:
137  return UT_OPTION_STRING;
138  case 5:
139  return UT_OPTION_INT;
140  case 6:
141  return UT_OPTION_INT;
142 
143  }
144  return UT_OPTION_INVALID;
145  }
146 
147  bool getFieldRawSubclass(const char *recordtype,
148  int recordnum,
149  const char *fieldname,
150  UT_OptionEntryPtr &result) const override
151  {
152  if (!isMyRecord(recordtype))
153  return false;
154  if (recordnum != 0)
155  return false;
156  // This is less optimal, but if we are in SIM_Query
157  // land we have already given up on performance.
158  if (!strcmp(fieldname, "enable"))
159  {
160  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableSolvers);
161  return true;
162  }
163  if (!strcmp(fieldname, "enableobjects"))
164  {
165  result = UTmakeUnique<UT_OptionString>(myParms.myEnableObjects);
166  return true;
167  }
168  if (!strcmp(fieldname, "enableattribclass"))
169  {
170  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableAttribClass);
171  return true;
172  }
173  if (!strcmp(fieldname, "enableattrib"))
174  {
175  result = UTmakeUnique<UT_OptionString>(myParms.myEnableAttrib);
176  return true;
177  }
178  if (!strcmp(fieldname, "enabledata"))
179  {
180  result = UTmakeUnique<UT_OptionString>(myParms.myEnableData);
181  return true;
182  }
183  if (!strcmp(fieldname, "enabledatamode"))
184  {
185  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableDataMode);
186  return true;
187  }
188  if (!strcmp(fieldname, "enableattribmode"))
189  {
190  result = UTmakeUnique<UT_OptionInt>(myParms.myEnableAttribMode);
191  return true;
192  }
193 
194  // Failed to find
195  return false;
196  }
197 
199  };
200 
201  SIM_Query *createQueryObject(const SIM_Data *owner) const
202  { return new Query(owner, *this); }
203 
204 
205 
206 
207  // Boiler plate to load individual types.
208  static void loadData(UT_IStream &is, int64 &v)
209  { is.bread(&v, 1); }
210  static void loadData(UT_IStream &is, bool &v)
211  { int64 iv; is.bread(&iv, 1); v = iv; }
212  static void loadData(UT_IStream &is, fpreal64 &v)
213  { is.bread<fpreal64>(&v, 1); }
214  static void loadData(UT_IStream &is, UT_Vector2D &v)
215  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
216  static void loadData(UT_IStream &is, UT_Vector3D &v)
217  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
218  is.bread<fpreal64>(&v.z(), 1); }
219  static void loadData(UT_IStream &is, UT_Vector4D &v)
220  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
221  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
222  static void loadData(UT_IStream &is, UT_Matrix2D &v)
223  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
224  static void loadData(UT_IStream &is, UT_Matrix3D &v)
225  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
226  static void loadData(UT_IStream &is, UT_Matrix4D &v)
227  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
228  static void loadData(UT_IStream &is, UT_Vector2I &v)
229  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
230  static void loadData(UT_IStream &is, UT_Vector3I &v)
231  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
232  is.bread<int64>(&v.z(), 1); }
233  static void loadData(UT_IStream &is, UT_Vector4I &v)
234  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
235  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
237  { is.bread(v); }
239  { UT_StringHolder rampdata;
240  loadData(is, rampdata);
241  if (rampdata.isstring())
242  {
243  v.reset(new UT_Ramp());
244  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
245  v->load(istr);
246  }
247  else v.reset();
248  }
251  loadData(is, data);
252  if (data.isstring())
253  {
254  // Find the data type.
255  const char *colon = UT_StringWrap(data).findChar(':');
256  if (colon)
257  {
258  int typelen = colon - data.buffer();
260  type.strncpy(data.buffer(), typelen);
261  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
262 
263  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
264  }
265  }
266  else v.reset();
267  }
268 
269  static void saveData(std::ostream &os, int64 v)
270  { UTwrite(os, &v); }
271  static void saveData(std::ostream &os, bool v)
272  { int64 iv = v; UTwrite(os, &iv); }
273  static void saveData(std::ostream &os, fpreal64 v)
274  { UTwrite<fpreal64>(os, &v); }
275  static void saveData(std::ostream &os, UT_Vector2D v)
276  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
277  static void saveData(std::ostream &os, UT_Vector3D v)
278  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
279  UTwrite<fpreal64>(os, &v.z()); }
280  static void saveData(std::ostream &os, UT_Vector4D v)
281  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
282  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
283  static void saveData(std::ostream &os, UT_Matrix2D v)
285  static void saveData(std::ostream &os, UT_Matrix3D v)
287  static void saveData(std::ostream &os, UT_Matrix4D v)
289  static void saveData(std::ostream &os, UT_StringHolder s)
290  { UT_StringWrap(s).saveBinary(os); }
291  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
293  UT_OStringStream ostr;
294  if (s) s->save(ostr);
295  result = ostr.str();
296  saveData(os, result);
297  }
298  static void saveData(std::ostream &os, PRM_DataItemHandle s)
300  UT_OStringStream ostr;
301  if (s)
302  {
303  ostr << s->getDataTypeToken();
304  ostr << ":";
305  s->saveBinary(ostr);
306  }
307  result = ostr.str();
308  saveData(os, result);
309  }
310 
311 
312  void save(std::ostream &os) const
313  {
314  int32 v = version();
315  UTwrite(os, &v);
316  saveData(os, myEnableSolvers);
317  saveData(os, myEnableObjects);
318  saveData(os, myEnableAttribClass);
319  saveData(os, myEnableAttrib);
320  saveData(os, myEnableData);
321  saveData(os, myEnableDataMode);
322  saveData(os, myEnableAttribMode);
323 
324  }
325 
326  bool load(UT_IStream &is)
327  {
328  int32 v;
329  is.bread(&v, 1);
330  if (version() != v)
331  {
332  // Fail incompatible versions
333  return false;
334  }
335  loadData(is, myEnableSolvers);
336  loadData(is, myEnableObjects);
337  loadData(is, myEnableAttribClass);
338  loadData(is, myEnableAttrib);
339  loadData(is, myEnableData);
340  loadData(is, myEnableDataMode);
341  loadData(is, myEnableAttribMode);
342 
343  return true;
344  }
345 
346  int64 getEnableSolvers() const { return myEnableSolvers; }
347  void setEnableSolvers(int64 val) { myEnableSolvers = val; }
348  const UT_StringHolder & getEnableObjects() const { return myEnableObjects; }
349  void setEnableObjects(const UT_StringHolder & val) { myEnableObjects = val; }
350  int64 getEnableAttribClass() const { return myEnableAttribClass; }
351  void setEnableAttribClass(int64 val) { myEnableAttribClass = val; }
352  const UT_StringHolder & getEnableAttrib() const { return myEnableAttrib; }
353  void setEnableAttrib(const UT_StringHolder & val) { myEnableAttrib = val; }
354  const UT_StringHolder & getEnableData() const { return myEnableData; }
355  void setEnableData(const UT_StringHolder & val) { myEnableData = val; }
356  int64 getEnableDataMode() const { return myEnableDataMode; }
357  void setEnableDataMode(int64 val) { myEnableDataMode = val; }
358  int64 getEnableAttribMode() const { return myEnableAttribMode; }
359  void setEnableAttribMode(int64 val) { myEnableAttribMode = val; }
360 
361 private:
362  int64 myEnableSolvers;
363  UT_StringHolder myEnableObjects;
364  int64 myEnableAttribClass;
365  UT_StringHolder myEnableAttrib;
366  UT_StringHolder myEnableData;
367  int64 myEnableDataMode;
368  int64 myEnableAttribMode;
369 
370 };
type
Definition: core.h:977
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
static void saveData(std::ostream &os, UT_Vector3D v)
exint bread(int32 *buffer, exint asize=1)
bool operator!=(const SIM_SolverEnableParms &src) const
Query(const SIM_Data *owner, const SIM_SolverEnableParms &parms)
const GLfloat * c
Definition: glew.h:16631
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)
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, fpreal64 v)
An output stream object that owns its own string buffer storage.
GLenum src
Definition: glcorearb.h:1792
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
static void saveData(std::ostream &os, bool v)
double fpreal64
Definition: SYS_Types.h:201
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
const char * getRecordTypeNameSubclass(int recordtypenum) const override
GLuint64EXT * result
Definition: glew.h:14311
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:508
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:30
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
const GLdouble * v
Definition: glcorearb.h:836
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:510
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
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:287
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)
GLboolean * data
Definition: glcorearb.h:130
GLuint GLfloat * val
Definition: glcorearb.h:1607
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:84
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
#define SIM_API
Definition: SIM_API.h:10
static void saveData(std::ostream &os, UT_StringHolder s)
void setEnableData(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector2I &v)
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:506
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:1371
const char * getFieldNameSubclass(const char *recordtype, int fieldnum) const override
void setEnableObjects(const UT_StringHolder &val)
GLboolean r
Definition: glcorearb.h:1221
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GLdouble s
Definition: glew.h:1395
int getNumRecordsSubclass(const char *recordtype) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
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)