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