HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Attrib.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Attrib_h__
10 #define __HOM_Attrib_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_EnumModules.h"
17 #include "HOM_IterableList.h"
18 #include "HOM_PtrOrNull.h"
19 #include <string>
20 
21 class HOM_AttribDataId;
22 class HOM_Geometry;
24 
26 
28 {
29 public:
31  { HOM_CONSTRUCT_OBJECT(this) }
33  { HOM_CONSTRUCT_OBJECT(this) }
34  virtual ~HOM_Attrib()
35  { HOM_DESTRUCT_OBJECT(this) }
36 
37  virtual bool operator==(HOM_PtrOrNull<HOM_Attrib> attrib) = 0;
38  virtual bool operator!=(HOM_PtrOrNull<HOM_Attrib> attrib) = 0;
39 
40  virtual int __hash__() = 0;
41  virtual std::string __repr__() = 0;
42 
43  virtual void destroy() = 0;
44 
45  SWIGOUT(%newobject geometry;)
46  virtual HOM_Geometry *geometry() = 0;
47 
48  virtual std::string name() = 0;
49  virtual HOM_EnumValue &dataType() = 0;
50  SWIGOUT(%warnfilter(321) type;)
51  virtual HOM_EnumValue &type() = 0;
52  virtual bool isArrayType() = 0;
53  virtual std::string qualifier() = 0;
54 
55  virtual int size() = 0;
56  virtual void setSize(int size) = 0;
57  virtual bool isTransformedAsVector() = 0;
58  virtual bool isTransformedAsNormal() = 0;
59 
60  // This methods return hboost::any objects and are not wrapped directly
61  // by swig.
62  SWIGOUT(%ignore boostAnyAttribValueAt;)
63  virtual hboost::any boostAnyDefaultValue() = 0;
64 
65  virtual std::vector<std::string> strings() = 0;
66 
67  virtual std::vector<HOM_ElemPtr<HOM_IndexPairPropertyTable> > indexPairPropertyTables() = 0;
68 
69 #ifndef SWIG
70  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
71  // that must be held for the duration of the reference to the UT_Options
72  // object.
74  {
75  public:
77  {
78  public:
79  virtual ~ImplBase() {}
80  protected:
81  ImplBase() {}
82  };
83 
84  OptionAutoLocks() : myImpl(0) {}
85  ~OptionAutoLocks() { delete myImpl; }
86 
87  void setImpl(ImplBase *impl) { myImpl = impl; }
88  private:
89  ImplBase *myImpl;
90  };
91 #endif
92 
93  // These methods return the UT_Options object associated with the attribute
94  // and are not wrapped by swig. The lock argument is present to ensure the
95  // caller holds the locks necessary to work with a reference to an object
96  // owned by the attribute.
97  SWIGOUT(%ignore getRawOptionsRO;)
98  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
99  SWIGOUT(%ignore getRawOptionsRW;)
100  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
101 
102  // Get the data type of a particular option.
103  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
104  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
105 
106  // Set an option value. The type_hint is used when the value type mapping
107  // to a UT_OptionType is ambiguous.
108  virtual void setOption(const char *name, HOM_UTOptionAny value,
109  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
110 
111  // Remove an option from the attribute's UT_Options object.
112  virtual void removeOption(const char *name) = 0;
113 
114  SWIGOUT(%newobject dataId;)
115  virtual HOM_AttribDataId *dataId() = 0;
116 
117  virtual void incrementDataId() = 0;
118 
119 #ifdef SWIG
120 %extend
121 {
122  InterpreterObject defaultValue()
123  {
124  return HOMboostAnyToInterpreterObject(self->boostAnyDefaultValue());
125  }
126 
127  InterpreterObject options()
128  {
130  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
131  UT_Options options;
132  attriboptions.buildFullOptions(options);
133  return HOMoptionsToInterpreterObject(options);
134  }
135 
136  InterpreterObject option(const char *option_name)
137  {
139  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
140  UT_Options options;
141  attriboptions.buildFullOptions(options);
142  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
143  return entry ? HOMoptionEntryToInterpreterObject(*entry)
144  : SWIG_Py_Void();
145  }
146 }
147 #endif
148 };
149 
150 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1211
GLsizeiptr size
Definition: glew.h:1681
void buildFullOptions(UT_Options &fulloptions) const
GLuint const GLchar * name
Definition: glew.h:1814
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
OIIO_API bool rename(string_view from, string_view to, std::string &err)
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
GLuint GLenum option
Definition: glew.h:3288
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
void setImpl(ImplBase *impl)
Definition: HOM_Attrib.h:87
bool any(const vbool4 &v)
Definition: simd.h:3372
#define HOM_API
Definition: HOM_API.h:13
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1210
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:563
GLsizei const GLchar *const * strings
Definition: glew.h:5883
INT GLenum dataType
Definition: wglew.h:145
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
GLsizei const GLchar *const * string
Definition: glew.h:1844
A map of string to various well defined value types.
Definition: UT_Options.h:84
virtual ~HOM_Attrib()
Definition: HOM_Attrib.h:34
HOM_Attrib(const HOM_Attrib &)
Definition: HOM_Attrib.h:32
const UT_OptionEntry * getOptionEntry(const UT_StringRef &name) const
GLsizei const GLfloat * value
Definition: glew.h:1849
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:549
type
Definition: core.h:528