HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_Invoke.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_InvokeEnums
22 {
23  enum class Unload
24  {
25  NEVER = 0,
26  FLAG,
27  ALWAYS
28  };
29 }
30 
31 
33 {
34 public:
35  static int version() { return 1; }
36  struct Inputs
37  {
40 
41 
43  {
44  name = ""_sh;
45  inputpath = ""_sh;
46 
47  }
48 
49  bool operator==(const Inputs &src) const
50  {
51  if (name != src.name) return false;
52  if (inputpath != src.inputpath) return false;
53 
54  return true;
55  }
56 
57  };
58 
60  {
62 
63  buf.strcat("[ ");
64  for (int i = 0; i < list.entries(); i++)
65  {
66  if (i)
67  buf.strcat(", ");
68  buf.strcat("( ");
69  buf.append("");
70  { UT_String tmp; tmp = UT_StringWrap(list(i).name).makeQuotedString('"'); buf.strcat(tmp); }
71  buf.append(", ");
72  { UT_String tmp; tmp = UT_StringWrap(list(i).inputpath).makeQuotedString('"'); buf.strcat(tmp); }
73 
74  buf.strcat(" )");
75  }
76  buf.strcat(" ]");
77 
78  UT_StringHolder result = buf;
79  return result;
80  }
81 
83  {
84  myBlockpath = ""_sh;
85  myUnload = 2;
86 
87  }
88 
89  explicit SOP_InvokeParms(const SOP_InvokeParms &) = default;
90 
91  virtual ~SOP_InvokeParms() {}
92 
93  bool operator==(const SOP_InvokeParms &src) const
94  {
95  if (myBlockpath != src.myBlockpath) return false;
96  if (myInputs != src.myInputs) return false;
97  if (myUnload != src.myUnload) return false;
98 
99  return true;
100  }
102 
103 
104 
105  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
106  {
107  if (true)
108  OP_Utils::evalOpParm(myBlockpath, node, "blockpath", time, 0);
109  else myBlockpath = ""_sh;
110  if (true)
111  {
112  int64 length;
113  OP_Utils::evalOpParm(length, node, "inputs", time, 0);
114  myInputs.entries(length);
115  for (exint i = 0; i < length; i++)
116  {
117  int parmidx = i+0;
118  auto && _curentry = myInputs(i);
119  (void) _curentry;
120  if (true)
121  OP_Utils::evalOpParmInst(myInputs(i).name, node, "name#", &parmidx, time, 0);
122  else myInputs(i).name = ""_sh;
123  if (true)
124  OP_Utils::evalOpParmInst(myInputs(i).inputpath, node, "inputpath#", &parmidx, time, 0);
125  else myInputs(i).inputpath = ""_sh;
126 
127  }
128  }
129  else
130  myInputs.clear();
131  if (true)
132  OP_Utils::evalOpParm(myUnload, node, "unload", time, 0);
133  else myUnload = 2;
134 
135  }
136 
137 
138  virtual void loadFromOpSubclass(const LoadParms &loadparms)
139  {
140  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
141  }
142 
143 
144  virtual void copyFrom(const SOP_NodeParms *src)
145  {
146  *this = *((const SOP_InvokeParms *)src);
147  }
148 
149  template <typename T>
150  void
151  doGetParmValue(exint idx, T &value) const
152  {
153  switch (idx)
154  {
155  case 0:
156  coerceValue(value, myBlockpath);
157  break;
158  case 2:
159  coerceValue(value, myUnload);
160  break;
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  case 0:
195  coerceValue(myBlockpath, value);
196  break;
197  case 2:
198  coerceValue(myUnload, value);
199  break;
200 
201  }
202  }
203 
204  void setParmValue(exint idx, const exint &value)
205  { doSetParmValue(idx, value); }
206  void setParmValue(exint idx, const fpreal &value)
207  { doSetParmValue(idx, value); }
208  void setParmValue(exint idx, const UT_Vector2D &value)
209  { doSetParmValue(idx, value); }
210  void setParmValue(exint idx, const UT_Vector3D &value)
211  { doSetParmValue(idx, value); }
212  void setParmValue(exint idx, const UT_Vector4D &value)
213  { doSetParmValue(idx, value); }
214  void setParmValue(exint idx, const UT_Matrix2D &value)
215  { doSetParmValue(idx, value); }
216  void setParmValue(exint idx, const UT_Matrix3D &value)
217  { doSetParmValue(idx, value); }
218  void setParmValue(exint idx, const UT_Matrix4D &value)
219  { doSetParmValue(idx, value); }
221  { doSetParmValue(idx, value); }
223  { doSetParmValue(idx, value); }
225  { doSetParmValue(idx, value); }
226 
227  virtual exint getNumParms() const
228  {
229  return 3;
230  }
231 
232  virtual const char *getParmName(exint fieldnum) const
233  {
234  switch (fieldnum)
235  {
236  case 0:
237  return "blockpath";
238  case 1:
239  return "inputs";
240  case 2:
241  return "unload";
242 
243  }
244  return 0;
245  }
246 
247  virtual ParmType getParmType(exint fieldnum) const
248  {
249  switch (fieldnum)
250  {
251  case 0:
252  return PARM_STRING;
253  case 2:
254  return PARM_INTEGER;
255 
256  }
257  return PARM_UNSUPPORTED;
258  }
259 
260  // Boiler plate to load individual types.
261  static void loadData(UT_IStream &is, int64 &v)
262  { is.bread(&v, 1); }
263  static void loadData(UT_IStream &is, bool &v)
264  { int64 iv; is.bread(&iv, 1); v = iv; }
265  static void loadData(UT_IStream &is, fpreal64 &v)
266  { is.bread<fpreal64>(&v, 1); }
267  static void loadData(UT_IStream &is, UT_Vector2D &v)
268  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
269  static void loadData(UT_IStream &is, UT_Vector3D &v)
270  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
271  is.bread<fpreal64>(&v.z(), 1); }
272  static void loadData(UT_IStream &is, UT_Vector4D &v)
273  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
274  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
275  static void loadData(UT_IStream &is, UT_Matrix2D &v)
276  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
277  static void loadData(UT_IStream &is, UT_Matrix3D &v)
278  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
279  static void loadData(UT_IStream &is, UT_Matrix4D &v)
280  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
281  static void loadData(UT_IStream &is, UT_Vector2I &v)
282  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
283  static void loadData(UT_IStream &is, UT_Vector3I &v)
284  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
285  is.bread<int64>(&v.z(), 1); }
286  static void loadData(UT_IStream &is, UT_Vector4I &v)
287  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
288  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
290  { is.bread(v); }
292  { UT_StringHolder rampdata;
293  loadData(is, rampdata);
294  if (rampdata.isstring())
295  {
296  v.reset(new UT_Ramp());
297  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
298  v->load(istr);
299  }
300  else v.reset();
301  }
304  loadData(is, data);
305  if (data.isstring())
306  {
307  // Find the data type.
308  char *colon = UT_StringWrap(data).findChar(':');
309  if (colon)
310  {
311  int typelen = colon - data.buffer();
313  type.strncpy(data.buffer(), typelen);
314  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
315 
316  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
317  }
318  }
319  else v.reset();
320  }
321 
322  static void saveData(std::ostream &os, int64 v)
323  { UTwrite(os, &v); }
324  static void saveData(std::ostream &os, bool v)
325  { int64 iv = v; UTwrite(os, &iv); }
326  static void saveData(std::ostream &os, fpreal64 v)
327  { UTwrite<fpreal64>(os, &v); }
328  static void saveData(std::ostream &os, UT_Vector2D v)
329  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
330  static void saveData(std::ostream &os, UT_Vector3D v)
331  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
332  UTwrite<fpreal64>(os, &v.z()); }
333  static void saveData(std::ostream &os, UT_Vector4D v)
334  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
335  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
336  static void saveData(std::ostream &os, UT_Matrix2D v)
338  static void saveData(std::ostream &os, UT_Matrix3D v)
340  static void saveData(std::ostream &os, UT_Matrix4D v)
342  static void saveData(std::ostream &os, UT_StringHolder s)
343  { UT_StringWrap(s).saveBinary(os); }
344  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
345  { UT_StringHolder result;
346  UT_OStringStream ostr;
347  if (s) s->save(ostr);
348  result = ostr.str();
349  saveData(os, result);
350  }
351  static void saveData(std::ostream &os, PRM_DataItemHandle s)
352  { UT_StringHolder result;
353  UT_OStringStream ostr;
354  if (s)
355  {
356  ostr << s->getDataTypeToken();
357  ostr << ":";
358  s->saveBinary(ostr);
359  }
360  result = ostr.str();
361  saveData(os, result);
362  }
363 
364 
365  void save(std::ostream &os) const
366  {
367  int32 v = version();
368  UTwrite(os, &v);
369  saveData(os, myBlockpath);
370  {
371  int64 length = myInputs.entries();
372  UTwrite(os, &length);
373  for (exint i = 0; i < length; i++)
374  {
375  saveData(os, myInputs(i).name);
376  saveData(os, myInputs(i).inputpath);
377 
378  }
379  }
380  saveData(os, myUnload);
381 
382  }
383 
384  bool load(UT_IStream &is)
385  {
386  int32 v;
387  is.bread(&v, 1);
388  if (version() != v)
389  {
390  // Fail incompatible versions
391  return false;
392  }
393  loadData(is, myBlockpath);
394  {
395  int64 length;
396  is.read(&length, 1);
397  myInputs.entries(length);
398  for (exint i = 0; i < length; i++)
399  {
400  loadData(is, myInputs(i).name);
401  loadData(is, myInputs(i).inputpath);
402 
403  }
404  }
405  loadData(is, myUnload);
406 
407  return true;
408  }
409 
410  const UT_StringHolder & getBlockpath() const { return myBlockpath; }
411  void setBlockpath(const UT_StringHolder & val) { myBlockpath = val; }
413  {
414  SOP_Node *thissop = cookparms.getNode();
415  if (!thissop) return getBlockpath();
416  UT_StringHolder result;
417  OP_Utils::evalOpParm(result, thissop, "blockpath", cookparms.getCookTime(), 0);
418  return result;
419  }
420  const UT_Array<Inputs> &getInputs() const { return myInputs; }
421  void setInputs(const UT_Array<Inputs> &val) { myInputs = val; }
422  exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
423  {
424  SOP_Node *thissop = cookparms.getNode();
425  if (!thissop) return getInputs().entries();
426  exint result;
427  OP_Utils::evalOpParm(result, thissop, "inputs", cookparms.getCookTime(), 0);
428  return result;
429  }
431  {
432  SOP_Node *thissop = cookparms.getNode();
433  if (!thissop) return (myInputs(_idx).name);
434  int _parmidx = _idx + 0;
435  UT_StringHolder result;
436  OP_Utils::evalOpParmInst(result, thissop, "name#", &_parmidx, cookparms.getCookTime(), 0);
437  return (result);
438  }
440  {
441  SOP_Node *thissop = cookparms.getNode();
442  if (!thissop) return (myInputs(_idx).inputpath);
443  int _parmidx = _idx + 0;
444  UT_StringHolder result;
445  OP_Utils::evalOpParmInst(result, thissop, "inputpath#", &_parmidx, cookparms.getCookTime(), 0);
446  return (result);
447  }
448 
449  Unload getUnload() const { return Unload(myUnload); }
450  void setUnload(Unload val) { myUnload = int64(val); }
451  Unload opUnload(const SOP_NodeVerb::CookParms &cookparms) const
452  {
453  SOP_Node *thissop = cookparms.getNode();
454  if (!thissop) return getUnload();
455  int64 result;
456  OP_Utils::evalOpParm(result, thissop, "unload", cookparms.getCookTime(), 0);
457  return Unload(result);
458  }
459 
460 private:
461  UT_StringHolder myBlockpath;
462  UT_Array<Inputs> myInputs;
463  int64 myUnload;
464 
465 };
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
UT_StringHolder opInputs_name(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void loadData(UT_IStream &is, int64 &v)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void doGetParmValue(exint idx, T &value) const
void setParmValue(exint idx, const UT_Matrix4D &value)
bool load(UT_IStream &is)
static void loadData(UT_IStream &is, fpreal64 &v)
virtual ParmType getParmType(exint fieldnum) const
void save(std::ostream &os) const
exint bread(int32 *buffer, exint asize=1)
void setUnload(Unload val)
UT_StringHolder inputpath
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
UT_StringHolder createString(const UT_Array< Inputs > &list) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
void getParmValue(exint idx, UT_Matrix3D &value) const
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
T & x(void)
Definition: UT_Vector2.h:284
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
An output stream object that owns its own string buffer storage.
virtual ~SOP_InvokeParms()
void setParmValue(exint idx, const UT_Vector2D &value)
void getParmValue(exint idx, UT_Vector4D &value) const
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
virtual void loadFromOpSubclass(const LoadParms &loadparms)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
void getParmValue(exint idx, fpreal &value) const
static void saveData(std::ostream &os, UT_Vector2D v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
Unload opUnload(const SOP_NodeVerb::CookParms &cookparms) const
png_uint_32 i
Definition: png.h:2877
virtual exint getNumParms() const
void setParmValue(exint idx, const UT_Vector3D &value)
void setInputs(const UT_Array< Inputs > &val)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
static void loadData(UT_IStream &is, UT_Vector4D &v)
UT_StringHolder opInputs_inputpath(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
long long int64
Definition: SYS_Types.h:100
static void saveData(std::ostream &os, int64 v)
static void saveData(std::ostream &os, UT_Vector4D v)
static void saveData(std::ostream &os, bool v)
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)
SYS_FORCE_INLINE const char * buffer() const
int64 exint
Definition: SYS_Types.h:109
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:185
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:280
static void saveData(std::ostream &os, UT_Matrix4D v)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void doSetParmValue(exint idx, const T &value)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setParmValue(exint idx, const UT_Matrix3D &value)
UT_StringHolder opBlockpath(const SOP_NodeVerb::CookParms &cookparms) const
const UT_Array< Inputs > & getInputs() const
void getParmValue(exint idx, UT_Matrix4D &value) const
void getParmValue(exint idx, UT_StringHolder &value) const
static void saveData(std::ostream &os, UT_Vector3D v)
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
void getParmValue(exint idx, PRM_DataItemHandle &value) const
int int32
Definition: SYS_Types.h:28
T & y(void)
Definition: UT_Vector4.h:370
const UT_StringHolder & getBlockpath() const
void getParmValue(exint idx, exint &value) const
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, UT_Vector4I &v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
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 fpreal &value)
void setBlockpath(const UT_StringHolder &val)
static void saveData(std::ostream &os, fpreal64 v)
void getParmValue(exint idx, UT_Matrix2D &value) 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)
static int version()
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool operator==(const Inputs &src) const
bool operator==(const SOP_InvokeParms &src) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void saveData(std::ostream &os, UT_StringHolder s)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLfloat * val
Definition: glcorearb.h:1607
virtual void copyFrom(const SOP_NodeParms *src)
void getParmValue(exint idx, UT_Vector2D &value) const
#define SOP_API
Definition: SOP_API.h:10
static void loadData(UT_IStream &is, bool &v)
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
void setParmValue(exint idx, const exint &value)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
T & x(void)
Definition: UT_Vector4.h:368
void setParmValue(exint idx, const UT_Vector4D &value)
virtual const char * getParmName(exint fieldnum) const
T & y(void)
Definition: UT_Vector2.h:286
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
GLboolean r
Definition: glcorearb.h:1221
void getParmValue(exint idx, UT_Vector3D &value) const
void setParmValue(exint idx, const UT_StringHolder &value)
void strcat(const char *src)
T & w(void)
Definition: UT_Vector4.h:374
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setParmValue(exint idx, const UT_Matrix2D &value)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
static void saveData(std::ostream &os, UT_Matrix2D v)
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
GLenum src
Definition: glcorearb.h:1792
Unload getUnload() const