HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_MLRegressionProximityCore.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 <OP/OP_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_MLRegressionProximityCoreEnums
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  myInputs.setSize(1);
206  myOutputs.setSize(1);
207 
208  }
209 
214 
216 
218  {
219  if (myBatch != src.myBatch) return false;
220  if (myInputs != src.myInputs) return false;
221  if (myOutputs != src.myOutputs) return false;
222 
223 
224  if (baseGetSignature() != src.baseGetSignature()) return false;
225 
226  return true;
227  }
229  {
230  return !operator==(src);
231  }
235 
236 
237 
238  void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
239  {
240  myBatch = 0;
241  if (true)
242  graph->evalOpParm(myBatch, nodeidx, "batch", time, graph->isDirect()?nullptr:depnode);
243  if (true)
244  {
245  int64 length = 0;
246  graph->evalOpParm(length, nodeidx, "inputs", time, graph->isDirect()?nullptr:depnode);
247  if (length < 0) length = 0;
248  myInputs.setSize(length);
249  for (exint i = 0; i < length; i++)
250  {
251  int parmidx[1];
252  int offsets[1];
253  parmidx[0] = i+1;
254  offsets[0] = 1;
255  auto && _curentry = myInputs(i);
256  (void) _curentry;
257  _curentry.inputtype = 0;
258  if (true)
259  graph->evalOpParmInst(_curentry.inputtype, nodeidx, "inputtype#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
260  _curentry.inputpointattribute = "value"_UTsh;
261  if (true && ( (true&&!(((_curentry.inputtype!=0)))) ) )
262  graph->evalOpParmInst(_curentry.inputpointattribute, nodeidx, "inputpointattribute#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
263  _curentry.inputvolumename = "density"_UTsh;
264  if (true && ( (true&&!(((_curentry.inputtype!=1)))) ) )
265  graph->evalOpParmInst(_curentry.inputvolumename, nodeidx, "inputvolumename#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
266 
267  }
268  }
269  else
270  myInputs.clear();
271  if (true)
272  {
273  int64 length = 0;
274  graph->evalOpParm(length, nodeidx, "outputs", time, graph->isDirect()?nullptr:depnode);
275  if (length < 0) length = 0;
276  myOutputs.setSize(length);
277  for (exint i = 0; i < length; i++)
278  {
279  int parmidx[1];
280  int offsets[1];
281  parmidx[0] = i+1;
282  offsets[0] = 1;
283  auto && _curentry = myOutputs(i);
284  (void) _curentry;
285  _curentry.outputtype = 0;
286  if (true)
287  graph->evalOpParmInst(_curentry.outputtype, nodeidx, "outputtype#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
288  _curentry.outputpointattribute = "value"_UTsh;
289  if (true && ( (true&&!(((_curentry.outputtype!=0)))) ) )
290  graph->evalOpParmInst(_curentry.outputpointattribute, nodeidx, "outputpointattribute#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
291  _curentry.outputvolumename = "density"_UTsh;
292  if (true && ( (true&&!(((_curentry.outputtype!=1)))) ) )
293  graph->evalOpParmInst(_curentry.outputvolumename, nodeidx, "outputvolumename#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
294  _curentry.outputvolumeresolution = UT_Vector3I(10,10,10);
295  if (true && ( (true&&!(((_curentry.outputtype!=1)))) ) )
296  graph->evalOpParmInst(_curentry.outputvolumeresolution, nodeidx, "outputvolumeresolution#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
297  _curentry.outputtuplesize = 1;
298  if (true)
299  graph->evalOpParmInst(_curentry.outputtuplesize, nodeidx, "outputtuplesize#", parmidx, offsets, time, graph->isDirect()?nullptr:depnode, 2-1);
300 
301  }
302  }
303  else
304  myOutputs.clear();
305 
306  }
307 
308 
309  void loadFromOpSubclass(const LoadParms &loadparms) override
310  {
311  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
312  }
313 
314 
315  void copyFrom(const OP_NodeParms *src) override
316  {
317  *this = *((const SOP_MLRegressionProximityCoreParms *)src);
318  }
319 
320  template <typename T>
321  void
322  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
323  {
324  if (idx.size() < 1)
325  return;
326  UT_ASSERT(idx.size() == instance.size()+1);
327  if (idx.size() != instance.size()+1)
328  return;
329  switch (idx[0])
330  {
331  case 0:
332  coerceValue(value, myBatch);
333  break;
334  case 1:
335  if (idx.size() == 1)
336  coerceValue(value, myInputs.entries());
337  else if (instance[0] < myInputs.entries())
338  {
339  auto && _data = myInputs(instance[0]);
340  switch (idx[1])
341  {
342  case 0:
343  coerceValue(value, _data.inputtype);
344  break;
345  case 1:
346  coerceValue(value, _data.inputpointattribute);
347  break;
348  case 2:
349  coerceValue(value, _data.inputvolumename);
350  break;
351 
352  }
353  }
354  break;
355  case 2:
356  if (idx.size() == 1)
357  coerceValue(value, myOutputs.entries());
358  else if (instance[0] < myOutputs.entries())
359  {
360  auto && _data = myOutputs(instance[0]);
361  switch (idx[1])
362  {
363  case 0:
364  coerceValue(value, _data.outputtype);
365  break;
366  case 1:
367  coerceValue(value, _data.outputpointattribute);
368  break;
369  case 2:
370  coerceValue(value, _data.outputvolumename);
371  break;
372  case 3:
373  coerceValue(value, _data.outputvolumeresolution);
374  break;
375  case 4:
376  coerceValue(value, _data.outputtuplesize);
377  break;
378 
379  }
380  }
381  break;
382 
383  }
384  }
385 
386  bool isParmColorRamp(exint idx) const override
387  {
388  switch (idx)
389  {
390 
391  }
392  return false;
393  }
394 
395  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
396  { doGetParmValue(idx, instance, value); }
397  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
398  { doGetParmValue(idx, instance, value); }
399  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
400  { doGetParmValue(idx, instance, value); }
401  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
402  { doGetParmValue(idx, instance, value); }
403  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
404  { doGetParmValue(idx, instance, value); }
405  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
406  { doGetParmValue(idx, instance, value); }
407  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
408  { doGetParmValue(idx, instance, value); }
409  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
410  { doGetParmValue(idx, instance, value); }
411  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
412  { doGetParmValue(idx, instance, value); }
413  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
414  { doGetParmValue(idx, instance, value); }
415  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
416  { doGetParmValue(idx, instance, value); }
417 
418  template <typename T>
419  void
420  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
421  {
422  if (idx.size() < 1)
423  return;
424  UT_ASSERT(idx.size() == instance.size()+1);
425  if (idx.size() != instance.size()+1)
426  return;
427  switch (idx[0])
428  {
429  case 0:
430  coerceValue(myBatch, clampMinValue(0, clampMaxValue(1, value ) ));
431  break;
432  case 1:
433  if (idx.size() == 1)
434  {
435  exint newsize;
436  coerceValue(newsize, value);
437  if (newsize < 0) newsize = 0;
438  myInputs.setSize(newsize);
439  }
440  else
441  {
442  if (instance[0] < 0)
443  return;
444  myInputs.setSizeIfNeeded(instance[0]+1);
445  auto && _data = myInputs(instance[0]);
446  switch (idx[1])
447  {
448  case 0:
449  coerceValue(_data.inputtype, value);
450  break;
451  case 1:
452  coerceValue(_data.inputpointattribute, value);
453  break;
454  case 2:
455  coerceValue(_data.inputvolumename, value);
456  break;
457 
458  }
459  }
460  break;
461  case 2:
462  if (idx.size() == 1)
463  {
464  exint newsize;
465  coerceValue(newsize, value);
466  if (newsize < 0) newsize = 0;
467  myOutputs.setSize(newsize);
468  }
469  else
470  {
471  if (instance[0] < 0)
472  return;
473  myOutputs.setSizeIfNeeded(instance[0]+1);
474  auto && _data = myOutputs(instance[0]);
475  switch (idx[1])
476  {
477  case 0:
478  coerceValue(_data.outputtype, value);
479  break;
480  case 1:
481  coerceValue(_data.outputpointattribute, value);
482  break;
483  case 2:
484  coerceValue(_data.outputvolumename, value);
485  break;
486  case 3:
487  coerceValue(_data.outputvolumeresolution, value);
488  break;
489  case 4:
490  coerceValue(_data.outputtuplesize, value);
491  break;
492 
493  }
494  }
495  break;
496 
497  }
498  }
499 
500  void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
501  { doSetParmValue(idx, instance, value); }
502  void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
503  { doSetParmValue(idx, instance, value); }
504  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
505  { doSetParmValue(idx, instance, value); }
506  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
507  { doSetParmValue(idx, instance, value); }
508  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
509  { doSetParmValue(idx, instance, value); }
510  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
511  { doSetParmValue(idx, instance, value); }
512  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
513  { doSetParmValue(idx, instance, value); }
514  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
515  { doSetParmValue(idx, instance, value); }
516  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
517  { doSetParmValue(idx, instance, value); }
518  void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr<UT_Ramp> &value) override
519  { doSetParmValue(idx, instance, value); }
520  void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
521  { doSetParmValue(idx, instance, value); }
522 
523  exint getNestNumParms(TempIndex idx) const override
524  {
525  if (idx.size() == 0)
526  return 3;
527  switch (idx[0])
528  {
529  case 1:
530  return 3;
531  case 2:
532  return 5;
533 
534  }
535  // Invalid
536  return 0;
537  }
538 
539  const char *getNestParmName(TempIndex fieldnum) const override
540  {
541  if (fieldnum.size() < 1)
542  return 0;
543  switch (fieldnum[0])
544  {
545  case 0:
546  return "batch";
547  case 1:
548  if (fieldnum.size() == 1)
549  return "inputs";
550  switch (fieldnum[1])
551  {
552  case 0:
553  return "inputtype#";
554  case 1:
555  return "inputpointattribute#";
556  case 2:
557  return "inputvolumename#";
558 
559  }
560  return 0;
561  case 2:
562  if (fieldnum.size() == 1)
563  return "outputs";
564  switch (fieldnum[1])
565  {
566  case 0:
567  return "outputtype#";
568  case 1:
569  return "outputpointattribute#";
570  case 2:
571  return "outputvolumename#";
572  case 3:
573  return "outputvolumeresolution#";
574  case 4:
575  return "outputtuplesize#";
576 
577  }
578  return 0;
579 
580  }
581  return 0;
582  }
583 
584  ParmType getNestParmType(TempIndex fieldnum) const override
585  {
586  if (fieldnum.size() < 1)
587  return PARM_UNSUPPORTED;
588  switch (fieldnum[0])
589  {
590  case 0:
591  return PARM_INTEGER;
592  case 1:
593  if (fieldnum.size() == 1)
594  return PARM_MULTIPARM;
595  switch (fieldnum[1])
596  {
597  case 0:
598  return PARM_INTEGER;
599  case 1:
600  return PARM_STRING;
601  case 2:
602  return PARM_STRING;
603 
604  }
605  return PARM_UNSUPPORTED;
606  case 2:
607  if (fieldnum.size() == 1)
608  return PARM_MULTIPARM;
609  switch (fieldnum[1])
610  {
611  case 0:
612  return PARM_INTEGER;
613  case 1:
614  return PARM_STRING;
615  case 2:
616  return PARM_STRING;
617  case 3:
618  return PARM_VECTOR3;
619  case 4:
620  return PARM_INTEGER;
621 
622  }
623  return PARM_UNSUPPORTED;
624 
625  }
626  return PARM_UNSUPPORTED;
627  }
628 
629  // Boiler plate to load individual types.
630  static void loadData(UT_IStream &is, int64 &v)
631  { is.bread(&v, 1); }
632  static void loadData(UT_IStream &is, bool &v)
633  { int64 iv; is.bread(&iv, 1); v = iv; }
634  static void loadData(UT_IStream &is, fpreal64 &v)
635  { is.bread<fpreal64>(&v, 1); }
636  static void loadData(UT_IStream &is, UT_Vector2D &v)
637  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
638  static void loadData(UT_IStream &is, UT_Vector3D &v)
639  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
640  is.bread<fpreal64>(&v.z(), 1); }
641  static void loadData(UT_IStream &is, UT_Vector4D &v)
642  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
643  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
644  static void loadData(UT_IStream &is, UT_Matrix2D &v)
645  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
646  static void loadData(UT_IStream &is, UT_Matrix3D &v)
647  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
648  static void loadData(UT_IStream &is, UT_Matrix4D &v)
649  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
650  static void loadData(UT_IStream &is, UT_Vector2I &v)
651  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
652  static void loadData(UT_IStream &is, UT_Vector3I &v)
653  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
654  is.bread<int64>(&v.z(), 1); }
655  static void loadData(UT_IStream &is, UT_Vector4I &v)
656  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
657  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
659  { is.bread(v); }
661  { UT_StringHolder rampdata;
662  loadData(is, rampdata);
663  if (rampdata.isstring())
664  {
665  v.reset(new UT_Ramp());
666  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
667  v->load(istr);
668  }
669  else v.reset();
670  }
673  loadData(is, data);
674  if (data.isstring())
675  {
676  // Find the data type.
677  const char *colon = UT_StringWrap(data).findChar(':');
678  if (colon)
679  {
680  int typelen = colon - data.buffer();
682  type.strncpy(data.buffer(), typelen);
683  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
684 
685  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
686  }
687  }
688  else v.reset();
689  }
690 
691  static void saveData(std::ostream &os, int64 v)
692  { UTwrite(os, &v); }
693  static void saveData(std::ostream &os, bool v)
694  { int64 iv = v; UTwrite(os, &iv); }
695  static void saveData(std::ostream &os, fpreal64 v)
696  { UTwrite<fpreal64>(os, &v); }
697  static void saveData(std::ostream &os, UT_Vector2D v)
698  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
699  static void saveData(std::ostream &os, UT_Vector3D v)
700  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
701  UTwrite<fpreal64>(os, &v.z()); }
702  static void saveData(std::ostream &os, UT_Vector4D v)
703  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
704  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
705  static void saveData(std::ostream &os, UT_Matrix2D v)
707  static void saveData(std::ostream &os, UT_Matrix3D v)
709  static void saveData(std::ostream &os, UT_Matrix4D v)
711  static void saveData(std::ostream &os, UT_StringHolder s)
712  { UT_StringWrap(s).saveBinary(os); }
713  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
715  UT_OStringStream ostr;
716  if (s) s->save(ostr);
717  result = ostr.str();
718  saveData(os, result);
719  }
720  static void saveData(std::ostream &os, PRM_DataItemHandle s)
722  UT_OStringStream ostr;
723  if (s)
724  {
725  ostr << s->getDataTypeToken();
726  ostr << ":";
727  s->saveBinary(ostr);
728  }
729  result = ostr.str();
730  saveData(os, result);
731  }
732 
733 
734  void save(std::ostream &os) const
735  {
736  int32 v = version();
737  UTwrite(os, &v);
738  saveData(os, myBatch);
739  {
740  int64 length = myInputs.entries();
741  UTwrite(os, &length);
742  for (exint i = 0; i < length; i++)
743  {
744  auto && _curentry = myInputs(i);
745  (void) _curentry;
746  saveData(os, _curentry.inputtype);
747  saveData(os, _curentry.inputpointattribute);
748  saveData(os, _curentry.inputvolumename);
749 
750  }
751  }
752  {
753  int64 length = myOutputs.entries();
754  UTwrite(os, &length);
755  for (exint i = 0; i < length; i++)
756  {
757  auto && _curentry = myOutputs(i);
758  (void) _curentry;
759  saveData(os, _curentry.outputtype);
760  saveData(os, _curentry.outputpointattribute);
761  saveData(os, _curentry.outputvolumename);
762  saveData(os, _curentry.outputvolumeresolution);
763  saveData(os, _curentry.outputtuplesize);
764 
765  }
766  }
767 
768  }
769 
770  bool load(UT_IStream &is)
771  {
772  int32 v;
773  is.bread(&v, 1);
774  if (version() != v)
775  {
776  // Fail incompatible versions
777  return false;
778  }
779  loadData(is, myBatch);
780  {
781  int64 length;
782  is.read(&length, 1);
783  myInputs.setSize(length);
784  for (exint i = 0; i < length; i++)
785  {
786  auto && _curentry = myInputs(i);
787  (void) _curentry;
788  loadData(is, _curentry.inputtype);
789  loadData(is, _curentry.inputpointattribute);
790  loadData(is, _curentry.inputvolumename);
791 
792  }
793  }
794  {
795  int64 length;
796  is.read(&length, 1);
797  myOutputs.setSize(length);
798  for (exint i = 0; i < length; i++)
799  {
800  auto && _curentry = myOutputs(i);
801  (void) _curentry;
802  loadData(is, _curentry.outputtype);
803  loadData(is, _curentry.outputpointattribute);
804  loadData(is, _curentry.outputvolumename);
805  loadData(is, _curentry.outputvolumeresolution);
806  loadData(is, _curentry.outputtuplesize);
807 
808  }
809  }
810 
811  return true;
812  }
813 
814  Batch getBatch() const { return Batch(myBatch); }
815  void setBatch(Batch val) { myBatch = int64(val); }
816  Batch opBatch(const SOP_NodeVerb::CookParms &cookparms) const
817  {
818  SOP_Node *thissop = cookparms.getNode();
819  if (!thissop) return getBatch();
820  int64 result;
821  OP_Utils::evalOpParm(result, thissop, "batch", cookparms.getCookTime(), 0);
822  return Batch(result);
823  }
824  const UT_Array<Inputs> &getInputs() const { return myInputs; }
825 void setInputs(const UT_Array<Inputs> &val) { myInputs = val; }
826  exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
827  {
828  SOP_Node *thissop = cookparms.getNode();
829  if (!thissop) return getInputs().entries();
830  exint result;
831  OP_Utils::evalOpParm(result, thissop, "inputs", cookparms.getCookTime(), 0);
832  return result;
833  }
834  int64 opInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
835  { return opinstInputs_inputtype(cookparms, &_idx); }
836  int64 opinstInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
837  {
838  SOP_Node *thissop = cookparms.getNode();
839  if (!thissop) return (myInputs(_idx[0]).inputtype);
840  int _parmidx[2-1];
841  _parmidx[1-1] = _idx[1-1] + 1;
842 
843  int64 result;
844  OP_Utils::evalOpParmInst(result, thissop, "inputtype#", _parmidx, cookparms.getCookTime(), 0, 2-1);
845  return (result);
846  }
848  { return opinstInputs_inputpointattribute(cookparms, &_idx); }
850  {
851  SOP_Node *thissop = cookparms.getNode();
852  if (!thissop) return (myInputs(_idx[0]).inputpointattribute);
853  int _parmidx[2-1];
854  _parmidx[1-1] = _idx[1-1] + 1;
855 
857  OP_Utils::evalOpParmInst(result, thissop, "inputpointattribute#", _parmidx, cookparms.getCookTime(), 0, 2-1);
858  return (result);
859  }
861  { return opinstInputs_inputvolumename(cookparms, &_idx); }
863  {
864  SOP_Node *thissop = cookparms.getNode();
865  if (!thissop) return (myInputs(_idx[0]).inputvolumename);
866  int _parmidx[2-1];
867  _parmidx[1-1] = _idx[1-1] + 1;
868 
870  OP_Utils::evalOpParmInst(result, thissop, "inputvolumename#", _parmidx, cookparms.getCookTime(), 0, 2-1);
871  return (result);
872  }
873 
874  const UT_Array<Outputs> &getOutputs() const { return myOutputs; }
875 void setOutputs(const UT_Array<Outputs> &val) { myOutputs = val; }
876  exint opOutputs(const SOP_NodeVerb::CookParms &cookparms) const
877  {
878  SOP_Node *thissop = cookparms.getNode();
879  if (!thissop) return getOutputs().entries();
880  exint result;
881  OP_Utils::evalOpParm(result, thissop, "outputs", cookparms.getCookTime(), 0);
882  return result;
883  }
884  int64 opOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
885  { return opinstOutputs_outputtype(cookparms, &_idx); }
886  int64 opinstOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
887  {
888  SOP_Node *thissop = cookparms.getNode();
889  if (!thissop) return (myOutputs(_idx[0]).outputtype);
890  int _parmidx[2-1];
891  _parmidx[1-1] = _idx[1-1] + 1;
892 
893  int64 result;
894  OP_Utils::evalOpParmInst(result, thissop, "outputtype#", _parmidx, cookparms.getCookTime(), 0, 2-1);
895  return (result);
896  }
898  { return opinstOutputs_outputpointattribute(cookparms, &_idx); }
900  {
901  SOP_Node *thissop = cookparms.getNode();
902  if (!thissop) return (myOutputs(_idx[0]).outputpointattribute);
903  int _parmidx[2-1];
904  _parmidx[1-1] = _idx[1-1] + 1;
905 
907  OP_Utils::evalOpParmInst(result, thissop, "outputpointattribute#", _parmidx, cookparms.getCookTime(), 0, 2-1);
908  return (result);
909  }
911  { return opinstOutputs_outputvolumename(cookparms, &_idx); }
913  {
914  SOP_Node *thissop = cookparms.getNode();
915  if (!thissop) return (myOutputs(_idx[0]).outputvolumename);
916  int _parmidx[2-1];
917  _parmidx[1-1] = _idx[1-1] + 1;
918 
920  OP_Utils::evalOpParmInst(result, thissop, "outputvolumename#", _parmidx, cookparms.getCookTime(), 0, 2-1);
921  return (result);
922  }
924  { return opinstOutputs_outputvolumeresolution(cookparms, &_idx); }
926  {
927  SOP_Node *thissop = cookparms.getNode();
928  if (!thissop) return (myOutputs(_idx[0]).outputvolumeresolution);
929  int _parmidx[2-1];
930  _parmidx[1-1] = _idx[1-1] + 1;
931 
933  OP_Utils::evalOpParmInst(result, thissop, "outputvolumeresolution#", _parmidx, cookparms.getCookTime(), 0, 2-1);
934  return (result);
935  }
936  int64 opOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
937  { return opinstOutputs_outputtuplesize(cookparms, &_idx); }
938  int64 opinstOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
939  {
940  SOP_Node *thissop = cookparms.getNode();
941  if (!thissop) return (myOutputs(_idx[0]).outputtuplesize);
942  int _parmidx[2-1];
943  _parmidx[1-1] = _idx[1-1] + 1;
944 
945  int64 result;
946  OP_Utils::evalOpParmInst(result, thissop, "outputtuplesize#", _parmidx, cookparms.getCookTime(), 0, 2-1);
947  return (result);
948  }
949 
950 
951 private:
952  int64 myBatch;
953  UT_Array<Inputs> myInputs;
954  UT_Array<Outputs> myOutputs;
955 
956 };
void loadFromOpSubclass(const LoadParms &loadparms) override
int64 opOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
type
Definition: core.h:556
UT_StringHolder opInputs_inputpointattribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void saveData(std::ostream &os, UT_Vector2D v)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
void setOutputs(const UT_Array< Outputs > &val)
static void loadData(UT_IStream &is, UT_Vector3D &v)
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:347
UT_StringHolder opOutputs_outputpointattribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void
Definition: png.h:1083
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
UT_StringHolder opinstInputs_inputpointattribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) 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
fpreal getTime() const
Definition: OP_Context.h:63
GLsizei const GLfloat * value
Definition: glcorearb.h:824
int64 opOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
UT_StringHolder opinstOutputs_outputpointattribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
Definition: OP_NodeParms.h:97
static void saveData(std::ostream &os, UT_Vector3D v)
static void saveData(std::ostream &os, UT_Vector4D v)
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:667
int64 exint
Definition: SYS_Types.h:125
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GLdouble s
Definition: glad.h:3009
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
UT_Vector3I opOutputs_outputvolumeresolution(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_Vector4D &v)
UT_Vector3I opinstOutputs_outputvolumeresolution(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
**But if you need a result
Definition: thread.h:622
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
UT_Vector3T< int64 > UT_Vector3I
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
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_Matrix3D v)
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector4.h:491
UT_StringHolder createString(const UT_Array< Outputs > &list) const
bool operator==(const SOP_MLRegressionProximityCoreParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
double fpreal64
Definition: SYS_Types.h:201
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector2.h:423
static void saveData(std::ostream &os, UT_Matrix2D v)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
const UT_Array< Outputs > & getOutputs() const
bool operator!=(const SOP_MLRegressionProximityCoreParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
exint length() const
UT_StringHolder opinstOutputs_outputvolumename(const SOP_NodeVerb::CookParms &cookparms, const 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
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector4.h:495
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:276
Batch opBatch(const SOP_NodeVerb::CookParms &cookparms) const
const OP_GraphProxy * graph() const
Definition: OP_NodeParms.h:94
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
static void loadData(UT_IStream &is, fpreal64 &v)
static void saveData(std::ostream &os, int64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void saveData(std::ostream &os, bool v)
UT_StringHolder opOutputs_outputvolumename(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void saveData(std::ostream &os, UT_Matrix4D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
static void loadData(UT_IStream &is, UT_Vector2I &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
static void loadData(UT_IStream &is, UT_Matrix3D &v)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
const char * getNestParmName(TempIndex fieldnum) const override
UT_StringHolder opinstInputs_inputvolumename(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
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)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:303
int64 opinstOutputs_outputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
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:655
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
ParmType getNestParmType(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, int64 &v)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void copyFrom(const OP_NodeParms *src) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
fpreal64 fpreal
Definition: SYS_Types.h:278
DEP_MicroNode * depnode() const
Definition: OP_NodeParms.h:99
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
UT_StringHolder opInputs_inputvolumename(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, UT_Vector4I &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
int64 opInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
virtual UT_StringHolder baseGetSignature() const
Definition: OP_NodeParms.h:294
#define SOP_API
Definition: SOP_API.h:10
exint opInputs(const SOP_NodeVerb::CookParms &cookparms) const
int64 opinstInputs_inputtype(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void saveData(std::ostream &os, UT_StringHolder s)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:372
SYS_FORCE_INLINE UT_StringHolder getToken(Batch enum_value)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
const char * findChar(int c) const
Definition: UT_String.h:1406
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
int64 opinstOutputs_outputtuplesize(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
UT_StringHolder createString(const UT_Array< Inputs > &list) const
GLboolean r
Definition: glcorearb.h:1222
exint opOutputs(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
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
static void loadData(UT_IStream &is, bool &v)
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector2.h:425
SYS_FORCE_INLINE bool isstring() const
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, UT_Vector2D &v)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
exint getNestNumParms(TempIndex idx) const override
GLenum src
Definition: glcorearb.h:1793
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:663