HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_RTIIndex.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_RTIIndex.h ( GA Library, C++)
7  *
8  * COMMENTS: This is like the "Python" range function. That is, the end is
9  * non-inclusive:
10  * GA_RTIIndex(list, 0, 3) = [0, 1, 2]
11  */
12 
13 #ifndef __GA_RTIIndex__
14 #define __GA_RTIIndex__
15 
16 #include "GA_API.h"
17 #include "GA_RTISingle.h"
18 #include "GA_Types.h"
19 
20 
21 class GA_IndexMap;
22 class GA_IteratorState;
23 class GA_Range;
25 
26 
28 {
29 public:
30  /// Iterate over the entire range of elements (in order)
31  GA_RTIIndex(GA_IndexMap &list);
32  GA_RTIIndex(const GA_IndexMap &list);
33 
34  /// Specify a single element by index
35  GA_RTIIndex(GA_IndexMap &list, GA_Index singleton);
36  GA_RTIIndex(const GA_IndexMap &list, GA_Index singleton);
37 
38  /// Iterate over a range of elements, passing a negative step will iterate
39  /// backward over the range (in this case end should be < start).
41  GA_Size step=1);
42  GA_RTIIndex(const GA_IndexMap &list, GA_Index start, GA_Index end,
43  GA_Size step=1);
44 
45  /// Copy constructor
46  GA_RTIIndex(const GA_RTIIndex &src);
47 
48  /// Destructor
49  ~GA_RTIIndex() override;
50 
51  /// @{
52  /// RangeTypeInterface implementation
53  GA_RangeTypeInterface *copy() const override;
54  bool isSplittable() const override { return false; }
55  bool isEmpty() const override;
56  GA_Size getMaxEntries() const override;
57  GA_Size getEntries() const override;
58  bool split(GA_RangeTypeInterface *list[2]) const override;
59  bool isEqual(const GA_RangeTypeInterface &src) const override;
60  void iterateCopy(GA_IteratorState &dest,
61  const GA_IteratorState &src) const override;
62  void iterateRewind(GA_IteratorState &state,
63  GA_Offset &start, GA_Offset &end) const override;
64  void iterateNext(GA_IteratorState &state,
65  GA_Offset &start, GA_Offset &end) const override;
66  bool isOrdered() const override;
67  bool areTraversalDeletionsSafe() const override { return true; }
68  bool canContainDuplicates() const override { return false; }
69  GA_Size getPageCount() const override { return -1; }
70  bool getPageElementRange(GA_Range &, GA_Size, GA_Size) const override
74  /// @}
75 
76 private:
77  /// @{
78  /// RangeTypeInterface implementation
79  void singleRewind(GA_IteratorState &state) const override;
80  bool singleGet(const GA_IteratorState &state,
81  GA_Offset &value) const override;
82  void singleNext(GA_IteratorState &state) const override;
83  /// @}
84  void init(GA_Size start, GA_Size end, GA_Size step);
85 
86  GA_Index myStart, myEnd;
88 };
89 
90 #endif
91 
A class to manage an ordered array which has fixed offset handles.
Definition: GA_IndexMap.h:63
virtual bool isEmpty() const =0
Check whether the range is empty.
virtual GA_RangeTypeInterface * copy() const =0
Method to create a copy of this selection.
bool areTraversalDeletionsSafe() const override
Definition: GA_RTIIndex.h:67
virtual bool singleGet(const GA_IteratorState &state, GA_Offset &value) const =0
virtual void iterateCopy(GA_IteratorState &dest, const GA_IteratorState &src) const =0
Copy iterator state. The dest state will not have been constructed.
virtual bool split(GA_RangeTypeInterface *list[2]) const =0
GLuint start
Definition: glcorearb.h:475
bool isSplittable() const override
Definition: GA_RTIIndex.h:54
int myStep
Definition: GT_CurveEval.h:264
virtual bool isOrdered() const
Query if the RTI is ordered according to the index.
#define GA_API
Definition: GA_API.h:14
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:235
A range of elements in an index-map.
Definition: GA_Range.h:42
bool getPageElementRangeNonSplittable() const
Method which can be called for getPageElementRange()
GA_Size GA_Offset
Definition: GA_Types.h:641
GA_Size getPageCount() const override
Definition: GA_RTIIndex.h:69
GA_Offset getFirstOffsetInPage(GA_Size) const override
Definition: GA_RTIIndex.h:72
GA_Offset getFirstOffsetInPageNonSplittable() const
Method which can be called for getFirstOffsetInPage()
GLuint GLuint end
Definition: glcorearb.h:475
bool canContainDuplicates() const override
Definition: GA_RTIIndex.h:68
void iterateNext(GA_IteratorState &state, GA_Offset &start, GA_Offset &end) const override
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:635
Abstract implementation of a range.
virtual void singleNext(GA_IteratorState &state) const =0
void iterateRewind(GA_IteratorState &state, GA_Offset &start, GA_Offset &end) const override
virtual GA_Size getMaxEntries() const =0
Get an upper bound on the size of the range.
virtual void singleRewind(GA_IteratorState &state) const =0
bool getPageElementRange(GA_Range &, GA_Size, GA_Size) const override
Definition: GA_RTIIndex.h:70
Definition: core.h:1131
virtual GA_Size getEntries() const =0
Base class for ranges providing consolidation to contiguous blocks.
Definition: GA_RTISingle.h:31
virtual bool isEqual(const GA_RangeTypeInterface &src) const =0
GLenum src
Definition: glcorearb.h:1793