HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Rest.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_RestEnums
22 {
23  enum class Nml
24  {
25  OFF = 0,
26  POLY,
27  ON
28  };
29  enum class Quadric
30  {
31  OFF = 0,
32  POLY,
33  ON
34  };
35 }
36 
37 
39 {
40 public:
41  static int version() { return 1; }
42 
44  {
45  myFile = ""_sh;
46  myNml = 0;
47  myQuadric = 0;
48 
49  }
50 
51  explicit SOP_RestParms(const SOP_RestParms &) = default;
52 
53  virtual ~SOP_RestParms() {}
54 
55  bool operator==(const SOP_RestParms &src) const
56  {
57  if (myFile != src.myFile) return false;
58  if (myNml != src.myNml) return false;
59  if (myQuadric != src.myQuadric) return false;
60 
61  return true;
62  }
63  bool operator!=(const SOP_RestParms &src) const
64  {
65  return !operator==(src);
66  }
69 
70 
71 
72  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
73  {
74  if (true && ( (!((((node->getInput(1)!=0)==1)))) ) )
75  OP_Utils::evalOpParm(myFile, node, "file", time, 0);
76  else myFile = ""_sh;
77  if (true)
78  OP_Utils::evalOpParm(myNml, node, "nml", time, 0);
79  else myNml = 0;
80  if (true)
81  OP_Utils::evalOpParm(myQuadric, node, "quadric", time, 0);
82  else myQuadric = 0;
83 
84  }
85 
86 
87  virtual void loadFromOpSubclass(const LoadParms &loadparms)
88  {
89  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
90  }
91 
92 
93  virtual void copyFrom(const SOP_NodeParms *src)
94  {
95  *this = *((const SOP_RestParms *)src);
96  }
97 
98  template <typename T>
99  void
100  doGetParmValue(exint idx, T &value) const
101  {
102  switch (idx)
103  {
104  case 0:
105  coerceValue(value, myFile);
106  break;
107  case 1:
108  coerceValue(value, myNml);
109  break;
110  case 2:
111  coerceValue(value, myQuadric);
112  break;
113 
114  }
115  }
116 
117  void getParmValue(exint idx, exint &value) const
118  { doGetParmValue(idx, value); }
119  void getParmValue(exint idx, fpreal &value) const
120  { doGetParmValue(idx, value); }
122  { doGetParmValue(idx, value); }
124  { doGetParmValue(idx, value); }
126  { doGetParmValue(idx, value); }
128  { doGetParmValue(idx, value); }
130  { doGetParmValue(idx, value); }
132  { doGetParmValue(idx, value); }
134  { doGetParmValue(idx, value); }
136  { doGetParmValue(idx, value); }
138  { doGetParmValue(idx, value); }
139 
140  template <typename T>
141  void
142  doSetParmValue(exint idx, const T &value)
143  {
144  switch (idx)
145  {
146  case 0:
147  coerceValue(myFile, value);
148  break;
149  case 1:
150  coerceValue(myNml, value);
151  break;
152  case 2:
153  coerceValue(myQuadric, value);
154  break;
155 
156  }
157  }
158 
159  void setParmValue(exint idx, const exint &value)
160  { doSetParmValue(idx, value); }
161  void setParmValue(exint idx, const fpreal &value)
162  { doSetParmValue(idx, value); }
163  void setParmValue(exint idx, const UT_Vector2D &value)
164  { doSetParmValue(idx, value); }
165  void setParmValue(exint idx, const UT_Vector3D &value)
166  { doSetParmValue(idx, value); }
167  void setParmValue(exint idx, const UT_Vector4D &value)
168  { doSetParmValue(idx, value); }
169  void setParmValue(exint idx, const UT_Matrix2D &value)
170  { doSetParmValue(idx, value); }
171  void setParmValue(exint idx, const UT_Matrix3D &value)
172  { doSetParmValue(idx, value); }
173  void setParmValue(exint idx, const UT_Matrix4D &value)
174  { doSetParmValue(idx, value); }
176  { doSetParmValue(idx, value); }
178  { doSetParmValue(idx, value); }
180  { doSetParmValue(idx, value); }
181 
182  virtual exint getNumParms() const
183  {
184  return 3;
185  }
186 
187  virtual const char *getParmName(exint fieldnum) const
188  {
189  switch (fieldnum)
190  {
191  case 0:
192  return "file";
193  case 1:
194  return "nml";
195  case 2:
196  return "quadric";
197 
198  }
199  return 0;
200  }
201 
202  virtual ParmType getParmType(exint fieldnum) const
203  {
204  switch (fieldnum)
205  {
206  case 0:
207  return PARM_STRING;
208  case 1:
209  return PARM_INTEGER;
210  case 2:
211  return PARM_INTEGER;
212 
213  }
214  return PARM_UNSUPPORTED;
215  }
216 
217  // Boiler plate to load individual types.
218  static void loadData(UT_IStream &is, int64 &v)
219  { is.bread(&v, 1); }
220  static void loadData(UT_IStream &is, bool &v)
221  { int64 iv; is.bread(&iv, 1); v = iv; }
222  static void loadData(UT_IStream &is, fpreal64 &v)
223  { is.bread<fpreal64>(&v, 1); }
224  static void loadData(UT_IStream &is, UT_Vector2D &v)
225  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
226  static void loadData(UT_IStream &is, UT_Vector3D &v)
227  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
228  is.bread<fpreal64>(&v.z(), 1); }
229  static void loadData(UT_IStream &is, UT_Vector4D &v)
230  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
231  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
232  static void loadData(UT_IStream &is, UT_Matrix2D &v)
233  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
234  static void loadData(UT_IStream &is, UT_Matrix3D &v)
235  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
236  static void loadData(UT_IStream &is, UT_Matrix4D &v)
237  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
238  static void loadData(UT_IStream &is, UT_Vector2I &v)
239  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
240  static void loadData(UT_IStream &is, UT_Vector3I &v)
241  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
242  is.bread<int64>(&v.z(), 1); }
243  static void loadData(UT_IStream &is, UT_Vector4I &v)
244  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
245  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
247  { is.bread(v); }
249  { UT_StringHolder rampdata;
250  loadData(is, rampdata);
251  if (rampdata.isstring())
252  {
253  v.reset(new UT_Ramp());
254  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
255  v->load(istr);
256  }
257  else v.reset();
258  }
261  loadData(is, data);
262  if (data.isstring())
263  {
264  // Find the data type.
265  char *colon = UT_StringWrap(data).findChar(':');
266  if (colon)
267  {
268  int typelen = colon - data.buffer();
270  type.strncpy(data.buffer(), typelen);
271  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
272 
273  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
274  }
275  }
276  else v.reset();
277  }
278 
279  static void saveData(std::ostream &os, int64 v)
280  { UTwrite(os, &v); }
281  static void saveData(std::ostream &os, bool v)
282  { int64 iv = v; UTwrite(os, &iv); }
283  static void saveData(std::ostream &os, fpreal64 v)
284  { UTwrite<fpreal64>(os, &v); }
285  static void saveData(std::ostream &os, UT_Vector2D v)
286  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
287  static void saveData(std::ostream &os, UT_Vector3D v)
288  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
289  UTwrite<fpreal64>(os, &v.z()); }
290  static void saveData(std::ostream &os, UT_Vector4D v)
291  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
292  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
293  static void saveData(std::ostream &os, UT_Matrix2D v)
295  static void saveData(std::ostream &os, UT_Matrix3D v)
297  static void saveData(std::ostream &os, UT_Matrix4D v)
299  static void saveData(std::ostream &os, UT_StringHolder s)
300  { UT_StringWrap(s).saveBinary(os); }
301  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
302  { UT_StringHolder result;
303  UT_OStringStream ostr;
304  if (s) s->save(ostr);
305  result = ostr.str();
306  saveData(os, result);
307  }
308  static void saveData(std::ostream &os, PRM_DataItemHandle s)
309  { UT_StringHolder result;
310  UT_OStringStream ostr;
311  if (s)
312  {
313  ostr << s->getDataTypeToken();
314  ostr << ":";
315  s->saveBinary(ostr);
316  }
317  result = ostr.str();
318  saveData(os, result);
319  }
320 
321 
322  void save(std::ostream &os) const
323  {
324  int32 v = version();
325  UTwrite(os, &v);
326  saveData(os, myFile);
327  saveData(os, myNml);
328  saveData(os, myQuadric);
329 
330  }
331 
332  bool load(UT_IStream &is)
333  {
334  int32 v;
335  is.bread(&v, 1);
336  if (version() != v)
337  {
338  // Fail incompatible versions
339  return false;
340  }
341  loadData(is, myFile);
342  loadData(is, myNml);
343  loadData(is, myQuadric);
344 
345  return true;
346  }
347 
348  const UT_StringHolder & getFile() const { return myFile; }
349  void setFile(const UT_StringHolder & val) { myFile = val; }
351  {
352  SOP_Node *thissop = cookparms.getNode();
353  if (!thissop) return getFile();
354  UT_StringHolder result;
355  OP_Utils::evalOpParm(result, thissop, "file", cookparms.getCookTime(), 0);
356  return result;
357  }
358  Nml getNml() const { return Nml(myNml); }
359  void setNml(Nml val) { myNml = int64(val); }
360  Nml opNml(const SOP_NodeVerb::CookParms &cookparms) const
361  {
362  SOP_Node *thissop = cookparms.getNode();
363  if (!thissop) return getNml();
364  int64 result;
365  OP_Utils::evalOpParm(result, thissop, "nml", cookparms.getCookTime(), 0);
366  return Nml(result);
367  }
368  Quadric getQuadric() const { return Quadric(myQuadric); }
369  void setQuadric(Quadric val) { myQuadric = int64(val); }
370  Quadric opQuadric(const SOP_NodeVerb::CookParms &cookparms) const
371  {
372  SOP_Node *thissop = cookparms.getNode();
373  if (!thissop) return getQuadric();
374  int64 result;
375  OP_Utils::evalOpParm(result, thissop, "quadric", cookparms.getCookTime(), 0);
376  return Quadric(result);
377  }
378 
379 private:
380  UT_StringHolder myFile;
381  int64 myNml;
382  int64 myQuadric;
383 
384 };
static void loadData(UT_IStream &is, UT_Matrix3D &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
Quadric getQuadric() const
void setParmValue(exint idx, const fpreal &value)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:494
T & z(void)
Definition: UT_Vector4.h:379
Nml getNml() const
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
const GLdouble * v
Definition: glcorearb.h:836
void setParmValue(exint idx, const UT_Matrix2D &value)
void setParmValue(exint idx, const UT_Vector2D &value)
static void saveData(std::ostream &os, UT_Matrix3D v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
void getParmValue(exint idx, fpreal &value) const
static void loadData(UT_IStream &is, UT_StringHolder &v)
SYS_FORCE_INLINE const char * buffer() const
T & x(void)
Definition: UT_Vector2.h:285
void setNml(Nml val)
void doSetParmValue(exint idx, const T &value)
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:498
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, fpreal64 &v)
Quadric opQuadric(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, bool &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getParmValue(exint idx, PRM_DataItemHandle &value) const
void setParmValue(exint idx, const UT_Matrix3D &value)
const UT_StringHolder & getFile() const
bool load(UT_IStream &is)
static void saveData(std::ostream &os, UT_Matrix2D v)
static void saveData(std::ostream &os, UT_StringHolder s)
virtual exint getNumParms() const
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
long long int64
Definition: SYS_Types.h:107
virtual const char * getParmName(exint fieldnum) const
virtual void copyFrom(const SOP_NodeParms *src)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool operator==(const SOP_RestParms &src) const
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
void doGetParmValue(exint idx, T &value) const
int64 exint
Definition: SYS_Types.h:116
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setParmValue(exint idx, const UT_Vector4D &value)
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:192
UT_StringHolder opFile(const SOP_NodeVerb::CookParms &cookparms) const
OP_Node * getInput(unsigned idx, bool mark_used=false) const
Returns the node connected to a particular input (may be null).
static void saveData(std::ostream &os, PRM_DataItemHandle s)
virtual ~SOP_RestParms()
Nml opNml(const SOP_NodeVerb::CookParms &cookparms) const
void setParmValue(exint idx, const exint &value)
GLboolean * data
Definition: glcorearb.h:130
void getParmValue(exint idx, UT_Vector4D &value) const
int int32
Definition: SYS_Types.h:35
T & y(void)
Definition: UT_Vector4.h:377
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
void setParmValue(exint idx, const UT_Vector3D &value)
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 setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void getParmValue(exint idx, UT_Matrix4D &value) const
static void loadData(UT_IStream &is, int64 &v)
bool operator!=(const SOP_RestParms &src) const
static void saveData(std::ostream &os, UT_Matrix4D v)
void setParmValue(exint idx, const UT_StringHolder &value)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void getParmValue(exint idx, UT_Matrix3D &value) const
static void saveData(std::ostream &os, UT_Vector4D v)
virtual void loadFromOpSubclass(const LoadParms &loadparms)
GLuint GLfloat * val
Definition: glcorearb.h:1607
void getParmValue(exint idx, UT_StringHolder &value) const
void setParmValue(exint idx, const UT_Matrix4D &value)
static void saveData(std::ostream &os, UT_Vector3D v)
#define SOP_API
Definition: SOP_API.h:10
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:501
void setParmValue(exint idx, const PRM_DataItemHandle &value)
T & x(void)
Definition: UT_Vector4.h:375
void setFile(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector2D &v)
void getParmValue(exint idx, exint &value) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, fpreal64 v)
T & y(void)
Definition: UT_Vector2.h:287
virtual ParmType getParmType(exint fieldnum) const
void getParmValue(exint idx, UT_Matrix2D &value) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
GLboolean r
Definition: glcorearb.h:1221
void setQuadric(Quadric val)
static int version()
T & w(void)
Definition: UT_Vector4.h:381
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void save(std::ostream &os) const
void getParmValue(exint idx, UT_Vector2D &value) const
static void saveData(std::ostream &os, bool v)
static void saveData(std::ostream &os, UT_Vector2D v)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:88
void getParmValue(exint idx, UT_Vector3D &value) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1792
static void loadData(UT_IStream &is, UT_Vector2I &v)