HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  }
53 
54 
55  class Query : public SIM_Query
56  {
57  public:
58  explicit Query(const SIM_Data *owner, const SIM_SolverEnableParms &parms)
59  : SIM_Query(owner)
60  , myParms(parms)
61  { }
62  virtual ~Query() {}
63 
64  protected:
65  bool isMyRecord(const char *recordtype) const
66  { return !strcmp(recordtype, "Params"); }
67 
68  virtual int getNumRecordTypesSubclass() const { return 1; }
69  virtual const char *getRecordTypeNameSubclass(int recordtypenum) const
70  {
71  if (recordtypenum == 0) return "Params";
72  return 0;
73  }
74  virtual int getNumRecordsSubclass(const char *recordtype) const
75  {
76  if (isMyRecord(recordtype)) return 1;
77  return 0;
78  }
79  virtual int getNumFieldsSubclass(const char *recordtype) const
80  {
81  if (isMyRecord(recordtype))
82  return 6;
83  return 0;
84  }
85 
86  virtual const char *getFieldNameSubclass(const char *recordtype,
87  int fieldnum) const
88  {
89  if (!isMyRecord(recordtype))
90  return 0;
91 
92  switch (fieldnum)
93  {
94  case 0:
95  return "enable";
96  case 1:
97  return "enableattribclass";
98  case 2:
99  return "enableattrib";
100  case 3:
101  return "enabledata";
102  case 4:
103  return "enabledatamode";
104  case 5:
105  return "enableattribmode";
106 
107  }
108  return 0;
109  }
110  virtual UT_OptionType getFieldTypeSubclass(const char *recordtype,
111  int fieldnum) const
112  {
113  if (!isMyRecord(recordtype))
114  return UT_OPTION_INVALID;
115 
116  switch (fieldnum)
117  {
118  case 0:
119  return UT_OPTION_INT;
120  case 1:
121  return UT_OPTION_INT;
122  case 2:
123  return UT_OPTION_STRING;
124  case 3:
125  return UT_OPTION_STRING;
126  case 4:
127  return UT_OPTION_INT;
128  case 5:
129  return UT_OPTION_INT;
130 
131  }
132  return UT_OPTION_INVALID;
133  }
134 
135  virtual bool getFieldRawSubclass(const char *recordtype,
136  int recordnum,
137  const char *fieldname,
138  UT_OptionEntry *&result) const
139  {
140  if (!isMyRecord(recordtype))
141  return false;
142  if (recordnum != 0)
143  return false;
144  // This is less optimal, but if we are in SIM_Query
145  // land we have already given up on performance.
146  if (!strcmp(fieldname, "enable"))
147  {
148  result = new UT_OptionInt(myParms.myEnableSolvers);
149  return true;
150  }
151  if (!strcmp(fieldname, "enableattribclass"))
152  {
153  result = new UT_OptionInt(myParms.myEnableAttribClass);
154  return true;
155  }
156  if (!strcmp(fieldname, "enableattrib"))
157  {
158  result = new UT_OptionString(myParms.myEnableAttrib);
159  return true;
160  }
161  if (!strcmp(fieldname, "enabledata"))
162  {
163  result = new UT_OptionString(myParms.myEnableData);
164  return true;
165  }
166  if (!strcmp(fieldname, "enabledatamode"))
167  {
168  result = new UT_OptionInt(myParms.myEnableDataMode);
169  return true;
170  }
171  if (!strcmp(fieldname, "enableattribmode"))
172  {
173  result = new UT_OptionInt(myParms.myEnableAttribMode);
174  return true;
175  }
176 
177  // Failed to find
178  return false;
179  }
180 
182  };
183 
184  SIM_Query *createQueryObject(const SIM_Data *owner) const
185  { return new Query(owner, *this); }
186 
187 
188 
189 
190  // Boiler plate to load individual types.
191  static void loadData(UT_IStream &is, int64 &v)
192  { is.bread(&v, 1); }
193  static void loadData(UT_IStream &is, bool &v)
194  { int64 iv; is.bread(&iv, 1); v = iv; }
195  static void loadData(UT_IStream &is, fpreal64 &v)
196  { is.bread<fpreal64>(&v, 1); }
197  static void loadData(UT_IStream &is, UT_Vector2D &v)
198  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
199  static void loadData(UT_IStream &is, UT_Vector3D &v)
200  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
201  is.bread<fpreal64>(&v.z(), 1); }
202  static void loadData(UT_IStream &is, UT_Vector4D &v)
203  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
204  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
205  static void loadData(UT_IStream &is, UT_Matrix2D &v)
206  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
207  static void loadData(UT_IStream &is, UT_Matrix3D &v)
208  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
209  static void loadData(UT_IStream &is, UT_Matrix4D &v)
210  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
211  static void loadData(UT_IStream &is, UT_Vector2I &v)
212  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
213  static void loadData(UT_IStream &is, UT_Vector3I &v)
214  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
215  is.bread<int64>(&v.z(), 1); }
216  static void loadData(UT_IStream &is, UT_Vector4I &v)
217  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
218  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
220  { is.bread(v); }
222  { UT_StringHolder rampdata;
223  loadData(is, rampdata);
224  if (rampdata.isstring())
225  {
226  v.reset(new UT_Ramp());
227  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
228  v->load(istr);
229  }
230  else v.reset();
231  }
234  loadData(is, data);
235  if (data.isstring())
236  {
237  // Find the data type.
238  char *colon = UT_StringWrap(data).findChar(':');
239  if (colon)
240  {
241  int typelen = colon - data.buffer();
243  type.strncpy(data.buffer(), typelen);
244  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
245 
246  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
247  }
248  }
249  else v.reset();
250  }
251 
252  static void saveData(std::ostream &os, int64 v)
253  { UTwrite(os, &v); }
254  static void saveData(std::ostream &os, bool v)
255  { int64 iv = v; UTwrite(os, &iv); }
256  static void saveData(std::ostream &os, fpreal64 v)
257  { UTwrite<fpreal64>(os, &v); }
258  static void saveData(std::ostream &os, UT_Vector2D v)
259  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
260  static void saveData(std::ostream &os, UT_Vector3D v)
261  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
262  UTwrite<fpreal64>(os, &v.z()); }
263  static void saveData(std::ostream &os, UT_Vector4D v)
264  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
265  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
266  static void saveData(std::ostream &os, UT_Matrix2D v)
268  static void saveData(std::ostream &os, UT_Matrix3D v)
270  static void saveData(std::ostream &os, UT_Matrix4D v)
272  static void saveData(std::ostream &os, UT_StringHolder s)
273  { UT_StringWrap(s).saveBinary(os); }
274  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
275  { UT_StringHolder result;
276  UT_OStringStream ostr;
277  if (s) s->save(ostr);
278  result = ostr.str();
279  saveData(os, result);
280  }
281  static void saveData(std::ostream &os, PRM_DataItemHandle s)
282  { UT_StringHolder result;
283  UT_OStringStream ostr;
284  if (s)
285  {
286  ostr << s->getDataTypeToken();
287  ostr << ":";
288  s->saveBinary(ostr);
289  }
290  result = ostr.str();
291  saveData(os, result);
292  }
293 
294 
295  void save(std::ostream &os) const
296  {
297  int32 v = version();
298  UTwrite(os, &v);
299  saveData(os, myEnableSolvers);
300  saveData(os, myEnableAttribClass);
301  saveData(os, myEnableAttrib);
302  saveData(os, myEnableData);
303  saveData(os, myEnableDataMode);
304  saveData(os, myEnableAttribMode);
305 
306  }
307 
308  bool load(UT_IStream &is)
309  {
310  int32 v;
311  is.bread(&v, 1);
312  if (version() != v)
313  {
314  // Fail incompatible versions
315  return false;
316  }
317  loadData(is, myEnableSolvers);
318  loadData(is, myEnableAttribClass);
319  loadData(is, myEnableAttrib);
320  loadData(is, myEnableData);
321  loadData(is, myEnableDataMode);
322  loadData(is, myEnableAttribMode);
323 
324  return true;
325  }
326 
327  int64 getEnableSolvers() const { return myEnableSolvers; }
328  void setEnableSolvers(int64 val) { myEnableSolvers = val; }
329  int64 getEnableAttribClass() const { return myEnableAttribClass; }
330  void setEnableAttribClass(int64 val) { myEnableAttribClass = val; }
331  const UT_StringHolder & getEnableAttrib() const { return myEnableAttrib; }
332  void setEnableAttrib(const UT_StringHolder & val) { myEnableAttrib = val; }
333  const UT_StringHolder & getEnableData() const { return myEnableData; }
334  void setEnableData(const UT_StringHolder & val) { myEnableData = val; }
335  int64 getEnableDataMode() const { return myEnableDataMode; }
336  void setEnableDataMode(int64 val) { myEnableDataMode = val; }
337  int64 getEnableAttribMode() const { return myEnableAttribMode; }
338  void setEnableAttribMode(int64 val) { myEnableAttribMode = val; }
339 
340 private:
341  int64 myEnableSolvers;
342  int64 myEnableAttribClass;
343  UT_StringHolder myEnableAttrib;
344  UT_StringHolder myEnableData;
345  int64 myEnableDataMode;
346  int64 myEnableAttribMode;
347 
348 };
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:372
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
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)
T & x(void)
Definition: UT_Vector2.h:284
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:581
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:585
long long int64
Definition: SYS_Types.h:100
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
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:185
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:28
T & y(void)
Definition: UT_Vector4.h:370
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)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
void strncpy(const char *src, exint maxlen)
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)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
T & x(void)
Definition: UT_Vector4.h:368
T & y(void)
Definition: UT_Vector2.h:286
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:374
static void loadData(UT_IStream &is, UT_Matrix2D &v)
virtual const char * getRecordTypeNameSubclass(int recordtypenum) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
SYS_FORCE_INLINE bool isstring() const
GLenum src
Definition: glcorearb.h:1792