HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GT_DAInherit.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  * NAME: GT_DAInherit.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_DAInherit__
12 #define __GT_DAInherit__
13 
14 #include "GT_API.h"
15 #include "GT_DataArray.h"
16 
17 /// @brief Base class for a data array which references another data array
19 public:
20  /// Default constructor
21  GT_DAInherit() : myData() {}
22  /// Convenience constructor
23  GT_DAInherit(const GT_DataArrayHandle &data) : myData(data) { }
24  /// Copy constructor
26  : myData(src.myData)
27  , GT_DataArray()
28  {
29  }
30  virtual ~GT_DAInherit();
31 
33  {
34  myData = data;
35  }
36 
37  /// @{
38  /// Methods defined on GT_DataArray
39  virtual GT_Storage getStorage() const
40  { return myData->getStorage(); }
41  virtual GT_Size getTupleSize() const
42  { return myData->getTupleSize(); }
43  virtual GT_Type getTypeInfo() const
44  { return myData->getTypeInfo(); }
45  virtual int64 getMemoryUsage() const
46  { return myData->getMemoryUsage() + sizeof(*this); }
47 
48  /// Return "true" if there's pointer aliasing
49  virtual bool getPointerAliasing(const void *data) const
50  { return myData->getPointerAliasing(data); }
51  virtual bool isValid() const { return myData && myData->isValid(); }
52  virtual int64 getDataId() const { return myData->getDataId(); }
53  virtual void updateGeoDetail(const GU_ConstDetailHandle &dtl,
54  const char *attrib_name,
55  GT_Owner attrib_owner,
56  const int expected_size)
57  {
58  myData->updateGeoDetail(dtl, attrib_name,
59  attrib_owner,
60  expected_size);
61  }
62  /// @}
63 
64  /// @{
65  /// Implement the specific methods of the inherited array.
66  /// @param MAP_INDEX @n
67  /// A function which takes an offset an maps it to the index in the
68  /// source array
69  /// @param SIZE @n
70  /// The size of this array
71 #define GT_IMPL_INHERIT_ARRAY(MAP_INDEX, SIZE) \
72  virtual GT_Size entries() const { return SIZE; } \
73  virtual fpreal16 getF16(GT_Offset offset, int idx=0) const \
74  { return myData->getF16(MAP_INDEX(offset), idx); } \
75  virtual fpreal32 getF32(GT_Offset offset, int idx=0) const \
76  { return myData->getF32(MAP_INDEX(offset), idx); } \
77  virtual fpreal64 getF64(GT_Offset offset, int idx=0) const \
78  { return myData->getF64(MAP_INDEX(offset), idx); } \
79  virtual uint8 getU8(GT_Offset offset, int idx=0) const \
80  { return myData->getU8(MAP_INDEX(offset), idx); } \
81  virtual int32 getI32(GT_Offset offset, int idx=0) const \
82  { return myData->getI32(MAP_INDEX(offset), idx); } \
83  virtual int64 getI64(GT_Offset offset, int idx=0) const \
84  { return myData->getI64(MAP_INDEX(offset), idx); } \
85  virtual GT_String getS(GT_Offset offset, int idx=0) const \
86  { return myData->getS(MAP_INDEX(offset), idx); } \
87  virtual GT_Size getStringIndexCount() const \
88  { return myData->getStringIndexCount(); } \
89  virtual GT_Offset getStringIndex(GT_Offset offset, int idx) const \
90  { return myData->getStringIndex(MAP_INDEX(offset), idx); } \
91  virtual void getIndexedStrings(UT_StringArray &strings, \
92  UT_IntArray &indices) const \
93  { myData->getIndexedStrings(strings, indices); } \
94  virtual void doImport(GT_Offset off, uint8 *d, GT_Size sz) const \
95  { myData->import(MAP_INDEX(off), d, sz); } \
96  virtual void doImport(GT_Offset off, int32 *d, GT_Size sz) const \
97  { myData->import(MAP_INDEX(off), d, sz); } \
98  virtual void doImport(GT_Offset off, int64 *d, GT_Size sz) const \
99  { myData->import(MAP_INDEX(off), d, sz); } \
100  virtual void doImport(GT_Offset off, fpreal16 *d, GT_Size sz) const \
101  { myData->import(MAP_INDEX(off), d, sz); } \
102  virtual void doImport(GT_Offset off, fpreal32 *d, GT_Size sz) const \
103  { myData->import(MAP_INDEX(off), d, sz); } \
104  virtual void doImport(GT_Offset off, fpreal64 *d, GT_Size sz) const \
105  { myData->import(MAP_INDEX(off), d, sz); }
106  /// @}
107 
108 protected:
109 
111 };
112 
113 #endif
114 
virtual void updateGeoDetail(const GU_ConstDetailHandle &dtl, const char *attrib_name, GT_Owner attrib_owner, const int expected_size)
Definition: GT_DAInherit.h:53
GT_Storage
Definition: GT_Types.h:17
GT_DataArrayHandle myData
Definition: GT_DAInherit.h:110
virtual GT_Size getTupleSize() const
Definition: GT_DAInherit.h:41
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:31
virtual int64 getMemoryUsage() const
Definition: GT_DAInherit.h:45
long long int64
Definition: SYS_Types.h:100
virtual GT_Storage getStorage() const
Definition: GT_DAInherit.h:39
virtual int64 getDataId() const
Definition: GT_DAInherit.h:52
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:38
virtual GT_Type getTypeInfo() const
Definition: GT_DAInherit.h:43
GLboolean * data
Definition: glcorearb.h:130
GT_Owner
Definition: GT_Types.h:72
GT_DAInherit(const GT_DAInherit &src)
Copy constructor.
Definition: GT_DAInherit.h:25
virtual bool getPointerAliasing(const void *data) const
Return "true" if there's pointer aliasing.
Definition: GT_DAInherit.h:49
Base class for a data array which references another data array.
Definition: GT_DAInherit.h:18
virtual bool isValid() const
Definition: GT_DAInherit.h:51
GT_DAInherit()
Default constructor.
Definition: GT_DAInherit.h:21
void init(const GT_DataArrayHandle &data)
Definition: GT_DAInherit.h:32
GT_DAInherit(const GT_DataArrayHandle &data)
Convenience constructor.
Definition: GT_DAInherit.h:23
int64 GT_Size
Definition: GT_Types.h:109
GLenum src
Definition: glcorearb.h:1792