HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  bool operator!=(const Numerror &src) const
60  {
61  return !operator==(src);
62  }
63 
64  };
65 
67  {
69 
70  buf.strcat("[ ");
71  for (int i = 0; i < list.entries(); i++)
72  {
73  if (i)
74  buf.strcat(", ");
75  buf.strcat("( ");
76  buf.append("");
77  { UT_String tmp; tmp = UT_StringWrap(list(i).errormsg).makeQuotedString('"'); buf.strcat(tmp); }
78  buf.append(", ");
79  buf.appendSprintf("%d", (int) list(i).severity);
80  buf.append(", ");
81  buf.appendSprintf("%d", (int) list(i).enable);
82 
83  buf.strcat(" )");
84  }
85  buf.strcat(" ]");
86 
87  UT_StringHolder result = buf;
88  return result;
89  }
90 
92  {
93 
94  }
95 
96  explicit SOP_ErrorNodeParms(const SOP_ErrorNodeParms &) = default;
97 
98  virtual ~SOP_ErrorNodeParms() {}
99 
100  bool operator==(const SOP_ErrorNodeParms &src) const
101  {
102  if (myNumerror != src.myNumerror) return false;
103 
104  return true;
105  }
106  bool operator!=(const SOP_ErrorNodeParms &src) const
107  {
108  return !operator==(src);
109  }
111 
112 
113 
114  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
115  {
116  if (true)
117  {
118  int64 length;
119  OP_Utils::evalOpParm(length, node, "numerror", time, 0);
120  myNumerror.entries(length);
121  for (exint i = 0; i < length; i++)
122  {
123  int parmidx = i+1;
124  auto && _curentry = myNumerror(i);
125  (void) _curentry;
126  if (true)
127  OP_Utils::evalOpParmInst(myNumerror(i).errormsg, node, "errormsg#", &parmidx, time, 0);
128  else myNumerror(i).errormsg = ""_sh;
129  if (true)
130  OP_Utils::evalOpParmInst(myNumerror(i).severity, node, "severity#", &parmidx, time, 0);
131  else myNumerror(i).severity = 0;
132  if (true)
133  OP_Utils::evalOpParmInst(myNumerror(i).enable, node, "enable#", &parmidx, time, 0);
134  else myNumerror(i).enable = 0;
135 
136  }
137  }
138  else
139  myNumerror.clear();
140 
141  }
142 
143 
144  virtual void loadFromOpSubclass(const LoadParms &loadparms)
145  {
146  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
147  }
148 
149 
150  virtual void copyFrom(const SOP_NodeParms *src)
151  {
152  *this = *((const SOP_ErrorNodeParms *)src);
153  }
154 
155  template <typename T>
156  void
157  doGetParmValue(exint idx, T &value) const
158  {
159  switch (idx)
160  {
161 
162  }
163  }
164 
165  void getParmValue(exint idx, exint &value) const
166  { doGetParmValue(idx, value); }
167  void getParmValue(exint idx, fpreal &value) const
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); }
184  { doGetParmValue(idx, value); }
186  { doGetParmValue(idx, value); }
187 
188  template <typename T>
189  void
190  doSetParmValue(exint idx, const T &value)
191  {
192  switch (idx)
193  {
194 
195  }
196  }
197 
198  void setParmValue(exint idx, const exint &value)
199  { doSetParmValue(idx, value); }
200  void setParmValue(exint idx, const fpreal &value)
201  { doSetParmValue(idx, value); }
202  void setParmValue(exint idx, const UT_Vector2D &value)
203  { doSetParmValue(idx, value); }
204  void setParmValue(exint idx, const UT_Vector3D &value)
205  { doSetParmValue(idx, value); }
206  void setParmValue(exint idx, const UT_Vector4D &value)
207  { doSetParmValue(idx, value); }
208  void setParmValue(exint idx, const UT_Matrix2D &value)
209  { doSetParmValue(idx, value); }
210  void setParmValue(exint idx, const UT_Matrix3D &value)
211  { doSetParmValue(idx, value); }
212  void setParmValue(exint idx, const UT_Matrix4D &value)
213  { doSetParmValue(idx, value); }
215  { doSetParmValue(idx, value); }
217  { doSetParmValue(idx, value); }
219  { doSetParmValue(idx, value); }
220 
221  virtual exint getNumParms() const
222  {
223  return 1;
224  }
225 
226  virtual const char *getParmName(exint fieldnum) const
227  {
228  switch (fieldnum)
229  {
230  case 0:
231  return "numerror";
232 
233  }
234  return 0;
235  }
236 
237  virtual ParmType getParmType(exint fieldnum) const
238  {
239  switch (fieldnum)
240  {
241 
242  }
243  return PARM_UNSUPPORTED;
244  }
245 
246  // Boiler plate to load individual types.
247  static void loadData(UT_IStream &is, int64 &v)
248  { is.bread(&v, 1); }
249  static void loadData(UT_IStream &is, bool &v)
250  { int64 iv; is.bread(&iv, 1); v = iv; }
251  static void loadData(UT_IStream &is, fpreal64 &v)
252  { is.bread<fpreal64>(&v, 1); }
253  static void loadData(UT_IStream &is, UT_Vector2D &v)
254  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
255  static void loadData(UT_IStream &is, UT_Vector3D &v)
256  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
257  is.bread<fpreal64>(&v.z(), 1); }
258  static void loadData(UT_IStream &is, UT_Vector4D &v)
259  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
260  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
261  static void loadData(UT_IStream &is, UT_Matrix2D &v)
262  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
263  static void loadData(UT_IStream &is, UT_Matrix3D &v)
264  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
265  static void loadData(UT_IStream &is, UT_Matrix4D &v)
266  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
267  static void loadData(UT_IStream &is, UT_Vector2I &v)
268  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
269  static void loadData(UT_IStream &is, UT_Vector3I &v)
270  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
271  is.bread<int64>(&v.z(), 1); }
272  static void loadData(UT_IStream &is, UT_Vector4I &v)
273  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
274  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
276  { is.bread(v); }
278  { UT_StringHolder rampdata;
279  loadData(is, rampdata);
280  if (rampdata.isstring())
281  {
282  v.reset(new UT_Ramp());
283  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
284  v->load(istr);
285  }
286  else v.reset();
287  }
290  loadData(is, data);
291  if (data.isstring())
292  {
293  // Find the data type.
294  char *colon = UT_StringWrap(data).findChar(':');
295  if (colon)
296  {
297  int typelen = colon - data.buffer();
299  type.strncpy(data.buffer(), typelen);
300  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
301 
302  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
303  }
304  }
305  else v.reset();
306  }
307 
308  static void saveData(std::ostream &os, int64 v)
309  { UTwrite(os, &v); }
310  static void saveData(std::ostream &os, bool v)
311  { int64 iv = v; UTwrite(os, &iv); }
312  static void saveData(std::ostream &os, fpreal64 v)
313  { UTwrite<fpreal64>(os, &v); }
314  static void saveData(std::ostream &os, UT_Vector2D v)
315  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
316  static void saveData(std::ostream &os, UT_Vector3D v)
317  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
318  UTwrite<fpreal64>(os, &v.z()); }
319  static void saveData(std::ostream &os, UT_Vector4D v)
320  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
321  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
322  static void saveData(std::ostream &os, UT_Matrix2D v)
324  static void saveData(std::ostream &os, UT_Matrix3D v)
326  static void saveData(std::ostream &os, UT_Matrix4D v)
328  static void saveData(std::ostream &os, UT_StringHolder s)
329  { UT_StringWrap(s).saveBinary(os); }
330  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
331  { UT_StringHolder result;
332  UT_OStringStream ostr;
333  if (s) s->save(ostr);
334  result = ostr.str();
335  saveData(os, result);
336  }
337  static void saveData(std::ostream &os, PRM_DataItemHandle s)
338  { UT_StringHolder result;
339  UT_OStringStream ostr;
340  if (s)
341  {
342  ostr << s->getDataTypeToken();
343  ostr << ":";
344  s->saveBinary(ostr);
345  }
346  result = ostr.str();
347  saveData(os, result);
348  }
349 
350 
351  void save(std::ostream &os) const
352  {
353  int32 v = version();
354  UTwrite(os, &v);
355  {
356  int64 length = myNumerror.entries();
357  UTwrite(os, &length);
358  for (exint i = 0; i < length; i++)
359  {
360  saveData(os, myNumerror(i).errormsg);
361  saveData(os, myNumerror(i).severity);
362  saveData(os, myNumerror(i).enable);
363 
364  }
365  }
366 
367  }
368 
369  bool load(UT_IStream &is)
370  {
371  int32 v;
372  is.bread(&v, 1);
373  if (version() != v)
374  {
375  // Fail incompatible versions
376  return false;
377  }
378  {
379  int64 length;
380  is.read(&length, 1);
381  myNumerror.entries(length);
382  for (exint i = 0; i < length; i++)
383  {
384  loadData(is, myNumerror(i).errormsg);
385  loadData(is, myNumerror(i).severity);
386  loadData(is, myNumerror(i).enable);
387 
388  }
389  }
390 
391  return true;
392  }
393 
394  const UT_Array<Numerror> &getNumerror() const { return myNumerror; }
395  void setNumerror(const UT_Array<Numerror> &val) { myNumerror = val; }
396  exint opNumerror(const SOP_NodeVerb::CookParms &cookparms) const
397  {
398  SOP_Node *thissop = cookparms.getNode();
399  if (!thissop) return getNumerror().entries();
400  exint result;
401  OP_Utils::evalOpParm(result, thissop, "numerror", cookparms.getCookTime(), 0);
402  return result;
403  }
405  {
406  SOP_Node *thissop = cookparms.getNode();
407  if (!thissop) return (myNumerror(_idx).errormsg);
408  int _parmidx = _idx + 1;
409  UT_StringHolder result;
410  OP_Utils::evalOpParmInst(result, thissop, "errormsg#", &_parmidx, cookparms.getCookTime(), 0);
411  return (result);
412  }
414  {
415  SOP_Node *thissop = cookparms.getNode();
416  if (!thissop) return (myNumerror(_idx).severity);
417  int _parmidx = _idx + 1;
418  int64 result;
419  OP_Utils::evalOpParmInst(result, thissop, "severity#", &_parmidx, cookparms.getCookTime(), 0);
420  return (result);
421  }
422  int64 opNumerror_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
423  {
424  SOP_Node *thissop = cookparms.getNode();
425  if (!thissop) return (myNumerror(_idx).enable);
426  int _parmidx = _idx + 1;
427  int64 result;
428  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
429  return (result);
430  }
431 
432 
433 private:
434  UT_Array<Numerror> myNumerror;
435 
436 };
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:494
static void saveData(std::ostream &os, UT_Matrix2D v)
T & z(void)
Definition: UT_Vector4.h:379
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)
GT_API const UT_StringHolder time
bool operator==(const SOP_ErrorNodeParms &src) const
fpreal getTime() const
Definition: OP_Context.h:60
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
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:285
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:498
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:502
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void getParmValue(exint idx, UT_Matrix2D &value) const
long long int64
Definition: SYS_Types.h:107
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
static void saveData(std::ostream &os, UT_Vector2D v)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
int64 exint
Definition: SYS_Types.h:116
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:192
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:284
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:35
T & y(void)
Definition: UT_Vector4.h:377
SYS_FORCE_INLINE void strcat(const char *src)
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)
GT_API const UT_StringHolder version
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:453
bool operator!=(const Numerror &src) const
void setParmValue(exint idx, const PRM_DataItemHandle &value)
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:500
void doGetParmValue(exint idx, T &value) const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:270
int64 opNumerror_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
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)
SYS_FORCE_INLINE void append(char character)
GLuint GLfloat * val
Definition: glcorearb.h:1607
bool operator!=(const SOP_ErrorNodeParms &src) const
#define SOP_API
Definition: SOP_API.h:10
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:501
T & x(void)
Definition: UT_Vector4.h:375
T & y(void)
Definition: UT_Vector2.h:287
bool load(UT_IStream &is)
static void saveData(std::ostream &os, UT_Matrix3D v)
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:381
static void loadData(UT_IStream &is, UT_Matrix3D &v)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:88
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_Vector3I &v)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
GLenum src
Definition: glcorearb.h:1792