HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_AttribPromote.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_AttribPromoteEnums
22 {
23  enum class Inclass
24  {
25  DETAIL = 0,
26  PRIMITIVE,
27  POINT,
28  VERTEX
29  };
30  enum class Outclass
31  {
32  DETAIL = 0,
33  PRIMITIVE,
34  POINT,
35  VERTEX
36  };
37  enum class Method
38  {
39  MAX = 0,
40  MIN,
41  MEAN,
42  MODE,
43  MEDIAN,
44  SUM,
45  SUMSQUARE,
46  RMS,
47  FIRST,
48  LAST
49  };
50 }
51 
52 
54 {
55 public:
56  static int version() { return 1; }
57 
59  {
60  myInname = ""_sh;
61  myInclass = 2;
62  myOutclass = 2;
63  myMethod = 2;
64  myUseoutname = false;
65  myOutname = ""_sh;
66  myDeletein = true;
67 
68  }
69 
70  explicit SOP_AttribPromoteParms(const SOP_AttribPromoteParms &) = default;
71 
73 
75  {
76  if (myInname != src.myInname) return false;
77  if (myInclass != src.myInclass) return false;
78  if (myOutclass != src.myOutclass) return false;
79  if (myMethod != src.myMethod) return false;
80  if (myUseoutname != src.myUseoutname) return false;
81  if (myOutname != src.myOutname) return false;
82  if (myDeletein != src.myDeletein) return false;
83 
84  return true;
85  }
89 
90 
91 
92  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
93  {
94  if (true)
95  OP_Utils::evalOpParm(myInname, node, "inname", time, 0);
96  else myInname = ""_sh;
97  if (true)
98  OP_Utils::evalOpParm(myInclass, node, "inclass", time, 0);
99  else myInclass = 2;
100  if (true)
101  OP_Utils::evalOpParm(myOutclass, node, "outclass", time, 0);
102  else myOutclass = 2;
103  if (true)
104  OP_Utils::evalOpParm(myMethod, node, "method", time, 0);
105  else myMethod = 2;
106  if (true)
107  OP_Utils::evalOpParm(myUseoutname, node, "useoutname", time, 0);
108  else myUseoutname = false;
109  if (true && ( (!(((getUseoutname()==0)))) ) )
110  OP_Utils::evalOpParm(myOutname, node, "outname", time, 0);
111  else myOutname = ""_sh;
112  if (true && ( (!(((getUseoutname()==0)&&(int64(getInclass())==2)&&(int64(getOutclass())==3))||((getUseoutname()==0)&&(int64(getInclass())==3)&&(int64(getOutclass())==2)))) ) )
113  OP_Utils::evalOpParm(myDeletein, node, "deletein", time, 0);
114  else myDeletein = true;
115 
116  }
117 
118 
119  virtual void loadFromOpSubclass(const LoadParms &loadparms)
120  {
121  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
122  }
123 
124 
125  virtual void copyFrom(const SOP_NodeParms *src)
126  {
127  *this = *((const SOP_AttribPromoteParms *)src);
128  }
129 
130  template <typename T>
131  void
132  doGetParmValue(exint idx, T &value) const
133  {
134  switch (idx)
135  {
136  case 0:
137  coerceValue(value, myInname);
138  break;
139  case 1:
140  coerceValue(value, myInclass);
141  break;
142  case 2:
143  coerceValue(value, myOutclass);
144  break;
145  case 3:
146  coerceValue(value, myMethod);
147  break;
148  case 4:
149  coerceValue(value, myUseoutname);
150  break;
151  case 5:
152  coerceValue(value, myOutname);
153  break;
154  case 6:
155  coerceValue(value, myDeletein);
156  break;
157 
158  }
159  }
160 
161  void getParmValue(exint idx, exint &value) const
162  { doGetParmValue(idx, value); }
163  void getParmValue(exint idx, fpreal &value) const
164  { doGetParmValue(idx, value); }
166  { doGetParmValue(idx, value); }
168  { doGetParmValue(idx, value); }
170  { doGetParmValue(idx, value); }
172  { doGetParmValue(idx, value); }
174  { doGetParmValue(idx, value); }
176  { doGetParmValue(idx, value); }
178  { doGetParmValue(idx, value); }
180  { doGetParmValue(idx, value); }
182  { doGetParmValue(idx, value); }
183 
184  template <typename T>
185  void
186  doSetParmValue(exint idx, const T &value)
187  {
188  switch (idx)
189  {
190  case 0:
191  coerceValue(myInname, value);
192  break;
193  case 1:
194  coerceValue(myInclass, value);
195  break;
196  case 2:
197  coerceValue(myOutclass, value);
198  break;
199  case 3:
200  coerceValue(myMethod, value);
201  break;
202  case 4:
203  coerceValue(myUseoutname, value);
204  break;
205  case 5:
206  coerceValue(myOutname, value);
207  break;
208  case 6:
209  coerceValue(myDeletein, value);
210  break;
211 
212  }
213  }
214 
215  void setParmValue(exint idx, const exint &value)
216  { doSetParmValue(idx, value); }
217  void setParmValue(exint idx, const fpreal &value)
218  { doSetParmValue(idx, value); }
219  void setParmValue(exint idx, const UT_Vector2D &value)
220  { doSetParmValue(idx, value); }
221  void setParmValue(exint idx, const UT_Vector3D &value)
222  { doSetParmValue(idx, value); }
223  void setParmValue(exint idx, const UT_Vector4D &value)
224  { doSetParmValue(idx, value); }
225  void setParmValue(exint idx, const UT_Matrix2D &value)
226  { doSetParmValue(idx, value); }
227  void setParmValue(exint idx, const UT_Matrix3D &value)
228  { doSetParmValue(idx, value); }
229  void setParmValue(exint idx, const UT_Matrix4D &value)
230  { doSetParmValue(idx, value); }
232  { doSetParmValue(idx, value); }
234  { doSetParmValue(idx, value); }
236  { doSetParmValue(idx, value); }
237 
238  virtual exint getNumParms() const
239  {
240  return 7;
241  }
242 
243  virtual const char *getParmName(exint fieldnum) const
244  {
245  switch (fieldnum)
246  {
247  case 0:
248  return "inname";
249  case 1:
250  return "inclass";
251  case 2:
252  return "outclass";
253  case 3:
254  return "method";
255  case 4:
256  return "useoutname";
257  case 5:
258  return "outname";
259  case 6:
260  return "deletein";
261 
262  }
263  return 0;
264  }
265 
266  virtual ParmType getParmType(exint fieldnum) const
267  {
268  switch (fieldnum)
269  {
270  case 0:
271  return PARM_STRING;
272  case 1:
273  return PARM_INTEGER;
274  case 2:
275  return PARM_INTEGER;
276  case 3:
277  return PARM_INTEGER;
278  case 4:
279  return PARM_INTEGER;
280  case 5:
281  return PARM_STRING;
282  case 6:
283  return PARM_INTEGER;
284 
285  }
286  return PARM_UNSUPPORTED;
287  }
288 
289  // Boiler plate to load individual types.
290  static void loadData(UT_IStream &is, int64 &v)
291  { is.bread(&v, 1); }
292  static void loadData(UT_IStream &is, bool &v)
293  { int64 iv; is.bread(&iv, 1); v = iv; }
294  static void loadData(UT_IStream &is, fpreal64 &v)
295  { is.bread<fpreal64>(&v, 1); }
296  static void loadData(UT_IStream &is, UT_Vector2D &v)
297  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
298  static void loadData(UT_IStream &is, UT_Vector3D &v)
299  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
300  is.bread<fpreal64>(&v.z(), 1); }
301  static void loadData(UT_IStream &is, UT_Vector4D &v)
302  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
303  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
304  static void loadData(UT_IStream &is, UT_Matrix2D &v)
305  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
306  static void loadData(UT_IStream &is, UT_Matrix3D &v)
307  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
308  static void loadData(UT_IStream &is, UT_Matrix4D &v)
309  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
310  static void loadData(UT_IStream &is, UT_Vector2I &v)
311  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
312  static void loadData(UT_IStream &is, UT_Vector3I &v)
313  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
314  is.bread<int64>(&v.z(), 1); }
315  static void loadData(UT_IStream &is, UT_Vector4I &v)
316  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
317  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
319  { is.bread(v); }
321  { UT_StringHolder rampdata;
322  loadData(is, rampdata);
323  if (rampdata.isstring())
324  {
325  v.reset(new UT_Ramp());
326  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
327  v->load(istr);
328  }
329  else v.reset();
330  }
333  loadData(is, data);
334  if (data.isstring())
335  {
336  // Find the data type.
337  char *colon = UT_StringWrap(data).findChar(':');
338  if (colon)
339  {
340  int typelen = colon - data.buffer();
342  type.strncpy(data.buffer(), typelen);
343  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
344 
345  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
346  }
347  }
348  else v.reset();
349  }
350 
351  static void saveData(std::ostream &os, int64 v)
352  { UTwrite(os, &v); }
353  static void saveData(std::ostream &os, bool v)
354  { int64 iv = v; UTwrite(os, &iv); }
355  static void saveData(std::ostream &os, fpreal64 v)
356  { UTwrite<fpreal64>(os, &v); }
357  static void saveData(std::ostream &os, UT_Vector2D v)
358  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
359  static void saveData(std::ostream &os, UT_Vector3D v)
360  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
361  UTwrite<fpreal64>(os, &v.z()); }
362  static void saveData(std::ostream &os, UT_Vector4D v)
363  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
364  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
365  static void saveData(std::ostream &os, UT_Matrix2D v)
367  static void saveData(std::ostream &os, UT_Matrix3D v)
369  static void saveData(std::ostream &os, UT_Matrix4D v)
371  static void saveData(std::ostream &os, UT_StringHolder s)
372  { UT_StringWrap(s).saveBinary(os); }
373  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
374  { UT_StringHolder result;
375  UT_OStringStream ostr;
376  if (s) s->save(ostr);
377  result = ostr.str();
378  saveData(os, result);
379  }
380  static void saveData(std::ostream &os, PRM_DataItemHandle s)
381  { UT_StringHolder result;
382  UT_OStringStream ostr;
383  if (s)
384  {
385  ostr << s->getDataTypeToken();
386  ostr << ":";
387  s->saveBinary(ostr);
388  }
389  result = ostr.str();
390  saveData(os, result);
391  }
392 
393 
394  void save(std::ostream &os) const
395  {
396  int32 v = version();
397  UTwrite(os, &v);
398  saveData(os, myInname);
399  saveData(os, myInclass);
400  saveData(os, myOutclass);
401  saveData(os, myMethod);
402  saveData(os, myUseoutname);
403  saveData(os, myOutname);
404  saveData(os, myDeletein);
405 
406  }
407 
408  bool load(UT_IStream &is)
409  {
410  int32 v;
411  is.bread(&v, 1);
412  if (version() != v)
413  {
414  // Fail incompatible versions
415  return false;
416  }
417  loadData(is, myInname);
418  loadData(is, myInclass);
419  loadData(is, myOutclass);
420  loadData(is, myMethod);
421  loadData(is, myUseoutname);
422  loadData(is, myOutname);
423  loadData(is, myDeletein);
424 
425  return true;
426  }
427 
428  const UT_StringHolder & getInname() const { return myInname; }
429  void setInname(const UT_StringHolder & val) { myInname = val; }
431  {
432  SOP_Node *thissop = cookparms.getNode();
433  if (!thissop) return getInname();
434  UT_StringHolder result;
435  OP_Utils::evalOpParm(result, thissop, "inname", cookparms.getCookTime(), 0);
436  return result;
437  }
438  Inclass getInclass() const { return Inclass(myInclass); }
439  void setInclass(Inclass val) { myInclass = int64(val); }
440  Inclass opInclass(const SOP_NodeVerb::CookParms &cookparms) const
441  {
442  SOP_Node *thissop = cookparms.getNode();
443  if (!thissop) return getInclass();
444  int64 result;
445  OP_Utils::evalOpParm(result, thissop, "inclass", cookparms.getCookTime(), 0);
446  return Inclass(result);
447  }
448  Outclass getOutclass() const { return Outclass(myOutclass); }
449  void setOutclass(Outclass val) { myOutclass = int64(val); }
451  {
452  SOP_Node *thissop = cookparms.getNode();
453  if (!thissop) return getOutclass();
454  int64 result;
455  OP_Utils::evalOpParm(result, thissop, "outclass", cookparms.getCookTime(), 0);
456  return Outclass(result);
457  }
458  Method getMethod() const { return Method(myMethod); }
459  void setMethod(Method val) { myMethod = int64(val); }
460  Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
461  {
462  SOP_Node *thissop = cookparms.getNode();
463  if (!thissop) return getMethod();
464  int64 result;
465  OP_Utils::evalOpParm(result, thissop, "method", cookparms.getCookTime(), 0);
466  return Method(result);
467  }
468  bool getUseoutname() const { return myUseoutname; }
469  void setUseoutname(bool val) { myUseoutname = val; }
470  bool opUseoutname(const SOP_NodeVerb::CookParms &cookparms) const
471  {
472  SOP_Node *thissop = cookparms.getNode();
473  if (!thissop) return getUseoutname();
474  bool result;
475  OP_Utils::evalOpParm(result, thissop, "useoutname", cookparms.getCookTime(), 0);
476  return result;
477  }
478  const UT_StringHolder & getOutname() const { return myOutname; }
479  void setOutname(const UT_StringHolder & val) { myOutname = val; }
481  {
482  SOP_Node *thissop = cookparms.getNode();
483  if (!thissop) return getOutname();
484  UT_StringHolder result;
485  OP_Utils::evalOpParm(result, thissop, "outname", cookparms.getCookTime(), 0);
486  return result;
487  }
488  bool getDeletein() const { return myDeletein; }
489  void setDeletein(bool val) { myDeletein = val; }
490  bool opDeletein(const SOP_NodeVerb::CookParms &cookparms) const
491  {
492  SOP_Node *thissop = cookparms.getNode();
493  if (!thissop) return getDeletein();
494  bool result;
495  OP_Utils::evalOpParm(result, thissop, "deletein", cookparms.getCookTime(), 0);
496  return result;
497  }
498 
499 private:
500  UT_StringHolder myInname;
501  int64 myInclass;
502  int64 myOutclass;
503  int64 myMethod;
504  bool myUseoutname;
505  UT_StringHolder myOutname;
506  bool myDeletein;
507 
508 };
static void saveData(std::ostream &os, int64 v)
void setParmValue(exint idx, const UT_Matrix4D &value)
static void loadData(UT_IStream &is, UT_Vector2I &v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
bool operator==(const SOP_AttribPromoteParms &src) const
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
static void loadData(UT_IStream &is, UT_Vector3D &v)
T & z(void)
Definition: UT_Vector4.h:372
bool opDeletein(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_StringHolder s)
exint bread(int32 *buffer, exint asize=1)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void setOutname(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector2D &v)
T & x(void)
Definition: UT_Vector2.h:284
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setInname(const UT_StringHolder &val)
An output stream object that owns its own string buffer storage.
void doGetParmValue(exint idx, T &value) const
void getParmValue(exint idx, UT_Vector4D &value) const
void getParmValue(exint idx, fpreal &value) const
void setParmValue(exint idx, const UT_Vector4D &value)
virtual exint getNumParms() const
virtual void loadFromOpSubclass(const LoadParms &loadparms)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
void setParmValue(exint idx, const UT_Matrix3D &value)
bool opUseoutname(const SOP_NodeVerb::CookParms &cookparms) const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void getParmValue(exint idx, UT_Vector2D &value) const
static void loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
virtual ParmType getParmType(exint fieldnum) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
long long int64
Definition: SYS_Types.h:100
void setParmValue(exint idx, const fpreal &value)
void setParmValue(exint idx, const UT_Vector2D &value)
void getParmValue(exint idx, UT_Matrix3D &value) const
void setParmValue(exint idx, const UT_Matrix2D &value)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
void getParmValue(exint idx, UT_Matrix4D &value) const
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
void getParmValue(exint idx, UT_StringHolder &value) const
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
SYS_FORCE_INLINE const char * buffer() const
int64 exint
Definition: SYS_Types.h:109
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
static void saveData(std::ostream &os, UT_Vector4D v)
double fpreal64
Definition: SYS_Types.h:185
static void saveData(std::ostream &os, PRM_DataItemHandle s)
const UT_StringHolder & getInname() const
UT_StringHolder opOutname(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void getParmValue(exint idx, exint &value) const
GLboolean * data
Definition: glcorearb.h:130
static void loadData(UT_IStream &is, UT_Matrix3D &v)
int int32
Definition: SYS_Types.h:28
T & y(void)
Definition: UT_Vector4.h:370
static void saveData(std::ostream &os, fpreal64 v)
const UT_StringHolder & getOutname() const
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
static void saveData(std::ostream &os, UT_Matrix2D v)
void getParmValue(exint idx, UT_Vector3D &value) const
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void setParmValue(exint idx, const exint &value)
virtual const char * getParmName(exint fieldnum) const
void setParmValue(exint idx, const PRM_DataItemHandle &value)
UT_StringHolder opInname(const SOP_NodeVerb::CookParms &cookparms) 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
static void saveData(std::ostream &os, bool v)
void strncpy(const char *src, exint maxlen)
static void loadData(UT_IStream &is, UT_Vector3I &v)
Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector3D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, fpreal64 &v)
void setParmValue(exint idx, const UT_StringHolder &value)
static void loadData(UT_IStream &is, bool &v)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
void save(std::ostream &os) const
static void loadData(UT_IStream &is, PRM_DataItemHandle &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
void getParmValue(exint idx, UT_Matrix2D &value) const
static void saveData(std::ostream &os, UT_Matrix4D v)
T & y(void)
Definition: UT_Vector2.h:286
void getParmValue(exint idx, PRM_DataItemHandle &value) const
GLboolean r
Definition: glcorearb.h:1221
Outclass opOutclass(const SOP_NodeVerb::CookParms &cookparms) const
virtual void copyFrom(const SOP_NodeParms *src)
T & w(void)
Definition: UT_Vector4.h:374
void doSetParmValue(exint idx, const T &value)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
Inclass opInclass(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
static void saveData(std::ostream &os, UT_Vector2D v)
SYS_FORCE_INLINE bool isstring() const
void setParmValue(exint idx, const UT_Vector3D &value)
GLenum src
Definition: glcorearb.h:1792