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