VMware GemFire Native C++ Reference
9.2.4
|
Go to the documentation of this file.
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);
190 typedef VectorT<CacheablePtr> _VectorOfCacheable;
191 typedef VectorT<CacheableKeyPtr> _VectorOfCacheableKey;
192 typedef VectorT<RegionEntryPtr> VectorOfRegionEntry;
193 typedef VectorT<RegionPtr> VectorOfRegion;
194 typedef VectorT<CacheableStringPtr> VectorOfCacheableString;
195 typedef VectorT<CqListenerPtr> VectorOfCqListener;
196 typedef VectorT<CqQueryPtr> VectorOfCqQuery;
254 typedef SharedPtr<VectorOfCacheable> VectorOfCacheablePtr;
255 typedef SharedPtr<VectorOfCacheableKey> VectorOfCacheableKeyPtr;
260 #endif // GEODE_VECTORT_H_
SharedBasePtr & at(int32_t n)
Return the n'th element with bounds checking.
const PTR_TYPE operator[](int32_t n) const
Return the n'th element.
Definition: VectorT.hpp:102
Represents a vector of apache::geode::client::SharedBasePtr
Definition: VectorOfSharedBase.hpp:47
Iterator begin() const
Get an iterator pointing to the start of vector.
Definition: VectorT.hpp:115
Each enum represents a predefined RegionAttributes in a {}.
Definition: Assert.hpp:31
int32_t size() const
return the size of the vector.
Definition: VectorT.hpp:76
VectorOfCacheableKey()
Create an empty vector.
Definition: VectorT.hpp:237
void insert(int32_t index, const PTR_TYPE &t)
insert object at the given position.
Definition: VectorT.hpp:182
void pop_back()
removes the last element.
int32_t capacity() const
return the number of elements allocated for this vector.
Definition: VectorT.hpp:89
~VectorT()
destructor, sets all SharedPtr elements to NULLPTR
Definition: VectorT.hpp:133
void push_back(const PTR_TYPE &e)
insert a new element at the end.
Definition: VectorT.hpp:163
int32_t length() const
synonym for size.
Definition: VectorT.hpp:79
VectorT()
Create an empty vector.
Definition: VectorT.hpp:121
bool empty() const
return true if the vector's size is 0.
Iterator begin() const
Get an iterator pointing to the start of vector.
VectorT(int32_t n, const PTR_TYPE &t)
Create a vector with n copies of t.
Definition: VectorT.hpp:127
VectorOfCacheableKey(int32_t n, const CacheableKeyPtr &t)
Create a vector with n copies of t.
Definition: VectorT.hpp:243
VectorOfCacheableKey(const VectorOfCacheableKey &other)
Copy constructor.
Definition: VectorT.hpp:247
VectorT(int32_t n)
Create a vector with n elements allocated.
Definition: VectorT.hpp:124
void swap(VectorOfSharedBase &other)
swaps the contents of two vectors.
int32_t capacity() const
return the number of elements allocated for this vector.
Iterator end() const
Get an iterator pointing to the end of vector.
Definition: VectorT.hpp:118
VectorOfCacheable(int32_t n)
Create a vector with n elements allocated.
Definition: VectorT.hpp:212
void erase(int32_t index)
removes the object at the specified index from a vector
VectorOfCacheable(int32_t n, const CacheablePtr &t)
Create a vector with n copies of t.
Definition: VectorT.hpp:215
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
PTR_TYPE operator[](int32_t n)
Return the n'th element.
Definition: VectorT.hpp:97
const PTR_TYPE back() const
returns the last element.
Definition: VectorT.hpp:158
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.
SharedBasePtr & front()
returns the first element.
void swap(VectorT &other)
swaps the contents of two vectors.
Definition: VectorT.hpp:169
int32_t max_size() const
return the largest possible size of the vector.
VectorT(const VectorT &other)
copy constructor
Definition: VectorT.hpp:130
A vector of Cacheable objects that also extends SharedBase for smart pointers.
Definition: VectorT.hpp:202
VectorT & operator=(const VectorT &other)
assignment operator
Definition: VectorT.hpp:138
const PTR_TYPE front() const
returns the first element.
Definition: VectorT.hpp:150
Iterator end() const
Get an iterator pointing to the end of vector.
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
void pop_back()
removes the last element.
Definition: VectorT.hpp:166
void clear()
erases all elements.
void clear()
erases all elements.
Definition: VectorT.hpp:172
_VectorOfCacheable::Iterator Iterator
Iterator class for the vector.
Definition: VectorT.hpp:206
int32_t size() const
return the size of the vector.
_VectorOfCacheableKey::Iterator Iterator
Iterator class for the vector.
Definition: VectorT.hpp:234
PTR_TYPE back()
returns the last element.
Definition: VectorT.hpp:155
bool empty() const
return true if the vector's size is 0.
Definition: VectorT.hpp:94
const PTR_TYPE at(int32_t n) const
Return the n'th element with bounds checking.
Definition: VectorT.hpp:110
int32_t max_size() const
return the largest possible size of the vector.
Definition: VectorT.hpp:84
SharedBasePtr & back()
returns the last element.
VectorOfCacheable(const VectorOfCacheable &other)
Copy constructor.
Definition: VectorT.hpp:219
void push_back(const SharedBasePtr &e)
insert a new element at the end.
PTR_TYPE at(int32_t n)
Return the n'th element with bounds checking.
Definition: VectorT.hpp:107
void erase(int32_t index)
Removes the object at the specified index from a vector.
Definition: VectorT.hpp:187
void insert(int32_t index, const SharedBasePtr &t)
insert object at the given index.
void reserve(int32_t n)
reallocate a vector to hold n elements.
Definition: VectorT.hpp:144
Definition: SharedBase.hpp:40
VectorOfCacheableKey(int32_t n)
Create a vector with n elements allocated.
Definition: VectorT.hpp:240
Interface of an iterator for VectorT.
Definition: VectorT.hpp:43
void reserve(int32_t n)
reallocate a vector to hold n elements.
VectorOfCacheable()
Create an empty vector.
Definition: VectorT.hpp:209
Interface of an iterator for VectorOfSharedBase.
Definition: VectorOfSharedBase.hpp:53
PTR_TYPE front()
returns the first element.
Definition: VectorT.hpp:147
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:52
A vector of CacheableKey objects that also extends SharedBase for smart pointers.
Definition: VectorT.hpp:230
Vector template type class.
Definition: VectorT.hpp:37
Pivotal GemFire C++ Cache API Documentation