HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_MLRegressionInferenceCore.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_MLRegressionInferenceCoreEnums
24 {
25  enum class Batch
26  {
27  SINGLE = 0,
29  };
30 
32  getToken(Batch enum_value)
33  {
34  using namespace UT::Literal;
35  switch (enum_value) {
36  case Batch::SINGLE: return "single"_sh;
37  case Batch::MULTIPLEPACKED: return "multiplepacked"_sh;
38  default: UT_ASSERT(false); return ""_sh;
39  }
40  }
41 
42  enum class InputType
43  {
44  POINT = 0,
45  VOLUME
46  };
47 
49  getToken(InputType enum_value)
50  {
51  using namespace UT::Literal;
52  switch (enum_value) {
53  case InputType::POINT: return "point"_sh;
54  case InputType::VOLUME: return "volume"_sh;
55  default: UT_ASSERT(false); return ""_sh;
56  }
57  }
58 
59  enum class OutputType
60  {
61  POINT = 0,
62  VOLUME
63  };
64 
66  getToken(OutputType enum_value)
67  {
68  using namespace UT::Literal;
69  switch (enum_value) {
70  case OutputType::POINT: return "point"_sh;
71  case OutputType::VOLUME: return "volume"_sh;
72  default: UT_ASSERT(false); return ""_sh;
73  }
74  }
75 
76 }
77 
78 
80 {
81 public:
82  static int version() { return 1; }
83  struct Inputs
84  {
88 
89 
91  {
92  inputtype = 0;
93  inputpointattribute = "value"_UTsh;
94  inputvolumename = "density"_UTsh;
95 
96  }
97 
98  bool operator==(const Inputs &src) const
99  {
100  if (inputtype != src.inputtype) return false;
101  if (inputpointattribute != src.inputpointattribute) return false;
102  if (inputvolumename != src.inputvolumename) return false;
103 
104  return true;
105  }
106  bool operator!=(const Inputs &src) const
107  {
108  return !operator==(src);
109  }
110 
111  };
112 
114  {
116 
117  buf.strcat("[ ");
118  for (int i = 0; i < list.entries(); i++)
119  {
120  if (i)
121  buf.strcat(", ");
122  buf.strcat("( ");
123  buf.append("");
124  buf.appendSprintf("%d", (int) list(i).inputtype);
125  buf.append(", ");
126  { UT_String tmp; tmp = UT_StringWrap(list(i).inputpointattribute).makeQuotedString('"'); buf.strcat(tmp); }
127  buf.append(", ");
128  { UT_String tmp; tmp = UT_StringWrap(list(i).inputvolumename).makeQuotedString('"'); buf.strcat(tmp); }
129 
130  buf.strcat(" )");
131  }
132  buf.strcat(" ]");
133 
135  return result;
136  }
137  struct Outputs
138  {
144 
145 
147  {
148  outputtype = 0;
149  outputpointattribute = "value"_UTsh;
150  outputvolumename = "density"_UTsh;
151  outputvolumeresolution = UT_Vector3I(10,10,10);
152  outputtuplesize = 1;
153 
154  }
155 
156  bool operator==(const Outputs &src) const
157  {
158  if (outputtype != src.outputtype) return false;
159  if (outputpointattribute != src.outputpointattribute) return false;
160  if (outputvolumename != src.outputvolumename) return false;
161  if (outputvolumeresolution != src.outputvolumeresolution) return false;
162  if (outputtuplesize != src.outputtuplesize) return false;
163 
164  return true;
165  }
166  bool operator!=(const Outputs &src) const
167  {
168  return !operator==(src);
169  }
170 
171  };
172 
174  {
176 
177  buf.strcat("[ ");
178  for (int i = 0; i < list.entries(); i++)
179  {
180  if (i)
181  buf.strcat(", ");
182  buf.strcat("( ");
183  buf.append("");
184  buf.appendSprintf("%d", (int) list(i).outputtype);
185  buf.append(", ");
186  { UT_String tmp; tmp = UT_StringWrap(list(i).outputpointattribute).makeQuotedString('"'); buf.strcat(tmp); }
187  buf.append(", ");
188  { UT_String tmp; tmp = UT_StringWrap(list(i).outputvolumename).makeQuotedString('"'); buf.strcat(tmp); }
189  buf.append(", ");
190  buf.appendSprintf("(%" SYS_PRId64 ", %" SYS_PRId64 ", %" SYS_PRId64 ")", list(i).outputvolumeresolution.x(), list(i).outputvolumeresolution.y(), list(i).outputvolumeresolution.z());
191  buf.append(", ");
192  buf.appendSprintf("%d", (int) list(i).outputtuplesize);
193 
194  buf.strcat(" )");
195  }
196  buf.strcat(" ]");
197 
199  return result;
200  }
201 
203  {
204  myBatch = 0;
205  myModelFile = ""_UTsh;
206  raw_myModelFile = ""_UTsh;
207  myInputs.setSize(1);
208  myOutputs.setSize(1);
209  myCuda = false;
210 
211  }
212 
217 
219 
221  {
222  if (myBatch != src.myBatch) return false;
223  if (myModelFile != src.myModelFile) return false;
224  if (raw_myModelFile != src.raw_myModelFile) return false;
225  if (myInputs != src.myInputs) return false;
226  if (myOutputs != src.myOutputs) return false;
227  if (myCuda != src.myCuda) return false;
228 
229  return true;
230  }
232  {
233  return !operator==(src);
234  }
238 
239 
240 
241  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
242  {
243  myBatch = 0;
244  if (true)
245  graph->evalOpParm(myBatch, nodeidx, "batch", time, 0);
246  myModelFile = ""_UTsh;
247  if (true)
248  graph->evalOpParm(myModelFile, nodeidx, "modelfile", time, 0);
249  raw_myModelFile = ""_UTsh;
250  if (true)
251  graph->evalOpParmRaw(raw_myModelFile, nodeidx, "modelfile", time, 0);
252  if (true)
253  {
254  int64 length = 0;
255  graph->evalOpParm(length, nodeidx, "inputs", time, 0);
256  if (length < 0) length = 0;
257  myInputs.setSize(length);
258  for (exint i = 0; i < length; i++)
259  {
260  int parmidx[1];
261  int offsets[1];
262  parmidx[0] = i+1;
263  offsets[0] = 1;
264  auto && _curentry = myInputs(i);
265  (void) _curentry;
266  _curentry.inputtype = 0;
267  if (true)
268  graph->evalOpParmInst(_curentry.inputtype, nodeidx, "inputtype#", parmidx, offsets, time, 0, 2-1);
269  _curentry.inputpointattribute = "value"_UTsh;
270  if (true && ( (true&&!(((_curentry.inputtype!=0)))) ) )
271  graph->evalOpParmInst(_curentry.inputpointattribute, nodeidx, "inputpointattribute#", parmidx, offsets, time, 0, 2-1);
272  _curentry.inputvolumename = "density"_UTsh;
273  if (true && ( (true&&!(((_curentry.inputtype!=1)))) ) )
274  graph->evalOpParmInst(_curentry.inputvolumename, nodeidx, "inputvolumename#", parmidx, offsets, time, 0, 2-1);
275 
276  }
277  }
278  else
279  myInputs.clear();
280  if (true)
281  {
282  int64 length = 0;
283  graph->evalOpParm(length, nodeidx, "outputs", time, 0);
284  if (length < 0) length = 0;
285  myOutputs.setSize(length);
286  for (exint i = 0; i < length; i++)
287  {
288  int parmidx[1];
289  int offsets[1];
290  parmidx[0] = i+1;
291  offsets[0] = 1;
292  auto && _curentry = myOutputs(i);
293  (void) _curentry;
294  _curentry.outputtype = 0;
295  if (true)
296  graph->evalOpParmInst(_curentry.outputtype, nodeidx, "outputtype#", parmidx, offsets, time, 0, 2-1);
297  _curentry.outputpointattribute = "value"_UTsh;
298  if (true && ( (true&&!(((_curentry.outputtype!=0)))) ) )
299  graph->evalOpParmInst(_curentry.outputpointattribute, nodeidx, "outputpointattribute#", parmidx, offsets, time, 0, 2-1);
300  _curentry.outputvolumename = "density"_UTsh;
301  if (true && ( (true&&!(((_curentry.outputtype!=1)))) ) )
302  graph->evalOpParmInst(_curentry.outputvolumename, nodeidx, "outputvolumename#", parmidx, offsets, time, 0, 2-1);
303  _curentry.outputvolumeresolution = UT_Vector3I(10,10,10);
304  if (true && ( (true&&!(((_curentry.outputtype!=1)))) ) )
305  graph->evalOpParmInst(_curentry.outputvolumeresolution, nodeidx, "outputvolumeresolution#", parmidx, offsets, time, 0, 2-1);
306  _curentry.outputtuplesize = 1;
307  if (true)
308  graph->evalOpParmInst(_curentry.outputtuplesize, nodeidx, "outputtuplesize#", parmidx, offsets, time, 0, 2-1);
309 
310  }
311  }
312  else
313  myOutputs.clear();
314  myCuda = false;
315  if (true)
316  graph->evalOpParm(myCuda, nodeidx, "cuda", time, 0);
317 
318  }
319 
320 
321  void loadFromOpSubclass(const LoadParms &loadparms) override
322  {
323  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
324  }
325 
326 
327  void copyFrom(const OP_NodeParms *src) override
328  {
329  *this = *((const SOP_MLRegressionInferenceCoreParms *)src);
330  }
331 
332  template <typename T>
333  void
334  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
335  {
336  if (idx.size() < 1)
337  return;
338  UT_ASSERT(idx.size() == instance.size()+1);
339  if (idx.size() != instance.size()+1)
340  return;
341  switch (idx[0])
342  {
343  case 0:
344  coerceValue(value, myBatch);
345  break;
346  case 1:
347  coerceValue(value, myModelFile);
348  break;
349  case 2:
350  if (idx.size() == 1)
351  coerceValue(value, myInputs.entries());
352  else if (instance[0] < myInputs.entries())
353  {
354  auto && _data = myInputs(instance[0]);
355  switch (idx[1])
356  {
357  case 0:
358  coerceValue(value, _data.inputtype);
359  break;
360  case 1:
361  coerceValue(value, _data.inputpointattribute);
362  break;
363  case 2:
364  coerceValue(value, _data.inputvolumename);
365  break;
366 
367  }
368  }
369  break;
370  case 3:
371  if (idx.size() == 1)
372  coerceValue(value, myOutputs.entries());
373  else if (instance[0] < myOutputs.entries())
374  {
375  auto && _data = myOutputs(instance[0]);
376  switch (idx[1])
377  {
378  case 0:
379  coerceValue(value, _data.outputtype);
380  break;
381  case 1:
382  coerceValue(value, _data.outputpointattribute);
383  break;
384  case 2:
385  coerceValue(value, _data.outputvolumename);
386  break;
387  case 3:
388  coerceValue(value, _data.outputvolumeresolution);
389  break;
390  case 4:
391  coerceValue(value, _data.outputtuplesize);
392  break;
393 
394  }
395  }
396  break;
397  case 4:
398  coerceValue(value, myCuda);
399  break;
400 
401  }
402  }
403 
404  bool isParmColorRamp(exint idx) const override
405  {
406  switch (idx)
407  {
408 
409  }
410  return false;
411  }
412 
413  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
414  { doGetParmValue(idx, instance, value); }
415  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
416  { doGetParmValue(idx, instance, value); }
417  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
418  { doGetParmValue(idx, instance, value); }
419  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
420  { doGetParmValue(idx, instance, value); }
421  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
422  { doGetParmValue(idx, instance, value); }
423  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
424  { doGetParmValue(idx, instance, value); }
425  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
426  { doGetParmValue(idx, instance, value); }
427  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
428  { doGetParmValue(idx, instance, value); }
429  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
430  { doGetParmValue(idx, instance, value); }
431  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
432  { doGetParmValue(idx, instance, value); }
433  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
434  { doGetParmValue(idx, instance, value); }
435 
436  template <typename T>
437  void
438  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
439  {
440  if (idx.size() < 1)
441  return;
442  UT_ASSERT(idx.size() == instance.size()+1);
443  if (idx.size() != instance.size()+1)
444  return;
445  switch (idx[0])
446  {
447  case 0:
448  coerceValue(myBatch, clampMinValue(0, clampMaxValue(1, value ) ));
449  break;
450  case 1:
451  coerceValue(myModelFile, ( ( value ) ));
452  break;
453  case 2:
454  if (idx.size() == 1)
455  {
456  exint newsize;
457  coerceValue(newsize, value);
458  if (newsize < 0) newsize = 0;
459  myInputs.setSize(newsize);
460  }
461  else
462  {
463  if (instance[0] < 0)
464  return;
465  myInputs.setSizeIfNeeded(instance[0]+1);
466  auto && _data = myInputs(instance[0]);
467  switch (idx[1])
468  {
469  case 0:
470  coerceValue(_data.inputtype, value);
471  break;
472  case 1:
473  coerceValue(_data.inputpointattribute, value);
474  break;
475  case 2:
476  coerceValue(_data.inputvolumename, value);
477  break;
478 
479  }
480  }
481  break;
482  case 3:
483  if (idx.size() == 1)
484  {
485  exint newsize;
486  coerceValue(newsize, value);
487  if (newsize < 0) newsize = 0;
488  myOutputs.setSize(newsize);
489  }
490  else
491  {
492  if (instance[0] < 0)
493  return;
494  myOutputs.setSizeIfNeeded(instance[0]+1);
495  auto && _data = myOutputs(instance[0]);
496  switch (idx[1])
497  {
498  case 0:
499  coerceValue(_data.outputtype, value);
500  break;
501  case 1:
502  coerceValue(_data.outputpointattribute, value);
503  break;
504  case 2:
505  coerceValue(_data.outputvolumename, value);
506  break;
507  case 3:
508  coerceValue(_data.outputvolumeresolution, value);
509  break;
510  case 4:
511  coerceValue(_data.outputtuplesize, value);
512  break;
513 
514  }
515  }
516  break;
517  case 4:
518  coerceValue(myCuda, ( ( value ) ));
519  break;
520 
521  }
522  }
523 
524  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
525  { doSetParmValue(idx, instance, value); }
526  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
527  { doSetParmValue(idx, instance, value); }
528  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
529  { doSetParmValue(idx, instance, value); }
530  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
531  { doSetParmValue(idx, instance, value); }
532  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
533  { doSetParmValue(idx, instance, value); }
534  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
535  { doSetParmValue(idx, instance, value); }
536  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
537  { doSetParmValue(idx, instance, value); }
538  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
539  { doSetParmValue(idx, instance, value); }
540  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
541  { doSetParmValue(idx, instance, value); }
542  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
543  { doSetParmValue(idx, instance, value); }
544  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
545  { doSetParmValue(idx, instance, value); }
546 
547  exint getNestNumParms(TempIndex idx) const override
548  {
549  if (idx.size() == 0)
550  return 5;
551  switch (idx[0])
552  {
553  case 2:
554  return 3;
555  case 3:
556  return 5;
557 
558  }
559  // Invalid
560  return 0;
561  }
562 
563  const char *getNestParmName(TempIndex fieldnum) const override
564  {
565  if (fieldnum.size() < 1)
566  return 0;
567  switch (fieldnum[0])
568  {
569  case 0:
570  return "batch";
571  case 1:
572  return "modelfile";
573  case 2:
574  if (fieldnum.size() == 1)
575  return "inputs";
576  switch (fieldnum[1])
577  {
578  case 0:
579  return "inputtype#";
580  case 1:
581  return "inputpointattribute#";
582  case 2:
583  return "inputvolumename#";
584 
585  }
586  return 0;
587  case 3:
588  if (fieldnum.size() == 1)
589  return "outputs";
590  switch (fieldnum[1])
591  {
592  case 0:
593  return "outputtype#";
594  case 1:
595  return "outputpointattribute#";
596  case 2:
597  return "outputvolumename#";
598  case 3:
599  return "outputvolumeresolution#";
600  case 4:
601  return "outputtuplesize#";
602 
603  }
604  return 0;
605  case 4:
606  return "cuda";
607 
608  }
609  return 0;
610  }
611 
612  ParmType getNestParmType(TempIndex fieldnum) const override
613  {
614  if (fieldnum.size() < 1)
615  return PARM_UNSUPPORTED;
616  switch (fieldnum[0])
617  {
618  case 0:
619  return PARM_INTEGER;
620  case 1:
621  return PARM_STRING;
622  case 2:
623  if (fieldnum.size() == 1)
624  return PARM_MULTIPARM;
625  switch (fieldnum[1])
626  {
627  case 0:
628  return PARM_INTEGER;
629  case 1:
630  return PARM_STRING;
631  case 2:
632  return PARM_STRING;
633 
634  }
635  return PARM_UNSUPPORTED;
636  case 3:
637  if (fieldnum.size() == 1)
638  return PARM_MULTIPARM;
639  switch (fieldnum[1])
640  {
641  case 0:
642  return PARM_INTEGER;
643  case 1:
644  return PARM_STRING;
645  case 2:
646  return PARM_STRING;
647  case 3:
648  return PARM_VECTOR3;
649  case 4:
650  return PARM_INTEGER;
651 
652  }
653  return PARM_UNSUPPORTED;
654  case 4:
655  return PARM_INTEGER;
656 
657  }
658  return PARM_UNSUPPORTED;
659  }
660 
661  // Boiler plate to load individual types.
662  static void loadData(UT_IStream &is, int64 &v)
663  { is.bread(&v, 1); }
664  static void loadData(UT_IStream &is, bool &v)
665  { int64 iv; is.bread(&iv, 1); v = iv; }
666  static void loadData(UT_IStream &is, fpreal64 &v)
667  { is.bread<fpreal64>(&v, 1); }
668  static void loadData(UT_IStream &is, UT_Vector2D &v)
669  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
670  static void loadData(UT_IStream &is, UT_Vector3D &v)
671  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
672  is.bread<fpreal64>(&v.z(), 1); }
673  static void loadData(UT_IStream &is, UT_Vector4D &v)
674  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
675  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
676  static void loadData(UT_IStream &is, UT_Matrix2D &v)
677  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
678  static void loadData(UT_IStream &is, UT_Matrix3D &v)
679  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
680  static void loadData(UT_IStream &is, UT_Matrix4D &v)
681  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
682  static void loadData(UT_IStream &is, UT_Vector2I &v)
683  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
684  static void loadData(UT_IStream &is, UT_Vector3I &v)
685  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
686  is.bread<int64>(&v.z(), 1); }
687  static void loadData(UT_IStream &is, UT_Vector4I &v)
688  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
689  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
691  { is.bread(v); }
693  { UT_StringHolder rampdata;
694  loadData(is, rampdata);
695  if (rampdata.isstring())
696  {
697  v.reset(new UT_Ramp());
698  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
699  v->load(istr);
700  }
701  else v.reset();
702  }
705  loadData(is, data);
706  if (data.isstring())
707  {
708  // Find the data type.
709  const char *colon = UT_StringWrap(data).findChar(':');
710  if (colon)
711  {
712  int typelen = colon - data.buffer();
714  type.strncpy(data.buffer(), typelen);
715  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
716 
717  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
718  }
719  }
720  else v.reset();
721  }
722 
723  static void saveData(std::ostream &os, int64 v)
724  { UTwrite(os, &v); }
725  static void saveData(std::ostream &os, bool v)
726  { int64 iv = v; UTwrite(os, &iv); }
727  static void saveData(std::ostream &os, fpreal64 v)
728  { UTwrite<fpreal64>(os, &v); }
729  static void saveData(std::ostream &os, UT_Vector2D v)
730  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
731  static void saveData(std::ostream &os, UT_Vector3D v)
732  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
733  UTwrite<fpreal64>(os, &v.z()); }
734  static void saveData(std::ostream &os, UT_Vector4D v)
735  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
736  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
737  static void saveData(std::ostream &os, UT_Matrix2D v)
739  static void saveData(std::ostream &os, UT_Matrix3D v)
741  static void saveData(std::ostream &os, UT_Matrix4D v)
743  static void saveData(std::ostream &os, UT_StringHolder s)
744  { UT_StringWrap(s).saveBinary(os); }
745  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
747  UT_OStringStream ostr;
748  if (s) s->save(ostr);
749  result = ostr.str();
750  saveData(os, result);
751  }
752  static void saveData(std::ostream &os, PRM_DataItemHandle s)
754  UT_OStringStream ostr;
755  if (s)
756  {
757  ostr << s->getDataTypeToken();
758  ostr << ":";
759  s->saveBinary(ostr);
760  }
761  result = ostr.str();
762  saveData(os, result);
763  }
764 
765 
766  void save(std::ostream &os) const
767  {
768  int32 v = version();
769  UTwrite(os, &v);
770  saveData(os, myBatch);
771  saveData(os, myModelFile);
772  saveData(os, raw_myModelFile);
773  {
774  int64 length = myInputs.entries();
775  UTwrite(os, &length);
776  for (exint i = 0; i < length; i++)
777  {
778  auto && _curentry = myInputs(i);
779  (void) _curentry;
780  saveData(os, _curentry.inputtype);
781  saveData(os, _curentry.inputpointattribute);
782  saveData(os, _curentry.inputvolumename);
783 
784  }
785  }
786  {
787  int64 length = myOutputs.entries();
788  UTwrite(os, &length);
789  for (exint i = 0; i < length; i++)
790  {
791  auto && _curentry = myOutputs(i);
792  (void) _curentry;
793  saveData(os, _curentry.outputtype);
794  saveData(os, _curentry.outputpointattribute);
795  saveData(os, _curentry.outputvolumename);
796  saveData(os, _curentry.outputvolumeresolution);
797  saveData(os, _curentry.outputtuplesize);
798 
799  }
800  }
801  saveData(os, myCuda);
802 
803  }
804 
805  bool load(UT_IStream &is)
806  {
807  int32 v;
808  is.bread(&v, 1);
809  if (version() != v)
810  {
811  // Fail incompatible versions
812  return false;
813  }
814  loadData(is, myBatch);
815  loadData(is, myModelFile);
816  loadData(is, raw_myModelFile);
817  {
818  int64 length;
819  is.read(&length, 1);
820  myInputs.setSize(length);
821  for (exint i = 0; i < length; i++)
822  {
823  auto && _curentry = myInputs(i);
824  (void) _curentry;
825  loadData(is, _curentry.inputtype);
826  loadData(is, _curentry.inputpointattribute);
827  loadData(is, _curentry.inputvolumename);
828 
829  }
830  }
831  {
832  int64 length;
833  is.read(&length, 1);
834  myOutputs.setSize(length);
835  for (exint i = 0; i < length; i++)
836  {
837  auto && _curentry = myOutputs(i);
838  (void) _curentry;
839  loadData(is, _curentry.outputtype);
840  loadData(is, _curentry.outputpointattribute);
841  loadData(is, _curentry.outputvolumename);
842  loadData(is, _curentry.outputvolumeresolution);
843  loadData(is, _curentry.outputtuplesize);
844 
845  }
846  }
847  loadData(is, myCuda);
848 
849  return true;
850  }
851 
852  Batch getBatch() const { return Batch(myBatch); }
853  void setBatch(Batch val) { myBatch = int64(val); }
854  Batch opBatch(const SOP_NodeVerb::CookParms &cookparms) const
855  {
856  SOP_Node *thissop = cookparms.getNode();
857  if (!thissop) return getBatch();
858  int64 result;
859  OP_Utils::evalOpParm(result, thissop, "batch", cookparms.getCookTime(), 0);
860  return Batch(result);
861  }
862  const UT_StringHolder & getModelFile() const { return myModelFile; }
863  void setModelFile(const UT_StringHolder & val) { myModelFile = val; }
865  {
866  SOP_Node *thissop = cookparms.getNode();
867  if (!thissop) return getModelFile();
869  OP_Utils::evalOpParm(result, thissop, "modelfile", cookparms.getCookTime(), 0);
870  return result;
871  }
872  const UT_StringHolder & raw_getModelFile() const { return raw_myModelFile; }
873  void raw_setModelFile(const UT_StringHolder & val) { raw_myModelFile = val; }
875  {
876  SOP_Node *thissop = cookparms.getNode();
877  if (!thissop) return raw_getModelFile();
879  OP_Utils::evalOpParmRaw(result, thissop, "modelfile", cookparms.getCookTime(), 0);
880  return result;
881  }
882  const UT_Array<Inputs> &getInputs() const { return myInputs; }
883 void setInputs(const UT_Array<Inputs> &val) { myInputs = val; }
884  exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
885  {
886  SOP_Node *thissop = cookparms.getNode();
887  if (!thissop) return getInputs().entries();
888  exint result;
889  OP_Utils::evalOpParm(result, thissop, "inputs", cookparms.getCookTime(), 0);
890  return result;
891  }
892  int64 opInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
893  { return opinstInputs_inputtype(cookparms, &_idx); }
894  int64 opinstInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
895  {
896  SOP_Node *thissop = cookparms.getNode();
897  if (!thissop) return (myInputs(_idx[0]).inputtype);
898  int _parmidx[2-1];
899  _parmidx[1-1] = _idx[1-1] + 1;
900 
901  int64 result;
902  OP_Utils::evalOpParmInst(result, thissop, "inputtype#", _parmidx, cookparms.getCookTime(), 0, 2-1);
903  return (result);
904  }
906  { return opinstInputs_inputpointattribute(cookparms, &_idx); }
908  {
909  SOP_Node *thissop = cookparms.getNode();
910  if (!thissop) return (myInputs(_idx[0]).inputpointattribute);
911  int _parmidx[2-1];
912  _parmidx[1-1] = _idx[1-1] + 1;
913 
915  OP_Utils::evalOpParmInst(result, thissop, "inputpointattribute#", _parmidx, cookparms.getCookTime(), 0, 2-1);
916  return (result);
917  }
919  { return opinstInputs_inputvolumename(cookparms, &_idx); }
921  {
922  SOP_Node *thissop = cookparms.getNode();
923  if (!thissop) return (myInputs(_idx[0]).inputvolumename);
924  int _parmidx[2-1];
925  _parmidx[1-1] = _idx[1-1] + 1;
926 
928  OP_Utils::evalOpParmInst(result, thissop, "inputvolumename#", _parmidx, cookparms.getCookTime(), 0, 2-1);
929  return (result);
930  }
931 
932  const UT_Array<Outputs> &getOutputs() const { return myOutputs; }
933 void setOutputs(const UT_Array<Outputs> &val) { myOutputs = val; }
934  exint opOutputs(const SOP_NodeVerb::CookParms &cookparms) const
935  {
936  SOP_Node *thissop = cookparms.getNode();
937  if (!thissop) return getOutputs().entries();
938  exint result;
939  OP_Utils::evalOpParm(result, thissop, "outputs", cookparms.getCookTime(), 0);
940  return result;
941  }
942  int64 opOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
943  { return opinstOutputs_outputtype(cookparms, &_idx); }
944  int64 opinstOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
945  {
946  SOP_Node *thissop = cookparms.getNode();
947  if (!thissop) return (myOutputs(_idx[0]).outputtype);
948  int _parmidx[2-1];
949  _parmidx[1-1] = _idx[1-1] + 1;
950 
951  int64 result;
952  OP_Utils::evalOpParmInst(result, thissop, "outputtype#", _parmidx, cookparms.getCookTime(), 0, 2-1);
953  return (result);
954  }
956  { return opinstOutputs_outputpointattribute(cookparms, &_idx); }
958  {
959  SOP_Node *thissop = cookparms.getNode();
960  if (!thissop) return (myOutputs(_idx[0]).outputpointattribute);
961  int _parmidx[2-1];
962  _parmidx[1-1] = _idx[1-1] + 1;
963 
965  OP_Utils::evalOpParmInst(result, thissop, "outputpointattribute#", _parmidx, cookparms.getCookTime(), 0, 2-1);
966  return (result);
967  }
969  { return opinstOutputs_outputvolumename(cookparms, &_idx); }
971  {
972  SOP_Node *thissop = cookparms.getNode();
973  if (!thissop) return (myOutputs(_idx[0]).outputvolumename);
974  int _parmidx[2-1];
975  _parmidx[1-1] = _idx[1-1] + 1;
976 
978  OP_Utils::evalOpParmInst(result, thissop, "outputvolumename#", _parmidx, cookparms.getCookTime(), 0, 2-1);
979  return (result);
980  }
982  { return opinstOutputs_outputvolumeresolution(cookparms, &_idx); }
984  {
985  SOP_Node *thissop = cookparms.getNode();
986  if (!thissop) return (myOutputs(_idx[0]).outputvolumeresolution);
987  int _parmidx[2-1];
988  _parmidx[1-1] = _idx[1-1] + 1;
989 
991  OP_Utils::evalOpParmInst(result, thissop, "outputvolumeresolution#", _parmidx, cookparms.getCookTime(), 0, 2-1);
992  return (result);
993  }
994  int64 opOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
995  { return opinstOutputs_outputtuplesize(cookparms, &_idx); }
996  int64 opinstOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
997  {
998  SOP_Node *thissop = cookparms.getNode();
999  if (!thissop) return (myOutputs(_idx[0]).outputtuplesize);
1000  int _parmidx[2-1];
1001  _parmidx[1-1] = _idx[1-1] + 1;
1002 
1003  int64 result;
1004  OP_Utils::evalOpParmInst(result, thissop, "outputtuplesize#", _parmidx, cookparms.getCookTime(), 0, 2-1);
1005  return (result);
1006  }
1007 
1008  bool getCuda() const { return myCuda; }
1009  void setCuda(bool val) { myCuda = val; }
1010  bool opCuda(const SOP_NodeVerb::CookParms &cookparms) const
1011  {
1012  SOP_Node *thissop = cookparms.getNode();
1013  if (!thissop) return getCuda();
1014  bool result;
1015  OP_Utils::evalOpParm(result, thissop, "cuda", cookparms.getCookTime(), 0);
1016  return result;
1017  }
1018 
1019 private:
1020  int64 myBatch;
1021  UT_StringHolder myModelFile;
1022  UT_StringHolder raw_myModelFile;
1023  UT_Array<Inputs> myInputs;
1024  UT_Array<Outputs> myOutputs;
1025  bool myCuda;
1026 
1027 };
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
int64 opOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
bool operator!=(const SOP_MLRegressionInferenceCoreParms &src) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void saveData(std::ostream &os, bool v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
ParmType getNestParmType(TempIndex fieldnum) const override
int64 opInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void
Definition: png.h:1083
exint bread(int32 *buffer, exint asize=1)
GLboolean * data
Definition: glcorearb.h:131
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
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
fpreal getTime() const
Definition: OP_Context.h:62
UT_Vector3I opOutputs_outputvolumeresolution(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void saveData(std::ostream &os, UT_Vector4D v)
static void loadData(UT_IStream &is, int64 &v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
virtual void evalOpParmRaw(UT_StringHolder &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
const char * getNestParmName(TempIndex fieldnum) const override
SYS_FORCE_INLINE const char * buffer() const
static void loadData(UT_IStream &is, UT_Vector3I &v)
GLdouble s
Definition: glad.h:3009
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
exint opOutputs(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector2I &v)
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, fpreal64 &v)
static void saveData(std::ostream &os, UT_Matrix3D v)
**But if you need a result
Definition: thread.h:613
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
UT_Vector3T< int64 > UT_Vector3I
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
void loadFromOpSubclass(const LoadParms &loadparms) override
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.
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
int64 opOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
int64 opinstOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
static void loadData(UT_IStream &is, UT_Vector3D &v)
double fpreal64
Definition: SYS_Types.h:201
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
static void loadData(UT_IStream &is, UT_Matrix3D &v)
UT_StringHolder opInputs_inputpointattribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
const UT_Array< Outputs > & getOutputs() const
void setOutputs(const UT_Array< Outputs > &val)
exint length() const
exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
UT_StringHolder opinstInputs_inputvolumename(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
SYS_FORCE_INLINE UT_StringHolder getToken(Batch enum_value)
int64 opinstInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
UT_StringHolder opinstOutputs_outputpointattribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
UT_StringHolder createString(const UT_Array< Inputs > &list) const
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
bool operator==(const SOP_MLRegressionInferenceCoreParms &src) const
long long int64
Definition: SYS_Types.h:116
static void saveData(std::ostream &os, UT_Vector3D v)
UT_StringHolder opInputs_inputvolumename(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
UT_Vector3I opinstOutputs_outputvolumeresolution(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void loadData(UT_IStream &is, UT_StringHolder &v)
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:296
static void saveData(std::ostream &os, fpreal64 v)
static void saveData(std::ostream &os, UT_StringHolder s)
UT_StringHolder createString(const UT_Array< Outputs > &list) const
GT_API const UT_StringHolder version
#define SYS_PRId64
Definition: SYS_Types.h:76
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:648
Batch opBatch(const SOP_NodeVerb::CookParms &cookparms) const
exint getNestNumParms(TempIndex idx) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
int64 opinstOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void saveData(std::ostream &os, int64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void copyFrom(const OP_NodeParms *src) override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
UT_StringHolder opOutputs_outputvolumename(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
UT_StringHolder raw_opModelFile(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, UT_Vector4I &v)
fpreal64 fpreal
Definition: SYS_Types.h:277
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
UT_StringHolder opOutputs_outputpointattribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void saveData(std::ostream &os, UT_Matrix2D v)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
constexpr SYS_FORCE_INLINE T & w() noexcept
Definition: UT_Vector4.h:497
SYS_FORCE_INLINE void append(char character)
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define SOP_API
Definition: SOP_API.h:10
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:361
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const 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
UT_StringHolder opModelFile(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opinstOutputs_outputvolumename(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
GLboolean r
Definition: glcorearb.h:1222
static void loadData(UT_IStream &is, bool &v)
UT_StringHolder opinstInputs_inputpointattribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
bool opCuda(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:665
type
Definition: core.h:1059
static void saveData(std::ostream &os, UT_Matrix4D v)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:97
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
static void saveData(std::ostream &os, UT_Vector2D v)
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663