HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_VolumeAnalysis.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 <OP/OP_Utils.h>
8 #include <PRM/PRM_Parm.h>
9 #include <UT/UT_IStream.h>
10 #include <UT/UT_NTStreamUtil.h>
11 #include <UT/UT_Ramp.h>
12 #include <UT/UT_SharedPtr.h>
13 #include <UT/UT_StringHolder.h>
14 #include <UT/UT_StringStream.h>
15 #include <UT/UT_VectorTypes.h>
16 #include <SYS/SYS_Types.h>
17 
18 using namespace UT::Literal;
19 
20 class DEP_MicroNode;
21 namespace SOP_VolumeAnalysisEnums
22 {
23  enum class Analysis
24  {
25  CURVATURE = 0,
26  GRADIENT,
27  LAPLACIAN,
29  };
30  enum class Edgedetectmode
31  {
32  SOBEL = 0,
33  PREWITT
34  };
35 }
36 
37 
39 {
40 public:
41  static int version() { return 1; }
42 
44  {
45  myGroup = ""_sh;
46  myAnalysis = 0;
47  myEdgedetectmode = 0;
48 
49  }
50 
51  explicit SOP_VolumeAnalysisParms(const SOP_VolumeAnalysisParms &) = default;
52 
54 
56  {
57  if (myGroup != src.myGroup) return false;
58  if (myAnalysis != src.myAnalysis) return false;
59  if (myEdgedetectmode != src.myEdgedetectmode) return false;
60 
61  return true;
62  }
65 
66 
67 
68  void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
69  {
70  if (true)
71  OP_Utils::evalOpParm(myGroup, node, "group", time, 0);
72  else myGroup = ""_sh;
73  if (true)
74  OP_Utils::evalOpParm(myAnalysis, node, "analysis", time, 0);
75  else myAnalysis = 0;
76  if (true && ( (!(((int64(getAnalysis())!=3)))) ) )
77  OP_Utils::evalOpParm(myEdgedetectmode, node, "edgedetectmode", time, 0);
78  else myEdgedetectmode = 0;
79 
80  }
81 
82 
83  virtual void loadFromOpSubclass(const LoadParms &loadparms)
84  {
85  buildFromOp(loadparms.node(), loadparms.context().getTime(), loadparms.depnode());
86  }
87 
88 
89  virtual void copyFrom(const SOP_NodeParms *src)
90  {
91  *this = *((const SOP_VolumeAnalysisParms *)src);
92  }
93 
94  template <typename T>
95  void
96  doGetParmValue(exint idx, T &value) const
97  {
98  switch (idx)
99  {
100  case 0:
101  coerceValue(value, myGroup);
102  break;
103  case 1:
104  coerceValue(value, myAnalysis);
105  break;
106  case 2:
107  coerceValue(value, myEdgedetectmode);
108  break;
109 
110  }
111  }
112 
113  void getParmValue(exint idx, exint &value) const
114  { doGetParmValue(idx, value); }
115  void getParmValue(exint idx, fpreal &value) const
116  { doGetParmValue(idx, value); }
118  { doGetParmValue(idx, value); }
120  { doGetParmValue(idx, value); }
122  { doGetParmValue(idx, value); }
124  { doGetParmValue(idx, value); }
126  { doGetParmValue(idx, value); }
128  { doGetParmValue(idx, value); }
130  { doGetParmValue(idx, value); }
132  { doGetParmValue(idx, value); }
134  { doGetParmValue(idx, value); }
135 
136  template <typename T>
137  void
138  doSetParmValue(exint idx, const T &value)
139  {
140  switch (idx)
141  {
142  case 0:
143  coerceValue(myGroup, value);
144  break;
145  case 1:
146  coerceValue(myAnalysis, value);
147  break;
148  case 2:
149  coerceValue(myEdgedetectmode, value);
150  break;
151 
152  }
153  }
154 
155  void setParmValue(exint idx, const exint &value)
156  { doSetParmValue(idx, value); }
157  void setParmValue(exint idx, const fpreal &value)
158  { doSetParmValue(idx, value); }
159  void setParmValue(exint idx, const UT_Vector2D &value)
160  { doSetParmValue(idx, value); }
161  void setParmValue(exint idx, const UT_Vector3D &value)
162  { doSetParmValue(idx, value); }
163  void setParmValue(exint idx, const UT_Vector4D &value)
164  { doSetParmValue(idx, value); }
165  void setParmValue(exint idx, const UT_Matrix2D &value)
166  { doSetParmValue(idx, value); }
167  void setParmValue(exint idx, const UT_Matrix3D &value)
168  { doSetParmValue(idx, value); }
169  void setParmValue(exint idx, const UT_Matrix4D &value)
170  { doSetParmValue(idx, value); }
172  { doSetParmValue(idx, value); }
174  { doSetParmValue(idx, value); }
176  { doSetParmValue(idx, value); }
177 
178  virtual exint getNumParms() const
179  {
180  return 3;
181  }
182 
183  virtual const char *getParmName(exint fieldnum) const
184  {
185  switch (fieldnum)
186  {
187  case 0:
188  return "group";
189  case 1:
190  return "analysis";
191  case 2:
192  return "edgedetectmode";
193 
194  }
195  return 0;
196  }
197 
198  virtual ParmType getParmType(exint fieldnum) const
199  {
200  switch (fieldnum)
201  {
202  case 0:
203  return PARM_STRING;
204  case 1:
205  return PARM_INTEGER;
206  case 2:
207  return PARM_INTEGER;
208 
209  }
210  return PARM_UNSUPPORTED;
211  }
212 
213  // Boiler plate to load individual types.
214  static void loadData(UT_IStream &is, int64 &v)
215  { is.bread(&v, 1); }
216  static void loadData(UT_IStream &is, bool &v)
217  { int64 iv; is.bread(&iv, 1); v = iv; }
218  static void loadData(UT_IStream &is, fpreal64 &v)
219  { is.bread<fpreal64>(&v, 1); }
220  static void loadData(UT_IStream &is, UT_Vector2D &v)
221  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1); }
222  static void loadData(UT_IStream &is, UT_Vector3D &v)
223  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
224  is.bread<fpreal64>(&v.z(), 1); }
225  static void loadData(UT_IStream &is, UT_Vector4D &v)
226  { is.bread<fpreal64>(&v.x(), 1); is.bread<fpreal64>(&v.y(), 1);
227  is.bread<fpreal64>(&v.z(), 1); is.bread<fpreal64>(&v.w(), 1); }
228  static void loadData(UT_IStream &is, UT_Matrix2D &v)
229  { for (int r = 0; r < 2; r++) for (int c = 0; c < 2; c++) is.bread<fpreal64>(&v(r, c), 1); }
230  static void loadData(UT_IStream &is, UT_Matrix3D &v)
231  { for (int r = 0; r < 3; r++) for (int c = 0; c < 3; c++) is.bread<fpreal64>(&v(r, c), 1); }
232  static void loadData(UT_IStream &is, UT_Matrix4D &v)
233  { for (int r = 0; r < 4; r++) for (int c = 0; c < 4; c++) is.bread<fpreal64>(&v(r, c), 1); }
234  static void loadData(UT_IStream &is, UT_Vector2I &v)
235  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1); }
236  static void loadData(UT_IStream &is, UT_Vector3I &v)
237  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
238  is.bread<int64>(&v.z(), 1); }
239  static void loadData(UT_IStream &is, UT_Vector4I &v)
240  { is.bread<int64>(&v.x(), 1); is.bread<int64>(&v.y(), 1);
241  is.bread<int64>(&v.z(), 1); is.bread<int64>(&v.w(), 1); }
243  { is.bread(v); }
245  { UT_StringHolder rampdata;
246  loadData(is, rampdata);
247  if (rampdata.isstring())
248  {
249  v.reset(new UT_Ramp());
250  UT_IStream istr((const char *) rampdata, rampdata.length(), UT_ISTREAM_ASCII);
251  v->load(istr);
252  }
253  else v.reset();
254  }
257  loadData(is, data);
258  if (data.isstring())
259  {
260  // Find the data type.
261  char *colon = UT_StringWrap(data).findChar(':');
262  if (colon)
263  {
264  int typelen = colon - data.buffer();
266  type.strncpy(data.buffer(), typelen);
267  UT_IStream istr(((const char *) data) + typelen + 1, data.length() - (typelen + 1), UT_ISTREAM_BINARY);
268 
269  v = PRM_DataFactory::parseBinary(type.buffer(), istr);
270  }
271  }
272  else v.reset();
273  }
274 
275  static void saveData(std::ostream &os, int64 v)
276  { UTwrite(os, &v); }
277  static void saveData(std::ostream &os, bool v)
278  { int64 iv = v; UTwrite(os, &iv); }
279  static void saveData(std::ostream &os, fpreal64 v)
280  { UTwrite<fpreal64>(os, &v); }
281  static void saveData(std::ostream &os, UT_Vector2D v)
282  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y()); }
283  static void saveData(std::ostream &os, UT_Vector3D v)
284  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
285  UTwrite<fpreal64>(os, &v.z()); }
286  static void saveData(std::ostream &os, UT_Vector4D v)
287  { UTwrite<fpreal64>(os, &v.x()); UTwrite<fpreal64>(os, &v.y());
288  UTwrite<fpreal64>(os, &v.z()); UTwrite<fpreal64>(os, &v.w()); }
289  static void saveData(std::ostream &os, UT_Matrix2D v)
291  static void saveData(std::ostream &os, UT_Matrix3D v)
293  static void saveData(std::ostream &os, UT_Matrix4D v)
295  static void saveData(std::ostream &os, UT_StringHolder s)
296  { UT_StringWrap(s).saveBinary(os); }
297  static void saveData(std::ostream &os, UT_SharedPtr<UT_Ramp> s)
298  { UT_StringHolder result;
299  UT_OStringStream ostr;
300  if (s) s->save(ostr);
301  result = ostr.str();
302  saveData(os, result);
303  }
304  static void saveData(std::ostream &os, PRM_DataItemHandle s)
305  { UT_StringHolder result;
306  UT_OStringStream ostr;
307  if (s)
308  {
309  ostr << s->getDataTypeToken();
310  ostr << ":";
311  s->saveBinary(ostr);
312  }
313  result = ostr.str();
314  saveData(os, result);
315  }
316 
317 
318  void save(std::ostream &os) const
319  {
320  int32 v = version();
321  UTwrite(os, &v);
322  saveData(os, myGroup);
323  saveData(os, myAnalysis);
324  saveData(os, myEdgedetectmode);
325 
326  }
327 
328  bool load(UT_IStream &is)
329  {
330  int32 v;
331  is.bread(&v, 1);
332  if (version() != v)
333  {
334  // Fail incompatible versions
335  return false;
336  }
337  loadData(is, myGroup);
338  loadData(is, myAnalysis);
339  loadData(is, myEdgedetectmode);
340 
341  return true;
342  }
343 
344  const UT_StringHolder & getGroup() const { return myGroup; }
345  void setGroup(const UT_StringHolder & val) { myGroup = val; }
347  {
348  SOP_Node *thissop = cookparms.getNode();
349  if (!thissop) return getGroup();
350  UT_StringHolder result;
351  OP_Utils::evalOpParm(result, thissop, "group", cookparms.getCookTime(), 0);
352  return result;
353  }
354  Analysis getAnalysis() const { return Analysis(myAnalysis); }
355  void setAnalysis(Analysis val) { myAnalysis = int64(val); }
357  {
358  SOP_Node *thissop = cookparms.getNode();
359  if (!thissop) return getAnalysis();
360  int64 result;
361  OP_Utils::evalOpParm(result, thissop, "analysis", cookparms.getCookTime(), 0);
362  return Analysis(result);
363  }
364  Edgedetectmode getEdgedetectmode() const { return Edgedetectmode(myEdgedetectmode); }
365  void setEdgedetectmode(Edgedetectmode val) { myEdgedetectmode = int64(val); }
367  {
368  SOP_Node *thissop = cookparms.getNode();
369  if (!thissop) return getEdgedetectmode();
370  int64 result;
371  OP_Utils::evalOpParm(result, thissop, "edgedetectmode", cookparms.getCookTime(), 0);
372  return Edgedetectmode(result);
373  }
374 
375 private:
376  UT_StringHolder myGroup;
377  int64 myAnalysis;
378  int64 myEdgedetectmode;
379 
380 };
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setParmValue(exint idx, const PRM_DataItemHandle &value)
void setParmValue(exint idx, const UT_Vector2D &value)
SOP_Node * getNode() const
Definition: SOP_NodeVerb.h:492
T & z(void)
Definition: UT_Vector4.h:372
void getParmValue(exint idx, UT_Matrix3D &value) const
static void saveData(std::ostream &os, int64 v)
static void saveData(std::ostream &os, UT_Vector4D v)
exint bread(int32 *buffer, exint asize=1)
static void saveData(std::ostream &os, UT_Matrix2D v)
fpreal getTime() const
Definition: OP_Context.h:34
const GLdouble * v
Definition: glcorearb.h:836
void getParmValue(exint idx, UT_Vector4D &value) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void getParmValue(exint idx, fpreal &value) const
T & x(void)
Definition: UT_Vector2.h:284
virtual void loadFromOpSubclass(const LoadParms &loadparms)
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, bool &v)
void getParmValue(exint idx, UT_Vector2D &value) const
void setParmValue(exint idx, const fpreal &value)
const UT_WorkBuffer & str() const
Returns a read-only reference to the underlying UT_WorkBuffer.
static void saveData(std::ostream &os, fpreal64 v)
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void buildFromOp(const OP_Node *node, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void saveData(std::ostream &os, UT_Matrix3D v)
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
static void saveData(std::ostream &os, UT_Vector3D v)
long long int64
Definition: SYS_Types.h:100
void getParmValue(exint idx, UT_StringHolder &value) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void getParmValue(exint idx, exint &value) const
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_Matrix4D v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
exint length() const
char * findChar(int c) const
Find first occurrance of character. Returns NULL upon failure.
Definition: UT_String.h:550
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, UT_StringHolder s)
Analysis opAnalysis(const SOP_NodeVerb::CookParms &cookparms) const
int64 exint
Definition: SYS_Types.h:109
const OP_Node * node() const
Definition: SOP_NodeVerb.h:104
double fpreal64
Definition: SYS_Types.h:185
const UT_StringHolder & getGroup() const
void doSetParmValue(exint idx, const T &value)
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, fpreal64 &v)
void setParmValue(exint idx, const UT_Matrix3D &value)
void getParmValue(exint idx, UT_Matrix4D &value) const
virtual const char * getParmName(exint fieldnum) const
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:28
void setEdgedetectmode(Edgedetectmode val)
T & y(void)
Definition: UT_Vector4.h:370
void saveBinary(std::ostream &os) const
Save string to binary stream.
Definition: UT_String.h:294
DEP_MicroNode * depnode() const
Definition: SOP_NodeVerb.h:111
void getParmValue(exint idx, UT_Vector3D &value) const
void getParmValue(exint idx, PRM_DataItemHandle &value) const
void doGetParmValue(exint idx, T &value) const
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
void strncpy(const char *src, exint maxlen)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void setParmValue(exint idx, const UT_Vector3D &value)
Edgedetectmode getEdgedetectmode() const
virtual void copyFrom(const SOP_NodeParms *src)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void saveData(std::ostream &os, UT_Vector2D v)
void setGroup(const UT_StringHolder &val)
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
void setParmValue(exint idx, const UT_Matrix2D &value)
bool operator==(const SOP_VolumeAnalysisParms &src) const
const char * buffer() const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
fpreal getCookTime() const
Definition: SOP_NodeVerb.h:499
T & x(void)
Definition: UT_Vector4.h:368
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
void getParmValue(exint idx, UT_Matrix2D &value) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setParmValue(exint idx, const UT_Vector4D &value)
static void saveData(std::ostream &os, bool v)
T & y(void)
Definition: UT_Vector2.h:286
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
virtual exint getNumParms() const
GLboolean r
Definition: glcorearb.h:1221
T & w(void)
Definition: UT_Vector4.h:374
Edgedetectmode opEdgedetectmode(const SOP_NodeVerb::CookParms &cookparms) const
void save(std::ostream &os) const
void setParmValue(exint idx, const UT_StringHolder &value)
void setParmValue(exint idx, const UT_Matrix4D &value)
void setParmValue(exint idx, const exint &value)
const OP_Context & context() const
Definition: SOP_NodeVerb.h:109
SYS_FORCE_INLINE bool isstring() const
virtual ParmType getParmType(exint fieldnum) const
GLenum src
Definition: glcorearb.h:1792
static void loadData(UT_IStream &is, UT_Vector4D &v)