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