HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_MLExtractExampleCore.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_API.h>
7 #include <SOP/SOP_NodeVerb.h>
8 #include <SOP/SOP_GraphProxy.h>
9 
10 #include <OP/OP_Utils.h>
11 #include <PRM/PRM_Parm.h>
12 #include <UT/UT_IStream.h>
13 #include <UT/UT_NTStreamUtil.h>
14 #include <UT/UT_Ramp.h>
15 #include <UT/UT_SharedPtr.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringStream.h>
18 #include <UT/UT_VectorTypes.h>
19 #include <UT/UT_EnvControl.h>
20 #include <SYS/SYS_Types.h>
21 
22 class DEP_MicroNode;
23 
25 {
26 public:
27  static int version() { return 1; }
28 
30  {
31  myIndex = 0;
32  myKeepPacked = true;
33 
34  }
35 
39  SOP_MLExtractExampleCoreParms &operator=(SOP_MLExtractExampleCoreParms &&) noexcept = default;
40 
42 
44  {
45  if (myIndex != src.myIndex) return false;
46  if (myKeepPacked != src.myKeepPacked) return false;
47 
48  return true;
49  }
51  {
52  return !operator==(src);
53  }
54 
55 
56 
57  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
58  {
59  myIndex = 0;
60  if (true)
61  graph->evalOpParm(myIndex, nodeidx, "index", time, 0);
62  myKeepPacked = true;
63  if (true)
64  graph->evalOpParm(myKeepPacked, nodeidx, "keeppacked", time, 0);
65 
66  }
67 
68 
69  void loadFromOpSubclass(const LoadParms &loadparms) override
70  {
71  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
72  }
73 
74 
75  void copyFrom(const OP_NodeParms *src) override
76  {
77  *this = *((const SOP_MLExtractExampleCoreParms *)src);
78  }
79 
80  template <typename T>
81  void
82  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
83  {
84  if (idx.size() < 1)
85  return;
86  UT_ASSERT(idx.size() == instance.size()+1);
87  if (idx.size() != instance.size()+1)
88  return;
89  switch (idx[0])
90  {
91  case 0:
92  coerceValue(value, myIndex);
93  break;
94  case 1:
95  coerceValue(value, myKeepPacked);
96  break;
97 
98  }
99  }
100 
101  bool isParmColorRamp(exint idx) const override
102  {
103  switch (idx)
104  {
105 
106  }
107  return false;
108  }
109 
110  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
111  { doGetParmValue(idx, instance, value); }
112  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
113  { doGetParmValue(idx, instance, value); }
114  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
115  { doGetParmValue(idx, instance, value); }
116  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
117  { doGetParmValue(idx, instance, value); }
118  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
119  { doGetParmValue(idx, instance, value); }
120  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
121  { doGetParmValue(idx, instance, value); }
122  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
123  { doGetParmValue(idx, instance, value); }
124  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
125  { doGetParmValue(idx, instance, value); }
126  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
127  { doGetParmValue(idx, instance, value); }
128  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
129  { doGetParmValue(idx, instance, value); }
130  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
131  { doGetParmValue(idx, instance, value); }
132 
133  template <typename T>
134  void
135  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
136  {
137  if (idx.size() < 1)
138  return;
139  UT_ASSERT(idx.size() == instance.size()+1);
140  if (idx.size() != instance.size()+1)
141  return;
142  switch (idx[0])
143  {
144  case 0:
145  coerceValue(myIndex, ( ( value ) ));
146  break;
147  case 1:
148  coerceValue(myKeepPacked, ( ( value ) ));
149  break;
150 
151  }
152  }
153 
154  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
155  { doSetParmValue(idx, instance, value); }
156  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
157  { doSetParmValue(idx, instance, value); }
158  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
159  { doSetParmValue(idx, instance, value); }
160  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
161  { doSetParmValue(idx, instance, value); }
162  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
163  { doSetParmValue(idx, instance, value); }
164  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
165  { doSetParmValue(idx, instance, value); }
166  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
167  { doSetParmValue(idx, instance, value); }
168  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
169  { doSetParmValue(idx, instance, value); }
170  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
171  { doSetParmValue(idx, instance, value); }
172  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
173  { doSetParmValue(idx, instance, value); }
174  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
175  { doSetParmValue(idx, instance, value); }
176 
177  exint getNestNumParms(TempIndex idx) const override
178  {
179  if (idx.size() == 0)
180  return 2;
181  switch (idx[0])
182  {
183 
184  }
185  // Invalid
186  return 0;
187  }
188 
189  const char *getNestParmName(TempIndex fieldnum) const override
190  {
191  if (fieldnum.size() < 1)
192  return 0;
193  switch (fieldnum[0])
194  {
195  case 0:
196  return "index";
197  case 1:
198  return "keeppacked";
199 
200  }
201  return 0;
202  }
203 
204  ParmType getNestParmType(TempIndex fieldnum) const override
205  {
206  if (fieldnum.size() < 1)
207  return PARM_UNSUPPORTED;
208  switch (fieldnum[0])
209  {
210  case 0:
211  return PARM_INTEGER;
212  case 1:
213  return PARM_INTEGER;
214 
215  }
216  return PARM_UNSUPPORTED;
217  }
218 
219  // Boiler plate to load individual types.
220  static void loadData(UT_IStream &is, int64 &v)
221  { is.bread(&v, 1); }
222  static void loadData(UT_IStream &is, bool &v)
223  { int64 iv; is.bread(&iv, 1); v = iv; }
224  static void loadData(UT_IStream &is, fpreal64 &v)
225  { is.bread<fpreal64>(&v, 1); }
226  static void loadData(UT_IStream &is, UT_Vector2D &v)
227  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
228  static void loadData(UT_IStream &is, UT_Vector3D &v)
229  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
230  is.bread<fpreal64>(&v.z(), 1); }
231  static void loadData(UT_IStream &is, UT_Vector4D &v)
232  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
233  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
234  static void loadData(UT_IStream &is, UT_Matrix2D &v)
235  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
236  static void loadData(UT_IStream &is, UT_Matrix3D &v)
237  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
238  static void loadData(UT_IStream &is, UT_Matrix4D &v)
239  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
240  static void loadData(UT_IStream &is, UT_Vector2I &v)
241  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
242  static void loadData(UT_IStream &is, UT_Vector3I &v)
243  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
244  is.bread<int64>(&v.z(), 1); }
245  static void loadData(UT_IStream &is, UT_Vector4I &v)
246  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
247  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
249  { is.bread(v); }
251  { UT_StringHolder rampdata;
252  loadData(is, rampdata);
253  if (rampdata.isstring())
254  {
255  v.reset(new UT_Ramp());
256  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
257  v->load(istr);
258  }
259  else v.reset();
260  }
263  loadData(is, data);
264  if (data.isstring())
265  {
266  // Find the data type.
267  const char *colon = UT_StringWrap(data).findChar(':');
268  if (colon)
269  {
270  int typelen = colon - data.buffer();
272  type.strncpy(data.buffer(), typelen);
273  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
274 
275  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
276  }
277  }
278  else v.reset();
279  }
280 
281  static void saveData(std::ostream &os, int64 v)
282  { UTwrite(os, &v); }
283  static void saveData(std::ostream &os, bool v)
284  { int64 iv = v; UTwrite(os, &iv); }
285  static void saveData(std::ostream &os, fpreal64 v)
286  { UTwrite<fpreal64>(os, &v); }
287  static void saveData(std::ostream &os, UT_Vector2D v)
288  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
289  static void saveData(std::ostream &os, UT_Vector3D v)
290  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
291  UTwrite<fpreal64>(os, &v.z()); }
292  static void saveData(std::ostream &os, UT_Vector4D v)
293  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
294  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
295  static void saveData(std::ostream &os, UT_Matrix2D v)
297  static void saveData(std::ostream &os, UT_Matrix3D v)
299  static void saveData(std::ostream &os, UT_Matrix4D v)
301  static void saveData(std::ostream &os, UT_StringHolder s)
302  { UT_StringWrap(s).saveBinary(os); }
303  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
305  UT_OStringStream ostr;
306  if (s) s->save(ostr);
307  result = ostr.str();
308  saveData(os, result);
309  }
310  static void saveData(std::ostream &os, PRM_DataItemHandle s)
312  UT_OStringStream ostr;
313  if (s)
314  {
315  ostr << s->getDataTypeToken();
316  ostr << ":";
317  s->saveBinary(ostr);
318  }
319  result = ostr.str();
320  saveData(os, result);
321  }
322 
323 
324  void save(std::ostream &os) const
325  {
326  int32 v = version();
327  UTwrite(os, &v);
328  saveData(os, myIndex);
329  saveData(os, myKeepPacked);
330 
331  }
332 
333  bool load(UT_IStream &is)
334  {
335  int32 v;
336  is.bread(&v, 1);
337  if (version() != v)
338  {
339  // Fail incompatible versions
340  return false;
341  }
342  loadData(is, myIndex);
343  loadData(is, myKeepPacked);
344 
345  return true;
346  }
347 
348  int64 getIndex() const { return myIndex; }
349  void setIndex(int64 val) { myIndex = val; }
350  int64 opIndex(const SOP_NodeVerb::CookParms &cookparms) const
351  {
352  SOP_Node *thissop = cookparms.getNode();
353  if (!thissop) return getIndex();
354  int64 result;
355  OP_Utils::evalOpParm(result, thissop, "index", cookparms.getCookTime(), 0);
356  return result;
357  }
358  bool getKeepPacked() const { return myKeepPacked; }
359  void setKeepPacked(bool val) { myKeepPacked = val; }
360  bool opKeepPacked(const SOP_NodeVerb::CookParms &cookparms) const
361  {
362  SOP_Node *thissop = cookparms.getNode();
363  if (!thissop) return getKeepPacked();
364  bool result;
365  OP_Utils::evalOpParm(result, thissop, "keeppacked", cookparms.getCookTime(), 0);
366  return result;
367  }
368 
369 private:
370  int64 myIndex;
371  bool myKeepPacked;
372 
373 };
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, UT_Vector2D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
ParmType getNestParmType(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
static void loadData(UT_IStream &is, UT_Vector4I &v)
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
fpreal getTime() const
Definition: OP_Context.h:62
static void loadData(UT_IStream &is, UT_Matrix3D &v)
bool operator!=(const SOP_MLExtractExampleCoreParms &src) const
static void saveData(std::ostream &os, int64 v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
const OP_Context & context() const
Definition: OP_NodeParms.h:97
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
GLdouble s
Definition: glad.h:3009
An output stream object that owns its own string buffer storage.
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
**But if you need a result
Definition: thread.h:613
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
exint nodeIdx() const
Definition: OP_NodeParms.h:95
static void loadData(UT_IStream &is, UT_Vector2I &v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
static void saveData(std::ostream &os, UT_Vector3D v)
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
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:36
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, bool &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
long long int64
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, bool v)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void saveData(std::ostream &os, UT_Vector4D v)
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
GT_API const UT_StringHolder version
bool opKeepPacked(const SOP_NodeVerb::CookParms &cookparms) const
bool isParmColorRamp(exint idx) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, int64 &v)
void coerceValue(T &result, const S &src) const
Definition: OP_NodeParms.h:301
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
static void saveData(std::ostream &os, UT_Matrix3D v)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, UT_Matrix2D v)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
exint getNestNumParms(TempIndex idx) const override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void loadData(UT_IStream &is, UT_Vector4D &v)
void loadFromOpSubclass(const LoadParms &loadparms) override
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
void copyFrom(const OP_NodeParms *src) override
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
int64 opIndex(const SOP_NodeVerb::CookParms &cookparms) const
GLboolean r
Definition: glcorearb.h:1222
const char * getNestParmName(TempIndex fieldnum) const override
bool operator==(const SOP_MLExtractExampleCoreParms &src) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
type
Definition: core.h:1059
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
OP_NodeParms & operator=(const OP_NodeParms &)=default
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
GLenum src
Definition: glcorearb.h:1793
static void saveData(std::ostream &os, PRM_DataItemHandle s)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)