HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_PrimGroup.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_PrimGroup_h__
10 #define __HOM_PrimGroup_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Module.h"
14 #include "HOM_EnumModules.h"
15 #include "HOM_Prim.h"
16 #include "HOM_PtrOrNull.h"
17 #include "HOM_IterableList.h"
18 #include <vector>
19 
20 class HOM_AttribDataId;
21 class HOM_Geometry;
23 
24 SWIGOUT(%rename(PrimGroup) HOM_PrimGroup;)
25 
27 {
28 public:
30  { HOM_CONSTRUCT_OBJECT(this) }
32  { HOM_CONSTRUCT_OBJECT(this) }
33  virtual ~HOM_PrimGroup()
34  { HOM_DESTRUCT_OBJECT(this) }
35 
36  virtual bool operator==(HOM_PtrOrNull<HOM_PrimGroup> prim_group) = 0;
37  virtual bool operator!=(HOM_PtrOrNull<HOM_PrimGroup> prim_group) = 0;
38 
39  virtual int __hash__() = 0;
40  virtual std::string __repr__() = 0;
41 
42  SWIGOUT(%newobject geometry;)
43  virtual HOM_Geometry *geometry() = 0;
44 
45  virtual std::string name() = 0;
46 
47  SWIGOUT(%newobject iterPrims;)
48  virtual HOM_IterableList<HOM_Prim> *iterPrims() = 0;
49 
50  virtual std::vector<HOM_ElemPtr<HOM_Prim> > prims() = 0;
51 
52  virtual bool contains(HOM_Prim &prim) = 0;
53 
54  virtual bool isOrdered() = 0;
55 
56  virtual void add(HOM_Prim &prim) = 0;
57 
58  virtual void add(const std::vector<HOM_Prim *> &prims) = 0;
59 
60  virtual void add(HOM_PrimGroup &prim_group) = 0;
61 
62  virtual void remove(HOM_Prim &prim) = 0;
63 
64  virtual void remove(const std::vector<HOM_Prim *> &prims) = 0;
65 
66  virtual void remove(HOM_PrimGroup &prim_group) = 0;
67 
68  virtual void clear() = 0;
69 
70  virtual void destroy() = 0;
71 
72  virtual int64 primCount() = 0;
73 
74 #ifndef SWIG
75  // Helper class necessary for getRawOptions[RO\RW]() calls to manage locks
76  // that must be held for the duration of the reference to the UT_Options
77  // object.
79  {
80  public:
82  {
83  public:
84  virtual ~ImplBase() {}
85  protected:
86  ImplBase() {}
87  };
88 
89  OptionAutoLocks() : myImpl(0) {}
90  ~OptionAutoLocks() { delete myImpl; }
91 
92  void setImpl(ImplBase *impl) { myImpl = impl; }
93  private:
94  ImplBase *myImpl;
95  };
96 #endif
97 
98  // These methods return the UT_Options object associated with the attribute
99  // and are not wrapped by swig. The lock argument is present to ensure the
100  // caller holds the locks necessary to work with a reference to an object
101  // owned by the attribute.
102  SWIGOUT(%ignore getRawOptionsRO;)
103  virtual const GA_AttributeOptions &getRawOptionsRO(OptionAutoLocks &locks) = 0;
104  SWIGOUT(%ignore getRawOptionsRW;)
105  virtual GA_AttributeOptions &getRawOptionsRW(OptionAutoLocks &locks) = 0;
106 
107  // Get the data type of a particular option.
108  // TODO: We could implement here, but we need HOMFoptionTypeToEnumValue().
109  virtual HOM_EnumValue &optionType(const char *option_name) = 0;
110 
111  // Set an option value. The type_hint is used when the value type mapping
112  // to a UT_OptionType is ambiguous.
113  virtual void setOption(const char *name, HOM_UTOptionAny value,
114  HOM_EnumValue &type_hint =HOM_fieldType::NoSuchField) = 0;
115 
116  // Remove an option from the attribute's UT_Options object.
117  virtual void removeOption(const char *name) = 0;
118 
119  SWIGOUT(%newobject dataId;)
120  virtual HOM_AttribDataId *dataId() = 0;
121 
122  virtual void incrementDataId() = 0;
123 
124 #ifdef SWIG
125 %extend
126 {
127  InterpreterObject options()
128  {
130  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
131  UT_Options options;
132  attriboptions.buildFullOptions(options);
133  return HOMoptionsToInterpreterObject(options);
134  }
135 
136  InterpreterObject option(const char *option_name)
137  {
139  const GA_AttributeOptions &attriboptions = self->getRawOptionsRO(locks);
140  UT_Options options;
141  attriboptions.buildFullOptions(options);
142  const UT_OptionEntry *entry = options.getOptionEntry(option_name);
143  return entry ? HOMoptionEntryToInterpreterObject(*entry)
144  : SWIG_Py_Void();
145  }
146 }
147 #endif
148 };
149 
150 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1303
void buildFullOptions(UT_Options &fulloptions) const
HOM_PrimGroup(const HOM_PrimGroup &)
Definition: HOM_PrimGroup.h:31
hboost::any HOM_UTOptionAny
Definition: HOM_Defines.h:37
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
virtual ~HOM_PrimGroup()
Definition: HOM_PrimGroup.h:33
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
void setImpl(ImplBase *impl)
Definition: HOM_PrimGroup.h:92
#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
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
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)
void clear()
Reset to default.
Definition: core.h:1131
const UT_OptionEntry * getOptionEntry(const UT_StringRef &name) const
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
bool OIIO_UTIL_API contains(string_view a, string_view b)
Does 'a' contain the string 'b' within it?
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542