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