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