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