HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GAS_OpenCLParms.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 <GAS/GAS_API.h>
7 #include <SIM/SIM_Query.h>
8 #include <OP/OP_Utils.h>
9 #include <PRM/PRM_Parm.h>
10 #include <UT/UT_IStream.h>
11 #include <UT/UT_NTStreamUtil.h>
12 #include <UT/UT_Ramp.h>
13 #include <UT/UT_SharedPtr.h>
14 #include <UT/UT_StringHolder.h>
15 #include <UT/UT_StringStream.h>
16 #include <UT/UT_VectorTypes.h>
17 #include <UT/UT_EnvControl.h>
18 #include <SYS/SYS_Types.h>
19 
20 using namespace UT::Literal;
21 
22 class DEP_MicroNode;
23 
25 {
26 public:
27  static int version() { return 9; }
28  struct Bindings
29  {
47  bool resolution;
48  bool voxelsize;
52  bool readable;
53  bool writeable;
54  bool optional;
59 
60 
62  {
63  name = ""_sh;
64  type = 0;
65  intval = 0;
66  fval = 0;
67  v3val = 0;
68  v4val = 0;
69  timescale = 0;
70  fieldname = ""_sh;
71  fieldoffsets = false;
72  ramp = UT_SharedPtr<UT_Ramp>(0);
73  rampsize = 0;
74  geometry = ""_sh;
75  attribute = ""_sh;
76  attribclass = 0;
77  attribtype = 0;
78  attribsize = 0;
79  volume = ""_sh;
80  resolution = false;
81  voxelsize = false;
82  xformtoworld = false;
83  xformtovoxel = false;
84  precision = 0;
85  readable = false;
86  writeable = false;
87  optional = false;
88  dataname = ""_sh;
89  optionname = ""_sh;
90  optiontype = 0;
91  optionsize = 0;
92 
93  }
94 
95  bool operator==(const Bindings &src) const
96  {
97  if (name != src.name) return false;
98  if (type != src.type) return false;
99  if (intval != src.intval) return false;
100  if (fval != src.fval) return false;
101  if (v3val != src.v3val) return false;
102  if (v4val != src.v4val) return false;
103  if (timescale != src.timescale) return false;
104  if (fieldname != src.fieldname) return false;
105  if (fieldoffsets != src.fieldoffsets) return false;
106  if (ramp != src.ramp)
107  { if (!ramp || !src.ramp || !(*ramp == *src.ramp)) return false; }
108  if (rampsize != src.rampsize) return false;
109  if (geometry != src.geometry) return false;
110  if (attribute != src.attribute) return false;
111  if (attribclass != src.attribclass) return false;
112  if (attribtype != src.attribtype) return false;
113  if (attribsize != src.attribsize) return false;
114  if (volume != src.volume) return false;
115  if (resolution != src.resolution) return false;
116  if (voxelsize != src.voxelsize) return false;
117  if (xformtoworld != src.xformtoworld) return false;
118  if (xformtovoxel != src.xformtovoxel) return false;
119  if (precision != src.precision) return false;
120  if (readable != src.readable) return false;
121  if (writeable != src.writeable) return false;
122  if (optional != src.optional) return false;
123  if (dataname != src.dataname) return false;
124  if (optionname != src.optionname) return false;
125  if (optiontype != src.optiontype) return false;
126  if (optionsize != src.optionsize) return false;
127 
128  return true;
129  }
130  bool operator!=(const Bindings &src) const
131  {
132  return !operator==(src);
133  }
134 
135  };
136 
138  {
140 
141  buf.strcat("[ ");
142  for (int i = 0; i < list.entries(); i++)
143  {
144  if (i)
145  buf.strcat(", ");
146  buf.strcat("( ");
147  buf.append("");
148  { UT_String tmp; tmp = UT_StringWrap(list(i).name).makeQuotedString('"'); buf.strcat(tmp); }
149  buf.append(", ");
150  buf.appendSprintf("%d", (int) list(i).type);
151  buf.append(", ");
152  buf.appendSprintf("%d", (int) list(i).intval);
153  buf.append(", ");
154  buf.appendSprintf("%f", (list(i).fval));
155  buf.append(", ");
156  buf.appendSprintf("(%f, %f, %f)", list(i).v3val.x(), list(i).v3val.y(), list(i).v3val.z());
157  buf.append(", ");
158  buf.appendSprintf("(%f, %f, %f, %f)", list(i).v4val.x(), list(i).v4val.y(), list(i).v4val.z(), list(i).v4val.w());
159  buf.append(", ");
160  buf.appendSprintf("%d", (int) list(i).timescale);
161  buf.append(", ");
162  { UT_String tmp; tmp = UT_StringWrap(list(i).fieldname).makeQuotedString('"'); buf.strcat(tmp); }
163  buf.append(", ");
164  buf.appendSprintf("%s", (list(i).fieldoffsets) ? "true" : "false");
165  buf.append(", ");
166  if (list(i).ramp)
167  {
168  UT_OStringStream os;
169  UT_String tmp;
170  list(i).ramp->save(os);
171  tmp = UT_StringWrap(os.str().buffer()).makeQuotedString('"');
172  buf.strcat(tmp);
173  }
174  else buf.strcat("""");
175  buf.append(", ");
176  buf.appendSprintf("%d", (int) list(i).rampsize);
177  buf.append(", ");
178  { UT_String tmp; tmp = UT_StringWrap(list(i).geometry).makeQuotedString('"'); buf.strcat(tmp); }
179  buf.append(", ");
180  { UT_String tmp; tmp = UT_StringWrap(list(i).attribute).makeQuotedString('"'); buf.strcat(tmp); }
181  buf.append(", ");
182  buf.appendSprintf("%d", (int) list(i).attribclass);
183  buf.append(", ");
184  buf.appendSprintf("%d", (int) list(i).attribtype);
185  buf.append(", ");
186  buf.appendSprintf("%d", (int) list(i).attribsize);
187  buf.append(", ");
188  { UT_String tmp; tmp = UT_StringWrap(list(i).volume).makeQuotedString('"'); buf.strcat(tmp); }
189  buf.append(", ");
190  buf.appendSprintf("%s", (list(i).resolution) ? "true" : "false");
191  buf.append(", ");
192  buf.appendSprintf("%s", (list(i).voxelsize) ? "true" : "false");
193  buf.append(", ");
194  buf.appendSprintf("%s", (list(i).xformtoworld) ? "true" : "false");
195  buf.append(", ");
196  buf.appendSprintf("%s", (list(i).xformtovoxel) ? "true" : "false");
197  buf.append(", ");
198  buf.appendSprintf("%d", (int) list(i).precision);
199  buf.append(", ");
200  buf.appendSprintf("%s", (list(i).readable) ? "true" : "false");
201  buf.append(", ");
202  buf.appendSprintf("%s", (list(i).writeable) ? "true" : "false");
203  buf.append(", ");
204  buf.appendSprintf("%s", (list(i).optional) ? "true" : "false");
205  buf.append(", ");
206  { UT_String tmp; tmp = UT_StringWrap(list(i).dataname).makeQuotedString('"'); buf.strcat(tmp); }
207  buf.append(", ");
208  { UT_String tmp; tmp = UT_StringWrap(list(i).optionname).makeQuotedString('"'); buf.strcat(tmp); }
209  buf.append(", ");
210  buf.appendSprintf("%d", (int) list(i).optiontype);
211  buf.append(", ");
212  buf.appendSprintf("%d", (int) list(i).optionsize);
213 
214  buf.strcat(" )");
215  }
216  buf.strcat(" ]");
217 
219  return result;
220  }
221 
223  {
224  myRunOver = 0;
225  myAlign = false;
226  myUseCode = false;
227  myKernelName = ""_sh;
228  myKernelFile = ""_sh;
229  myKernelCode = ""_sh;
230  myKernelOptions = ""_sh;
231  myOptionAttribute = ""_sh;
232  myRecompile = false;
233  myOrigin = false;
234  mySize = false;
235  myVoxelSize = false;
236  myTime = false;
237  myFrame = false;
238  myTimeInc = false;
239  myFlushAttributes = false;
240  myFinish = false;
241  myTimeScale = 0;
242  myTimeMethod = 0;
243  myXNoise = false;
244  myWorksetsGeometry = ""_sh;
245  myWorksetsBeginAttr = ""_sh;
246  myWorksetsLengthAttr = ""_sh;
247  myWarnMissing = false;
248  myErrorMismatchedPoint = false;
249  myErrorMismatchedPrim = false;
250  mySingleWorkgroup = 0;
251  myPrecision = 0;
252 
253  }
254 
255  explicit GAS_OpenCLParms(const GAS_OpenCLParms &) = default;
256 
258 
259  bool operator==(const GAS_OpenCLParms &src) const
260  {
261  if (myRunOver != src.myRunOver) return false;
262  if (myAlign != src.myAlign) return false;
263  if (myUseCode != src.myUseCode) return false;
264  if (myKernelName != src.myKernelName) return false;
265  if (myKernelFile != src.myKernelFile) return false;
266  if (myKernelCode != src.myKernelCode) return false;
267  if (myKernelOptions != src.myKernelOptions) return false;
268  if (myOptionAttribute != src.myOptionAttribute) return false;
269  if (myRecompile != src.myRecompile) return false;
270  if (myOrigin != src.myOrigin) return false;
271  if (mySize != src.mySize) return false;
272  if (myVoxelSize != src.myVoxelSize) return false;
273  if (myTime != src.myTime) return false;
274  if (myFrame != src.myFrame) return false;
275  if (myTimeInc != src.myTimeInc) return false;
276  if (myFlushAttributes != src.myFlushAttributes) return false;
277  if (myFinish != src.myFinish) return false;
278  if (myTimeScale != src.myTimeScale) return false;
279  if (myTimeMethod != src.myTimeMethod) return false;
280  if (myXNoise != src.myXNoise) return false;
281  if (myWorksetsGeometry != src.myWorksetsGeometry) return false;
282  if (myWorksetsBeginAttr != src.myWorksetsBeginAttr) return false;
283  if (myWorksetsLengthAttr != src.myWorksetsLengthAttr) return false;
284  if (myWarnMissing != src.myWarnMissing) return false;
285  if (myErrorMismatchedPoint != src.myErrorMismatchedPoint) return false;
286  if (myErrorMismatchedPrim != src.myErrorMismatchedPrim) return false;
287  if (mySingleWorkgroup != src.mySingleWorkgroup) return false;
288  if (myPrecision != src.myPrecision) return false;
289  if (myBindings != src.myBindings) return false;
290 
291  return true;
292  }
293  bool operator!=(const GAS_OpenCLParms &src) const
294  {
295  return !operator==(src);
296  }
297 
298 
299  class Query : public SIM_Query
300  {
301  public:
302  explicit Query(const SIM_Data *owner, const GAS_OpenCLParms &parms)
303  : SIM_Query(owner)
304  , myParms(parms)
305  { }
306  ~Query() override {}
307 
308  protected:
309  bool isMyRecord(const char *recordtype) const
310  { return !strcmp(recordtype, "Params"); }
311 
312  int getNumRecordTypesSubclass() const override { return 1; }
313  const char *getRecordTypeNameSubclass(int recordtypenum) const override
314  {
315  if (recordtypenum == 0) return "Params";
316  return 0;
317  }
318  int getNumRecordsSubclass(const char *recordtype) const override
319  {
320  if (isMyRecord(recordtype)) return 1;
321  return 0;
322  }
323  int getNumFieldsSubclass(const char *recordtype) const override
324  {
325  if (isMyRecord(recordtype))
326  return 29;
327  return 0;
328  }
329 
330  const char *getFieldNameSubclass(const char *recordtype,
331  int fieldnum) const override
332  {
333  if (!isMyRecord(recordtype))
334  return 0;
335 
336  switch (fieldnum)
337  {
338  case 0:
339  return "runover";
340  case 1:
341  return "align";
342  case 2:
343  return "usecode";
344  case 3:
345  return "kernelname";
346  case 4:
347  return "kernelfile";
348  case 5:
349  return "kernelcode";
350  case 6:
351  return "kerneloptions";
352  case 7:
353  return "kerneloptionattrib";
354  case 8:
355  return "recompile";
356  case 9:
357  return "origin";
358  case 10:
359  return "size";
360  case 11:
361  return "voxelsize";
362  case 12:
363  return "time";
364  case 13:
365  return "frame";
366  case 14:
367  return "timeinc";
368  case 15:
369  return "flushattrib";
370  case 16:
371  return "finish";
372  case 17:
373  return "timescale";
374  case 18:
375  return "timemethod";
376  case 19:
377  return "xnoise";
378  case 20:
379  return "worksets_geo";
380  case 21:
381  return "worksets_begin";
382  case 22:
383  return "worksets_length";
384  case 23:
385  return "warnmissing";
386  case 24:
387  return "errormismatchedpoint";
388  case 25:
389  return "errormismatchedprim";
390  case 26:
391  return "singleworkgroup";
392  case 27:
393  return "precision";
394  case 28:
395  return "bindings";
396 
397  }
398  return 0;
399  }
400  UT_OptionType getFieldTypeSubclass(const char *recordtype,
401  int fieldnum) const override
402  {
403  if (!isMyRecord(recordtype))
404  return UT_OPTION_INVALID;
405 
406  switch (fieldnum)
407  {
408  case 0:
409  return UT_OPTION_INT;
410  case 1:
411  return UT_OPTION_BOOL;
412  case 2:
413  return UT_OPTION_BOOL;
414  case 3:
415  return UT_OPTION_STRING;
416  case 4:
417  return UT_OPTION_STRING;
418  case 5:
419  return UT_OPTION_STRING;
420  case 6:
421  return UT_OPTION_STRING;
422  case 7:
423  return UT_OPTION_STRING;
424  case 8:
425  return UT_OPTION_BOOL;
426  case 9:
427  return UT_OPTION_BOOL;
428  case 10:
429  return UT_OPTION_BOOL;
430  case 11:
431  return UT_OPTION_BOOL;
432  case 12:
433  return UT_OPTION_BOOL;
434  case 13:
435  return UT_OPTION_BOOL;
436  case 14:
437  return UT_OPTION_BOOL;
438  case 15:
439  return UT_OPTION_BOOL;
440  case 16:
441  return UT_OPTION_BOOL;
442  case 17:
443  return UT_OPTION_FPREAL;
444  case 18:
445  return UT_OPTION_INT;
446  case 19:
447  return UT_OPTION_BOOL;
448  case 20:
449  return UT_OPTION_STRING;
450  case 21:
451  return UT_OPTION_STRING;
452  case 22:
453  return UT_OPTION_STRING;
454  case 23:
455  return UT_OPTION_BOOL;
456  case 24:
457  return UT_OPTION_BOOL;
458  case 25:
459  return UT_OPTION_BOOL;
460  case 26:
461  return UT_OPTION_INT;
462  case 27:
463  return UT_OPTION_INT;
464  case 28:
465  return UT_OPTION_STRING;
466 
467  }
468  return UT_OPTION_INVALID;
469  }
470 
471  bool getFieldRawSubclass(const char *recordtype,
472  int recordnum,
473  const char *fieldname,
474  UT_OptionEntryPtr &result) const override
475  {
476  if (!isMyRecord(recordtype))
477  return false;
478  if (recordnum != 0)
479  return false;
480  // This is less optimal, but if we are in SIM_Query
481  // land we have already given up on performance.
482  if (!strcmp(fieldname, "runover"))
483  {
484  result = UTmakeUnique<UT_OptionInt>(myParms.myRunOver);
485  return true;
486  }
487  if (!strcmp(fieldname, "align"))
488  {
489  result = UTmakeUnique<UT_OptionBool>(myParms.myAlign);
490  return true;
491  }
492  if (!strcmp(fieldname, "usecode"))
493  {
494  result = UTmakeUnique<UT_OptionBool>(myParms.myUseCode);
495  return true;
496  }
497  if (!strcmp(fieldname, "kernelname"))
498  {
499  result = UTmakeUnique<UT_OptionString>(myParms.myKernelName);
500  return true;
501  }
502  if (!strcmp(fieldname, "kernelfile"))
503  {
504  result = UTmakeUnique<UT_OptionString>(myParms.myKernelFile);
505  return true;
506  }
507  if (!strcmp(fieldname, "kernelcode"))
508  {
509  result = UTmakeUnique<UT_OptionString>(myParms.myKernelCode);
510  return true;
511  }
512  if (!strcmp(fieldname, "kerneloptions"))
513  {
514  result = UTmakeUnique<UT_OptionString>(myParms.myKernelOptions);
515  return true;
516  }
517  if (!strcmp(fieldname, "kerneloptionattrib"))
518  {
519  result = UTmakeUnique<UT_OptionString>(myParms.myOptionAttribute);
520  return true;
521  }
522  if (!strcmp(fieldname, "recompile"))
523  {
524  result = UTmakeUnique<UT_OptionBool>(myParms.myRecompile);
525  return true;
526  }
527  if (!strcmp(fieldname, "origin"))
528  {
529  result = UTmakeUnique<UT_OptionBool>(myParms.myOrigin);
530  return true;
531  }
532  if (!strcmp(fieldname, "size"))
533  {
534  result = UTmakeUnique<UT_OptionBool>(myParms.mySize);
535  return true;
536  }
537  if (!strcmp(fieldname, "voxelsize"))
538  {
539  result = UTmakeUnique<UT_OptionBool>(myParms.myVoxelSize);
540  return true;
541  }
542  if (!strcmp(fieldname, "time"))
543  {
544  result = UTmakeUnique<UT_OptionBool>(myParms.myTime);
545  return true;
546  }
547  if (!strcmp(fieldname, "frame"))
548  {
549  result = UTmakeUnique<UT_OptionBool>(myParms.myFrame);
550  return true;
551  }
552  if (!strcmp(fieldname, "timeinc"))
553  {
554  result = UTmakeUnique<UT_OptionBool>(myParms.myTimeInc);
555  return true;
556  }
557  if (!strcmp(fieldname, "flushattrib"))
558  {
559  result = UTmakeUnique<UT_OptionBool>(myParms.myFlushAttributes);
560  return true;
561  }
562  if (!strcmp(fieldname, "finish"))
563  {
564  result = UTmakeUnique<UT_OptionBool>(myParms.myFinish);
565  return true;
566  }
567  if (!strcmp(fieldname, "timescale"))
568  {
569  result = UTmakeUnique<UT_OptionFpreal>(myParms.myTimeScale);
570  return true;
571  }
572  if (!strcmp(fieldname, "timemethod"))
573  {
574  result = UTmakeUnique<UT_OptionInt>(myParms.myTimeMethod);
575  return true;
576  }
577  if (!strcmp(fieldname, "xnoise"))
578  {
579  result = UTmakeUnique<UT_OptionBool>(myParms.myXNoise);
580  return true;
581  }
582  if (!strcmp(fieldname, "worksets_geo"))
583  {
584  result = UTmakeUnique<UT_OptionString>(myParms.myWorksetsGeometry);
585  return true;
586  }
587  if (!strcmp(fieldname, "worksets_begin"))
588  {
589  result = UTmakeUnique<UT_OptionString>(myParms.myWorksetsBeginAttr);
590  return true;
591  }
592  if (!strcmp(fieldname, "worksets_length"))
593  {
594  result = UTmakeUnique<UT_OptionString>(myParms.myWorksetsLengthAttr);
595  return true;
596  }
597  if (!strcmp(fieldname, "warnmissing"))
598  {
599  result = UTmakeUnique<UT_OptionBool>(myParms.myWarnMissing);
600  return true;
601  }
602  if (!strcmp(fieldname, "errormismatchedpoint"))
603  {
604  result = UTmakeUnique<UT_OptionBool>(myParms.myErrorMismatchedPoint);
605  return true;
606  }
607  if (!strcmp(fieldname, "errormismatchedprim"))
608  {
609  result = UTmakeUnique<UT_OptionBool>(myParms.myErrorMismatchedPrim);
610  return true;
611  }
612  if (!strcmp(fieldname, "singleworkgroup"))
613  {
614  result = UTmakeUnique<UT_OptionInt>(myParms.mySingleWorkgroup);
615  return true;
616  }
617  if (!strcmp(fieldname, "precision"))
618  {
619  result = UTmakeUnique<UT_OptionInt>(myParms.myPrecision);
620  return true;
621  }
622  if (!strcmp(fieldname, "bindings"))
623  {
624  result = UTmakeUnique<UT_OptionString>(myParms.createString(myParms.myBindings));
625  return true;
626  }
627 
628  // Failed to find
629  return false;
630  }
631 
633  };
634 
635  SIM_Query *createQueryObject(const SIM_Data *owner) const
636  { return new Query(owner, *this); }
637 
638 
639 
640 
641  // Boiler plate to load individual types.
642  static void loadData(UT_IStream &is, int64 &v)
643  { is.bread(&v, 1); }
644  static void loadData(UT_IStream &is, bool &v)
645  { int64 iv; is.bread(&iv, 1); v = iv; }
646  static void loadData(UT_IStream &is, fpreal64 &v)
647  { is.bread<fpreal64>(&v, 1); }
648  static void loadData(UT_IStream &is, UT_Vector2D &v)
649  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
650  static void loadData(UT_IStream &is, UT_Vector3D &v)
651  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
652  is.bread<fpreal64>(&v.z(), 1); }
653  static void loadData(UT_IStream &is, UT_Vector4D &v)
654  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
655  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
656  static void loadData(UT_IStream &is, UT_Matrix2D &v)
657  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
658  static void loadData(UT_IStream &is, UT_Matrix3D &v)
659  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
660  static void loadData(UT_IStream &is, UT_Matrix4D &v)
661  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
662  static void loadData(UT_IStream &is, UT_Vector2I &v)
663  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
664  static void loadData(UT_IStream &is, UT_Vector3I &v)
665  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
666  is.bread<int64>(&v.z(), 1); }
667  static void loadData(UT_IStream &is, UT_Vector4I &v)
668  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
669  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
671  { is.bread(v); }
673  { UT_StringHolder rampdata;
674  loadData(is, rampdata);
675  if (rampdata.isstring())
676  {
677  v.reset(new UT_Ramp());
678  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
679  v->load(istr);
680  }
681  else v.reset();
682  }
685  loadData(is, data);
686  if (data.isstring())
687  {
688  // Find the data type.
689  const char *colon = UT_StringWrap(data).findChar(':');
690  if (colon)
691  {
692  int typelen = colon - data.buffer();
694  type.strncpy(data.buffer(), typelen);
695  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
696 
697  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
698  }
699  }
700  else v.reset();
701  }
702 
703  static void saveData(std::ostream &os, int64 v)
704  { UTwrite(os, &v); }
705  static void saveData(std::ostream &os, bool v)
706  { int64 iv = v; UTwrite(os, &iv); }
707  static void saveData(std::ostream &os, fpreal64 v)
708  { UTwrite<fpreal64>(os, &v); }
709  static void saveData(std::ostream &os, UT_Vector2D v)
710  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
711  static void saveData(std::ostream &os, UT_Vector3D v)
712  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
713  UTwrite<fpreal64>(os, &v.z()); }
714  static void saveData(std::ostream &os, UT_Vector4D v)
715  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
716  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
717  static void saveData(std::ostream &os, UT_Matrix2D v)
719  static void saveData(std::ostream &os, UT_Matrix3D v)
721  static void saveData(std::ostream &os, UT_Matrix4D v)
723  static void saveData(std::ostream &os, UT_StringHolder s)
724  { UT_StringWrap(s).saveBinary(os); }
725  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
727  UT_OStringStream ostr;
728  if (s) s->save(ostr);
729  result = ostr.str();
730  saveData(os, result);
731  }
732  static void saveData(std::ostream &os, PRM_DataItemHandle s)
734  UT_OStringStream ostr;
735  if (s)
736  {
737  ostr << s->getDataTypeToken();
738  ostr << ":";
739  s->saveBinary(ostr);
740  }
741  result = ostr.str();
742  saveData(os, result);
743  }
744 
745 
746  void save(std::ostream &os) const
747  {
748  int32 v = version();
749  UTwrite(os, &v);
750  saveData(os, myRunOver);
751  saveData(os, myAlign);
752  saveData(os, myUseCode);
753  saveData(os, myKernelName);
754  saveData(os, myKernelFile);
755  saveData(os, myKernelCode);
756  saveData(os, myKernelOptions);
757  saveData(os, myOptionAttribute);
758  saveData(os, myRecompile);
759  saveData(os, myOrigin);
760  saveData(os, mySize);
761  saveData(os, myVoxelSize);
762  saveData(os, myTime);
763  saveData(os, myFrame);
764  saveData(os, myTimeInc);
765  saveData(os, myFlushAttributes);
766  saveData(os, myFinish);
767  saveData(os, myTimeScale);
768  saveData(os, myTimeMethod);
769  saveData(os, myXNoise);
770  saveData(os, myWorksetsGeometry);
771  saveData(os, myWorksetsBeginAttr);
772  saveData(os, myWorksetsLengthAttr);
773  saveData(os, myWarnMissing);
774  saveData(os, myErrorMismatchedPoint);
775  saveData(os, myErrorMismatchedPrim);
776  saveData(os, mySingleWorkgroup);
777  saveData(os, myPrecision);
778  {
779  int64 length = myBindings.entries();
780  UTwrite(os, &length);
781  for (exint i = 0; i < length; i++)
782  {
783  auto && _curentry = myBindings(i);
784  (void) _curentry;
785  saveData(os, _curentry.name);
786  saveData(os, _curentry.type);
787  saveData(os, _curentry.intval);
788  saveData(os, _curentry.fval);
789  saveData(os, _curentry.v3val);
790  saveData(os, _curentry.v4val);
791  saveData(os, _curentry.timescale);
792  saveData(os, _curentry.fieldname);
793  saveData(os, _curentry.fieldoffsets);
794  saveData(os, _curentry.ramp);
795  saveData(os, _curentry.rampsize);
796  saveData(os, _curentry.geometry);
797  saveData(os, _curentry.attribute);
798  saveData(os, _curentry.attribclass);
799  saveData(os, _curentry.attribtype);
800  saveData(os, _curentry.attribsize);
801  saveData(os, _curentry.volume);
802  saveData(os, _curentry.resolution);
803  saveData(os, _curentry.voxelsize);
804  saveData(os, _curentry.xformtoworld);
805  saveData(os, _curentry.xformtovoxel);
806  saveData(os, _curentry.precision);
807  saveData(os, _curentry.readable);
808  saveData(os, _curentry.writeable);
809  saveData(os, _curentry.optional);
810  saveData(os, _curentry.dataname);
811  saveData(os, _curentry.optionname);
812  saveData(os, _curentry.optiontype);
813  saveData(os, _curentry.optionsize);
814 
815  }
816  }
817 
818  }
819 
820  bool load(UT_IStream &is)
821  {
822  int32 v;
823  is.bread(&v, 1);
824  if (version() != v)
825  {
826  // Fail incompatible versions
827  return false;
828  }
829  loadData(is, myRunOver);
830  loadData(is, myAlign);
831  loadData(is, myUseCode);
832  loadData(is, myKernelName);
833  loadData(is, myKernelFile);
834  loadData(is, myKernelCode);
835  loadData(is, myKernelOptions);
836  loadData(is, myOptionAttribute);
837  loadData(is, myRecompile);
838  loadData(is, myOrigin);
839  loadData(is, mySize);
840  loadData(is, myVoxelSize);
841  loadData(is, myTime);
842  loadData(is, myFrame);
843  loadData(is, myTimeInc);
844  loadData(is, myFlushAttributes);
845  loadData(is, myFinish);
846  loadData(is, myTimeScale);
847  loadData(is, myTimeMethod);
848  loadData(is, myXNoise);
849  loadData(is, myWorksetsGeometry);
850  loadData(is, myWorksetsBeginAttr);
851  loadData(is, myWorksetsLengthAttr);
852  loadData(is, myWarnMissing);
853  loadData(is, myErrorMismatchedPoint);
854  loadData(is, myErrorMismatchedPrim);
855  loadData(is, mySingleWorkgroup);
856  loadData(is, myPrecision);
857  {
858  int64 length;
859  is.read(&length, 1);
860  myBindings.setSize(length);
861  for (exint i = 0; i < length; i++)
862  {
863  auto && _curentry = myBindings(i);
864  (void) _curentry;
865  loadData(is, _curentry.name);
866  loadData(is, _curentry.type);
867  loadData(is, _curentry.intval);
868  loadData(is, _curentry.fval);
869  loadData(is, _curentry.v3val);
870  loadData(is, _curentry.v4val);
871  loadData(is, _curentry.timescale);
872  loadData(is, _curentry.fieldname);
873  loadData(is, _curentry.fieldoffsets);
874  loadData(is, _curentry.ramp);
875  loadData(is, _curentry.rampsize);
876  loadData(is, _curentry.geometry);
877  loadData(is, _curentry.attribute);
878  loadData(is, _curentry.attribclass);
879  loadData(is, _curentry.attribtype);
880  loadData(is, _curentry.attribsize);
881  loadData(is, _curentry.volume);
882  loadData(is, _curentry.resolution);
883  loadData(is, _curentry.voxelsize);
884  loadData(is, _curentry.xformtoworld);
885  loadData(is, _curentry.xformtovoxel);
886  loadData(is, _curentry.precision);
887  loadData(is, _curentry.readable);
888  loadData(is, _curentry.writeable);
889  loadData(is, _curentry.optional);
890  loadData(is, _curentry.dataname);
891  loadData(is, _curentry.optionname);
892  loadData(is, _curentry.optiontype);
893  loadData(is, _curentry.optionsize);
894 
895  }
896  }
897 
898  return true;
899  }
900 
901  int64 getRunOver() const { return myRunOver; }
902  void setRunOver(int64 val) { myRunOver = val; }
903  bool getAlign() const { return myAlign; }
904  void setAlign(bool val) { myAlign = val; }
905  bool getUseCode() const { return myUseCode; }
906  void setUseCode(bool val) { myUseCode = val; }
907  const UT_StringHolder & getKernelName() const { return myKernelName; }
908  void setKernelName(const UT_StringHolder & val) { myKernelName = val; }
909  const UT_StringHolder & getKernelFile() const { return myKernelFile; }
910  void setKernelFile(const UT_StringHolder & val) { myKernelFile = val; }
911  const UT_StringHolder & getKernelCode() const { return myKernelCode; }
912  void setKernelCode(const UT_StringHolder & val) { myKernelCode = val; }
913  const UT_StringHolder & getKernelOptions() const { return myKernelOptions; }
914  void setKernelOptions(const UT_StringHolder & val) { myKernelOptions = val; }
915  const UT_StringHolder & getOptionAttribute() const { return myOptionAttribute; }
916  void setOptionAttribute(const UT_StringHolder & val) { myOptionAttribute = val; }
917  bool getRecompile() const { return myRecompile; }
918  void setRecompile(bool val) { myRecompile = val; }
919  bool getOrigin() const { return myOrigin; }
920  void setOrigin(bool val) { myOrigin = val; }
921  bool getSize() const { return mySize; }
922  void setSize(bool val) { mySize = val; }
923  bool getVoxelSize() const { return myVoxelSize; }
924  void setVoxelSize(bool val) { myVoxelSize = val; }
925  bool getTime() const { return myTime; }
926  void setTime(bool val) { myTime = val; }
927  bool getFrame() const { return myFrame; }
928  void setFrame(bool val) { myFrame = val; }
929  bool getTimeInc() const { return myTimeInc; }
930  void setTimeInc(bool val) { myTimeInc = val; }
931  bool getFlushAttributes() const { return myFlushAttributes; }
932  void setFlushAttributes(bool val) { myFlushAttributes = val; }
933  bool getFinish() const { return myFinish; }
934  void setFinish(bool val) { myFinish = val; }
935  fpreal64 getTimeScale() const { return myTimeScale; }
936  void setTimeScale(fpreal64 val) { myTimeScale = val; }
937  int64 getTimeMethod() const { return myTimeMethod; }
938  void setTimeMethod(int64 val) { myTimeMethod = val; }
939  bool getXNoise() const { return myXNoise; }
940  void setXNoise(bool val) { myXNoise = val; }
941  const UT_StringHolder & getWorksetsGeometry() const { return myWorksetsGeometry; }
942  void setWorksetsGeometry(const UT_StringHolder & val) { myWorksetsGeometry = val; }
943  const UT_StringHolder & getWorksetsBeginAttr() const { return myWorksetsBeginAttr; }
944  void setWorksetsBeginAttr(const UT_StringHolder & val) { myWorksetsBeginAttr = val; }
945  const UT_StringHolder & getWorksetsLengthAttr() const { return myWorksetsLengthAttr; }
946  void setWorksetsLengthAttr(const UT_StringHolder & val) { myWorksetsLengthAttr = val; }
947  bool getWarnMissing() const { return myWarnMissing; }
948  void setWarnMissing(bool val) { myWarnMissing = val; }
949  bool getErrorMismatchedPoint() const { return myErrorMismatchedPoint; }
950  void setErrorMismatchedPoint(bool val) { myErrorMismatchedPoint = val; }
951  bool getErrorMismatchedPrim() const { return myErrorMismatchedPrim; }
952  void setErrorMismatchedPrim(bool val) { myErrorMismatchedPrim = val; }
953  int64 getSingleWorkgroup() const { return mySingleWorkgroup; }
954  void setSingleWorkgroup(int64 val) { mySingleWorkgroup = val; }
955  int64 getPrecision() const { return myPrecision; }
956  void setPrecision(int64 val) { myPrecision = val; }
957  const UT_Array<Bindings> &getBindings() const { return myBindings; }
958 void setBindings(const UT_Array<Bindings> &val) { myBindings = val; }
959 
960 private:
961  int64 myRunOver;
962  bool myAlign;
963  bool myUseCode;
964  UT_StringHolder myKernelName;
965  UT_StringHolder myKernelFile;
966  UT_StringHolder myKernelCode;
967  UT_StringHolder myKernelOptions;
968  UT_StringHolder myOptionAttribute;
969  bool myRecompile;
970  bool myOrigin;
971  bool mySize;
972  bool myVoxelSize;
973  bool myTime;
974  bool myFrame;
975  bool myTimeInc;
976  bool myFlushAttributes;
977  bool myFinish;
978  fpreal64 myTimeScale;
979  int64 myTimeMethod;
980  bool myXNoise;
981  UT_StringHolder myWorksetsGeometry;
982  UT_StringHolder myWorksetsBeginAttr;
983  UT_StringHolder myWorksetsLengthAttr;
984  bool myWarnMissing;
985  bool myErrorMismatchedPoint;
986  bool myErrorMismatchedPrim;
987  int64 mySingleWorkgroup;
988  int64 myPrecision;
989  UT_Array<Bindings> myBindings;
990 
991 };
bool operator!=(const Bindings &src) const
static void saveData(std::ostream &os, UT_Vector3D v)
const UT_StringHolder & getKernelName() const
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, UT_Matrix3D v)
bool operator==(const GAS_OpenCLParms &src) const
void setOptionAttribute(const UT_StringHolder &val)
static void loadData(UT_IStream &is, fpreal64 &v)
int int32
Definition: SYS_Types.h:39
static void loadData(UT_IStream &is, UT_Matrix2D &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
void setTimeMethod(int64 val)
void setRunOver(int64 val)
bool getFlushAttributes() const
void setSize(bool val)
bool getErrorMismatchedPrim() const
const char * getFieldNameSubclass(const char *recordtype, int fieldnum) const override
void
Definition: png.h:1083
exint bread(int32 *buffer, exint asize=1)
#define GAS_API
Definition: GAS_API.h:10
bool getErrorMismatchedPoint() const
void setFrame(bool val)
UT_StringHolder createString(const UT_Array< Bindings > &list) const
void setFinish(bool val)
const GLfloat * c
Definition: glew.h:16631
bool isMyRecord(const char *recordtype) const
bool getWarnMissing() const
static void loadData(UT_IStream &is, UT_Vector2I &v)
UT_OptionType
Definition: UT_Options.h:44
void setWorksetsGeometry(const UT_StringHolder &val)
UT_OptionType getFieldTypeSubclass(const char *recordtype, int fieldnum) const override
void setOrigin(bool val)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:656
int64 exint
Definition: SYS_Types.h:125
const UT_StringHolder & getWorksetsGeometry() const
static void saveData(std::ostream &os, fpreal64 v)
SYS_FORCE_INLINE const char * buffer() const
An output stream object that owns its own string buffer storage.
Query(const SIM_Data *owner, const GAS_OpenCLParms &parms)
const GAS_OpenCLParms & myParms
void setXNoise(bool val)
GLuint const GLchar * name
Definition: glcorearb.h:786
bool getRecompile() const
GLenum src
Definition: glcorearb.h:1793
static void saveData(std::ostream &os, UT_Vector4D v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void setUseCode(bool val)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void setTimeInc(bool val)
bool getUseCode() const
double fpreal64
Definition: SYS_Types.h:201
bool getFieldRawSubclass(const char *recordtype, int recordnum, const char *fieldname, UT_OptionEntryPtr &result) const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
static void saveData(std::ostream &os, int64 v)
GLuint64EXT * result
Definition: glew.h:14311
void setBindings(const UT_Array< Bindings > &val)
exint length() const
bool load(UT_IStream &is)
SIM_Query * createQueryObject(const SIM_Data *owner) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
void save(std::ostream &os) const
int64 getTimeMethod() const
const GLdouble * v
Definition: glcorearb.h:837
UT_SharedPtr< UT_Ramp > ramp
exint read(bool *array, exint sz=1)
Definition: UT_IStream.h:288
int64 getPrecision() const
static void loadData(UT_IStream &is, bool &v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setErrorMismatchedPoint(bool val)
void setVoxelSize(bool val)
static void loadData(UT_IStream &is, UT_Vector4D &v)
long long int64
Definition: SYS_Types.h:116
HUSD_API const char * resolution()
static void saveData(std::ostream &os, UT_Vector2D v)
void setErrorMismatchedPrim(bool val)
const UT_Array< Bindings > & getBindings() const
static void saveData(std::ostream &os, UT_Matrix2D v)
const char * getRecordTypeNameSubclass(int recordtypenum) const override
int getNumRecordsSubclass(const char *recordtype) 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:287
void setRecompile(bool val)
const UT_StringHolder & getOptionAttribute() const
GT_API const UT_StringHolder version
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
GLenum GLint GLint * precision
Definition: glcorearb.h:1925
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:611
GLboolean * data
Definition: glcorearb.h:131
const UT_StringHolder & getKernelFile() const
void setPrecision(int64 val)
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
GLuint GLfloat * val
Definition: glcorearb.h:1608
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setWorksetsLengthAttr(const UT_StringHolder &val)
bool getTimeInc() const
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void setTimeScale(fpreal64 val)
const UT_StringHolder & getKernelCode() const
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void setWorksetsBeginAttr(const UT_StringHolder &val)
SYS_FORCE_INLINE void append(char character)
void setAlign(bool val)
static void loadData(UT_IStream &is, UT_Vector3D &v)
int getNumFieldsSubclass(const char *recordtype) const override
static void saveData(std::ostream &os, UT_StringHolder s)
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
bool operator!=(const GAS_OpenCLParms &src) const
bool operator==(const Bindings &src) const
void setWarnMissing(bool val)
const UT_StringHolder & getKernelOptions() const
void setSingleWorkgroup(int64 val)
static void loadData(UT_IStream &is, UT_StringHolder &v)
const char * findChar(int c) const
Definition: UT_String.h:1372
void setKernelName(const UT_StringHolder &val)
void setKernelCode(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector4I &v)
fpreal64 getTimeScale() const
int64 getRunOver() const
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
type
Definition: core.h:1059
bool getVoxelSize() const
GLboolean r
Definition: glcorearb.h:1222
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:654
void setKernelOptions(const UT_StringHolder &val)
GLdouble s
Definition: glew.h:1395
int64 getSingleWorkgroup() const
const UT_StringHolder & getWorksetsLengthAttr() const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: PRM_Parm.h:89
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setKernelFile(const UT_StringHolder &val)
void setFlushAttributes(bool val)
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr
SYS_FORCE_INLINE bool isstring() const
static void saveData(std::ostream &os, bool v)
int getNumRecordTypesSubclass() const override
void setTime(bool val)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
const UT_StringHolder & getWorksetsBeginAttr() const
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:652