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