HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_MLExampleSerializePacked.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 namespace SOP_MLExampleSerializePackedEnums
24 {
25  enum class InputType
26  {
27  POINT = 0,
28  VOLUME
29  };
30 
32  getToken(InputType enum_value)
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case InputType::POINT: return "point"_sh;
37  case InputType::VOLUME: return "volume"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42  enum class TargetType
43  {
44  POINT = 0,
45  VOLUME
46  };
47 
49  getToken(TargetType enum_value)
50  {
51  using namespace UT::Literal;
52  switch (enum_value) {
53  case TargetType::POINT: return "point"_sh;
54  case TargetType::VOLUME: return "volume"_sh;
55  default: UT_ASSERT(false); return ""_sh;
56  }
57  }
58 
59 }
60 
61 
63 {
64 public:
65  static int version() { return 1; }
66  struct Inputs
67  {
71 
72 
74  {
75  inputtype = 0;
76  inputpointattribute = "value"_UTsh;
77  inputvolumename = "density"_UTsh;
78 
79  }
80 
81  bool operator==(const Inputs &src) const
82  {
83  if (inputtype != src.inputtype) return false;
84  if (inputpointattribute != src.inputpointattribute) return false;
85  if (inputvolumename != src.inputvolumename) return false;
86 
87  return true;
88  }
89  bool operator!=(const Inputs &src) const
90  {
91  return !operator==(src);
92  }
93 
94  };
95 
97  {
99 
100  buf.strcat("[ ");
101  for (int i = 0; i < list.entries(); i++)
102  {
103  if (i)
104  buf.strcat(", ");
105  buf.strcat("( ");
106  buf.append("");
107  buf.appendSprintf("%d", (int) list(i).inputtype);
108  buf.append(", ");
109  { UT_String tmp; tmp = UT_StringWrap(list(i).inputpointattribute).makeQuotedString('"'); buf.strcat(tmp); }
110  buf.append(", ");
111  { UT_String tmp; tmp = UT_StringWrap(list(i).inputvolumename).makeQuotedString('"'); buf.strcat(tmp); }
112 
113  buf.strcat(" )");
114  }
115  buf.strcat(" ]");
116 
118  return result;
119  }
120  struct Targets
121  {
125 
126 
128  {
129  targettype = 0;
130  targetpointattribute = "value"_UTsh;
131  targetvolumename = "density"_UTsh;
132 
133  }
134 
135  bool operator==(const Targets &src) const
136  {
137  if (targettype != src.targettype) return false;
138  if (targetpointattribute != src.targetpointattribute) return false;
139  if (targetvolumename != src.targetvolumename) return false;
140 
141  return true;
142  }
143  bool operator!=(const Targets &src) const
144  {
145  return !operator==(src);
146  }
147 
148  };
149 
151  {
153 
154  buf.strcat("[ ");
155  for (int i = 0; i < list.entries(); i++)
156  {
157  if (i)
158  buf.strcat(", ");
159  buf.strcat("( ");
160  buf.append("");
161  buf.appendSprintf("%d", (int) list(i).targettype);
162  buf.append(", ");
163  { UT_String tmp; tmp = UT_StringWrap(list(i).targetpointattribute).makeQuotedString('"'); buf.strcat(tmp); }
164  buf.append(", ");
165  { UT_String tmp; tmp = UT_StringWrap(list(i).targetvolumename).makeQuotedString('"'); buf.strcat(tmp); }
166 
167  buf.strcat(" )");
168  }
169  buf.strcat(" ]");
170 
172  return result;
173  }
174 
176  {
177  myInputDimensionAttribute = "inputdimension"_UTsh;
178  myTargetDimensionAttribute = "targetdimension"_UTsh;
179  mySerialAttribute = "value"_UTsh;
180  myInputs.setSize(1);
181  myTargets.setSize(1);
182 
183  }
184 
189 
191 
193  {
194  if (myInputDimensionAttribute != src.myInputDimensionAttribute) return false;
195  if (myTargetDimensionAttribute != src.myTargetDimensionAttribute) return false;
196  if (mySerialAttribute != src.mySerialAttribute) return false;
197  if (myInputs != src.myInputs) return false;
198  if (myTargets != src.myTargets) return false;
199 
200  return true;
201  }
203  {
204  return !operator==(src);
205  }
208 
209 
210 
211  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
212  {
213  myInputDimensionAttribute = "inputdimension"_UTsh;
214  if (true)
215  graph->evalOpParm(myInputDimensionAttribute, nodeidx, "inputdimensionattribute", time, 0);
216  myTargetDimensionAttribute = "targetdimension"_UTsh;
217  if (true)
218  graph->evalOpParm(myTargetDimensionAttribute, nodeidx, "targetdimensionattribute", time, 0);
219  mySerialAttribute = "value"_UTsh;
220  if (true)
221  graph->evalOpParm(mySerialAttribute, nodeidx, "serialattribute", time, 0);
222  if (true)
223  {
224  int64 length = 0;
225  graph->evalOpParm(length, nodeidx, "inputs", time, 0);
226  if (length < 0) length = 0;
227  myInputs.setSize(length);
228  for (exint i = 0; i < length; i++)
229  {
230  int parmidx[1];
231  int offsets[1];
232  parmidx[0] = i+1;
233  offsets[0] = 1;
234  auto && _curentry = myInputs(i);
235  (void) _curentry;
236  _curentry.inputtype = 0;
237  if (true)
238  graph->evalOpParmInst(_curentry.inputtype, nodeidx, "inputtype#", parmidx, offsets, time, 0, 2-1);
239  _curentry.inputpointattribute = "value"_UTsh;
240  if (true && ( (true&&!(((_curentry.inputtype!=0)))) ) )
241  graph->evalOpParmInst(_curentry.inputpointattribute, nodeidx, "inputpointattribute#", parmidx, offsets, time, 0, 2-1);
242  _curentry.inputvolumename = "density"_UTsh;
243  if (true && ( (true&&!(((_curentry.inputtype!=1)))) ) )
244  graph->evalOpParmInst(_curentry.inputvolumename, nodeidx, "inputvolumename#", parmidx, offsets, time, 0, 2-1);
245 
246  }
247  }
248  else
249  myInputs.clear();
250  if (true)
251  {
252  int64 length = 0;
253  graph->evalOpParm(length, nodeidx, "targets", time, 0);
254  if (length < 0) length = 0;
255  myTargets.setSize(length);
256  for (exint i = 0; i < length; i++)
257  {
258  int parmidx[1];
259  int offsets[1];
260  parmidx[0] = i+1;
261  offsets[0] = 1;
262  auto && _curentry = myTargets(i);
263  (void) _curentry;
264  _curentry.targettype = 0;
265  if (true)
266  graph->evalOpParmInst(_curentry.targettype, nodeidx, "targettype#", parmidx, offsets, time, 0, 2-1);
267  _curentry.targetpointattribute = "value"_UTsh;
268  if (true && ( (true&&!(((_curentry.targettype!=0)))) ) )
269  graph->evalOpParmInst(_curentry.targetpointattribute, nodeidx, "targetpointattribute#", parmidx, offsets, time, 0, 2-1);
270  _curentry.targetvolumename = "density"_UTsh;
271  if (true && ( (true&&!(((_curentry.targettype!=1)))) ) )
272  graph->evalOpParmInst(_curentry.targetvolumename, nodeidx, "targetvolumename#", parmidx, offsets, time, 0, 2-1);
273 
274  }
275  }
276  else
277  myTargets.clear();
278 
279  }
280 
281 
282  void loadFromOpSubclass(const LoadParms &loadparms) override
283  {
284  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
285  }
286 
287 
288  void copyFrom(const OP_NodeParms *src) override
289  {
290  *this = *((const SOP_MLExampleSerializePackedParms *)src);
291  }
292 
293  template <typename T>
294  void
295  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
296  {
297  if (idx.size() < 1)
298  return;
299  UT_ASSERT(idx.size() == instance.size()+1);
300  if (idx.size() != instance.size()+1)
301  return;
302  switch (idx[0])
303  {
304  case 0:
305  coerceValue(value, myInputDimensionAttribute);
306  break;
307  case 1:
308  coerceValue(value, myTargetDimensionAttribute);
309  break;
310  case 2:
311  coerceValue(value, mySerialAttribute);
312  break;
313  case 3:
314  if (idx.size() == 1)
315  coerceValue(value, myInputs.entries());
316  else if (instance[0] < myInputs.entries())
317  {
318  auto && _data = myInputs(instance[0]);
319  switch (idx[1])
320  {
321  case 0:
322  coerceValue(value, _data.inputtype);
323  break;
324  case 1:
325  coerceValue(value, _data.inputpointattribute);
326  break;
327  case 2:
328  coerceValue(value, _data.inputvolumename);
329  break;
330 
331  }
332  }
333  break;
334  case 4:
335  if (idx.size() == 1)
336  coerceValue(value, myTargets.entries());
337  else if (instance[0] < myTargets.entries())
338  {
339  auto && _data = myTargets(instance[0]);
340  switch (idx[1])
341  {
342  case 0:
343  coerceValue(value, _data.targettype);
344  break;
345  case 1:
346  coerceValue(value, _data.targetpointattribute);
347  break;
348  case 2:
349  coerceValue(value, _data.targetvolumename);
350  break;
351 
352  }
353  }
354  break;
355 
356  }
357  }
358 
359  bool isParmColorRamp(exint idx) const override
360  {
361  switch (idx)
362  {
363 
364  }
365  return false;
366  }
367 
368  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
369  { doGetParmValue(idx, instance, value); }
370  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
371  { doGetParmValue(idx, instance, value); }
372  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
373  { doGetParmValue(idx, instance, value); }
374  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
375  { doGetParmValue(idx, instance, value); }
376  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
377  { doGetParmValue(idx, instance, value); }
378  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
379  { doGetParmValue(idx, instance, value); }
380  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
381  { doGetParmValue(idx, instance, value); }
382  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
383  { doGetParmValue(idx, instance, value); }
384  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
385  { doGetParmValue(idx, instance, value); }
386  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
387  { doGetParmValue(idx, instance, value); }
388  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
389  { doGetParmValue(idx, instance, value); }
390 
391  template <typename T>
392  void
393  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
394  {
395  if (idx.size() < 1)
396  return;
397  UT_ASSERT(idx.size() == instance.size()+1);
398  if (idx.size() != instance.size()+1)
399  return;
400  switch (idx[0])
401  {
402  case 0:
403  coerceValue(myInputDimensionAttribute, ( ( value ) ));
404  break;
405  case 1:
406  coerceValue(myTargetDimensionAttribute, ( ( value ) ));
407  break;
408  case 2:
409  coerceValue(mySerialAttribute, ( ( value ) ));
410  break;
411  case 3:
412  if (idx.size() == 1)
413  {
414  exint newsize;
415  coerceValue(newsize, value);
416  if (newsize < 0) newsize = 0;
417  myInputs.setSize(newsize);
418  }
419  else
420  {
421  if (instance[0] < 0)
422  return;
423  myInputs.setSizeIfNeeded(instance[0]+1);
424  auto && _data = myInputs(instance[0]);
425  switch (idx[1])
426  {
427  case 0:
428  coerceValue(_data.inputtype, value);
429  break;
430  case 1:
431  coerceValue(_data.inputpointattribute, value);
432  break;
433  case 2:
434  coerceValue(_data.inputvolumename, value);
435  break;
436 
437  }
438  }
439  break;
440  case 4:
441  if (idx.size() == 1)
442  {
443  exint newsize;
444  coerceValue(newsize, value);
445  if (newsize < 0) newsize = 0;
446  myTargets.setSize(newsize);
447  }
448  else
449  {
450  if (instance[0] < 0)
451  return;
452  myTargets.setSizeIfNeeded(instance[0]+1);
453  auto && _data = myTargets(instance[0]);
454  switch (idx[1])
455  {
456  case 0:
457  coerceValue(_data.targettype, value);
458  break;
459  case 1:
460  coerceValue(_data.targetpointattribute, value);
461  break;
462  case 2:
463  coerceValue(_data.targetvolumename, value);
464  break;
465 
466  }
467  }
468  break;
469 
470  }
471  }
472 
473  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
474  { doSetParmValue(idx, instance, value); }
475  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
476  { doSetParmValue(idx, instance, value); }
477  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
478  { doSetParmValue(idx, instance, value); }
479  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
480  { doSetParmValue(idx, instance, value); }
481  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
482  { doSetParmValue(idx, instance, value); }
483  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
484  { doSetParmValue(idx, instance, value); }
485  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
486  { doSetParmValue(idx, instance, value); }
487  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
488  { doSetParmValue(idx, instance, value); }
489  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
490  { doSetParmValue(idx, instance, value); }
491  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
492  { doSetParmValue(idx, instance, value); }
493  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
494  { doSetParmValue(idx, instance, value); }
495 
496  exint getNestNumParms(TempIndex idx) const override
497  {
498  if (idx.size() == 0)
499  return 5;
500  switch (idx[0])
501  {
502  case 3:
503  return 3;
504  case 4:
505  return 3;
506 
507  }
508  // Invalid
509  return 0;
510  }
511 
512  const char *getNestParmName(TempIndex fieldnum) const override
513  {
514  if (fieldnum.size() < 1)
515  return 0;
516  switch (fieldnum[0])
517  {
518  case 0:
519  return "inputdimensionattribute";
520  case 1:
521  return "targetdimensionattribute";
522  case 2:
523  return "serialattribute";
524  case 3:
525  if (fieldnum.size() == 1)
526  return "inputs";
527  switch (fieldnum[1])
528  {
529  case 0:
530  return "inputtype#";
531  case 1:
532  return "inputpointattribute#";
533  case 2:
534  return "inputvolumename#";
535 
536  }
537  return 0;
538  case 4:
539  if (fieldnum.size() == 1)
540  return "targets";
541  switch (fieldnum[1])
542  {
543  case 0:
544  return "targettype#";
545  case 1:
546  return "targetpointattribute#";
547  case 2:
548  return "targetvolumename#";
549 
550  }
551  return 0;
552 
553  }
554  return 0;
555  }
556 
557  ParmType getNestParmType(TempIndex fieldnum) const override
558  {
559  if (fieldnum.size() < 1)
560  return PARM_UNSUPPORTED;
561  switch (fieldnum[0])
562  {
563  case 0:
564  return PARM_STRING;
565  case 1:
566  return PARM_STRING;
567  case 2:
568  return PARM_STRING;
569  case 3:
570  if (fieldnum.size() == 1)
571  return PARM_MULTIPARM;
572  switch (fieldnum[1])
573  {
574  case 0:
575  return PARM_INTEGER;
576  case 1:
577  return PARM_STRING;
578  case 2:
579  return PARM_STRING;
580 
581  }
582  return PARM_UNSUPPORTED;
583  case 4:
584  if (fieldnum.size() == 1)
585  return PARM_MULTIPARM;
586  switch (fieldnum[1])
587  {
588  case 0:
589  return PARM_INTEGER;
590  case 1:
591  return PARM_STRING;
592  case 2:
593  return PARM_STRING;
594 
595  }
596  return PARM_UNSUPPORTED;
597 
598  }
599  return PARM_UNSUPPORTED;
600  }
601 
602  // Boiler plate to load individual types.
603  static void loadData(UT_IStream &is, int64 &v)
604  { is.bread(&v, 1); }
605  static void loadData(UT_IStream &is, bool &v)
606  { int64 iv; is.bread(&iv, 1); v = iv; }
607  static void loadData(UT_IStream &is, fpreal64 &v)
608  { is.bread<fpreal64>(&v, 1); }
609  static void loadData(UT_IStream &is, UT_Vector2D &v)
610  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
611  static void loadData(UT_IStream &is, UT_Vector3D &v)
612  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
613  is.bread<fpreal64>(&v.z(), 1); }
614  static void loadData(UT_IStream &is, UT_Vector4D &v)
615  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
616  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
617  static void loadData(UT_IStream &is, UT_Matrix2D &v)
618  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
619  static void loadData(UT_IStream &is, UT_Matrix3D &v)
620  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
621  static void loadData(UT_IStream &is, UT_Matrix4D &v)
622  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
623  static void loadData(UT_IStream &is, UT_Vector2I &v)
624  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
625  static void loadData(UT_IStream &is, UT_Vector3I &v)
626  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
627  is.bread<int64>(&v.z(), 1); }
628  static void loadData(UT_IStream &is, UT_Vector4I &v)
629  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
630  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
632  { is.bread(v); }
634  { UT_StringHolder rampdata;
635  loadData(is, rampdata);
636  if (rampdata.isstring())
637  {
638  v.reset(new UT_Ramp());
639  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
640  v->load(istr);
641  }
642  else v.reset();
643  }
646  loadData(is, data);
647  if (data.isstring())
648  {
649  // Find the data type.
650  const char *colon = UT_StringWrap(data).findChar(':');
651  if (colon)
652  {
653  int typelen = colon - data.buffer();
655  type.strncpy(data.buffer(), typelen);
656  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
657 
658  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
659  }
660  }
661  else v.reset();
662  }
663 
664  static void saveData(std::ostream &os, int64 v)
665  { UTwrite(os, &v); }
666  static void saveData(std::ostream &os, bool v)
667  { int64 iv = v; UTwrite(os, &iv); }
668  static void saveData(std::ostream &os, fpreal64 v)
669  { UTwrite<fpreal64>(os, &v); }
670  static void saveData(std::ostream &os, UT_Vector2D v)
671  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
672  static void saveData(std::ostream &os, UT_Vector3D v)
673  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
674  UTwrite<fpreal64>(os, &v.z()); }
675  static void saveData(std::ostream &os, UT_Vector4D v)
676  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
677  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
678  static void saveData(std::ostream &os, UT_Matrix2D v)
680  static void saveData(std::ostream &os, UT_Matrix3D v)
682  static void saveData(std::ostream &os, UT_Matrix4D v)
684  static void saveData(std::ostream &os, UT_StringHolder s)
685  { UT_StringWrap(s).saveBinary(os); }
686  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
688  UT_OStringStream ostr;
689  if (s) s->save(ostr);
690  result = ostr.str();
691  saveData(os, result);
692  }
693  static void saveData(std::ostream &os, PRM_DataItemHandle s)
695  UT_OStringStream ostr;
696  if (s)
697  {
698  ostr << s->getDataTypeToken();
699  ostr << ":";
700  s->saveBinary(ostr);
701  }
702  result = ostr.str();
703  saveData(os, result);
704  }
705 
706 
707  void save(std::ostream &os) const
708  {
709  int32 v = version();
710  UTwrite(os, &v);
711  saveData(os, myInputDimensionAttribute);
712  saveData(os, myTargetDimensionAttribute);
713  saveData(os, mySerialAttribute);
714  {
715  int64 length = myInputs.entries();
716  UTwrite(os, &length);
717  for (exint i = 0; i < length; i++)
718  {
719  auto && _curentry = myInputs(i);
720  (void) _curentry;
721  saveData(os, _curentry.inputtype);
722  saveData(os, _curentry.inputpointattribute);
723  saveData(os, _curentry.inputvolumename);
724 
725  }
726  }
727  {
728  int64 length = myTargets.entries();
729  UTwrite(os, &length);
730  for (exint i = 0; i < length; i++)
731  {
732  auto && _curentry = myTargets(i);
733  (void) _curentry;
734  saveData(os, _curentry.targettype);
735  saveData(os, _curentry.targetpointattribute);
736  saveData(os, _curentry.targetvolumename);
737 
738  }
739  }
740 
741  }
742 
743  bool load(UT_IStream &is)
744  {
745  int32 v;
746  is.bread(&v, 1);
747  if (version() != v)
748  {
749  // Fail incompatible versions
750  return false;
751  }
752  loadData(is, myInputDimensionAttribute);
753  loadData(is, myTargetDimensionAttribute);
754  loadData(is, mySerialAttribute);
755  {
756  int64 length;
757  is.read(&length, 1);
758  myInputs.setSize(length);
759  for (exint i = 0; i < length; i++)
760  {
761  auto && _curentry = myInputs(i);
762  (void) _curentry;
763  loadData(is, _curentry.inputtype);
764  loadData(is, _curentry.inputpointattribute);
765  loadData(is, _curentry.inputvolumename);
766 
767  }
768  }
769  {
770  int64 length;
771  is.read(&length, 1);
772  myTargets.setSize(length);
773  for (exint i = 0; i < length; i++)
774  {
775  auto && _curentry = myTargets(i);
776  (void) _curentry;
777  loadData(is, _curentry.targettype);
778  loadData(is, _curentry.targetpointattribute);
779  loadData(is, _curentry.targetvolumename);
780 
781  }
782  }
783 
784  return true;
785  }
786 
787  const UT_StringHolder & getInputDimensionAttribute() const { return myInputDimensionAttribute; }
788  void setInputDimensionAttribute(const UT_StringHolder & val) { myInputDimensionAttribute = val; }
790  {
791  SOP_Node *thissop = cookparms.getNode();
792  if (!thissop) return getInputDimensionAttribute();
794  OP_Utils::evalOpParm(result, thissop, "inputdimensionattribute", cookparms.getCookTime(), 0);
795  return result;
796  }
797  const UT_StringHolder & getTargetDimensionAttribute() const { return myTargetDimensionAttribute; }
798  void setTargetDimensionAttribute(const UT_StringHolder & val) { myTargetDimensionAttribute = val; }
800  {
801  SOP_Node *thissop = cookparms.getNode();
802  if (!thissop) return getTargetDimensionAttribute();
804  OP_Utils::evalOpParm(result, thissop, "targetdimensionattribute", cookparms.getCookTime(), 0);
805  return result;
806  }
807  const UT_StringHolder & getSerialAttribute() const { return mySerialAttribute; }
808  void setSerialAttribute(const UT_StringHolder & val) { mySerialAttribute = val; }
810  {
811  SOP_Node *thissop = cookparms.getNode();
812  if (!thissop) return getSerialAttribute();
814  OP_Utils::evalOpParm(result, thissop, "serialattribute", cookparms.getCookTime(), 0);
815  return result;
816  }
817  const UT_Array<Inputs> &getInputs() const { return myInputs; }
818 void setInputs(const UT_Array<Inputs> &val) { myInputs = val; }
819  exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
820  {
821  SOP_Node *thissop = cookparms.getNode();
822  if (!thissop) return getInputs().entries();
823  exint result;
824  OP_Utils::evalOpParm(result, thissop, "inputs", cookparms.getCookTime(), 0);
825  return result;
826  }
827  int64 opInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
828  { return opinstInputs_inputtype(cookparms, &_idx); }
829  int64 opinstInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
830  {
831  SOP_Node *thissop = cookparms.getNode();
832  if (!thissop) return (myInputs(_idx[0]).inputtype);
833  int _parmidx[2-1];
834  _parmidx[1-1] = _idx[1-1] + 1;
835 
836  int64 result;
837  OP_Utils::evalOpParmInst(result, thissop, "inputtype#", _parmidx, cookparms.getCookTime(), 0, 2-1);
838  return (result);
839  }
841  { return opinstInputs_inputpointattribute(cookparms, &_idx); }
843  {
844  SOP_Node *thissop = cookparms.getNode();
845  if (!thissop) return (myInputs(_idx[0]).inputpointattribute);
846  int _parmidx[2-1];
847  _parmidx[1-1] = _idx[1-1] + 1;
848 
850  OP_Utils::evalOpParmInst(result, thissop, "inputpointattribute#", _parmidx, cookparms.getCookTime(), 0, 2-1);
851  return (result);
852  }
854  { return opinstInputs_inputvolumename(cookparms, &_idx); }
856  {
857  SOP_Node *thissop = cookparms.getNode();
858  if (!thissop) return (myInputs(_idx[0]).inputvolumename);
859  int _parmidx[2-1];
860  _parmidx[1-1] = _idx[1-1] + 1;
861 
863  OP_Utils::evalOpParmInst(result, thissop, "inputvolumename#", _parmidx, cookparms.getCookTime(), 0, 2-1);
864  return (result);
865  }
866 
867  const UT_Array<Targets> &getTargets() const { return myTargets; }
868 void setTargets(const UT_Array<Targets> &val) { myTargets = val; }
869  exint opTargets(const SOP_NodeVerb::CookParms &cookparms) const
870  {
871  SOP_Node *thissop = cookparms.getNode();
872  if (!thissop) return getTargets().entries();
873  exint result;
874  OP_Utils::evalOpParm(result, thissop, "targets", cookparms.getCookTime(), 0);
875  return result;
876  }
877  int64 opTargets_targettype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
878  { return opinstTargets_targettype(cookparms, &_idx); }
879  int64 opinstTargets_targettype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
880  {
881  SOP_Node *thissop = cookparms.getNode();
882  if (!thissop) return (myTargets(_idx[0]).targettype);
883  int _parmidx[2-1];
884  _parmidx[1-1] = _idx[1-1] + 1;
885 
886  int64 result;
887  OP_Utils::evalOpParmInst(result, thissop, "targettype#", _parmidx, cookparms.getCookTime(), 0, 2-1);
888  return (result);
889  }
891  { return opinstTargets_targetpointattribute(cookparms, &_idx); }
893  {
894  SOP_Node *thissop = cookparms.getNode();
895  if (!thissop) return (myTargets(_idx[0]).targetpointattribute);
896  int _parmidx[2-1];
897  _parmidx[1-1] = _idx[1-1] + 1;
898 
900  OP_Utils::evalOpParmInst(result, thissop, "targetpointattribute#", _parmidx, cookparms.getCookTime(), 0, 2-1);
901  return (result);
902  }
904  { return opinstTargets_targetvolumename(cookparms, &_idx); }
906  {
907  SOP_Node *thissop = cookparms.getNode();
908  if (!thissop) return (myTargets(_idx[0]).targetvolumename);
909  int _parmidx[2-1];
910  _parmidx[1-1] = _idx[1-1] + 1;
911 
913  OP_Utils::evalOpParmInst(result, thissop, "targetvolumename#", _parmidx, cookparms.getCookTime(), 0, 2-1);
914  return (result);
915  }
916 
917 
918 private:
919  UT_StringHolder myInputDimensionAttribute;
920  UT_StringHolder myTargetDimensionAttribute;
921  UT_StringHolder mySerialAttribute;
922  UT_Array<Inputs> myInputs;
923  UT_Array<Targets> myTargets;
924 
925 };
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
void loadFromOpSubclass(const LoadParms &loadparms) override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
UT_StringHolder opinstTargets_targetpointattribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void saveData(std::ostream &os, UT_StringHolder s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
static void loadData(UT_IStream &is, int64 &v)
static void loadData(UT_IStream &is, fpreal64 &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void
Definition: png.h:1083
UT_StringHolder opSerialAttribute(const SOP_NodeVerb::CookParms &cookparms) const
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector4.h:493
const GLdouble * v
Definition: glcorearb.h:837
void setTargetDimensionAttribute(const UT_StringHolder &val)
fpreal getTime() const
Definition: OP_Context.h:62
UT_StringHolder opInputDimensionAttribute(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setSerialAttribute(const UT_StringHolder &val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
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
GLdouble s
Definition: glad.h:3009
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
static void saveData(std::ostream &os, PRM_DataItemHandle s)
An output stream object that owns its own string buffer storage.
void copyFrom(const OP_NodeParms *src) override
**But if you need a result
Definition: thread.h:613
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void saveData(std::ostream &os, bool v)
exint nodeIdx() const
Definition: OP_NodeParms.h:95
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_Matrix4D &value) const override
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void saveData(std::ostream &os, UT_Matrix2D v)
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
UT_StringHolder opInputs_inputvolumename(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
const UT_StringHolder & getTargetDimensionAttribute() const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void loadData(UT_IStream &is, bool &v)
UT_StringHolder opinstInputs_inputvolumename(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
bool operator!=(const SOP_MLExampleSerializePackedParms &src) const
void setInputs(const UT_Array< Inputs > &val)
ParmType getNestParmType(TempIndex fieldnum) const override
SYS_FORCE_INLINE UT_StringHolder getToken(InputType enum_value)
exint length() const
UT_StringHolder opTargets_targetvolumename(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
int64 opinstTargets_targettype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
UT_StringHolder opinstInputs_inputpointattribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
exint opTargets(const SOP_NodeVerb::CookParms &cookparms) const
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
UT_StringHolder opInputs_inputpointattribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
UT_StringHolder opTargets_targetpointattribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
const UT_StringHolder & getInputDimensionAttribute() const
static void saveData(std::ostream &os, int64 v)
static void saveData(std::ostream &os, UT_Vector3D v)
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, const int *inst, const int *offsets, fpreal time, DEP_MicroNode *depnode, int nestlevel=1) const =0
long long int64
Definition: SYS_Types.h:116
UT_StringHolder createString(const UT_Array< Inputs > &list) const
const char * getNestParmName(TempIndex fieldnum) const override
static void saveData(std::ostream &os, fpreal64 v)
const UT_Array< Inputs > & getInputs() const
static void saveData(std::ostream &os, UT_Matrix3D v)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void setInputDimensionAttribute(const UT_StringHolder &val)
UT_StringHolder createString(const UT_Array< Targets > &list) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
GT_API const UT_StringHolder version
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
bool operator==(const SOP_MLExampleSerializePackedParms &src) const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
int64 opinstInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setTargets(const UT_Array< Targets > &val)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
static void loadData(UT_IStream &is, UT_Matrix4D &v)
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
const UT_Array< Targets > & getTargets() const
static void saveData(std::ostream &os, UT_Vector2D v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
static void saveData(std::ostream &os, UT_Vector4D v)
int64 opTargets_targettype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
int64 opInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
const char * findChar(int c) const
Definition: UT_String.h:1395
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
GLboolean r
Definition: glcorearb.h:1222
UT_StringHolder opTargetDimensionAttribute(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
type
Definition: core.h:1059
UT_StringHolder opinstTargets_targetvolumename(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
static void loadData(UT_IStream &is, UT_Vector4D &v)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
exint getNestNumParms(TempIndex idx) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
const UT_StringHolder & getSerialAttribute() const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663