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  virtual HOM_EnumValue &type() = 0;
51  virtual bool isArrayType() = 0;
52  virtual std::string qualifier() = 0;
53 
54  virtual int size() = 0;
55  virtual void setSize(int size) = 0;
56  virtual bool isTransformedAsVector() = 0;
57  virtual bool isTransformedAsNormal() = 0;
58 
59  // This methods return hboost::any objects and are not wrapped directly
60  // by swig.
61  SWIGOUT(%ignore boostAnyAttribValueAt;)
62  virtual hboost::any boostAnyDefaultValue() = 0;
63 
64  virtual std::vector<std::string> strings() = 0;
65 
66  virtual std::vector<HOM_ElemPtr<HOM_IndexPairPropertyTable> > indexPairPropertyTables() = 0;
67 
68 #ifndef SWIG
69  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
70  // that must be held for the duration of the reference to the UT_Options
71  // object.
73  {
74  public:
76  {
77  public:
78  virtual ~ImplBase() {}
79  protected:
80  ImplBase() {}
81  };
82 
83  OptionAutoLocks() : myImpl(0) {}
84  ~OptionAutoLocks() { delete myImpl; }
85 
86  void setImpl(ImplBase *impl) { myImpl = impl; }
87  private:
88  ImplBase *myImpl;
89  };
90 #endif
91 
92  // These methods return the UT_Options object associated with the attribute
93  // and are not wrapped by swig. The lock argument is present to ensure the
94  // caller holds the locks necessary to work with a reference to an object
95  // owned by the attribute.
96  SWIGOUT(%ignore getRawOptionsRO;)
97  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
98  SWIGOUT(%ignore getRawOptionsRW;)
99  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
100 
101  // Get the data type of a particular option.
102  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
103  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
104 
105  // Set an option value. The type_hint is used when the value type mapping
106  // to a UT_OptionType is ambiguous.
107  virtual void setOption(const char *name, HOM_UTOptionAny value,
108  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
109 
110  // Remove an option from the attribute's UT_Options object.
111  virtual void removeOption(const char *name) = 0;
112 
113  SWIGOUT(%newobject dataId;)
114  virtual HOM_AttribDataId *dataId() = 0;
115 
116  virtual void incrementDataId() = 0;
117 
118 #ifdef SWIG
119 %extend
120 {
121  InterpreterObject defaultValue()
122  {
123  return HOMboostAnyToInterpreterObject(self->boostAnyDefaultValue());
124  }
125 
126  InterpreterObject options()
127  {
129  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
130  UT_Options options;
131  attriboptions.buildFullOptions(options);
132  return HOMoptionsToInterpreterObject(options);
133  }
134 
135  InterpreterObject option(const char *option_name)
136  {
138  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
139  UT_Options options;
140  attriboptions.buildFullOptions(options);
141  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
142  return entry ? HOMoptionEntryToInterpreterObject(*entry)
143  : SWIG_Py_Void();
144  }
145 }
146 #endif
147 };
148 
149 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1144
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:86
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:1143
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:604
GLsizei const GLchar *const * strings
Definition: glew.h:5883
INT GLenum dataType
Definition: wglew.h:145
GLsizei const GLchar *const * string
Definition: glew.h:1844
A map of string to various well defined value types.
Definition: UT_Options.h:42
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:590
type
Definition: core.h:528