HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_RTIOffsetList.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_RTIOffsetList.h ( GA Library, C++)
7  *
8  * COMMENTS: This is similar to GA_RangeOffset, except instead of
9  * specifying a range of offsets, we specify a list of offsets.
10  */
11 
12 #ifndef __GA_RTIOffsetList__
13 #define __GA_RTIOffsetList__
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_IndexMap;
21 class GA_IteratorState;
22 class GA_Range;
24 
25 
26 /// @brief Define a range based on a specific offset list
28 {
29 public:
30  // Iterate over the entire range of the offset list. If end is -1, it will
31  // be set to the number of entries in the offset list.
33  GA_Size start=0, GA_Size end=-1);
34 
35  // Copy c-tor
37 
38  ~GA_RTIOffsetList() override;
39 
40  /// @{
41  /// RangeTypeInterface implementation
42  GA_RangeTypeInterface *copy() const override;
43  bool isSplittable() const override;
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 areTraversalDeletionsSafe() const override { return true; }
52  GA_Size getPageCount() const override { return -1; }
53  bool getPageElementRange(GA_Range &, GA_Size, GA_Size) const override
57  /// @}
58 
59  /// Accessors for offset list.
60  /// @{
61  const GA_OffsetList &getOffsetList() const { return myOffsetList; }
62  bool isFullList() const
63  { return myStart == 0 && myEnd == myOffsetList.size(); }
64  GA_Size getStart() const
65  { return myStart; }
66  GA_Size getEnd() const
67  { return myEnd; }
68  /// @}
69 
70  /// Rewind the iterator (i.e. reset the iterator state). The start/offset
71  /// should be initialized so that they define the first contiguous "block"
72  /// for iteration. If the range is empty, @c start should be greater than
73  /// @c end
74  void iterateRewind(GA_IteratorState &state,
75  GA_Offset &start, GA_Offset &end) const override;
76 
77  /// Choose the next contiguous range. If the iteration is complete,
78  /// @c start should be set to a value greater than @c end.
79  void iterateNext(GA_IteratorState &state,
80  GA_Offset &start, GA_Offset &end) const override;
81 
82 private:
83  /// @{
84  /// RangeTypeInterface implementation
85  void singleRewind(GA_IteratorState &state) const override;
86  bool singleGet(const GA_IteratorState &state,
87  GA_Offset &value) const override;
88  void singleNext(GA_IteratorState &state) const override;
89  /// @}
90 
91  GA_OffsetList myOffsetList;
92  GA_Size myStart, myEnd; // Range of offset list
93 };
94 
95 #endif
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.
virtual bool isSplittable() const =0
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 getPageElementRange(GA_Range &, GA_Size, GA_Size) const override
bool areTraversalDeletionsSafe() const override
#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:236
GA_Size getStart() const
A range of elements in an index-map.
Definition: GA_Range.h:42
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
GA_Offset getFirstOffsetInPage(GA_Size) const override
bool getPageElementRangeNonSplittable() const
Method which can be called for getPageElementRange()
GA_Size GA_Offset
Definition: GA_Types.h:646
bool isFullList() const
GA_Offset getFirstOffsetInPageNonSplittable() const
Method which can be called for getFirstOffsetInPage()
GLuint GLuint end
Definition: glcorearb.h:475
const GA_OffsetList & getOffsetList() const
void iterateNext(GA_IteratorState &state, GA_Offset &start, GA_Offset &end) const override
Abstract implementation of a range.
virtual void singleNext(GA_IteratorState &state) const =0
Define a range based on a specific offset list.
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
GA_Size getPageCount() const override
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
GA_Size getEnd() const
GLenum src
Definition: glcorearb.h:1793