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 HOM_EnumValue &numericDataType() = 0;
54  virtual std::string qualifier() = 0;
55 
56  virtual int size() = 0;
57  virtual void setSize(int size) = 0;
58  virtual bool isTransformedAsVector() = 0;
59  virtual bool isTransformedAsNormal() = 0;
60 
61  // This methods return hboost::any objects and are not wrapped directly
62  // by swig.
63  SWIGOUT(%ignore boostAnyAttribValueAt;)
64  virtual hboost::any boostAnyDefaultValue() = 0;
65 
66  virtual int64 stringCount() = 0;
67  virtual std::vector<std::string> strings() = 0;
68  virtual bool replaceString(const std::string &before,
69  const std::string &after) = 0;
70  virtual int64 dictCount() = 0;
71  virtual std::vector<std::map<std::string,hboost::any> > dicts() = 0;
72 
73  virtual std::vector<HOM_ElemPtr<HOM_IndexPairPropertyTable> > indexPairPropertyTables() = 0;
74 
75 #ifndef SWIG
76  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
77  // that must be held for the duration of the reference to the UT_Options
78  // object.
80  {
81  public:
83  {
84  public:
85  virtual ~ImplBase() {}
86  protected:
87  ImplBase() {}
88  };
89 
90  OptionAutoLocks() : myImpl(0) {}
91  ~OptionAutoLocks() { delete myImpl; }
92 
93  void setImpl(ImplBase *impl) { myImpl = impl; }
94  private:
95  ImplBase *myImpl;
96  };
97 #endif
98 
99  // These methods return the UT_Options object associated with the attribute
100  // and are not wrapped by swig. The lock argument is present to ensure the
101  // caller holds the locks necessary to work with a reference to an object
102  // owned by the attribute.
103  SWIGOUT(%ignore getRawOptionsRO;)
104  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
105  SWIGOUT(%ignore getRawOptionsRW;)
106  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
107 
108  // Get the data type of a particular option.
109  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
110  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
111 
112  // Set an option value. The type_hint is used when the value type mapping
113  // to a UT_OptionType is ambiguous.
114  virtual void setOption(const char *name, HOM_UTOptionAny value,
115  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
116 
117  // Remove an option from the attribute's UT_Options object.
118  virtual void removeOption(const char *name) = 0;
119 
120  SWIGOUT(%newobject dataId;)
121  virtual HOM_AttribDataId *dataId() = 0;
122 
123  virtual void incrementDataId() = 0;
124 
125 #ifdef SWIG
126 %extend
127 {
128  InterpreterObject defaultValue()
129  {
130  return HOMboostAnyToInterpreterObject(self->boostAnyDefaultValue());
131  }
132 
133  InterpreterObject options()
134  {
136  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
137  UT_Options options;
138  attriboptions.buildFullOptions(options);
139  return HOMoptionsToInterpreterObject(options);
140  }
141 
142  InterpreterObject option(const char *option_name)
143  {
145  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
146  UT_Options options;
147  attriboptions.buildFullOptions(options);
148  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
149  return entry ? HOMoptionEntryToInterpreterObject(*entry)
150  : SWIG_Py_Void();
151  }
152 }
153 #endif
154 };
155 
156 #endif
type
Definition: core.h:556
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1348
void buildFullOptions(UT_Options &fulloptions) const
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
GLsizei const GLfloat * value
Definition: glcorearb.h:824
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
void setImpl(ImplBase *impl)
Definition: HOM_Attrib.h:93
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
bool any(const vbool4 &v)
Definition: simd.h:3600
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1347
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1933
GLsizeiptr size
Definition: glcorearb.h:664
A map of string to various well defined value types.
Definition: UT_Options.h:87
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
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
HUSD_API const char * dataType()
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542