HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_SwitchParms.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 <SOP/SOP_GraphProxy.h>
8 
9 #include <OP/OP_Utils.h>
10 #include <PRM/PRM_Parm.h>
11 #include <UT/UT_IStream.h>
12 #include <UT/UT_NTStreamUtil.h>
13 #include <UT/UT_Ramp.h>
14 #include <UT/UT_SharedPtr.h>
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_StringStream.h>
17 #include <UT/UT_VectorTypes.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 
25 {
26 public:
27  static int version() { return 1; }
28 
30  {
31  myInput = 0;
32 
33  }
34 
35  explicit SOP_SwitchParms(const SOP_SwitchParms &) = default;
36 
37  ~SOP_SwitchParms() override {}
38 
39  bool operator==(const SOP_SwitchParms &src) const
40  {
41  if (myInput != src.myInput) return false;
42 
43  return true;
44  }
45  bool operator!=(const SOP_SwitchParms &src) const
46  {
47  return !operator==(src);
48  }
49 
50 
51 
52  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
53  {
54  myInput = 0;
55  if (true)
56  graph->evalOpParm(myInput, nodeidx, "input", time, 0);
57 
58  }
59 
60 
61  void loadFromOpSubclass(const LoadParms &loadparms) override
62  {
63  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
64  }
65 
66 
67  void copyFrom(const SOP_NodeParms *src) override
68  {
69  *this = *((const SOP_SwitchParms *)src);
70  }
71 
72  template <typename T>
73  void
74  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
75  {
76  if (idx.size() < 1)
77  return;
78  UT_ASSERT(idx.size() == instance.size()+1);
79  if (idx.size() != instance.size()+1)
80  return;
81  switch (idx[0])
82  {
83  case 0:
84  coerceValue(value, myInput);
85  break;
86 
87  }
88  }
89 
90  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
91  { doGetParmValue(idx, instance, value); }
92  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
93  { doGetParmValue(idx, instance, value); }
94  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
95  { doGetParmValue(idx, instance, value); }
96  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
97  { doGetParmValue(idx, instance, value); }
98  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
99  { doGetParmValue(idx, instance, value); }
100  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
101  { doGetParmValue(idx, instance, value); }
102  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
103  { doGetParmValue(idx, instance, value); }
104  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
105  { doGetParmValue(idx, instance, value); }
106  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
107  { doGetParmValue(idx, instance, value); }
108  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
109  { doGetParmValue(idx, instance, value); }
110  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
111  { doGetParmValue(idx, instance, value); }
112 
113  template <typename T>
114  void
115  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
116  {
117  if (idx.size() < 1)
118  return;
119  UT_ASSERT(idx.size() == instance.size()+1);
120  if (idx.size() != instance.size()+1)
121  return;
122  switch (idx[0])
123  {
124  case 0:
125  coerceValue(myInput, value);
126  break;
127 
128  }
129  }
130 
131  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
132  { doSetParmValue(idx, instance, value); }
133  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
134  { doSetParmValue(idx, instance, value); }
135  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
136  { doSetParmValue(idx, instance, value); }
137  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
138  { doSetParmValue(idx, instance, value); }
139  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
140  { doSetParmValue(idx, instance, value); }
141  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
142  { doSetParmValue(idx, instance, value); }
143  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
144  { doSetParmValue(idx, instance, value); }
145  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
146  { doSetParmValue(idx, instance, value); }
147  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
148  { doSetParmValue(idx, instance, value); }
149  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
150  { doSetParmValue(idx, instance, value); }
151  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
152  { doSetParmValue(idx, instance, value); }
153 
154  exint getNestNumParms(TempIndex idx) const override
155  {
156  if (idx.size() == 0)
157  return 1;
158  switch (idx[0])
159  {
160 
161  }
162  // Invalid
163  return 0;
164  }
165 
166  const char *getNestParmName(TempIndex fieldnum) const override
167  {
168  if (fieldnum.size() < 1)
169  return 0;
170  switch (fieldnum[0])
171  {
172  case 0:
173  return "input";
174 
175  }
176  return 0;
177  }
178 
179  ParmType getNestParmType(TempIndex fieldnum) const override
180  {
181  if (fieldnum.size() < 1)
182  return PARM_UNSUPPORTED;
183  switch (fieldnum[0])
184  {
185  case 0:
186  return PARM_INTEGER;
187 
188  }
189  return PARM_UNSUPPORTED;
190  }
191 
192  // Boiler plate to load individual types.
193  static void loadData(UT_IStream &is, int64 &v)
194  { is.bread(&v, 1); }
195  static void loadData(UT_IStream &is, bool &v)
196  { int64 iv; is.bread(&iv, 1); v = iv; }
197  static void loadData(UT_IStream &is, fpreal64 &v)
198  { is.bread<fpreal64>(&v, 1); }
199  static void loadData(UT_IStream &is, UT_Vector2D &v)
200  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
201  static void loadData(UT_IStream &is, UT_Vector3D &v)
202  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
203  is.bread<fpreal64>(&v.z(), 1); }
204  static void loadData(UT_IStream &is, UT_Vector4D &v)
205  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
206  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
207  static void loadData(UT_IStream &is, UT_Matrix2D &v)
208  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
209  static void loadData(UT_IStream &is, UT_Matrix3D &v)
210  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
211  static void loadData(UT_IStream &is, UT_Matrix4D &v)
212  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
213  static void loadData(UT_IStream &is, UT_Vector2I &v)
214  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
215  static void loadData(UT_IStream &is, UT_Vector3I &v)
216  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
217  is.bread<int64>(&v.z(), 1); }
218  static void loadData(UT_IStream &is, UT_Vector4I &v)
219  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
220  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
222  { is.bread(v); }
224  { UT_StringHolder rampdata;
225  loadData(is, rampdata);
226  if (rampdata.isstring())
227  {
228  v.reset(new UT_Ramp());
229  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
230  v->load(istr);
231  }
232  else v.reset();
233  }
236  loadData(is, data);
237  if (data.isstring())
238  {
239  // Find the data type.
240  const char *colon = UT_StringWrap(data).findChar(':');
241  if (colon)
242  {
243  int typelen = colon - data.buffer();
245  type.strncpy(data.buffer(), typelen);
246  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
247 
248  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
249  }
250  }
251  else v.reset();
252  }
253 
254  static void saveData(std::ostream &os, int64 v)
255  { UTwrite(os, &v); }
256  static void saveData(std::ostream &os, bool v)
257  { int64 iv = v; UTwrite(os, &iv); }
258  static void saveData(std::ostream &os, fpreal64 v)
259  { UTwrite<fpreal64>(os, &v); }
260  static void saveData(std::ostream &os, UT_Vector2D v)
261  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
262  static void saveData(std::ostream &os, UT_Vector3D v)
263  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
264  UTwrite<fpreal64>(os, &v.z()); }
265  static void saveData(std::ostream &os, UT_Vector4D v)
266  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
267  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
268  static void saveData(std::ostream &os, UT_Matrix2D v)
270  static void saveData(std::ostream &os, UT_Matrix3D v)
272  static void saveData(std::ostream &os, UT_Matrix4D v)
274  static void saveData(std::ostream &os, UT_StringHolder s)
275  { UT_StringWrap(s).saveBinary(os); }
276  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
278  UT_OStringStream ostr;
279  if (s) s->save(ostr);
280  result = ostr.str();
281  saveData(os, result);
282  }
283  static void saveData(std::ostream &os, PRM_DataItemHandle s)
285  UT_OStringStream ostr;
286  if (s)
287  {
288  ostr << s->getDataTypeToken();
289  ostr << ":";
290  s->saveBinary(ostr);
291  }
292  result = ostr.str();
293  saveData(os, result);
294  }
295 
296 
297  void save(std::ostream &os) const
298  {
299  int32 v = version();
300  UTwrite(os, &v);
301  saveData(os, myInput);
302 
303  }
304 
305  bool load(UT_IStream &is)
306  {
307  int32 v;
308  is.bread(&v, 1);
309  if (version() != v)
310  {
311  // Fail incompatible versions
312  return false;
313  }
314  loadData(is, myInput);
315 
316  return true;
317  }
318 
319  int64 getInput() const { return myInput; }
320  void setInput(int64 val) { myInput = val; }
321  int64 opInput(const SOP_NodeVerb::CookParms &cookparms) const
322  {
323  SOP_Node *thissop = cookparms.getNode();
324  if (!thissop) return getInput();
325  int64 result;
326  OP_Utils::evalOpParm(result, thissop, "input", cookparms.getCookTime(), 0);
327  return result;
328  }
329 
330 private:
331  int64 myInput;
332 
333 };
GLdouble s
Definition: glew.h:1390
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
short * getInput(int size) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, bool &v)
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
static void saveData(std::ostream &os, UT_Matrix4D v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, UT_Matrix3D v)
static void saveData(std::ostream &os, UT_Vector3D v)
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
GLuint const GLfloat * val
Definition: glew.h:2794
static void saveData(std::ostream &os, fpreal64 v)
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
ParmType getNestParmType(TempIndex fieldnum) const override
An output stream object that owns its own string buffer storage.
const GLdouble * v
Definition: glew.h:1391
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void saveData(std::ostream &os, UT_Matrix2D v)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
double fpreal64
Definition: SYS_Types.h:201
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void copyFrom(const SOP_NodeParms *src) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, int64 &v)
exint length() 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 getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
void save(std::ostream &os) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
bool load(UT_IStream &is)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
const GLfloat * c
Definition: glew.h:16296
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void saveData(std::ostream &os, bool v)
long long int64
Definition: SYS_Types.h:116
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, fpreal64 &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:121
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void saveData(std::ostream &os, UT_Vector2D v)
int64 getInput() const
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Vector4D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
fpreal64 fpreal
Definition: SYS_Types.h:277
exint getNestNumParms(TempIndex idx) const override
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
static void saveData(std::ostream &os, UT_Vector4D v)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
#define SOP_API
Definition: SOP_API.h:10
static void saveData(std::ostream &os, PRM_DataItemHandle s)
bool operator!=(const SOP_SwitchParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
const char * getNestParmName(TempIndex fieldnum) const override
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:654
GLuint64EXT * result
Definition: glew.h:14007
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
const char * findChar(int c) const
Definition: UT_String.h:1367
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setInput(int64 val)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void loadFromOpSubclass(const LoadParms &loadparms) override
GLsizei const GLfloat * value
Definition: glew.h:1849
const OP_Context & context() const
Definition: SOP_NodeVerb.h:119
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
bool operator==(const SOP_SwitchParms &src) const
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528
int64 opInput(const SOP_NodeVerb::CookParms &cookparms) const