HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_AttribDataId.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_AttribDataId_h__
10 #define __HOM_AttribDataId_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Module.h"
15 #include "HOM_PtrOrNull.h"
16 #include <SYS/SYS_Types.h>
17 #include <SYS/SYS_Math.h>
18 #include <string>
19 #include <utility>
20 #include <vector>
21 
22 
23 SWIGOUT(%feature("notabstract") HOM_AttribDataId;)
24 SWIGOUT(%rename(AttribDataId) HOM_AttribDataId;)
25 
27 {
28 public:
29 #ifdef SWIG
30 %extend {
32  {
33  return HOM().newAttribDataId();
34  }
35 };
36 #else
38  { HOM_CONSTRUCT_OBJECT(this) }
39 
41  : myDataId(data_id)
42  { HOM_CONSTRUCT_OBJECT(this) }
43 
45  : myDataId(other.myDataId)
46  { HOM_CONSTRUCT_OBJECT(this) }
47 #endif
48 
50  { HOM_DESTRUCT_OBJECT(this) }
51 
52  //
53  // NOTE: We keep the virtual methods to a minimum for performance
54  //
55 
57  {
58  if (!other.myPointer)
59  return false;
60  return (myDataId == other.myPointer->myDataId);
61  }
63  {
64  return !operator==(other);
65  }
66 
67  int __hash__()
68  {
69  return (int)SYSwang_inthash(myDataId);
70  }
71 
72  bool isValid()
73  {
74  return (myDataId >= 0);
75  }
76 
77  virtual std::vector<int> vexAttribDataId() = 0;
78 
79  virtual std::string __repr__() = 0;
80 
81  // Pickle Support
82  //
83  // By design, pickle doesn't not call __init__() when unpickling. This is a
84  // problem for SWIG though because it requires this in order for the object
85  // to be properly wrapped to the C++ methods. So we need to wrap the
86  // __setstate__() implementation around something that calls __init__()
87  // first. For symmetry, we also wrap __getstate__() as well. So in the
88  // Python implementation, we define __getstate__()/__setstate__() that call
89  // the internal _getstate()/_setstate() C++ methods.
90  virtual std::pair<int64,int64> _getstate() = 0;
91  virtual void _setstate(std::pair<int64,int64> state) = 0;
92  // NOTE: Be careful with the %pythoncode below which must be indented using
93  // spaces!
94 #ifdef SWIG
95 %extend {
96 %pythoncode {
97  def __getstate__(self):
98  return self._getstate()
99  def __setstate__(self, state):
100  try:
101  self.this
102  except:
103  self.__init__()
104  self._setstate(state)
105 }
106 };
107 #endif
108 
109 protected:
110  int64 myDataId = -1;
111 };
112 
113 #endif
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1197
OIIO_API bool rename(string_view from, string_view to, std::string &err)
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
virtual HOM_AttribDataId * newAttribDataId()=0
#define HOM_API
Definition: HOM_API.h:13
bool operator==(HOM_PtrOrNull< HOM_AttribDataId > other)
*But if you need a or simply need to know when the task has note that the like this
Definition: thread.h:639
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1196
virtual ~HOM_AttribDataId()
long long int64
Definition: SYS_Types.h:116
HOM_AttribDataId(int64 data_id)
HOM_AttribDataId(const HOM_AttribDataId &other)
GLsizei const GLchar *const * string
Definition: glew.h:1844
HOM_API HOM_Module & HOM()
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:563
bool operator!=(HOM_PtrOrNull< HOM_AttribDataId > other)