HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_TetPartition.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 
23 {
24 public:
25  static int version() { return 1; }
26 
28  {
29  myTetgroup = ""_sh;
30  myPolygroup = ""_sh;
31  myAttrib = "name"_sh;
32 
33  }
34 
35  explicit SOP_TetPartitionParms(const SOP_TetPartitionParms &) = default;
36 
38 
40  {
41  if (myTetgroup != src.myTetgroup) return false;
42  if (myPolygroup != src.myPolygroup) return false;
43  if (myAttrib != src.myAttrib) return false;
44 
45  return true;
46  }
47 
48 
49 
50  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
51  {
52  if (true)
53  OP_Utils::evalOpParm(myTetgroup, node, "tetgroup", time, 0);
54  else myTetgroup = ""_sh;
55  if (true)
56  OP_Utils::evalOpParm(myPolygroup, node, "polygroup", time, 0);
57  else myPolygroup = ""_sh;
58  if (true)
59  OP_Utils::evalOpParm(myAttrib, node, "attrib", time, 0);
60  else myAttrib = "name"_sh;
61 
62  }
63 
64 
65  virtual void loadFromOpSubclass(const LoadParms &loadparms)
66  {
67  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
68  }
69 
70 
71  virtual void copyFrom(const SOP_NodeParms *src)
72  {
73  *this = *((const SOP_TetPartitionParms *)src);
74  }
75 
76  template <typename T>
77  void
78  doGetParmValue(exint idx, T &value) const
79  {
80  switch (idx)
81  {
82  case 0:
83  coerceValue(value, myTetgroup);
84  break;
85  case 1:
86  coerceValue(value, myPolygroup);
87  break;
88  case 2:
89  coerceValue(value, myAttrib);
90  break;
91 
92  }
93  }
94 
95  void getParmValue(exint idx, exint &value) const
96  { doGetParmValue(idx, value); }
97  void getParmValue(exint idx, fpreal &value) const
98  { doGetParmValue(idx, value); }
99  void getParmValue(exint idx, UT_Vector2D &value) const
100  { doGetParmValue(idx, value); }
102  { doGetParmValue(idx, value); }
104  { doGetParmValue(idx, value); }
106  { doGetParmValue(idx, value); }
108  { doGetParmValue(idx, value); }
110  { doGetParmValue(idx, value); }
112  { doGetParmValue(idx, value); }
114  { doGetParmValue(idx, value); }
116  { doGetParmValue(idx, value); }
117 
118  template <typename T>
119  void
120  doSetParmValue(exint idx, const T &value)
121  {
122  switch (idx)
123  {
124  case 0:
125  coerceValue(myTetgroup, value);
126  break;
127  case 1:
128  coerceValue(myPolygroup, value);
129  break;
130  case 2:
131  coerceValue(myAttrib, value);
132  break;
133 
134  }
135  }
136 
137  void setParmValue(exint idx, const exint &value)
138  { doSetParmValue(idx, value); }
139  void setParmValue(exint idx, const fpreal &value)
140  { doSetParmValue(idx, value); }
141  void setParmValue(exint idx, const UT_Vector2D &value)
142  { doSetParmValue(idx, value); }
143  void setParmValue(exint idx, const UT_Vector3D &value)
144  { doSetParmValue(idx, value); }
145  void setParmValue(exint idx, const UT_Vector4D &value)
146  { doSetParmValue(idx, value); }
147  void setParmValue(exint idx, const UT_Matrix2D &value)
148  { doSetParmValue(idx, value); }
149  void setParmValue(exint idx, const UT_Matrix3D &value)
150  { doSetParmValue(idx, value); }
151  void setParmValue(exint idx, const UT_Matrix4D &value)
152  { doSetParmValue(idx, value); }
154  { doSetParmValue(idx, value); }
156  { doSetParmValue(idx, value); }
158  { doSetParmValue(idx, value); }
159 
160  virtual exint getNumParms() const
161  {
162  return 3;
163  }
164 
165  virtual const char *getParmName(exint fieldnum) const
166  {
167  switch (fieldnum)
168  {
169  case 0:
170  return "tetgroup";
171  case 1:
172  return "polygroup";
173  case 2:
174  return "attrib";
175 
176  }
177  return 0;
178  }
179 
180  virtual ParmType getParmType(exint fieldnum) const
181  {
182  switch (fieldnum)
183  {
184  case 0:
185  return PARM_STRING;
186  case 1:
187  return PARM_STRING;
188  case 2:
189  return PARM_STRING;
190 
191  }
192  return PARM_UNSUPPORTED;
193  }
194 
195  // Boiler plate to load individual types.
196  static void loadData(UT_IStream &is, int64 &v)
197  { is.bread(&v, 1); }
198  static void loadData(UT_IStream &is, bool &v)
199  { int64 iv; is.bread(&iv, 1); v = iv; }
200  static void loadData(UT_IStream &is, fpreal64 &v)
201  { is.bread<fpreal64>(&v, 1); }
202  static void loadData(UT_IStream &is, UT_Vector2D &v)
203  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
204  static void loadData(UT_IStream &is, UT_Vector3D &v)
205  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
206  is.bread<fpreal64>(&v.z(), 1); }
207  static void loadData(UT_IStream &is, UT_Vector4D &v)
208  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
209  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
210  static void loadData(UT_IStream &is, UT_Matrix2D &v)
211  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
212  static void loadData(UT_IStream &is, UT_Matrix3D &v)
213  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
214  static void loadData(UT_IStream &is, UT_Matrix4D &v)
215  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
216  static void loadData(UT_IStream &is, UT_Vector2I &v)
217  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
218  static void loadData(UT_IStream &is, UT_Vector3I &v)
219  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
220  is.bread<int64>(&v.z(), 1); }
221  static void loadData(UT_IStream &is, UT_Vector4I &v)
222  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
223  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
225  { is.bread(v); }
227  { UT_StringHolder rampdata;
228  loadData(is, rampdata);
229  if (rampdata.isstring())
230  {
231  v.reset(new UT_Ramp());
232  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
233  v->load(istr);
234  }
235  else v.reset();
236  }
239  loadData(is, data);
240  if (data.isstring())
241  {
242  // Find the data type.
243  char *colon = UT_StringWrap(data).findChar(':');
244  if (colon)
245  {
246  int typelen = colon - data.buffer();
248  type.strncpy(data.buffer(), typelen);
249  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
250 
251  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
252  }
253  }
254  else v.reset();
255  }
256 
257  static void saveData(std::ostream &os, int64 v)
258  { UTwrite(os, &v); }
259  static void saveData(std::ostream &os, bool v)
260  { int64 iv = v; UTwrite(os, &iv); }
261  static void saveData(std::ostream &os, fpreal64 v)
262  { UTwrite<fpreal64>(os, &v); }
263  static void saveData(std::ostream &os, UT_Vector2D v)
264  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
265  static void saveData(std::ostream &os, UT_Vector3D v)
266  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
267  UTwrite<fpreal64>(os, &v.z()); }
268  static void saveData(std::ostream &os, UT_Vector4D v)
269  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
270  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
271  static void saveData(std::ostream &os, UT_Matrix2D v)
273  static void saveData(std::ostream &os, UT_Matrix3D v)
275  static void saveData(std::ostream &os, UT_Matrix4D v)
277  static void saveData(std::ostream &os, UT_StringHolder s)
278  { UT_StringWrap(s).saveBinary(os); }
279  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
280  { UT_StringHolder result;
281  UT_OStringStream ostr;
282  if (s) s->save(ostr);
283  result = ostr.str();
284  saveData(os, result);
285  }
286  static void saveData(std::ostream &os, PRM_DataItemHandle s)
287  { UT_StringHolder result;
288  UT_OStringStream ostr;
289  if (s)
290  {
291  ostr << s->getDataTypeToken();
292  ostr << ":";
293  s->saveBinary(ostr);
294  }
295  result = ostr.str();
296  saveData(os, result);
297  }
298 
299 
300  void save(std::ostream &os) const
301  {
302  int32 v = version();
303  UTwrite(os, &v);
304  saveData(os, myTetgroup);
305  saveData(os, myPolygroup);
306  saveData(os, myAttrib);
307 
308  }
309 
310  bool load(UT_IStream &is)
311  {
312  int32 v;
313  is.bread(&v, 1);
314  if (version() != v)
315  {
316  // Fail incompatible versions
317  return false;
318  }
319  loadData(is, myTetgroup);
320  loadData(is, myPolygroup);
321  loadData(is, myAttrib);
322 
323  return true;
324  }
325 
326  const UT_StringHolder & getTetgroup() const { return myTetgroup; }
327  void setTetgroup(const UT_StringHolder & val) { myTetgroup = val; }
329  {
330  SOP_Node *thissop = cookparms.getNode();
331  if (!thissop) return getTetgroup();
332  UT_StringHolder result;
333  OP_Utils::evalOpParm(result, thissop, "tetgroup", cookparms.getCookTime(), 0);
334  return result;
335  }
336  const UT_StringHolder & getPolygroup() const { return myPolygroup; }
337  void setPolygroup(const UT_StringHolder & val) { myPolygroup = val; }
339  {
340  SOP_Node *thissop = cookparms.getNode();
341  if (!thissop) return getPolygroup();
342  UT_StringHolder result;
343  OP_Utils::evalOpParm(result, thissop, "polygroup", cookparms.getCookTime(), 0);
344  return result;
345  }
346  const UT_StringHolder & getAttrib() const { return myAttrib; }
347  void setAttrib(const UT_StringHolder & val) { myAttrib = val; }
349  {
350  SOP_Node *thissop = cookparms.getNode();
351  if (!thissop) return getAttrib();
352  UT_StringHolder result;
353  OP_Utils::evalOpParm(result, thissop, "attrib", cookparms.getCookTime(), 0);
354  return result;
355  }
356 
357 private:
358  UT_StringHolder myTetgroup;
359  UT_StringHolder myPolygroup;
360  UT_StringHolder myAttrib;
361 
362 };
static void loadData(UT_IStream &is, UT_Matrix2D &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
void setParmValue(exint idx, const UT_StringHolder &value)
UT_StringHolder opAttrib(const SOP_NodeVerb::CookParms &cookparms) const
void getParmValue(exint idx, exint &value) const
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void getParmValue(exint idx, UT_Vector3D &value) const
void setTetgroup(const UT_StringHolder &val)
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void setParmValue(exint idx, const UT_Vector4D &value)
void setParmValue(exint idx, const fpreal &value)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void setParmValue(exint idx, const UT_Vector2D &value)
static void saveData(std::ostream &os, UT_Vector2D v)
void getParmValue(exint idx, UT_StringHolder &value) const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
bool load(UT_IStream &is)
T & x(void)
Definition: UT_Vector2.h:284
void setParmValue(exint idx, const PRM_DataItemHandle &value)
void getParmValue(exint idx, UT_Matrix4D &value) const
An output stream object that owns its own string buffer storage.
UT_StringHolder opPolygroup(const SOP_NodeVerb::CookParms &cookparms) const
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 void loadData(UT_IStream &is, int64 &v)
void setAttrib(const UT_StringHolder &val)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Vector2D &v)
void getParmValue(exint idx, UT_Vector4D &value) const
void getParmValue(exint idx, UT_Vector2D &value) const
bool operator==(const SOP_TetPartitionParms &src) const
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:100
virtual const char * getParmName(exint fieldnum) const
virtual void loadFromOpSubclass(const LoadParms &loadparms)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void doGetParmValue(exint idx, T &value) const
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
const UT_StringHolder & getAttrib() const
int64 exint
Definition: SYS_Types.h:109
void getParmValue(exint idx, fpreal &value) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void saveData(std::ostream &os, bool v)
static void saveData(std::ostream &os, fpreal64 v)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
static void loadData(UT_IStream &is, UT_StringHolder &v)
double fpreal64
Definition: SYS_Types.h:185
static void saveData(std::ostream &os, UT_Matrix2D v)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
const UT_StringHolder & getPolygroup() const
void doSetParmValue(exint idx, const T &value)
void setParmValue(exint idx, const UT_Matrix2D &value)
void getParmValue(exint idx, UT_Matrix2D &value) const
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:28
void setParmValue(exint idx, const UT_Vector3D &value)
void setParmValue(exint idx, const exint &value)
T & y(void)
Definition: UT_Vector4.h:370
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
void getParmValue(exint idx, UT_Matrix3D &value) const
void setPolygroup(const UT_StringHolder &val)
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
const UT_StringHolder & getTetgroup() const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
virtual ParmType getParmType(exint fieldnum) const
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:263
void strncpy(const char *src, exint maxlen)
virtual void copyFrom(const SOP_NodeParms *src)
void save(std::ostream &os) const
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, UT_Vector4D v)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
UT_StringHolder opTetgroup(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix4D v)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
T & x(void)
Definition: UT_Vector4.h:368
T & y(void)
Definition: UT_Vector2.h:286
GLboolean r
Definition: glcorearb.h:1221
static void saveData(std::ostream &os, UT_Vector3D v)
T & w(void)
Definition: UT_Vector4.h:374
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, int64 v)
static void saveData(std::ostream &os, UT_StringHolder s)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
void setParmValue(exint idx, const UT_Matrix4D &value)
SYS_FORCE_INLINE bool isstring() const
virtual exint getNumParms() const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, UT_Matrix3D v)
GLenum src
Definition: glcorearb.h:1792
void setParmValue(exint idx, const UT_Matrix3D &value)