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 class HOM_Geometry;
22 
23 SWIGOUT(%rename(Attrib) HOM_Attrib;)
24 
26 {
27 public:
29  { HOM_CONSTRUCT_OBJECT(this) }
31  { HOM_CONSTRUCT_OBJECT(this) }
32  virtual ~HOM_Attrib()
33  { HOM_DESTRUCT_OBJECT(this) }
34 
35  virtual bool operator==(HOM_PtrOrNull<HOM_Attrib> attrib) = 0;
36  virtual bool operator!=(HOM_PtrOrNull<HOM_Attrib> attrib) = 0;
37 
38  virtual int __hash__() = 0;
39  virtual std::string __repr__() = 0;
40 
41  virtual void destroy() = 0;
42 
43  SWIGOUT(%newobject geometry;)
44  virtual HOM_Geometry *geometry() = 0;
45 
46  virtual std::string name() = 0;
47  virtual HOM_EnumValue &dataType() = 0;
48  virtual HOM_EnumValue &type() = 0;
49  virtual bool isArrayType() = 0;
50  virtual std::string qualifier() = 0;
51 
52  virtual int size() = 0;
53  virtual void setSize(int size) = 0;
54  virtual bool isTransformedAsVector() = 0;
55  virtual bool isTransformedAsNormal() = 0;
56 
57  // This methods return hboost::any objects and are not wrapped directly
58  // by swig.
59  SWIGOUT(%ignore boostAnyAttribValueAt;)
60  virtual hboost::any boostAnyDefaultValue() = 0;
61 
62  virtual std::vector<std::string> strings() = 0;
63 
64  virtual std::vector<HOM_ElemPtr<HOM_IndexPairPropertyTable> > indexPairPropertyTables() = 0;
65 
66 #ifndef SWIG
67  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
68  // that must be held for the duration of the reference to the UT_Options
69  // object.
71  {
72  public:
74  {
75  public:
76  virtual ~ImplBase() {}
77  protected:
78  ImplBase() {}
79  };
80 
81  OptionAutoLocks() : myImpl(0) {}
82  ~OptionAutoLocks() { delete myImpl; }
83 
84  void setImpl(ImplBase *impl) { myImpl = impl; }
85  private:
86  ImplBase *myImpl;
87  };
88 #endif
89 
90  // These methods return the UT_Options object associated with the attribute
91  // and are not wrapped by swig. The lock argument is present to ensure the
92  // caller holds the locks necessary to work with a reference to an object
93  // owned by the attribute.
94  SWIGOUT(%ignore getRawOptionsRO;)
95  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
96  SWIGOUT(%ignore getRawOptionsRW;)
97  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
98 
99  // Get the data type of a particular option.
100  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
101  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
102 
103  // Set an option value. The type_hint is used when the value type mapping
104  // to a UT_OptionType is ambiguous.
105  virtual void setOption(const char *name, HOM_UTOptionAny value,
106  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
107 
108  // Remove an option from the attribute's UT_Options object.
109  virtual void removeOption(const char *name) = 0;
110 
111 
112 #ifdef SWIG
113 %extend
114 {
115  InterpreterObject defaultValue()
116  {
117  return HOMboostAnyToInterpreterObject(self->boostAnyDefaultValue());
118  }
119 
120  InterpreterObject options()
121  {
123  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
124  UT_Options options;
125  attriboptions.buildFullOptions(options);
126  return HOMoptionsToInterpreterObject(options);
127  }
128 
129  InterpreterObject option(const char *option_name)
130  {
132  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
133  UT_Options options;
134  attriboptions.buildFullOptions(options);
135  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
136  return entry ? HOMoptionEntryToInterpreterObject(*entry)
137  : SWIG_Py_Void();
138  }
139 }
140 #endif
141 };
142 
143 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1053
void buildFullOptions(UT_Options &fulloptions) const
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:344
GLsizeiptr size
Definition: glcorearb.h:663
void setImpl(ImplBase *impl)
Definition: HOM_Attrib.h:84
#define HOM_API
Definition: HOM_API.h:13
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1052
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:604
GLuint const GLchar * name
Definition: glcorearb.h:785
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1932
GLsizei const GLfloat * value
Definition: glcorearb.h:823
A map of string to various well defined value types.
Definition: UT_Options.h:42
virtual ~HOM_Attrib()
Definition: HOM_Attrib.h:32
HOM_Attrib(const HOM_Attrib &)
Definition: HOM_Attrib.h:30
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
const UT_OptionEntry * getOptionEntry(const UT_StringRef &name) const
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:590