HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_RTIOrderedRange.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_RTIOrderedRange.h ( GA Library, C++)
7  *
8  * COMMENTS: This is an RTI class that sorts and orders another RTI for
9  * iteration or traversal.
10  */
11 
12 #ifndef __GA_RTIOrderedRange__
13 #define __GA_RTIOrderedRange__
14 
15 #include "GA_API.h"
16 #include "GA_OffsetList.h"
17 #include "GA_RTISingle.h"
18 #include "GA_Types.h"
19 
20 class GA_IteratorState;
21 class GA_Range;
23 
24 
26 {
27 public:
28  /// Iterate over the source range but in order.
29  /// @param descending If true, the index order is going to be in
30  /// a descending order. If false, it's ascending.
32  bool descending = false);
33 
34  /// Copy constructor
36 
37  /// Destructor
38  ~GA_RTIOrderedRange() override;
39 
40  /// @{
41  /// RangeTypeInterface implementation
42  GA_RangeTypeInterface *copy() const override;
43  bool isSplittable() const override { return false; }
44  bool isEmpty() const override;
45  GA_Size getMaxEntries() const override;
46  GA_Size getEntries() const override;
47  bool split(GA_RangeTypeInterface *list[2]) const override;
48  bool isEqual(const GA_RangeTypeInterface &src) const override;
49  void iterateCopy(GA_IteratorState &dest,
50  const GA_IteratorState &src) const override;
51  bool isOrdered() const override;
52  bool areTraversalDeletionsSafe() const override { return true; }
53  GA_Size getPageCount() const override { return -1; }
54  bool getPageElementRange(GA_Range &, GA_Size, GA_Size) const override
58  /// @}
59 
60 private:
61  /// @{
62  /// RangeTypeInterface implementation
63  void singleRewind(GA_IteratorState &state) const override;
64  bool singleGet(const GA_IteratorState &state,
65  GA_Offset &value) const override;
66  void singleNext(GA_IteratorState &state) const override;
67  /// @}
68 
69  /// Initialize the ordered range object.
70  void init(const GA_RangeTypeInterface &src,
71  bool descending = false);
72 
73  /// Finds an index that has a valid offset that is equal or greater
74  /// than the index given by the argument. Returns -1 if no such valid
75  /// index can be found.
76  GA_Size findValidOffsetIndexAtOrAfter(GA_Size index) const;
77 
78  /// The array that contains a permutation of offsets that orders
79  /// them according to the index
80  GA_OffsetList myOffsetOrder;
81 
82  /// The iteration step, usually +1 or -1 to indicate traversal direction.
83  int myStep;
84 };
85 
86 #endif
87 
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 getPageElementRange(GA_Range &, GA_Size, GA_Size) const override
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
bool isSplittable() const override
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
GLenum src
Definition: glcorearb.h:1792
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:234
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:640
GA_Offset getFirstOffsetInPage(GA_Size) const override
GA_Offset getFirstOffsetInPageNonSplittable() const
Method which can be called for getFirstOffsetInPage()
bool areTraversalDeletionsSafe() const override
Abstract implementation of a range.
virtual void singleNext(GA_IteratorState &state) const =0
virtual GA_Size getMaxEntries() const =0
Get an upper bound on the size of the range.
virtual void singleRewind(GA_IteratorState &state) const =0
GLuint index
Definition: glcorearb.h:785
GLsizei const GLfloat * value
Definition: glcorearb.h:823
virtual GA_Size getEntries() const =0
Base class for ranges providing consolidation to contiguous blocks.
Definition: GA_RTISingle.h:31
GA_Size getPageCount() const override
virtual bool isEqual(const GA_RangeTypeInterface &src) const =0