HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_VolumeBound.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_VolumeBoundEnums
22 {
23  enum class Comp
24  {
25  GREATER = 0,
26  LESS
27  };
28 }
29 
30 
32 {
33 public:
34  static int version() { return 1; }
35 
37  {
38  myGroup = ""_sh;
39  myComp = 0;
40  myValue = 0;
41  myVoxelpad = UT_Vector3D(0,0,0);
42 
43  }
44 
45  explicit SOP_VolumeBoundParms(const SOP_VolumeBoundParms &) = default;
46 
47  virtual ~SOP_VolumeBoundParms() {}
48 
49  bool operator==(const SOP_VolumeBoundParms &src) const
50  {
51  if (myGroup != src.myGroup) return false;
52  if (myComp != src.myComp) return false;
53  if (myValue != src.myValue) return false;
54  if (myVoxelpad != src.myVoxelpad) return false;
55 
56  return true;
57  }
59 
60 
61 
62  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
63  {
64  if (true)
65  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
66  else myGroup = ""_sh;
67  if (true)
68  OP_Utils::evalOpParm(myComp, node, "comp", time, 0);
69  else myComp = 0;
70  if (true)
71  OP_Utils::evalOpParm(myValue, node, "value", time, 0);
72  else myValue = 0;
73  if (true)
74  OP_Utils::evalOpParm(myVoxelpad, node, "voxelpad", time, 0);
75  else myVoxelpad = UT_Vector3D(0,0,0);
76 
77  }
78 
79 
80  virtual void loadFromOpSubclass(const LoadParms &loadparms)
81  {
82  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
83  }
84 
85 
86  virtual void copyFrom(const SOP_NodeParms *src)
87  {
88  *this = *((const SOP_VolumeBoundParms *)src);
89  }
90 
91  template <typename T>
92  void
93  doGetParmValue(exint idx, T &value) const
94  {
95  switch (idx)
96  {
97  case 0:
98  coerceValue(value, myGroup);
99  break;
100  case 1:
101  coerceValue(value, myComp);
102  break;
103  case 2:
104  coerceValue(value, myValue);
105  break;
106  case 3:
107  coerceValue(value, myVoxelpad);
108  break;
109 
110  }
111  }
112 
113  void getParmValue(exint idx, exint &value) const
114  { doGetParmValue(idx, value); }
115  void getParmValue(exint idx, fpreal &value) const
116  { doGetParmValue(idx, value); }
118  { doGetParmValue(idx, value); }
120  { doGetParmValue(idx, value); }
122  { doGetParmValue(idx, value); }
124  { doGetParmValue(idx, value); }
126  { doGetParmValue(idx, value); }
128  { doGetParmValue(idx, value); }
130  { doGetParmValue(idx, value); }
132  { doGetParmValue(idx, value); }
134  { doGetParmValue(idx, value); }
135 
136  template <typename T>
137  void
138  doSetParmValue(exint idx, const T &value)
139  {
140  switch (idx)
141  {
142  case 0:
143  coerceValue(myGroup, value);
144  break;
145  case 1:
146  coerceValue(myComp, value);
147  break;
148  case 2:
149  coerceValue(myValue, value);
150  break;
151  case 3:
152  coerceValue(myVoxelpad, value);
153  break;
154 
155  }
156  }
157 
158  void setParmValue(exint idx, const exint &value)
159  { doSetParmValue(idx, value); }
160  void setParmValue(exint idx, const fpreal &value)
161  { doSetParmValue(idx, value); }
162  void setParmValue(exint idx, const UT_Vector2D &value)
163  { doSetParmValue(idx, value); }
164  void setParmValue(exint idx, const UT_Vector3D &value)
165  { doSetParmValue(idx, value); }
166  void setParmValue(exint idx, const UT_Vector4D &value)
167  { doSetParmValue(idx, value); }
168  void setParmValue(exint idx, const UT_Matrix2D &value)
169  { doSetParmValue(idx, value); }
170  void setParmValue(exint idx, const UT_Matrix3D &value)
171  { doSetParmValue(idx, value); }
172  void setParmValue(exint idx, const UT_Matrix4D &value)
173  { doSetParmValue(idx, value); }
175  { doSetParmValue(idx, value); }
177  { doSetParmValue(idx, value); }
179  { doSetParmValue(idx, value); }
180 
181  virtual exint getNumParms() const
182  {
183  return 4;
184  }
185 
186  virtual const char *getParmName(exint fieldnum) const
187  {
188  switch (fieldnum)
189  {
190  case 0:
191  return "group";
192  case 1:
193  return "comp";
194  case 2:
195  return "value";
196  case 3:
197  return "voxelpad";
198 
199  }
200  return 0;
201  }
202 
203  virtual ParmType getParmType(exint fieldnum) const
204  {
205  switch (fieldnum)
206  {
207  case 0:
208  return PARM_STRING;
209  case 1:
210  return PARM_INTEGER;
211  case 2:
212  return PARM_FLOAT;
213  case 3:
214  return PARM_VECTOR3;
215 
216  }
217  return PARM_UNSUPPORTED;
218  }
219 
220  // Boiler plate to load individual types.
221  static void loadData(UT_IStream &is, int64 &v)
222  { is.bread(&v, 1); }
223  static void loadData(UT_IStream &is, bool &v)
224  { int64 iv; is.bread(&iv, 1); v = iv; }
225  static void loadData(UT_IStream &is, fpreal64 &v)
226  { is.bread<fpreal64>(&v, 1); }
227  static void loadData(UT_IStream &is, UT_Vector2D &v)
228  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
229  static void loadData(UT_IStream &is, UT_Vector3D &v)
230  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
231  is.bread<fpreal64>(&v.z(), 1); }
232  static void loadData(UT_IStream &is, UT_Vector4D &v)
233  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
234  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
235  static void loadData(UT_IStream &is, UT_Matrix2D &v)
236  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
237  static void loadData(UT_IStream &is, UT_Matrix3D &v)
238  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
239  static void loadData(UT_IStream &is, UT_Matrix4D &v)
240  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
241  static void loadData(UT_IStream &is, UT_Vector2I &v)
242  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
243  static void loadData(UT_IStream &is, UT_Vector3I &v)
244  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
245  is.bread<int64>(&v.z(), 1); }
246  static void loadData(UT_IStream &is, UT_Vector4I &v)
247  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
248  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
250  { is.bread(v); }
252  { UT_StringHolder rampdata;
253  loadData(is, rampdata);
254  if (rampdata.isstring())
255  {
256  v.reset(new UT_Ramp());
257  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
258  v->load(istr);
259  }
260  else v.reset();
261  }
264  loadData(is, data);
265  if (data.isstring())
266  {
267  // Find the data type.
268  char *colon = UT_StringWrap(data).findChar(':');
269  if (colon)
270  {
271  int typelen = colon - data.buffer();
273  type.strncpy(data.buffer(), typelen);
274  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
275 
276  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
277  }
278  }
279  else v.reset();
280  }
281 
282  static void saveData(std::ostream &os, int64 v)
283  { UTwrite(os, &v); }
284  static void saveData(std::ostream &os, bool v)
285  { int64 iv = v; UTwrite(os, &iv); }
286  static void saveData(std::ostream &os, fpreal64 v)
287  { UTwrite<fpreal64>(os, &v); }
288  static void saveData(std::ostream &os, UT_Vector2D v)
289  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
290  static void saveData(std::ostream &os, UT_Vector3D v)
291  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
292  UTwrite<fpreal64>(os, &v.z()); }
293  static void saveData(std::ostream &os, UT_Vector4D v)
294  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
295  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
296  static void saveData(std::ostream &os, UT_Matrix2D v)
298  static void saveData(std::ostream &os, UT_Matrix3D v)
300  static void saveData(std::ostream &os, UT_Matrix4D v)
302  static void saveData(std::ostream &os, UT_StringHolder s)
303  { UT_StringWrap(s).saveBinary(os); }
304  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
305  { UT_StringHolder result;
306  UT_OStringStream ostr;
307  if (s) s->save(ostr);
308  result = ostr.str();
309  saveData(os, result);
310  }
311  static void saveData(std::ostream &os, PRM_DataItemHandle s)
312  { UT_StringHolder result;
313  UT_OStringStream ostr;
314  if (s)
315  {
316  ostr << s->getDataTypeToken();
317  ostr << ":";
318  s->saveBinary(ostr);
319  }
320  result = ostr.str();
321  saveData(os, result);
322  }
323 
324 
325  void save(std::ostream &os) const
326  {
327  int32 v = version();
328  UTwrite(os, &v);
329  saveData(os, myGroup);
330  saveData(os, myComp);
331  saveData(os, myValue);
332  saveData(os, myVoxelpad);
333 
334  }
335 
336  bool load(UT_IStream &is)
337  {
338  int32 v;
339  is.bread(&v, 1);
340  if (version() != v)
341  {
342  // Fail incompatible versions
343  return false;
344  }
345  loadData(is, myGroup);
346  loadData(is, myComp);
347  loadData(is, myValue);
348  loadData(is, myVoxelpad);
349 
350  return true;
351  }
352 
353  const UT_StringHolder & getGroup() const { return myGroup; }
354  void setGroup(const UT_StringHolder & val) { myGroup = val; }
356  {
357  SOP_Node *thissop = cookparms.getNode();
358  if (!thissop) return getGroup();
359  UT_StringHolder result;
360  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
361  return result;
362  }
363  Comp getComp() const { return Comp(myComp); }
364  void setComp(Comp val) { myComp = int64(val); }
365  Comp opComp(const SOP_NodeVerb::CookParms &cookparms) const
366  {
367  SOP_Node *thissop = cookparms.getNode();
368  if (!thissop) return getComp();
369  int64 result;
370  OP_Utils::evalOpParm(result, thissop, "comp", cookparms.getCookTime(), 0);
371  return Comp(result);
372  }
373  fpreal64 getValue() const { return myValue; }
374  void setValue(fpreal64 val) { myValue = val; }
375  fpreal64 opValue(const SOP_NodeVerb::CookParms &cookparms) const
376  {
377  SOP_Node *thissop = cookparms.getNode();
378  if (!thissop) return getValue();
379  fpreal64 result;
380  OP_Utils::evalOpParm(result, thissop, "value", cookparms.getCookTime(), 0);
381  return result;
382  }
383  UT_Vector3D getVoxelpad() const { return myVoxelpad; }
384  void setVoxelpad(UT_Vector3D val) { myVoxelpad = val; }
386  {
387  SOP_Node *thissop = cookparms.getNode();
388  if (!thissop) return getVoxelpad();
389  UT_Vector3D result;
390  OP_Utils::evalOpParm(result, thissop, "voxelpad", cookparms.getCookTime(), 0);
391  return result;
392  }
393 
394 private:
395  UT_StringHolder myGroup;
396  int64 myComp;
397  fpreal64 myValue;
398  UT_Vector3D myVoxelpad;
399 
400 };
Comp opComp(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, fpreal64 &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
exint bread(int32 *buffer, exint asize=1)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void setValue(fpreal64 val)
T & x(void)
Definition: UT_Vector2.h:284
void doGetParmValue(exint idx, T &value) const
fpreal64 getValue() const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
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.
virtual ParmType getParmType(exint fieldnum) const
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
bool operator==(const SOP_VolumeBoundParms &src) const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void getParmValue(exint idx, UT_Vector2D &value) const
void doSetParmValue(exint idx, const T &value)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void setParmValue(exint idx, const exint &value)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
UT_Vector3D opVoxelpad(const SOP_NodeVerb::CookParms &cookparms) const
long long int64
Definition: SYS_Types.h:106
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void save(std::ostream &os) const
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_Vector2D &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, UT_Vector4D v)
int64 exint
Definition: SYS_Types.h:115
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:191
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, bool v)
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
bool load(UT_IStream &is)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, UT_Matrix3D v)
fpreal64 opValue(const SOP_NodeVerb::CookParms &cookparms) const
const UT_StringHolder & getGroup() const
virtual void copyFrom(const SOP_NodeParms *src)
UT_Vector3T< fpreal64 > UT_Vector3D
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
void getParmValue(exint idx, UT_StringHolder &value) const
void setParmValue(exint idx, const UT_Matrix2D &value)
void getParmValue(exint idx, UT_Matrix2D &value) const
void setVoxelpad(UT_Vector3D val)
void getParmValue(exint idx, UT_Vector3D &value) const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
static void saveData(std::ostream &os, fpreal64 v)
void getParmValue(exint idx, UT_Matrix4D &value) const
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
static void saveData(std::ostream &os, UT_StringHolder s)
virtual const char * getParmName(exint fieldnum) const
void setParmValue(exint idx, const UT_Matrix3D &value)
void getParmValue(exint idx, exint &value) const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
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
static void saveData(std::ostream &os, UT_Vector3D v)
void strncpy(const char *src, exint maxlen)
static void saveData(std::ostream &os, UT_Matrix4D v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void getParmValue(exint idx, UT_Matrix3D &value) const
void setParmValue(exint idx, const UT_Vector4D &value)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void setParmValue(exint idx, const UT_Vector2D &value)
static void loadData(UT_IStream &is, UT_Vector4D &v)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
static void saveData(std::ostream &os, UT_Vector2D v)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
void getParmValue(exint idx, fpreal &value) const
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
static void saveData(std::ostream &os, int64 v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
void setGroup(const UT_StringHolder &val)
T & x(void)
Definition: UT_Vector4.h:368
static void saveData(std::ostream &os, PRM_DataItemHandle s)
T & y(void)
Definition: UT_Vector2.h:286
void setParmValue(exint idx, const fpreal &value)
GLboolean r
Definition: glcorearb.h:1221
void setParmValue(exint idx, const UT_Matrix4D &value)
void getParmValue(exint idx, UT_Vector4D &value) const
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, int64 &v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
T & w(void)
Definition: UT_Vector4.h:374
UT_Vector3D getVoxelpad() const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
void setParmValue(exint idx, const UT_StringHolder &value)
SYS_FORCE_INLINE bool isstring() const
virtual exint getNumParms() const
void setParmValue(exint idx, const UT_Vector3D &value)
static void loadData(UT_IStream &is, UT_Vector3I &v)
GLenum src
Definition: glcorearb.h:1792