HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_RTICachedRange.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_RTICachedRange.h ( GA Library, C++)
7  *
8  * COMMENTS: This is an RTI class that caches the data offsets visited by
9  * another RTI to allow traversal when it would not otherwise
10  * be safe with the original RTI.
11  */
12 
13 #ifndef __GA_RTICachedRange__
14 #define __GA_RTICachedRange__
15 
16 #include "GA_API.h"
17 #include "GA_OffsetList.h"
18 #include "GA_RTISingle.h"
19 #include "GA_Types.h"
20 
21 
22 class GA_IteratorState;
23 class GA_Range;
25 
26 
27 /// @brief Cache a given range for later traversal
29 {
30 public:
31  /// Iterate over the source range but in order.
32  GA_RTICachedRange(const GA_RangeTypeInterface &range_to_cache);
33 
34  // Copy c-tor
36 
37  virtual ~GA_RTICachedRange();
38 
39  /// @{
40  /// RangeTypeInterface implementation
41  virtual GA_RangeTypeInterface *copy() const;
42  virtual bool isSplittable() const { return false; }
43  virtual bool isEmpty() const;
44  virtual GA_Size getMaxEntries() const;
45  virtual GA_Size getEntries() const;
46  virtual bool split(GA_RangeTypeInterface *list[2]) const;
47  virtual bool isEqual(const GA_RangeTypeInterface &src) const;
48  virtual void iterateCopy(GA_IteratorState &dest,
49  const GA_IteratorState &src) const;
50  virtual bool isOrdered() const { return myIsOrdered; }
51  virtual bool areTraversalDeletionsSafe() const { return true; }
52 
53  virtual GA_Size getPageCount() const { return 0; }
54  virtual bool getPageElementRange(GA_Range &, GA_Size, GA_Size) const
58  /// @}
59 
60  /// Accessor to offset list
61  const GA_OffsetList &getOffsetList() const { return myOffsetList; }
62 
63  /// Get a GA_RangeTypeInterface representing the remainder of the range
64  /// after iterating over part of it, as specified by state and current.
65  /// NOTE: The caller is responsible for deleting the returned
66  /// GA_RangeTypeInterface!
67  virtual GA_RangeTypeInterface *getRemainder(
68  const GA_IteratorState &state,
69  const GA_Offset current) const;
70 
71 private:
72  /// @{
73  /// RangeTypeInterface implementation
74  virtual void singleRewind(GA_IteratorState &state) const;
75  virtual bool singleGet(const GA_IteratorState &state,
76  GA_Offset &value) const;
77  virtual void singleNext(GA_IteratorState &state) const;
78  /// @}
79  //
80  /// Initialize the cache.
81  void init(const GA_RangeTypeInterface &range_to_cache);
82 
83  GA_OffsetList myOffsetList;
84 
85  /// We support using a subset of our offset list to allow sharing of the
86  /// underlying data when splitting the range. Note that the valid range
87  /// is [myStart..myEnd-1], i.e., myEnd is non-inclusive.
88  GA_Size myStart, myEnd;
89 
90  bool myIsOrdered;
91 };
92 
93 #endif
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.
const GA_OffsetList & getOffsetList() const
Accessor to offset list.
virtual bool singleGet(const GA_IteratorState &state, GA_Offset &value) const =0
Cache a given range for later traversal.
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
virtual bool isSplittable() const
#define GA_API
Definition: GA_API.h:12
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
virtual GA_Size getPageCount() const
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:617
GA_Offset getFirstOffsetInPageNonSplittable() const
Method which can be called for getFirstOffsetInPage()
Abstract implementation of a range.
virtual void singleNext(GA_IteratorState &state) const =0
GLsizei const GLfloat * value
Definition: glcorearb.h:823
virtual GA_Size getMaxEntries() const =0
Get an upper bound on the size of the range.
virtual void singleRewind(GA_IteratorState &state) const =0
virtual GA_Offset getFirstOffsetInPage(GA_Size) const
virtual bool getPageElementRange(GA_Range &, GA_Size, GA_Size) const
virtual bool isOrdered() const
virtual bool areTraversalDeletionsSafe() const
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:1792