3 #ifndef GEODE_VECTORT_H_ 4 #define GEODE_VECTORT_H_ 23 #include "geode_globals.hpp" 36 template <
class PTR_TYPE>
53 inline const PTR_TYPE operator*()
const {
54 return staticCast<PTR_TYPE>(*m_iter);
62 inline void operator++(
int) { m_iter++; }
64 inline bool operator==(
const Iterator& other)
const {
65 return (m_iter == other.m_iter);
68 inline bool operator!=(
const Iterator& other)
const {
69 return (m_iter != other.m_iter);
76 inline int32_t
size()
const {
return static_cast<int32_t
>(m_vector.
size()); }
80 return static_cast<int32_t
>(m_vector.
size());
85 return static_cast<int32_t
>(m_vector.
max_size());
90 return static_cast<int32_t
>(m_vector.
capacity());
98 return staticCast<PTR_TYPE>(m_vector[n]);
103 return staticCast<PTR_TYPE>(m_vector[n]);
107 inline PTR_TYPE
at(int32_t n) {
return staticCast<PTR_TYPE>(m_vector.
at(n)); }
110 inline const PTR_TYPE
at(int32_t n)
const {
111 return staticCast<PTR_TYPE>(m_vector.
at(n));
115 inline Iterator
begin()
const {
return Iterator(m_vector.
begin()); }
118 inline Iterator
end()
const {
return Iterator(m_vector.
end()); }
127 inline VectorT(int32_t n,
const PTR_TYPE& t) : m_vector(n, t) {}
139 m_vector = other.m_vector;
147 inline PTR_TYPE
front() {
return staticCast<PTR_TYPE>(m_vector.
front()); }
150 inline const PTR_TYPE
front()
const {
151 return staticCast<PTR_TYPE>(m_vector.
front());
155 inline PTR_TYPE
back() {
return staticCast<PTR_TYPE>(m_vector.
back()); }
158 inline const PTR_TYPE
back()
const {
159 return staticCast<PTR_TYPE>(m_vector.
back());
177 inline void resize(int32_t n,
const PTR_TYPE& t = NULLPTR) {
182 inline void insert(int32_t index,
const PTR_TYPE& t) {
183 m_vector.
insert(index, t);
216 : _VectorOfCacheable(n, t) {}
220 : _VectorOfCacheable(other) {}
244 : _VectorOfCacheableKey(n, t) {}
248 : _VectorOfCacheableKey(other) {}
260 #endif // GEODE_VECTORT_H_ void swap(VectorOfSharedBase &other)
swaps the contents of two vectors.
bool empty() const
return true if the vector's size is 0.
Definition: VectorT.hpp:94
const PTR_TYPE back() const
returns the last element.
Definition: VectorT.hpp:158
int32_t max_size() const
return the largest possible size of the vector.
int32_t max_size() const
return the largest possible size of the vector.
Definition: VectorT.hpp:84
_VectorOfCacheableKey::Iterator Iterator
Iterator class for the vector.
Definition: VectorT.hpp:234
Iterator begin() const
Get an iterator pointing to the start of vector.
Definition: VectorT.hpp:115
int32_t size() const
return the size of the vector.
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
VectorOfCacheableKey(const VectorOfCacheableKey &other)
Copy constructor.
Definition: VectorT.hpp:247
VectorOfCacheable(const VectorOfCacheable &other)
Copy constructor.
Definition: VectorT.hpp:219
A vector of Cacheable objects that also extends SharedBase for smart pointers.
Definition: VectorT.hpp:202
VectorT(int32_t n, const PTR_TYPE &t)
Create a vector with n copies of t.
Definition: VectorT.hpp:127
int32_t length() const
synonym for size.
Definition: VectorT.hpp:79
const PTR_TYPE front() const
returns the first element.
Definition: VectorT.hpp:150
int32_t size() const
return the size of the vector.
Definition: VectorT.hpp:76
const PTR_TYPE at(int32_t n) const
Return the n'th element with bounds checking.
Definition: VectorT.hpp:110
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
Interface of an iterator for VectorT.
Definition: VectorT.hpp:43
Iterator begin() const
Get an iterator pointing to the start of vector.
VectorOfCacheable(int32_t n, const CacheablePtr &t)
Create a vector with n copies of t.
Definition: VectorT.hpp:215
PTR_TYPE back()
returns the last element.
Definition: VectorT.hpp:155
void erase(int32_t index)
removes the object at the specified index from a vector
void resize(int32_t n, const PTR_TYPE &t=::apache::geode::client::NullSharedBase::s_instancePtr)
inserts or erases elements at the end such that size becomes n.
Definition: VectorT.hpp:177
void insert(int32_t index, const SharedBasePtr &t)
insert object at the given index.
bool empty() const
return true if the vector's size is 0.
~VectorT()
destructor, sets all SharedPtr elements to NULLPTR
Definition: VectorT.hpp:133
SharedBasePtr & front()
returns the first element.
VectorT(int32_t n)
Create a vector with n elements allocated.
Definition: VectorT.hpp:124
_VectorOfCacheable::Iterator Iterator
Iterator class for the vector.
Definition: VectorT.hpp:206
void push_back(const PTR_TYPE &e)
insert a new element at the end.
Definition: VectorT.hpp:163
void pop_back()
removes the last element.
Definition: VectorT.hpp:166
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:52
PTR_TYPE at(int32_t n)
Return the n'th element with bounds checking.
Definition: VectorT.hpp:107
void insert(int32_t index, const PTR_TYPE &t)
insert object at the given position.
Definition: VectorT.hpp:182
VectorOfCacheableKey(int32_t n)
Create a vector with n elements allocated.
Definition: VectorT.hpp:240
VectorOfCacheableKey(int32_t n, const CacheableKeyPtr &t)
Create a vector with n copies of t.
Definition: VectorT.hpp:243
void swap(VectorT &other)
swaps the contents of two vectors.
Definition: VectorT.hpp:169
VectorT()
Create an empty vector.
Definition: VectorT.hpp:121
void resize(int32_t n, const SharedBasePtr &t=::apache::geode::client::NullSharedBase::s_instancePtr)
inserts or erases elements at the end such that size becomes n.
Interface of an iterator for VectorOfSharedBase.
Definition: VectorOfSharedBase.hpp:53
void push_back(const SharedBasePtr &e)
insert a new element at the end.
VectorOfCacheableKey()
Create an empty vector.
Definition: VectorT.hpp:237
Represents a vector of apache::geode::client::SharedBasePtr
Definition: VectorOfSharedBase.hpp:47
SharedBasePtr & at(int32_t n)
Return the n'th element with bounds checking.
void reserve(int32_t n)
reallocate a vector to hold n elements.
Definition: VectorT.hpp:144
PTR_TYPE operator[](int32_t n)
Return the n'th element.
Definition: VectorT.hpp:97
PTR_TYPE front()
returns the first element.
Definition: VectorT.hpp:147
Iterator end() const
Get an iterator pointing to the end of vector.
SharedBasePtr & back()
returns the last element.
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:40
void reserve(int32_t n)
reallocate a vector to hold n elements.
void clear()
erases all elements.
void pop_back()
removes the last element.
Vector template type class.
Definition: VectorT.hpp:37
const PTR_TYPE operator[](int32_t n) const
Return the n'th element.
Definition: VectorT.hpp:102
Iterator end() const
Get an iterator pointing to the end of vector.
Definition: VectorT.hpp:118
A vector of CacheableKey objects that also extends SharedBase for smart pointers. ...
Definition: VectorT.hpp:230
int32_t capacity() const
return the number of elements allocated for this vector.
VectorOfCacheable()
Create an empty vector.
Definition: VectorT.hpp:209
void erase(int32_t index)
Removes the object at the specified index from a vector.
Definition: VectorT.hpp:187
VectorT & operator=(const VectorT &other)
assignment operator
Definition: VectorT.hpp:138
VectorT(const VectorT &other)
copy constructor
Definition: VectorT.hpp:130
VectorOfCacheable(int32_t n)
Create a vector with n elements allocated.
Definition: VectorT.hpp:212
void clear()
erases all elements.
Definition: VectorT.hpp:172
This namespace contains all the Geode C++ API classes, enumerations and globals.
int32_t capacity() const
return the number of elements allocated for this vector.
Definition: VectorT.hpp:89