HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_ErrorNode.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_ErrorNodeEnums
22 {
23  enum class Severity
24  {
25  MESSAGE = 0,
26  WARN,
27  ERROR
28  };
29 }
30 
31 
33 {
34 public:
35  static int version() { return 1; }
36  struct Numerror
37  {
41 
42 
44  {
45  errormsg = ""_sh;
46  severity = 0;
47  enable = 0;
48 
49  }
50 
51  bool operator==(const Numerror &src) const
52  {
53  if (errormsg != src.errormsg) return false;
54  if (severity != src.severity) return false;
55  if (enable != src.enable) return false;
56 
57  return true;
58  }
59 
60  };
61 
63  {
65 
66  buf.strcat("[ ");
67  for (int i = 0; i < list.entries(); i++)
68  {
69  if (i)
70  buf.strcat(", ");
71  buf.strcat("( ");
72  buf.append("");
73  { UT_String tmp; tmp = UT_StringWrap(list(i).errormsg).makeQuotedString('"'); buf.strcat(tmp); }
74  buf.append(", ");
75  buf.appendSprintf("%d", (int) list(i).severity);
76  buf.append(", ");
77  buf.appendSprintf("%d", (int) list(i).enable);
78 
79  buf.strcat(" )");
80  }
81  buf.strcat(" ]");
82 
83  UT_StringHolder result = buf;
84  return result;
85  }
86 
88  {
89 
90  }
91 
92  explicit SOP_ErrorNodeParms(const SOP_ErrorNodeParms &) = default;
93 
94  virtual ~SOP_ErrorNodeParms() {}
95 
96  bool operator==(const SOP_ErrorNodeParms &src) const
97  {
98  if (myNumerror != src.myNumerror) return false;
99 
100  return true;
101  }
103 
104 
105 
106  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
107  {
108  if (true)
109  {
110  int64 length;
111  OP_Utils::evalOpParm(length, node, "numerror", time, 0);
112  myNumerror.entries(length);
113  for (exint i = 0; i < length; i++)
114  {
115  int parmidx = i+1;
116  auto && _curentry = myNumerror(i);
117  (void) _curentry;
118  if (true)
119  OP_Utils::evalOpParmInst(myNumerror(i).errormsg, node, "errormsg#", &parmidx, time, 0);
120  else myNumerror(i).errormsg = ""_sh;
121  if (true)
122  OP_Utils::evalOpParmInst(myNumerror(i).severity, node, "severity#", &parmidx, time, 0);
123  else myNumerror(i).severity = 0;
124  if (true)
125  OP_Utils::evalOpParmInst(myNumerror(i).enable, node, "enable#", &parmidx, time, 0);
126  else myNumerror(i).enable = 0;
127 
128  }
129  }
130  else
131  myNumerror.clear();
132 
133  }
134 
135 
136  virtual void loadFromOpSubclass(const LoadParms &loadparms)
137  {
138  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
139  }
140 
141 
142  virtual void copyFrom(const SOP_NodeParms *src)
143  {
144  *this = *((const SOP_ErrorNodeParms *)src);
145  }
146 
147  template <typename T>
148  void
149  doGetParmValue(exint idx, T &value) const
150  {
151  switch (idx)
152  {
153 
154  }
155  }
156 
157  void getParmValue(exint idx, exint &value) const
158  { doGetParmValue(idx, value); }
159  void getParmValue(exint idx, fpreal &value) const
160  { doGetParmValue(idx, value); }
162  { doGetParmValue(idx, value); }
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); }
179 
180  template <typename T>
181  void
182  doSetParmValue(exint idx, const T &value)
183  {
184  switch (idx)
185  {
186 
187  }
188  }
189 
190  void setParmValue(exint idx, const exint &value)
191  { doSetParmValue(idx, value); }
192  void setParmValue(exint idx, const fpreal &value)
193  { doSetParmValue(idx, value); }
194  void setParmValue(exint idx, const UT_Vector2D &value)
195  { doSetParmValue(idx, value); }
196  void setParmValue(exint idx, const UT_Vector3D &value)
197  { doSetParmValue(idx, value); }
198  void setParmValue(exint idx, const UT_Vector4D &value)
199  { doSetParmValue(idx, value); }
200  void setParmValue(exint idx, const UT_Matrix2D &value)
201  { doSetParmValue(idx, value); }
202  void setParmValue(exint idx, const UT_Matrix3D &value)
203  { doSetParmValue(idx, value); }
204  void setParmValue(exint idx, const UT_Matrix4D &value)
205  { doSetParmValue(idx, value); }
207  { doSetParmValue(idx, value); }
209  { doSetParmValue(idx, value); }
211  { doSetParmValue(idx, value); }
212 
213  virtual exint getNumParms() const
214  {
215  return 1;
216  }
217 
218  virtual const char *getParmName(exint fieldnum) const
219  {
220  switch (fieldnum)
221  {
222  case 0:
223  return "numerror";
224 
225  }
226  return 0;
227  }
228 
229  virtual ParmType getParmType(exint fieldnum) const
230  {
231  switch (fieldnum)
232  {
233 
234  }
235  return PARM_UNSUPPORTED;
236  }
237 
238  // Boiler plate to load individual types.
239  static void loadData(UT_IStream &is, int64 &v)
240  { is.bread(&v, 1); }
241  static void loadData(UT_IStream &is, bool &v)
242  { int64 iv; is.bread(&iv, 1); v = iv; }
243  static void loadData(UT_IStream &is, fpreal64 &v)
244  { is.bread<fpreal64>(&v, 1); }
245  static void loadData(UT_IStream &is, UT_Vector2D &v)
246  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
247  static void loadData(UT_IStream &is, UT_Vector3D &v)
248  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
249  is.bread<fpreal64>(&v.z(), 1); }
250  static void loadData(UT_IStream &is, UT_Vector4D &v)
251  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
252  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
253  static void loadData(UT_IStream &is, UT_Matrix2D &v)
254  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
255  static void loadData(UT_IStream &is, UT_Matrix3D &v)
256  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
257  static void loadData(UT_IStream &is, UT_Matrix4D &v)
258  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
259  static void loadData(UT_IStream &is, UT_Vector2I &v)
260  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
261  static void loadData(UT_IStream &is, UT_Vector3I &v)
262  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
263  is.bread<int64>(&v.z(), 1); }
264  static void loadData(UT_IStream &is, UT_Vector4I &v)
265  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
266  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
268  { is.bread(v); }
270  { UT_StringHolder rampdata;
271  loadData(is, rampdata);
272  if (rampdata.isstring())
273  {
274  v.reset(new UT_Ramp());
275  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
276  v->load(istr);
277  }
278  else v.reset();
279  }
282  loadData(is, data);
283  if (data.isstring())
284  {
285  // Find the data type.
286  char *colon = UT_StringWrap(data).findChar(':');
287  if (colon)
288  {
289  int typelen = colon - data.buffer();
291  type.strncpy(data.buffer(), typelen);
292  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
293 
294  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
295  }
296  }
297  else v.reset();
298  }
299 
300  static void saveData(std::ostream &os, int64 v)
301  { UTwrite(os, &v); }
302  static void saveData(std::ostream &os, bool v)
303  { int64 iv = v; UTwrite(os, &iv); }
304  static void saveData(std::ostream &os, fpreal64 v)
305  { UTwrite<fpreal64>(os, &v); }
306  static void saveData(std::ostream &os, UT_Vector2D v)
307  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
308  static void saveData(std::ostream &os, UT_Vector3D v)
309  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
310  UTwrite<fpreal64>(os, &v.z()); }
311  static void saveData(std::ostream &os, UT_Vector4D v)
312  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
313  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
314  static void saveData(std::ostream &os, UT_Matrix2D v)
316  static void saveData(std::ostream &os, UT_Matrix3D v)
318  static void saveData(std::ostream &os, UT_Matrix4D v)
320  static void saveData(std::ostream &os, UT_StringHolder s)
321  { UT_StringWrap(s).saveBinary(os); }
322  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
323  { UT_StringHolder result;
324  UT_OStringStream ostr;
325  if (s) s->save(ostr);
326  result = ostr.str();
327  saveData(os, result);
328  }
329  static void saveData(std::ostream &os, PRM_DataItemHandle s)
330  { UT_StringHolder result;
331  UT_OStringStream ostr;
332  if (s)
333  {
334  ostr << s->getDataTypeToken();
335  ostr << ":";
336  s->saveBinary(ostr);
337  }
338  result = ostr.str();
339  saveData(os, result);
340  }
341 
342 
343  void save(std::ostream &os) const
344  {
345  int32 v = version();
346  UTwrite(os, &v);
347  {
348  int64 length = myNumerror.entries();
349  UTwrite(os, &length);
350  for (exint i = 0; i < length; i++)
351  {
352  saveData(os, myNumerror(i).errormsg);
353  saveData(os, myNumerror(i).severity);
354  saveData(os, myNumerror(i).enable);
355 
356  }
357  }
358 
359  }
360 
361  bool load(UT_IStream &is)
362  {
363  int32 v;
364  is.bread(&v, 1);
365  if (version() != v)
366  {
367  // Fail incompatible versions
368  return false;
369  }
370  {
371  int64 length;
372  is.read(&length, 1);
373  myNumerror.entries(length);
374  for (exint i = 0; i < length; i++)
375  {
376  loadData(is, myNumerror(i).errormsg);
377  loadData(is, myNumerror(i).severity);
378  loadData(is, myNumerror(i).enable);
379 
380  }
381  }
382 
383  return true;
384  }
385 
386  const UT_Array<Numerror> &getNumerror() const { return myNumerror; }
387  void setNumerror(const UT_Array<Numerror> &val) { myNumerror = val; }
388  exint opNumerror(const SOP_NodeVerb::CookParms &cookparms) const
389  {
390  SOP_Node *thissop = cookparms.getNode();
391  if (!thissop) return getNumerror().entries();
392  exint result;
393  OP_Utils::evalOpParm(result, thissop, "numerror", cookparms.getCookTime(), 0);
394  return result;
395  }
397  {
398  SOP_Node *thissop = cookparms.getNode();
399  if (!thissop) return (myNumerror(_idx).errormsg);
400  int _parmidx = _idx + 1;
401  UT_StringHolder result;
402  OP_Utils::evalOpParmInst(result, thissop, "errormsg#", &_parmidx, cookparms.getCookTime(), 0);
403  return (result);
404  }
406  {
407  SOP_Node *thissop = cookparms.getNode();
408  if (!thissop) return (myNumerror(_idx).severity);
409  int _parmidx = _idx + 1;
410  int64 result;
411  OP_Utils::evalOpParmInst(result, thissop, "severity#", &_parmidx, cookparms.getCookTime(), 0);
412  return (result);
413  }
414  int64 opNumerror_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
415  {
416  SOP_Node *thissop = cookparms.getNode();
417  if (!thissop) return (myNumerror(_idx).enable);
418  int _parmidx = _idx + 1;
419  int64 result;
420  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
421  return (result);
422  }
423 
424 
425 private:
426  UT_Array<Numerror> myNumerror;
427 
428 };
void setNumerror(const UT_Array< Numerror > &val)
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
void getParmValue(exint idx, exint &value) const
virtual void copyFrom(const SOP_NodeParms *src)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
static void saveData(std::ostream &os, UT_Matrix2D v)
T & z(void)
Definition: UT_Vector4.h:372
void getParmValue(exint idx, UT_Matrix4D &value) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setParmValue(exint idx, const UT_StringHolder &value)
static void saveData(std::ostream &os, UT_Vector4D v)
void setParmValue(exint idx, const UT_Vector3D &value)
exint bread(int32 *buffer, exint asize=1)
bool operator==(const SOP_ErrorNodeParms &src) const
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
UT_StringHolder opNumerror_errormsg(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void saveData(std::ostream &os, int64 v)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
void setParmValue(exint idx, const UT_Vector2D &value)
void doSetParmValue(exint idx, const T &value)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
T & x(void)
Definition: UT_Vector2.h:284
static void loadData(UT_IStream &is, UT_Vector4I &v)
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, fpreal64 v)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
const UT_Array< Numerror > & getNumerror() const
static void saveData(std::ostream &os, UT_Vector3D v)
void setParmValue(exint idx, const fpreal &value)
void getParmValue(exint idx, UT_Vector3D &value) const
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
void setParmValue(exint idx, const UT_Matrix3D &value)
virtual exint getNumParms() const
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
png_uint_32 i
Definition: png.h:2877
int64 opNumerror_severity(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void setParmValue(exint idx, const exint &value)
static void saveData(std::ostream &os, bool v)
void setParmValue(exint idx, const UT_Matrix2D &value)
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
void getParmValue(exint idx, UT_Matrix2D &value) const
long long int64
Definition: SYS_Types.h:106
virtual const char * getParmName(exint fieldnum) const
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
void append(char character)
static void saveData(std::ostream &os, UT_Vector2D v)
SYS_FORCE_INLINE const char * buffer() const
int64 exint
Definition: SYS_Types.h:115
static void loadData(UT_IStream &is, UT_Vector4D &v)
void getParmValue(exint idx, fpreal &value) const
static void loadData(UT_IStream &is, UT_StringHolder &v)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:191
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:280
void getParmValue(exint idx, UT_Vector2D &value) const
static void saveData(std::ostream &os, UT_StringHolder s)
void getParmValue(exint idx, UT_StringHolder &value) const
void save(std::ostream &os) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, bool &v)
GLenum GLenum severity
Definition: glcorearb.h:2538
GLboolean * data
Definition: glcorearb.h:130
void getParmValue(exint idx, UT_Vector4D &value) const
int int32
Definition: SYS_Types.h:34
T & y(void)
Definition: UT_Vector4.h:370
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
UT_StringHolder createString(const UT_Array< Numerror > &list) const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void setParmValue(exint idx, const UT_Matrix4D &value)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2539
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:446
void setParmValue(exint idx, const PRM_DataItemHandle &value)
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
void doGetParmValue(exint idx, T &value) const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:269
int64 opNumerror_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void strncpy(const char *src, exint maxlen)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
exint opNumerror(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
virtual ParmType getParmType(exint fieldnum) const
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void setParmValue(exint idx, const UT_Vector4D &value)
bool operator==(const Numerror &src) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
void getParmValue(exint idx, UT_Matrix3D &value) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
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
bool load(UT_IStream &is)
static void saveData(std::ostream &os, UT_Matrix3D v)
GLboolean r
Definition: glcorearb.h:1221
void strcat(const char *src)
T & w(void)
Definition: UT_Vector4.h:374
static void loadData(UT_IStream &is, UT_Matrix3D &v)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_Vector3I &v)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
GLenum src
Definition: glcorearb.h:1792