HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Measure.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 <SOP/SOP_NodeVerb.h>
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 namespace SOP_MeasureEnums
22 {
23  enum class Type
24  {
25  PERIMETER = 0,
26  AREA,
27  CURVATURE,
28  VOLUME
29  };
30  enum class Curvetype
31  {
32  ALL = 0,
33  CONCAVE,
34  CONEX
35  };
36 }
37 
38 
40 {
41 public:
42  static int version() { return 1; }
43 
45  {
46  myGroup = ""_sh;
47  myType = 0;
48  myOverride = false;
49  myAttribname = "area"_sh;
50  myCurvetype = 0;
51  myCurve = UT_Vector2D(0,1000);
52  myT = UT_Vector3D(0,0,0);
53 
54  }
55 
56  explicit SOP_MeasureParms(const SOP_MeasureParms &) = default;
57 
58  virtual ~SOP_MeasureParms() {}
59 
60  bool operator==(const SOP_MeasureParms &src) const
61  {
62  if (myGroup != src.myGroup) return false;
63  if (myType != src.myType) return false;
64  if (myOverride != src.myOverride) return false;
65  if (myAttribname != src.myAttribname) return false;
66  if (myCurvetype != src.myCurvetype) return false;
67  if (myCurve != src.myCurve) return false;
68  if (myT != src.myT) return false;
69 
70  return true;
71  }
74 
75 
76 
77  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
78  {
79  if (true)
80  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
81  else myGroup = ""_sh;
82  if (true)
83  OP_Utils::evalOpParm(myType, node, "type", time, 0);
84  else myType = 0;
85  if (true)
86  OP_Utils::evalOpParm(myOverride, node, "override", time, 0);
87  else myOverride = false;
88  if (true && ( (!(((getOverride()==0)))) ) )
89  OP_Utils::evalOpParm(myAttribname, node, "attribname", time, 0);
90  else myAttribname = "area"_sh;
91  if (true && ( (!(((int64(getType())!=2)))) ) )
92  OP_Utils::evalOpParm(myCurvetype, node, "curvetype", time, 0);
93  else myCurvetype = 0;
94  if (true && ( (!(((int64(getType())!=2)))) ) )
95  OP_Utils::evalOpParm(myCurve, node, "curve", time, 0);
96  else myCurve = UT_Vector2D(0,1000);
97  if (true && ( (!(((int64(getType())!=3)))) ) )
98  OP_Utils::evalOpParm(myT, node, "t", time, 0);
99  else myT = UT_Vector3D(0,0,0);
100 
101  }
102 
103 
104  virtual void loadFromOpSubclass(const LoadParms &loadparms)
105  {
106  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
107  }
108 
109 
110  virtual void copyFrom(const SOP_NodeParms *src)
111  {
112  *this = *((const SOP_MeasureParms *)src);
113  }
114 
115  template <typename T>
116  void
117  doGetParmValue(exint idx, T &value) const
118  {
119  switch (idx)
120  {
121  case 0:
122  coerceValue(value, myGroup);
123  break;
124  case 1:
125  coerceValue(value, myType);
126  break;
127  case 2:
128  coerceValue(value, myOverride);
129  break;
130  case 3:
131  coerceValue(value, myAttribname);
132  break;
133  case 4:
134  coerceValue(value, myCurvetype);
135  break;
136  case 5:
137  coerceValue(value, myCurve);
138  break;
139  case 6:
140  coerceValue(value, myT);
141  break;
142 
143  }
144  }
145 
146  void getParmValue(exint idx, exint &value) const
147  { doGetParmValue(idx, value); }
148  void getParmValue(exint idx, fpreal &value) const
149  { doGetParmValue(idx, value); }
151  { doGetParmValue(idx, value); }
153  { doGetParmValue(idx, value); }
155  { doGetParmValue(idx, value); }
157  { doGetParmValue(idx, value); }
159  { doGetParmValue(idx, value); }
161  { doGetParmValue(idx, value); }
163  { doGetParmValue(idx, value); }
165  { doGetParmValue(idx, value); }
167  { doGetParmValue(idx, value); }
168 
169  template <typename T>
170  void
171  doSetParmValue(exint idx, const T &value)
172  {
173  switch (idx)
174  {
175  case 0:
176  coerceValue(myGroup, value);
177  break;
178  case 1:
179  coerceValue(myType, value);
180  break;
181  case 2:
182  coerceValue(myOverride, value);
183  break;
184  case 3:
185  coerceValue(myAttribname, value);
186  break;
187  case 4:
188  coerceValue(myCurvetype, value);
189  break;
190  case 5:
191  coerceValue(myCurve, value);
192  break;
193  case 6:
194  coerceValue(myT, value);
195  break;
196 
197  }
198  }
199 
200  void setParmValue(exint idx, const exint &value)
201  { doSetParmValue(idx, value); }
202  void setParmValue(exint idx, const fpreal &value)
203  { doSetParmValue(idx, value); }
204  void setParmValue(exint idx, const UT_Vector2D &value)
205  { doSetParmValue(idx, value); }
206  void setParmValue(exint idx, const UT_Vector3D &value)
207  { doSetParmValue(idx, value); }
208  void setParmValue(exint idx, const UT_Vector4D &value)
209  { doSetParmValue(idx, value); }
210  void setParmValue(exint idx, const UT_Matrix2D &value)
211  { doSetParmValue(idx, value); }
212  void setParmValue(exint idx, const UT_Matrix3D &value)
213  { doSetParmValue(idx, value); }
214  void setParmValue(exint idx, const UT_Matrix4D &value)
215  { doSetParmValue(idx, value); }
217  { doSetParmValue(idx, value); }
219  { doSetParmValue(idx, value); }
221  { doSetParmValue(idx, value); }
222 
223  virtual exint getNumParms() const
224  {
225  return 7;
226  }
227 
228  virtual const char *getParmName(exint fieldnum) const
229  {
230  switch (fieldnum)
231  {
232  case 0:
233  return "group";
234  case 1:
235  return "type";
236  case 2:
237  return "override";
238  case 3:
239  return "attribname";
240  case 4:
241  return "curvetype";
242  case 5:
243  return "curve";
244  case 6:
245  return "t";
246 
247  }
248  return 0;
249  }
250 
251  virtual ParmType getParmType(exint fieldnum) const
252  {
253  switch (fieldnum)
254  {
255  case 0:
256  return PARM_STRING;
257  case 1:
258  return PARM_INTEGER;
259  case 2:
260  return PARM_INTEGER;
261  case 3:
262  return PARM_STRING;
263  case 4:
264  return PARM_INTEGER;
265  case 5:
266  return PARM_VECTOR2;
267  case 6:
268  return PARM_VECTOR3;
269 
270  }
271  return PARM_UNSUPPORTED;
272  }
273 
274  // Boiler plate to load individual types.
275  static void loadData(UT_IStream &is, int64 &v)
276  { is.bread(&v, 1); }
277  static void loadData(UT_IStream &is, bool &v)
278  { int64 iv; is.bread(&iv, 1); v = iv; }
279  static void loadData(UT_IStream &is, fpreal64 &v)
280  { is.bread<fpreal64>(&v, 1); }
281  static void loadData(UT_IStream &is, UT_Vector2D &v)
282  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
283  static void loadData(UT_IStream &is, UT_Vector3D &v)
284  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
285  is.bread<fpreal64>(&v.z(), 1); }
286  static void loadData(UT_IStream &is, UT_Vector4D &v)
287  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
288  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
289  static void loadData(UT_IStream &is, UT_Matrix2D &v)
290  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
291  static void loadData(UT_IStream &is, UT_Matrix3D &v)
292  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
293  static void loadData(UT_IStream &is, UT_Matrix4D &v)
294  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
295  static void loadData(UT_IStream &is, UT_Vector2I &v)
296  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
297  static void loadData(UT_IStream &is, UT_Vector3I &v)
298  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
299  is.bread<int64>(&v.z(), 1); }
300  static void loadData(UT_IStream &is, UT_Vector4I &v)
301  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
302  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
304  { is.bread(v); }
306  { UT_StringHolder rampdata;
307  loadData(is, rampdata);
308  if (rampdata.isstring())
309  {
310  v.reset(new UT_Ramp());
311  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
312  v->load(istr);
313  }
314  else v.reset();
315  }
318  loadData(is, data);
319  if (data.isstring())
320  {
321  // Find the data type.
322  char *colon = UT_StringWrap(data).findChar(':');
323  if (colon)
324  {
325  int typelen = colon - data.buffer();
327  type.strncpy(data.buffer(), typelen);
328  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
329 
330  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
331  }
332  }
333  else v.reset();
334  }
335 
336  static void saveData(std::ostream &os, int64 v)
337  { UTwrite(os, &v); }
338  static void saveData(std::ostream &os, bool v)
339  { int64 iv = v; UTwrite(os, &iv); }
340  static void saveData(std::ostream &os, fpreal64 v)
341  { UTwrite<fpreal64>(os, &v); }
342  static void saveData(std::ostream &os, UT_Vector2D v)
343  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
344  static void saveData(std::ostream &os, UT_Vector3D v)
345  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
346  UTwrite<fpreal64>(os, &v.z()); }
347  static void saveData(std::ostream &os, UT_Vector4D v)
348  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
349  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
350  static void saveData(std::ostream &os, UT_Matrix2D v)
352  static void saveData(std::ostream &os, UT_Matrix3D v)
354  static void saveData(std::ostream &os, UT_Matrix4D v)
356  static void saveData(std::ostream &os, UT_StringHolder s)
357  { UT_StringWrap(s).saveBinary(os); }
358  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
359  { UT_StringHolder result;
360  UT_OStringStream ostr;
361  if (s) s->save(ostr);
362  result = ostr.str();
363  saveData(os, result);
364  }
365  static void saveData(std::ostream &os, PRM_DataItemHandle s)
366  { UT_StringHolder result;
367  UT_OStringStream ostr;
368  if (s)
369  {
370  ostr << s->getDataTypeToken();
371  ostr << ":";
372  s->saveBinary(ostr);
373  }
374  result = ostr.str();
375  saveData(os, result);
376  }
377 
378 
379  void save(std::ostream &os) const
380  {
381  int32 v = version();
382  UTwrite(os, &v);
383  saveData(os, myGroup);
384  saveData(os, myType);
385  saveData(os, myOverride);
386  saveData(os, myAttribname);
387  saveData(os, myCurvetype);
388  saveData(os, myCurve);
389  saveData(os, myT);
390 
391  }
392 
393  bool load(UT_IStream &is)
394  {
395  int32 v;
396  is.bread(&v, 1);
397  if (version() != v)
398  {
399  // Fail incompatible versions
400  return false;
401  }
402  loadData(is, myGroup);
403  loadData(is, myType);
404  loadData(is, myOverride);
405  loadData(is, myAttribname);
406  loadData(is, myCurvetype);
407  loadData(is, myCurve);
408  loadData(is, myT);
409 
410  return true;
411  }
412 
413  const UT_StringHolder & getGroup() const { return myGroup; }
414  void setGroup(const UT_StringHolder & val) { myGroup = val; }
416  {
417  SOP_Node *thissop = cookparms.getNode();
418  if (!thissop) return getGroup();
419  UT_StringHolder result;
420  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
421  return result;
422  }
423  Type getType() const { return Type(myType); }
424  void setType(Type val) { myType = int64(val); }
425  Type opType(const SOP_NodeVerb::CookParms &cookparms) const
426  {
427  SOP_Node *thissop = cookparms.getNode();
428  if (!thissop) return getType();
429  int64 result;
430  OP_Utils::evalOpParm(result, thissop, "type", cookparms.getCookTime(), 0);
431  return Type(result);
432  }
433  bool getOverride() const { return myOverride; }
434  void setOverride(bool val) { myOverride = val; }
435  bool opOverride(const SOP_NodeVerb::CookParms &cookparms) const
436  {
437  SOP_Node *thissop = cookparms.getNode();
438  if (!thissop) return getOverride();
439  bool result;
440  OP_Utils::evalOpParm(result, thissop, "override", cookparms.getCookTime(), 0);
441  return result;
442  }
443  const UT_StringHolder & getAttribname() const { return myAttribname; }
444  void setAttribname(const UT_StringHolder & val) { myAttribname = val; }
446  {
447  SOP_Node *thissop = cookparms.getNode();
448  if (!thissop) return getAttribname();
449  UT_StringHolder result;
450  OP_Utils::evalOpParm(result, thissop, "attribname", cookparms.getCookTime(), 0);
451  return result;
452  }
453  Curvetype getCurvetype() const { return Curvetype(myCurvetype); }
454  void setCurvetype(Curvetype val) { myCurvetype = int64(val); }
456  {
457  SOP_Node *thissop = cookparms.getNode();
458  if (!thissop) return getCurvetype();
459  int64 result;
460  OP_Utils::evalOpParm(result, thissop, "curvetype", cookparms.getCookTime(), 0);
461  return Curvetype(result);
462  }
463  UT_Vector2D getCurve() const { return myCurve; }
464  void setCurve(UT_Vector2D val) { myCurve = val; }
466  {
467  SOP_Node *thissop = cookparms.getNode();
468  if (!thissop) return getCurve();
469  UT_Vector2D result;
470  OP_Utils::evalOpParm(result, thissop, "curve", cookparms.getCookTime(), 0);
471  return result;
472  }
473  UT_Vector3D getT() const { return myT; }
474  void setT(UT_Vector3D val) { myT = val; }
475  UT_Vector3D opT(const SOP_NodeVerb::CookParms &cookparms) const
476  {
477  SOP_Node *thissop = cookparms.getNode();
478  if (!thissop) return getT();
479  UT_Vector3D result;
480  OP_Utils::evalOpParm(result, thissop, "t", cookparms.getCookTime(), 0);
481  return result;
482  }
483 
484 private:
485  UT_StringHolder myGroup;
486  int64 myType;
487  bool myOverride;
488  UT_StringHolder myAttribname;
489  int64 myCurvetype;
490  UT_Vector2D myCurve;
491  UT_Vector3D myT;
492 
493 };
void setGroup(const UT_StringHolder &val)
bool operator==(const SOP_MeasureParms &src) const
static void loadData(UT_IStream &is, fpreal64 &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
bool opOverride(const SOP_NodeVerb::CookParms &cookparms) const
T & z(void)
Definition: UT_Vector4.h:372
static void saveData(std::ostream &os, UT_Matrix3D v)
void doSetParmValue(exint idx, const T &value)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
exint bread(int32 *buffer, exint asize=1)
void setT(UT_Vector3D val)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
static void loadData(UT_IStream &is, UT_Matrix3D &v)
UT_Vector2T< fpreal64 > UT_Vector2D
void save(std::ostream &os) const
void setType(Type val)
void setParmValue(exint idx, const UT_Vector2D &value)
Type getType() const
T & x(void)
Definition: UT_Vector2.h:284
static void loadData(UT_IStream &is, UT_Vector4D &v)
virtual const char * getParmName(exint fieldnum) const
static void saveData(std::ostream &os, UT_Matrix2D v)
An output stream object that owns its own string buffer storage.
const UT_StringHolder & getGroup() const
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
void getParmValue(exint idx, fpreal &value) const
static void loadData(UT_IStream &is, bool &v)
void setAttribname(const UT_StringHolder &val)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
Type opType(const SOP_NodeVerb::CookParms &cookparms) const
void getParmValue(exint idx, UT_Vector4D &value) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
virtual exint getNumParms() const
static void saveData(std::ostream &os, UT_StringHolder s)
UT_Vector3D getT() const
void getParmValue(exint idx, UT_Matrix2D &value) const
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:106
virtual ~SOP_MeasureParms()
static void saveData(std::ostream &os, int64 v)
void getParmValue(exint idx, UT_StringHolder &value) const
static void loadData(UT_IStream &is, int64 &v)
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
SYS_FORCE_INLINE const char * buffer() const
int64 exint
Definition: SYS_Types.h:115
void setParmValue(exint idx, const UT_Vector4D &value)
bool load(UT_IStream &is)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
static void saveData(std::ostream &os, UT_Matrix4D v)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
double fpreal64
Definition: SYS_Types.h:191
void getParmValue(exint idx, UT_Vector2D &value) const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
Curvetype getCurvetype() const
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void saveData(std::ostream &os, UT_Vector4D v)
void getParmValue(exint idx, UT_Matrix4D &value) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void getParmValue(exint idx, PRM_DataItemHandle &value) const
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void getParmValue(exint idx, UT_Vector3D &value) const
static void saveData(std::ostream &os, bool v)
UT_StringHolder opAttribname(const SOP_NodeVerb::CookParms &cookparms) const
bool getOverride() const
void setParmValue(exint idx, const UT_Matrix2D &value)
UT_Vector3T< fpreal64 > UT_Vector3D
void setParmValue(exint idx, const UT_Matrix3D &value)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
void setCurve(UT_Vector2D val)
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void doGetParmValue(exint idx, T &value) const
void setParmValue(exint idx, const UT_StringHolder &value)
void getParmValue(exint idx, exint &value) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void setCurvetype(Curvetype val)
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:269
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void strncpy(const char *src, exint maxlen)
void setParmValue(exint idx, const fpreal &value)
void setOverride(bool val)
static void saveData(std::ostream &os, UT_Vector3D v)
void getParmValue(exint idx, UT_Matrix3D &value) const
virtual void copyFrom(const SOP_NodeParms *src)
virtual ParmType getParmType(exint fieldnum) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
GLuint GLfloat * val
Definition: glcorearb.h:1607
UT_Vector2D getCurve() const
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, UT_StringHolder &v)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
static void loadData(UT_IStream &is, UT_Matrix4D &v)
T & x(void)
Definition: UT_Vector4.h:368
void setParmValue(exint idx, const UT_Matrix4D &value)
T & y(void)
Definition: UT_Vector2.h:286
Curvetype opCurvetype(const SOP_NodeVerb::CookParms &cookparms) const
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:374
void setParmValue(exint idx, const UT_Vector3D &value)
const UT_StringHolder & getAttribname() const
UT_Vector3D opT(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector2D opCurve(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
static void saveData(std::ostream &os, fpreal64 v)
static void saveData(std::ostream &os, UT_Vector2D v)
SYS_FORCE_INLINE bool isstring() const
void setParmValue(exint idx, const exint &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
GLenum src
Definition: glcorearb.h:1792
static int version()