HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFNumericArray.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: GA_AIFNumericArray.h ( GA Library, C++)
7  *
8  * COMMENTS: Array Data Attribute Interface
9  */
10 
11 #ifndef __GA_AIFNumericArrayTuple__
12 #define __GA_AIFNumericArrayTuple__
13 
14 #include "GA_API.h"
15 #include "GA_Types.h"
16 
17 #include <SYS/SYS_Types.h>
19 
20 
21 class GA_Attribute;
22 class GA_Range;
23 
24 /// @brief Generic Attribute Interface class to access an attribute as a
25 /// array.
26 ///
27 /// This class provides the interface to access attribute data. Each
28 /// attribute type may provide this interface if it makes sense.
30 {
31 public:
33  virtual ~GA_AIFNumericArray();
34 
35  /// @{
36  /// Query and set some tuple intrisics.
37  virtual int getTupleSize(const GA_Attribute *attrib) const = 0;
38  virtual bool setTupleSize(GA_Attribute *attrib, int size) const = 0;
39 
40  virtual GA_Storage getStorage(const GA_Attribute *attrib) const = 0;
41  virtual bool setStorage(GA_Attribute *attrib,
42  GA_Storage storage) const = 0;
43  /// @}
44 
45  /// @{
46  /// Erase all arrays
47  virtual bool clear(GA_Attribute *attrib) const = 0;
48  /// @}
49 
50  /// @{
51  /// Return the length of longest array
52  virtual exint findMaximumArrayLength(const GA_Attribute *attrib) const = 0;
53  /// @}
54 
55  /// @{
56  /// Get a single value from a single offset in an attribute array.
57  virtual bool get(const GA_Attribute *attrib,
58  GA_Offset ai, UT_Array<fpreal32> &data) const = 0;
59  virtual bool get(const GA_Attribute *attrib,
60  GA_Offset ai, UT_Array<fpreal64> &data) const = 0;
61  virtual bool get(const GA_Attribute *attrib,
62  GA_Offset ai, UT_Array<int32> &data) const = 0;
63  virtual bool get(const GA_Attribute *attrib,
64  GA_Offset ai, UT_Array<int64> &data) const = 0;
65  /// @}
66 
67  /// @{
68  /// Appends a value from a single offset into a packed array.
69  virtual bool append(const GA_Attribute *attrib,
71  virtual bool append(const GA_Attribute *attrib,
72  GA_Offset ai, UT_PackedArrayOfArrays<fpreal64> &data) const = 0;
73  virtual bool append(const GA_Attribute *attrib,
74  GA_Offset ai, UT_PackedArrayOfArrays<int32> &data) const = 0;
75  virtual bool append(const GA_Attribute *attrib,
76  GA_Offset ai, UT_PackedArrayOfArrays<int64> &data) const = 0;
77  /// @}
78 
79  /// @{
80  /// Stream in a block representation of the array.
81  /// The index array will have nelements+1. Each array will go
82  /// from [index[i] .. index[i+1]) in the data array.
83 #define GETBLOCKFROMINDEX(ITYPE, DTYPE) \
84  virtual bool getBlockFromIndices(const GA_Attribute *attrib, \
85  GA_Index start, GA_Size nelem, \
86  UT_Array<ITYPE> &index, \
87  UT_Array<DTYPE> &data) const = 0;
88 
97 #undef GETBLOCKFROMINDEX
98  /// @}
99 
100  /// @{
101  /// Stream in a packed array representation of the array.
102 #define GETBLOCKFROMINDEX(DTYPE) \
103  bool getPackedArrayFromIndices(const GA_Attribute *attrib, \
104  GA_Index start, GA_Size nelem, \
105  UT_PackedArrayOfArrays<DTYPE> &array) const \
106  { return getBlockFromIndices(attrib, start, nelem, array.rawOffsets(), array.rawData()); }
107 
112 #undef GETBLOCKFROMINDEX
113 
114  /// @}
115 
116  /// @{
117  /// Test if any elements are NAN's
118  virtual bool isNan(const GA_Attribute *attrib, GA_Offset ai) const=0;
119  virtual bool isNan(const GA_Attribute *attrib,
120  const GA_Range &it) const = 0;
121  /// @}
122 
123  /// Return the size of the array for the GA_Offset
124  virtual exint arraySize(const GA_Attribute *atr, GA_Offset off) const = 0;
125 
126  // ----------------------------------------------------------------------
127 
128  /// @{
129  /// Set a single array of the array.
130  virtual bool set(GA_Attribute *attrib, GA_Offset ai,
131  const UT_Array<fpreal32> &data) const = 0;
132  virtual bool set(GA_Attribute *attrib, GA_Offset ai,
133  const UT_Array<fpreal64> &data) const = 0;
134  virtual bool set(GA_Attribute *attrib, GA_Offset ai,
135  const UT_Array<int32> &data) const = 0;
136  virtual bool set(GA_Attribute *attrib, GA_Offset ai,
137  const UT_Array<int64> &data) const = 0;
138  /// @}
139 };
140 
141 #endif
Definition of a geometry attribute.
Definition: GA_Attribute.h:190
Generic Attribute Interface class to access an attribute as a array.
#define GA_API
Definition: GA_API.h:12
bool isNan(const Tuple< SIZE, T > &t)
Return true if a Nan is present in the tuple.
Definition: Tuple.h:243
GLsizeiptr size
Definition: glcorearb.h:663
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_Size GA_Offset
Definition: GA_Types.h:617
long long int64
Definition: SYS_Types.h:107
int64 exint
Definition: SYS_Types.h:116
double fpreal64
Definition: SYS_Types.h:192
#define GETBLOCKFROMINDEX(ITYPE, DTYPE)
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:35
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
float fpreal32
Definition: SYS_Types.h:191
GA_Storage
Definition: GA_Types.h:48