HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_DataBitArrayTuple.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_DataBitArrayTuple.h ( GA Library, C++)
7  *
8  * COMMENTS: Maintains an tuple of GA_DataBitArray objects.
9  * This is a tuple of arrays.
10  */
11 
12 #ifndef __GA_DataBitArrayTuple__
13 #define __GA_DataBitArrayTuple__
14 
15 #include "GA_API.h"
16 #include "GA_Types.h"
17 
18 #include <SYS/SYS_Types.h>
19 
20 
21 class GA_DataBitArray;
22 class GA_Defaults;
23 class GA_Defragment;
24 class GA_MergeMap;
25 
26 class UT_MemoryCounter;
27 
28 /// @brief A tuple of bit arrays
29 ///
30 /// This class maintains a tuple of bit arrays.
31 ///
32 /// @see GA_DataBitArray, GA_DataArrayTuple
33 
35 {
36 public:
39 
40  /// Report memory usage
41  int64 getMemoryUsage(bool inclusive) const;
42 
43  /// Count memory usage using a UT_MemoryCounter in order to count
44  /// shared memory correctly.
45  /// If inclusive is true, the size of this object is counted,
46  /// else only memory owned by this object is counted.
47  /// If this is pointed to by the calling object, inclusive should be true.
48  /// If this is contained in the calling object, inclusive should be false.
49  /// (Its memory was already counted in the size of the calling object.)
50  void countMemory(UT_MemoryCounter &counter, bool inclusive) const;
51 
52  /// Setting the tuple size requires the array_size and the defaults
53  void setTupleSize(int tuple_size,
54  GA_Offset array_size, const GA_Defaults &defs);
55 
56  /// This method grows each array of the tuple
57  void setArraySize(GA_Offset size);
58 
59  /// This method queries the (common) size of the arrays.
60  GA_Offset getArraySize() const;
61 
62  void mergeGrowArrayAndCopy(const GA_MergeMap &map,
63  GA_AttributeOwner owner,
64  const GA_DataBitArrayTuple &src);
65 
66  int getTupleSize() const { return myTupleSize; }
67  GA_DataBitArray *getData(int tuple_index)
68  { return myData[tuple_index]; }
69  const GA_DataBitArray *getData(int tuple_index) const
70  { return myData[tuple_index]; }
71 
72  /// @{
73  /// Interface for defragmentation
74  void defragment(const GA_Defragment &defrag);
75  /// @}
76 
77 #if 0
78  /// Save data to a JSON stream.
79  /// @section JSON-GA_DataBitArrayTuple JSON Schema: GA_DataBitArrayTuple
80  /// @code
81  /// {
82  /// "name" : "GA_DataBitArrayTuple",
83  /// "description : "A tuple of bit arrays",
84  /// "properties" :
85  /// {
86  /// "size": {
87  /// "type" : "integer",
88  /// "minimum" : 1,
89  /// },
90  /// "data": {
91  /// "type" : "array",
92  /// "items" : { "$ref":"GA_DataBitArray" }
93  /// }
94  /// }
95  /// }
96  /// @endcode
97  /// @see @ref JSON_FileFormat
98  bool jsonSave(UT_JSONWriter &w, const GA_Range &it,
99  const UT_Options *options) const;
100 #endif
101 private:
102  GA_DataBitArray **myData;
103  int myTupleSize;
104 };
105 
106 #endif
const GA_DataBitArray * getData(int tuple_index) const
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
GA_DataBitArray * getData(int tuple_index)
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
#define GA_API
Definition: GA_API.h:14
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_Size GA_Offset
Definition: GA_Types.h:641
long long int64
Definition: SYS_Types.h:116
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
GLsizeiptr size
Definition: glcorearb.h:664
GA_AttributeOwner
Definition: GA_Types.h:34
A map of string to various well defined value types.
Definition: UT_Options.h:84
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
A tuple of bit arrays.
An array of bits.
GLenum src
Definition: glcorearb.h:1793