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  virtual bool replaceString(const std::string &before,
67  const std::string &after) = 0;
68  virtual std::vector<std::map<std::string,hboost::any> > dicts() = 0;
69 
70  virtual std::vector<HOM_ElemPtr<HOM_IndexPairPropertyTable> > indexPairPropertyTables() = 0;
71 
72 #ifndef SWIG
73  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
74  // that must be held for the duration of the reference to the UT_Options
75  // object.
77  {
78  public:
80  {
81  public:
82  virtual ~ImplBase() {}
83  protected:
84  ImplBase() {}
85  };
86 
87  OptionAutoLocks() : myImpl(0) {}
88  ~OptionAutoLocks() { delete myImpl; }
89 
90  void setImpl(ImplBase *impl) { myImpl = impl; }
91  private:
92  ImplBase *myImpl;
93  };
94 #endif
95 
96  // These methods return the UT_Options object associated with the attribute
97  // and are not wrapped by swig. The lock argument is present to ensure the
98  // caller holds the locks necessary to work with a reference to an object
99  // owned by the attribute.
100  SWIGOUT(%ignore getRawOptionsRO;)
101  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
102  SWIGOUT(%ignore getRawOptionsRW;)
103  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
104 
105  // Get the data type of a particular option.
106  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
107  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
108 
109  // Set an option value. The type_hint is used when the value type mapping
110  // to a UT_OptionType is ambiguous.
111  virtual void setOption(const char *name, HOM_UTOptionAny value,
112  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
113 
114  // Remove an option from the attribute's UT_Options object.
115  virtual void removeOption(const char *name) = 0;
116 
117  SWIGOUT(%newobject dataId;)
118  virtual HOM_AttribDataId *dataId() = 0;
119 
120  virtual void incrementDataId() = 0;
121 
122 #ifdef SWIG
123 %extend
124 {
125  InterpreterObject defaultValue()
126  {
127  return HOMboostAnyToInterpreterObject(self->boostAnyDefaultValue());
128  }
129 
130  InterpreterObject options()
131  {
133  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
134  UT_Options options;
135  attriboptions.buildFullOptions(options);
136  return HOMoptionsToInterpreterObject(options);
137  }
138 
139  InterpreterObject option(const char *option_name)
140  {
142  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
143  UT_Options options;
144  attriboptions.buildFullOptions(options);
145  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
146  return entry ? HOMoptionEntryToInterpreterObject(*entry)
147  : SWIG_Py_Void();
148  }
149 }
150 #endif
151 };
152 
153 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1291
void buildFullOptions(UT_Options &fulloptions) const
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:352
void setImpl(ImplBase *impl)
Definition: HOM_Attrib.h:90
bool any(const vbool4 &v)
Definition: simd.h:3468
#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:1290
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
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:84
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
Definition: core.h:1131
const UT_OptionEntry * getOptionEntry(const UT_StringRef &name) const
type
Definition: core.h:1059
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