HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_SwitchIf.proto.h
Go to the documentation of this file.
1 /* Automagically Generated by generate_proto.py
2  * Do not Edit
3  */
4 #pragma once
5 
6 #include <SOP/SOP_NodeVerb.h>
7 #include <SOP/SOP_GraphProxy.h>
8 
9 #include <OP/OP_Utils.h>
10 #include <PRM/PRM_Parm.h>
11 #include <UT/UT_IStream.h>
12 #include <UT/UT_NTStreamUtil.h>
13 #include <UT/UT_Ramp.h>
14 #include <UT/UT_SharedPtr.h>
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_StringStream.h>
17 #include <UT/UT_VectorTypes.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 namespace SOP_SwitchIfEnums
24 {
25  enum class MergeCondition
26  {
27  ALL = 0,
28  ANY,
29  NONE,
30  MISSING
31  };
32  enum class TestInput
33  {
34  FIRST = 0,
35  SECOND,
36  SPARE
37  };
38  enum class Type
39  {
40  EXPR = 0,
41  ATTRIB,
42  COUNT,
43  ATTRIBVAL,
44  HASINPUT
45  };
46  enum class Attribtype
47  {
48  ALL = 0,
49  ANY,
50  NONE,
51  MISSING
52  };
53  enum class Attribowner
54  {
55  ANY = 0,
56  DETAIL,
57  PRIM,
58  POINT,
59  VERTEX,
61  };
62  enum class Attribvaltype
63  {
64  FLT = 0,
65  STR
66  };
67  enum class Attribfloatcomp
68  {
69  EQUAL = 0,
70  NEQUAL,
71  GREATER,
72  LESS,
73  GEQUAL,
74  LEQUAL
75  };
76  enum class Attribstringcomp
77  {
78  EQUAL = 0,
79  NEQUAL,
80  MATCH,
81  NOMATCH,
82  CONTAINS
83  };
84  enum class Counttype
85  {
86  POINTS = 0,
87  PRIMS,
88  VERTICES
89  };
90  enum class Countcomp
91  {
92  EQUAL = 0,
93  NEQUAL,
94  GREATER,
95  LESS,
96  GEQUAL,
97  LEQUAL
98  };
99 }
100 
101 
103 {
104 public:
105  static int version() { return 1; }
106  struct Tests
107  {
108  bool enable;
123 
124 
126  {
127  enable = true;
128  type = 0;
129  expr = 1;
130  attribtype = 0;
131  attribowner = 3;
132  attributes = ""_sh;
133  attribvaltype = 0;
134  attribfloatcomp = 0;
135  attribstringcomp = 0;
136  attribval = 0;
137  attribsval = ""_sh;
138  counttype = 0;
139  countgroup = ""_sh;
140  countcomp = 0;
141  countval = 0;
142 
143  }
144 
145  bool operator==(const Tests &src) const
146  {
147  if (enable != src.enable) return false;
148  if (type != src.type) return false;
149  if (expr != src.expr) return false;
150  if (attribtype != src.attribtype) return false;
151  if (attribowner != src.attribowner) return false;
152  if (attributes != src.attributes) return false;
153  if (attribvaltype != src.attribvaltype) return false;
154  if (attribfloatcomp != src.attribfloatcomp) return false;
155  if (attribstringcomp != src.attribstringcomp) return false;
156  if (attribval != src.attribval) return false;
157  if (attribsval != src.attribsval) return false;
158  if (counttype != src.counttype) return false;
159  if (countgroup != src.countgroup) return false;
160  if (countcomp != src.countcomp) return false;
161  if (countval != src.countval) return false;
162 
163  return true;
164  }
165  bool operator!=(const Tests &src) const
166  {
167  return !operator==(src);
168  }
169 
170  };
171 
173  {
175 
176  buf.strcat("[ ");
177  for (int i = 0; i < list.entries(); i++)
178  {
179  if (i)
180  buf.strcat(", ");
181  buf.strcat("( ");
182  buf.append("");
183  buf.appendSprintf("%s", (list(i).enable) ? "true" : "false");
184  buf.append(", ");
185  buf.appendSprintf("%d", (int) list(i).type);
186  buf.append(", ");
187  buf.appendSprintf("%d", (int) list(i).expr);
188  buf.append(", ");
189  buf.appendSprintf("%d", (int) list(i).attribtype);
190  buf.append(", ");
191  buf.appendSprintf("%d", (int) list(i).attribowner);
192  buf.append(", ");
193  { UT_String tmp; tmp = UT_StringWrap(list(i).attributes).makeQuotedString('"'); buf.strcat(tmp); }
194  buf.append(", ");
195  buf.appendSprintf("%d", (int) list(i).attribvaltype);
196  buf.append(", ");
197  buf.appendSprintf("%d", (int) list(i).attribfloatcomp);
198  buf.append(", ");
199  buf.appendSprintf("%d", (int) list(i).attribstringcomp);
200  buf.append(", ");
201  buf.appendSprintf("%f", (list(i).attribval));
202  buf.append(", ");
203  { UT_String tmp; tmp = UT_StringWrap(list(i).attribsval).makeQuotedString('"'); buf.strcat(tmp); }
204  buf.append(", ");
205  buf.appendSprintf("%d", (int) list(i).counttype);
206  buf.append(", ");
207  { UT_String tmp; tmp = UT_StringWrap(list(i).countgroup).makeQuotedString('"'); buf.strcat(tmp); }
208  buf.append(", ");
209  buf.appendSprintf("%d", (int) list(i).countcomp);
210  buf.append(", ");
211  buf.appendSprintf("%d", (int) list(i).countval);
212 
213  buf.strcat(" )");
214  }
215  buf.strcat(" ]");
216 
218  return result;
219  }
220 
222  {
223  myMergeCondition = 0;
224  myTestInput = 0;
225 
226  }
227 
228  explicit SOP_SwitchIfParms(const SOP_SwitchIfParms &) = default;
229 
230  ~SOP_SwitchIfParms() override {}
231 
232  bool operator==(const SOP_SwitchIfParms &src) const
233  {
234  if (myMergeCondition != src.myMergeCondition) return false;
235  if (myTestInput != src.myTestInput) return false;
236  if (myTests != src.myTests) return false;
237 
238  return true;
239  }
240  bool operator!=(const SOP_SwitchIfParms &src) const
241  {
242  return !operator==(src);
243  }
254 
255 
256 
257  void buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
258  {
259  myMergeCondition = 0;
260  if (true)
261  graph->evalOpParm(myMergeCondition, nodeidx, "mergecondition", time, 0);
262  myTestInput = 0;
263  if (true)
264  graph->evalOpParm(myTestInput, nodeidx, "testinput", time, 0);
265  if (true)
266  {
267  int64 length = 0;
268  graph->evalOpParm(length, nodeidx, "tests", time, 0);
269  myTests.entries(length);
270  for (exint i = 0; i < length; i++)
271  {
272  int parmidx = i+1;
273  auto && _curentry = myTests(i);
274  (void) _curentry;
275  myTests(i).enable = true;
276  if (true)
277  graph->evalOpParmInst(myTests(i).enable, nodeidx, "enable#", &parmidx, time, 0);
278  myTests(i).type = 0;
279  if (true && ( (!(((_curentry.enable==0)))) ) )
280  graph->evalOpParmInst(myTests(i).type, nodeidx, "type#", &parmidx, time, 0);
281  myTests(i).expr = 1;
282  if (true && ( (!(((_curentry.type!=0))||((_curentry.enable==0)))) ) )
283  graph->evalOpParmInst(myTests(i).expr, nodeidx, "expr#", &parmidx, time, 0);
284  myTests(i).attribtype = 0;
285  if (true && ( (!(((_curentry.type!=1))||((_curentry.enable==0)))) ) )
286  graph->evalOpParmInst(myTests(i).attribtype, nodeidx, "attribtype#", &parmidx, time, 0);
287  myTests(i).attribowner = 3;
288  if (true && ( (!(((_curentry.type!=1)&&(_curentry.type!=3))||((_curentry.enable==0)))) ) )
289  graph->evalOpParmInst(myTests(i).attribowner, nodeidx, "attribowner#", &parmidx, time, 0);
290  myTests(i).attributes = ""_sh;
291  if (true && ( (!(((_curentry.type!=1)&&(_curentry.type!=3))||((_curentry.enable==0)))) ) )
292  graph->evalOpParmInst(myTests(i).attributes, nodeidx, "attributes#", &parmidx, time, 0);
293  myTests(i).attribvaltype = 0;
294  if (true && ( (!(((_curentry.type!=3))||((_curentry.enable==0)))) ) )
295  graph->evalOpParmInst(myTests(i).attribvaltype, nodeidx, "attribvaltype#", &parmidx, time, 0);
296  myTests(i).attribfloatcomp = 0;
297  if (true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=0))||((_curentry.enable==0)))) ) )
298  graph->evalOpParmInst(myTests(i).attribfloatcomp, nodeidx, "attribfloatcomp#", &parmidx, time, 0);
299  myTests(i).attribstringcomp = 0;
300  if (true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=1))||((_curentry.enable==0)))) ) )
301  graph->evalOpParmInst(myTests(i).attribstringcomp, nodeidx, "attribstringcomp#", &parmidx, time, 0);
302  myTests(i).attribval = 0;
303  if (true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=0))||((_curentry.enable==0)))) ) )
304  graph->evalOpParmInst(myTests(i).attribval, nodeidx, "attribval#", &parmidx, time, 0);
305  myTests(i).attribsval = ""_sh;
306  if (true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=1))||((_curentry.enable==0)))) ) )
307  graph->evalOpParmInst(myTests(i).attribsval, nodeidx, "attribsval#", &parmidx, time, 0);
308  myTests(i).counttype = 0;
309  if (true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
310  graph->evalOpParmInst(myTests(i).counttype, nodeidx, "counttype#", &parmidx, time, 0);
311  myTests(i).countgroup = ""_sh;
312  if (true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
313  graph->evalOpParmInst(myTests(i).countgroup, nodeidx, "countgroup#", &parmidx, time, 0);
314  myTests(i).countcomp = 0;
315  if (true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
316  graph->evalOpParmInst(myTests(i).countcomp, nodeidx, "countcomp#", &parmidx, time, 0);
317  myTests(i).countval = 0;
318  if (true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
319  graph->evalOpParmInst(myTests(i).countval, nodeidx, "countval#", &parmidx, time, 0);
320 
321  }
322  }
323  else
324  myTests.clear();
325 
326  }
327 
328 
329  void loadFromOpSubclass(const LoadParms &loadparms) override
330  {
331  buildFromOp(loadparms.graph(), loadparms.nodeIdx(), loadparms.context().getTime(), loadparms.depnode());
332  }
333 
334 
335  void copyFrom(const SOP_NodeParms *src) override
336  {
337  *this = *((const SOP_SwitchIfParms *)src);
338  }
339 
340  template <typename T>
341  void
342  doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
343  {
344  if (idx.size() < 1)
345  return;
346  UT_ASSERT(idx.size() == instance.size()+1);
347  if (idx.size() != instance.size()+1)
348  return;
349  switch (idx[0])
350  {
351  case 0:
352  coerceValue(value, myMergeCondition);
353  break;
354  case 1:
355  coerceValue(value, myTestInput);
356  break;
357  case 2:
358  if (idx.size() == 1)
359  coerceValue(value, myTests.entries());
360  else if (instance[0] < myTests.entries())
361  {
362  auto && _data = myTests(instance[0]);
363  switch (idx[1])
364  {
365  case 0:
366  coerceValue(value, _data.enable);
367  break;
368  case 1:
369  coerceValue(value, _data.type);
370  break;
371  case 2:
372  coerceValue(value, _data.expr);
373  break;
374  case 3:
375  coerceValue(value, _data.attribtype);
376  break;
377  case 4:
378  coerceValue(value, _data.attribowner);
379  break;
380  case 5:
381  coerceValue(value, _data.attributes);
382  break;
383  case 6:
384  coerceValue(value, _data.attribvaltype);
385  break;
386  case 7:
387  coerceValue(value, _data.attribfloatcomp);
388  break;
389  case 8:
390  coerceValue(value, _data.attribstringcomp);
391  break;
392  case 9:
393  coerceValue(value, _data.attribval);
394  break;
395  case 10:
396  coerceValue(value, _data.attribsval);
397  break;
398  case 11:
399  coerceValue(value, _data.counttype);
400  break;
401  case 12:
402  coerceValue(value, _data.countgroup);
403  break;
404  case 13:
405  coerceValue(value, _data.countcomp);
406  break;
407  case 14:
408  coerceValue(value, _data.countval);
409  break;
410 
411  }
412  }
413  break;
414 
415  }
416  }
417 
418  void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
419  { doGetParmValue(idx, instance, value); }
420  void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
421  { doGetParmValue(idx, instance, value); }
422  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
423  { doGetParmValue(idx, instance, value); }
424  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
425  { doGetParmValue(idx, instance, value); }
426  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
427  { doGetParmValue(idx, instance, value); }
428  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
429  { doGetParmValue(idx, instance, value); }
430  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
431  { doGetParmValue(idx, instance, value); }
432  void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
433  { doGetParmValue(idx, instance, value); }
434  void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
435  { doGetParmValue(idx, instance, value); }
436  void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr<UT_Ramp> &value) const override
437  { doGetParmValue(idx, instance, value); }
438  void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
439  { doGetParmValue(idx, instance, value); }
440 
441  template <typename T>
442  void
443  doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
444  {
445  if (idx.size() < 1)
446  return;
447  UT_ASSERT(idx.size() == instance.size()+1);
448  if (idx.size() != instance.size()+1)
449  return;
450  switch (idx[0])
451  {
452  case 0:
453  coerceValue(myMergeCondition, value);
454  break;
455  case 1:
456  coerceValue(myTestInput, value);
457  break;
458  case 2:
459  if (idx.size() == 1)
460  {
461  exint newsize;
462  coerceValue(newsize, value);
463  myTests.setSize(newsize);
464  }
465  else
466  {
467  myTests.setSizeIfNeeded(instance[0]+1);
468  auto && _data = myTests(instance[0]);
469  switch (idx[1])
470  {
471  case 0:
472  coerceValue(_data.enable, value);
473  break;
474  case 1:
475  coerceValue(_data.type, value);
476  break;
477  case 2:
478  coerceValue(_data.expr, value);
479  break;
480  case 3:
481  coerceValue(_data.attribtype, value);
482  break;
483  case 4:
484  coerceValue(_data.attribowner, value);
485  break;
486  case 5:
487  coerceValue(_data.attributes, value);
488  break;
489  case 6:
490  coerceValue(_data.attribvaltype, value);
491  break;
492  case 7:
493  coerceValue(_data.attribfloatcomp, value);
494  break;
495  case 8:
496  coerceValue(_data.attribstringcomp, value);
497  break;
498  case 9:
499  coerceValue(_data.attribval, value);
500  break;
501  case 10:
502  coerceValue(_data.attribsval, value);
503  break;
504  case 11:
505  coerceValue(_data.counttype, value);
506  break;
507  case 12:
508  coerceValue(_data.countgroup, value);
509  break;
510  case 13:
511  coerceValue(_data.countcomp, value);
512  break;
513  case 14:
514  coerceValue(_data.countval, value);
515  break;
516 
517  }
518  }
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 3;
551  switch (idx[0])
552  {
553  case 2:
554  return 15;
555 
556  }
557  // Invalid
558  return 0;
559  }
560 
561  const char *getNestParmName(TempIndex fieldnum) const override
562  {
563  if (fieldnum.size() < 1)
564  return 0;
565  switch (fieldnum[0])
566  {
567  case 0:
568  return "mergecondition";
569  case 1:
570  return "testinput";
571  case 2:
572  if (fieldnum.size() == 1)
573  return "tests";
574  switch (fieldnum[1])
575  {
576  case 0:
577  return "enable#";
578  case 1:
579  return "type#";
580  case 2:
581  return "expr#";
582  case 3:
583  return "attribtype#";
584  case 4:
585  return "attribowner#";
586  case 5:
587  return "attributes#";
588  case 6:
589  return "attribvaltype#";
590  case 7:
591  return "attribfloatcomp#";
592  case 8:
593  return "attribstringcomp#";
594  case 9:
595  return "attribval#";
596  case 10:
597  return "attribsval#";
598  case 11:
599  return "counttype#";
600  case 12:
601  return "countgroup#";
602  case 13:
603  return "countcomp#";
604  case 14:
605  return "countval#";
606 
607  }
608  return 0;
609 
610  }
611  return 0;
612  }
613 
614  ParmType getNestParmType(TempIndex fieldnum) const override
615  {
616  if (fieldnum.size() < 1)
617  return PARM_UNSUPPORTED;
618  switch (fieldnum[0])
619  {
620  case 0:
621  return PARM_INTEGER;
622  case 1:
623  return PARM_INTEGER;
624  case 2:
625  if (fieldnum.size() == 1)
626  return PARM_MULTIPARM;
627  switch (fieldnum[1])
628  {
629  case 0:
630  return PARM_INTEGER;
631  case 1:
632  return PARM_INTEGER;
633  case 2:
634  return PARM_INTEGER;
635  case 3:
636  return PARM_INTEGER;
637  case 4:
638  return PARM_INTEGER;
639  case 5:
640  return PARM_STRING;
641  case 6:
642  return PARM_INTEGER;
643  case 7:
644  return PARM_INTEGER;
645  case 8:
646  return PARM_INTEGER;
647  case 9:
648  return PARM_FLOAT;
649  case 10:
650  return PARM_STRING;
651  case 11:
652  return PARM_INTEGER;
653  case 12:
654  return PARM_STRING;
655  case 13:
656  return PARM_INTEGER;
657  case 14:
658  return PARM_INTEGER;
659 
660  }
661  return PARM_UNSUPPORTED;
662 
663  }
664  return PARM_UNSUPPORTED;
665  }
666 
667  // Boiler plate to load individual types.
668  static void loadData(UT_IStream &is, int64 &v)
669  { is.bread(&v, 1); }
670  static void loadData(UT_IStream &is, bool &v)
671  { int64 iv; is.bread(&iv, 1); v = iv; }
672  static void loadData(UT_IStream &is, fpreal64 &v)
673  { is.bread<fpreal64>(&v, 1); }
674  static void loadData(UT_IStream &is, UT_Vector2D &v)
675  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
676  static void loadData(UT_IStream &is, UT_Vector3D &v)
677  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
678  is.bread<fpreal64>(&v.z(), 1); }
679  static void loadData(UT_IStream &is, UT_Vector4D &v)
680  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
681  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
682  static void loadData(UT_IStream &is, UT_Matrix2D &v)
683  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
684  static void loadData(UT_IStream &is, UT_Matrix3D &v)
685  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
686  static void loadData(UT_IStream &is, UT_Matrix4D &v)
687  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
688  static void loadData(UT_IStream &is, UT_Vector2I &v)
689  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
690  static void loadData(UT_IStream &is, UT_Vector3I &v)
691  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
692  is.bread<int64>(&v.z(), 1); }
693  static void loadData(UT_IStream &is, UT_Vector4I &v)
694  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
695  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
697  { is.bread(v); }
699  { UT_StringHolder rampdata;
700  loadData(is, rampdata);
701  if (rampdata.isstring())
702  {
703  v.reset(new UT_Ramp());
704  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
705  v->load(istr);
706  }
707  else v.reset();
708  }
711  loadData(is, data);
712  if (data.isstring())
713  {
714  // Find the data type.
715  const char *colon = UT_StringWrap(data).findChar(':');
716  if (colon)
717  {
718  int typelen = colon - data.buffer();
720  type.strncpy(data.buffer(), typelen);
721  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
722 
723  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
724  }
725  }
726  else v.reset();
727  }
728 
729  static void saveData(std::ostream &os, int64 v)
730  { UTwrite(os, &v); }
731  static void saveData(std::ostream &os, bool v)
732  { int64 iv = v; UTwrite(os, &iv); }
733  static void saveData(std::ostream &os, fpreal64 v)
734  { UTwrite<fpreal64>(os, &v); }
735  static void saveData(std::ostream &os, UT_Vector2D v)
736  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
737  static void saveData(std::ostream &os, UT_Vector3D v)
738  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
739  UTwrite<fpreal64>(os, &v.z()); }
740  static void saveData(std::ostream &os, UT_Vector4D v)
741  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
742  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
743  static void saveData(std::ostream &os, UT_Matrix2D v)
745  static void saveData(std::ostream &os, UT_Matrix3D v)
747  static void saveData(std::ostream &os, UT_Matrix4D v)
749  static void saveData(std::ostream &os, UT_StringHolder s)
750  { UT_StringWrap(s).saveBinary(os); }
751  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
753  UT_OStringStream ostr;
754  if (s) s->save(ostr);
755  result = ostr.str();
756  saveData(os, result);
757  }
758  static void saveData(std::ostream &os, PRM_DataItemHandle s)
760  UT_OStringStream ostr;
761  if (s)
762  {
763  ostr << s->getDataTypeToken();
764  ostr << ":";
765  s->saveBinary(ostr);
766  }
767  result = ostr.str();
768  saveData(os, result);
769  }
770 
771 
772  void save(std::ostream &os) const
773  {
774  int32 v = version();
775  UTwrite(os, &v);
776  saveData(os, myMergeCondition);
777  saveData(os, myTestInput);
778  {
779  int64 length = myTests.entries();
780  UTwrite(os, &length);
781  for (exint i = 0; i < length; i++)
782  {
783  saveData(os, myTests(i).enable);
784  saveData(os, myTests(i).type);
785  saveData(os, myTests(i).expr);
786  saveData(os, myTests(i).attribtype);
787  saveData(os, myTests(i).attribowner);
788  saveData(os, myTests(i).attributes);
789  saveData(os, myTests(i).attribvaltype);
790  saveData(os, myTests(i).attribfloatcomp);
791  saveData(os, myTests(i).attribstringcomp);
792  saveData(os, myTests(i).attribval);
793  saveData(os, myTests(i).attribsval);
794  saveData(os, myTests(i).counttype);
795  saveData(os, myTests(i).countgroup);
796  saveData(os, myTests(i).countcomp);
797  saveData(os, myTests(i).countval);
798 
799  }
800  }
801 
802  }
803 
804  bool load(UT_IStream &is)
805  {
806  int32 v;
807  is.bread(&v, 1);
808  if (version() != v)
809  {
810  // Fail incompatible versions
811  return false;
812  }
813  loadData(is, myMergeCondition);
814  loadData(is, myTestInput);
815  {
816  int64 length;
817  is.read(&length, 1);
818  myTests.entries(length);
819  for (exint i = 0; i < length; i++)
820  {
821  loadData(is, myTests(i).enable);
822  loadData(is, myTests(i).type);
823  loadData(is, myTests(i).expr);
824  loadData(is, myTests(i).attribtype);
825  loadData(is, myTests(i).attribowner);
826  loadData(is, myTests(i).attributes);
827  loadData(is, myTests(i).attribvaltype);
828  loadData(is, myTests(i).attribfloatcomp);
829  loadData(is, myTests(i).attribstringcomp);
830  loadData(is, myTests(i).attribval);
831  loadData(is, myTests(i).attribsval);
832  loadData(is, myTests(i).counttype);
833  loadData(is, myTests(i).countgroup);
834  loadData(is, myTests(i).countcomp);
835  loadData(is, myTests(i).countval);
836 
837  }
838  }
839 
840  return true;
841  }
842 
843  MergeCondition getMergeCondition() const { return MergeCondition(myMergeCondition); }
844  void setMergeCondition(MergeCondition val) { myMergeCondition = int64(val); }
846  {
847  SOP_Node *thissop = cookparms.getNode();
848  if (!thissop) return getMergeCondition();
849  int64 result;
850  OP_Utils::evalOpParm(result, thissop, "mergecondition", cookparms.getCookTime(), 0);
851  return MergeCondition(result);
852  }
853  TestInput getTestInput() const { return TestInput(myTestInput); }
854  void setTestInput(TestInput val) { myTestInput = int64(val); }
856  {
857  SOP_Node *thissop = cookparms.getNode();
858  if (!thissop) return getTestInput();
859  int64 result;
860  OP_Utils::evalOpParm(result, thissop, "testinput", cookparms.getCookTime(), 0);
861  return TestInput(result);
862  }
863  const UT_Array<Tests> &getTests() const { return myTests; }
864  void setTests(const UT_Array<Tests> &val) { myTests = val; }
865  exint opTests(const SOP_NodeVerb::CookParms &cookparms) const
866  {
867  SOP_Node *thissop = cookparms.getNode();
868  if (!thissop) return getTests().entries();
869  exint result;
870  OP_Utils::evalOpParm(result, thissop, "tests", cookparms.getCookTime(), 0);
871  return result;
872  }
873  bool opTests_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
874  {
875  SOP_Node *thissop = cookparms.getNode();
876  if (!thissop) return (myTests(_idx).enable);
877  int _parmidx = _idx + 1;
878  bool result;
879  OP_Utils::evalOpParmInst(result, thissop, "enable#", &_parmidx, cookparms.getCookTime(), 0);
880  return (result);
881  }
882  int64 opTests_type(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
883  {
884  SOP_Node *thissop = cookparms.getNode();
885  if (!thissop) return (myTests(_idx).type);
886  int _parmidx = _idx + 1;
887  int64 result;
888  OP_Utils::evalOpParmInst(result, thissop, "type#", &_parmidx, cookparms.getCookTime(), 0);
889  return (result);
890  }
891  int64 opTests_expr(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
892  {
893  SOP_Node *thissop = cookparms.getNode();
894  if (!thissop) return (myTests(_idx).expr);
895  int _parmidx = _idx + 1;
896  int64 result;
897  OP_Utils::evalOpParmInst(result, thissop, "expr#", &_parmidx, cookparms.getCookTime(), 0);
898  return (result);
899  }
901  {
902  SOP_Node *thissop = cookparms.getNode();
903  if (!thissop) return (myTests(_idx).attribtype);
904  int _parmidx = _idx + 1;
905  int64 result;
906  OP_Utils::evalOpParmInst(result, thissop, "attribtype#", &_parmidx, cookparms.getCookTime(), 0);
907  return (result);
908  }
910  {
911  SOP_Node *thissop = cookparms.getNode();
912  if (!thissop) return (myTests(_idx).attribowner);
913  int _parmidx = _idx + 1;
914  int64 result;
915  OP_Utils::evalOpParmInst(result, thissop, "attribowner#", &_parmidx, cookparms.getCookTime(), 0);
916  return (result);
917  }
919  {
920  SOP_Node *thissop = cookparms.getNode();
921  if (!thissop) return (myTests(_idx).attributes);
922  int _parmidx = _idx + 1;
924  OP_Utils::evalOpParmInst(result, thissop, "attributes#", &_parmidx, cookparms.getCookTime(), 0);
925  return (result);
926  }
928  {
929  SOP_Node *thissop = cookparms.getNode();
930  if (!thissop) return (myTests(_idx).attribvaltype);
931  int _parmidx = _idx + 1;
932  int64 result;
933  OP_Utils::evalOpParmInst(result, thissop, "attribvaltype#", &_parmidx, cookparms.getCookTime(), 0);
934  return (result);
935  }
937  {
938  SOP_Node *thissop = cookparms.getNode();
939  if (!thissop) return (myTests(_idx).attribfloatcomp);
940  int _parmidx = _idx + 1;
941  int64 result;
942  OP_Utils::evalOpParmInst(result, thissop, "attribfloatcomp#", &_parmidx, cookparms.getCookTime(), 0);
943  return (result);
944  }
946  {
947  SOP_Node *thissop = cookparms.getNode();
948  if (!thissop) return (myTests(_idx).attribstringcomp);
949  int _parmidx = _idx + 1;
950  int64 result;
951  OP_Utils::evalOpParmInst(result, thissop, "attribstringcomp#", &_parmidx, cookparms.getCookTime(), 0);
952  return (result);
953  }
955  {
956  SOP_Node *thissop = cookparms.getNode();
957  if (!thissop) return (myTests(_idx).attribval);
958  int _parmidx = _idx + 1;
960  OP_Utils::evalOpParmInst(result, thissop, "attribval#", &_parmidx, cookparms.getCookTime(), 0);
961  return (result);
962  }
964  {
965  SOP_Node *thissop = cookparms.getNode();
966  if (!thissop) return (myTests(_idx).attribsval);
967  int _parmidx = _idx + 1;
969  OP_Utils::evalOpParmInst(result, thissop, "attribsval#", &_parmidx, cookparms.getCookTime(), 0);
970  return (result);
971  }
972  int64 opTests_counttype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
973  {
974  SOP_Node *thissop = cookparms.getNode();
975  if (!thissop) return (myTests(_idx).counttype);
976  int _parmidx = _idx + 1;
977  int64 result;
978  OP_Utils::evalOpParmInst(result, thissop, "counttype#", &_parmidx, cookparms.getCookTime(), 0);
979  return (result);
980  }
982  {
983  SOP_Node *thissop = cookparms.getNode();
984  if (!thissop) return (myTests(_idx).countgroup);
985  int _parmidx = _idx + 1;
987  OP_Utils::evalOpParmInst(result, thissop, "countgroup#", &_parmidx, cookparms.getCookTime(), 0);
988  return (result);
989  }
990  int64 opTests_countcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
991  {
992  SOP_Node *thissop = cookparms.getNode();
993  if (!thissop) return (myTests(_idx).countcomp);
994  int _parmidx = _idx + 1;
995  int64 result;
996  OP_Utils::evalOpParmInst(result, thissop, "countcomp#", &_parmidx, cookparms.getCookTime(), 0);
997  return (result);
998  }
999  int64 opTests_countval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
1000  {
1001  SOP_Node *thissop = cookparms.getNode();
1002  if (!thissop) return (myTests(_idx).countval);
1003  int _parmidx = _idx + 1;
1004  int64 result;
1005  OP_Utils::evalOpParmInst(result, thissop, "countval#", &_parmidx, cookparms.getCookTime(), 0);
1006  return (result);
1007  }
1008 
1009 
1010 private:
1011  int64 myMergeCondition;
1012  int64 myTestInput;
1013  UT_Array<Tests> myTests;
1014 
1015 };
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
GLdouble s
Definition: glew.h:1390
const char * getNestParmName(TempIndex fieldnum) const override
exint nodeIdx() const
Definition: SOP_NodeVerb.h:114
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
GLenum src
Definition: glew.h:2410
int int32
Definition: SYS_Types.h:39
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:640
static void loadData(UT_IStream &is, UT_StringHolder &v)
exint getNestNumParms(TempIndex idx) const override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
exint opTests(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
int64 opTests_countcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, int *inst, fpreal time, DEP_MicroNode *depnode) const =0
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, bool &v)
GT_API const UT_StringHolder time
fpreal getTime() const
Definition: OP_Context.h:60
GLuint const GLfloat * val
Definition: glew.h:2794
bool operator==(const Tests &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
int64 exint
Definition: SYS_Types.h:125
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
Definition: SOP_NodeVerb.h:113
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_Vector3D &v)
UT_StringHolder opTests_attribsval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
const GLdouble * v
Definition: glew.h:1391
const UT_Array< Tests > & getTests() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
int64 opTests_attribtype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
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 buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
bool operator==(const SOP_SwitchIfParms &src) const
UT_StringHolder opTests_attributes(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void loadFromOpSubclass(const LoadParms &loadparms) override
double fpreal64
Definition: SYS_Types.h:201
UT_StringHolder createString(const UT_Array< Tests > &list) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void saveData(std::ostream &os, UT_Vector2D v)
static void saveData(std::ostream &os, UT_Matrix3D v)
int64 opTests_attribfloatcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool operator!=(const SOP_SwitchIfParms &src) const
MergeCondition getMergeCondition() const
void setMergeCondition(MergeCondition val)
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
exint length() const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:284
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
static void saveData(std::ostream &os, UT_Vector3D v)
int64 opTests_type(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void
Definition: png.h:1083
int64 opTests_counttype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
const GLfloat * c
Definition: glew.h:16296
GLuint GLsizei GLsizei * length
Definition: glew.h:1825
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
long long int64
Definition: SYS_Types.h:116
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static void saveData(std::ostream &os, UT_Vector4D v)
MergeCondition opMergeCondition(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
void setTests(const UT_Array< Tests > &val)
TestInput getTestInput() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
SYS_FORCE_INLINE void strcat(const char *src)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void saveData(std::ostream &os, fpreal64 v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
UT_StringHolder opTests_countgroup(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opTests_attribstringcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:121
int64 opTests_countval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool opTests_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:460
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
int64 opTests_attribowner(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opTests_attribvaltype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
fpreal64 opTests_attribval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
TestInput opTestInput(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, bool v)
ParmType getNestParmType(TempIndex fieldnum) const override
bool operator!=(const Tests &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setTestInput(TestInput val)
static void saveData(std::ostream &os, int64 v)
fpreal64 fpreal
Definition: SYS_Types.h:277
bool load(UT_IStream &is)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
SYS_FORCE_INLINE void append(char character)
static void saveData(std::ostream &os, UT_Matrix4D v)
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
~SOP_SwitchIfParms() override
static void saveData(std::ostream &os, UT_StringHolder s)
#define SOP_API
Definition: SOP_API.h:10
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
static void loadData(UT_IStream &is, UT_Vector2I &v)
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:654
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void copyFrom(const SOP_NodeParms *src) override
GLuint64EXT * result
Definition: glew.h:14007
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void save(std::ostream &os) const
const char * findChar(int c) const
Definition: UT_String.h:1367
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, int64 &v)
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
GLsizei const GLfloat * value
Definition: glew.h:1849
GLboolean enable
Definition: glew.h:2745
const OP_Context & context() const
Definition: SOP_NodeVerb.h:119
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
int64 opTests_expr(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, UT_Matrix2D &v)
SYS_FORCE_INLINE bool isstring() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
type
Definition: core.h:528