gemfire::VectorT< PTR_TYPE > Class Template Reference

Inherited by gemfire::CacheableObjectArray, gemfire::VectorOfCacheable, and gemfire::VectorOfCacheableKey.


Detailed Description

template<class PTR_TYPE>
class gemfire::VectorT< PTR_TYPE >

Vector template type class.

Public Member Functions

const PTR_TYPE at (int32_t n) const
 Return the n'th element with bounds checking.
PTR_TYPE at (int32_t n)
 Return the n'th element with bounds checking.
const PTR_TYPE back () const
 returns the last element.
PTR_TYPE back ()
 returns the last element.
Iterator begin () const
 Get an iterator pointing to the start of vector.
int32_t capacity () const
 return the number of elements allocated for this vector.
void clear ()
 erases all elements.
bool empty () const
 return true if the vector's size is 0.
Iterator end () const
 Get an iterator pointing to the end of vector.
void erase (int32_t index)
 Removes the object at the specified index from a vector.
const PTR_TYPE front () const
 returns the first element.
PTR_TYPE front ()
 returns the first element.
void insert (int32_t index, const PTR_TYPE &t)
 insert object at the given position.
int32_t length () const
 synonym for size.
int32_t max_size () const
 return the largest possible size of the vector.
VectorToperator= (const VectorT &other)
 assignment operator
const PTR_TYPE operator[] (int32_t n) const
 Return the n'th element.
PTR_TYPE operator[] (int32_t n)
 Return the n'th element.
void pop_back ()
 removes the last element.
void push_back (const PTR_TYPE &e)
 insert a new element at the end.
void reserve (int32_t n)
 reallocate a vector to hold n elements.
void resize (int32_t n, const PTR_TYPE &t=gemfire::NullSharedBase::s_instancePtr)
 inserts or erases elements at the end such that size becomes n.
int32_t size () const
 return the size of the vector.
void swap (VectorT &other)
 swaps the contents of two vectors.
 VectorT (const VectorT &other)
 copy constructor
 VectorT (int32_t n, const PTR_TYPE &t)
 Create a vector with n copies of t.
 VectorT (int32_t n)
 Create a vector with n elements allocated.
 VectorT ()
 Create an empty vector.
 ~VectorT ()
 destructor, sets all SharedPtr elements to NULLPTR

Data Structures

class  Iterator
 Interface of an iterator for VectorT. More...

Constructor & Destructor Documentation

template<class PTR_TYPE>
gemfire::VectorT< PTR_TYPE >::VectorT (  )  [inline]

Create an empty vector.

template<class PTR_TYPE>
gemfire::VectorT< PTR_TYPE >::VectorT ( int32_t  n  )  [inline]

Create a vector with n elements allocated.

template<class PTR_TYPE>
gemfire::VectorT< PTR_TYPE >::VectorT ( int32_t  n,
const PTR_TYPE &  t 
) [inline]

Create a vector with n copies of t.

template<class PTR_TYPE>
gemfire::VectorT< PTR_TYPE >::VectorT ( const VectorT< PTR_TYPE > &  other  )  [inline]

copy constructor

template<class PTR_TYPE>
gemfire::VectorT< PTR_TYPE >::~VectorT (  )  [inline]

destructor, sets all SharedPtr elements to NULLPTR


Member Function Documentation

template<class PTR_TYPE>
const PTR_TYPE gemfire::VectorT< PTR_TYPE >::at ( int32_t  n  )  const [inline]

Return the n'th element with bounds checking.

template<class PTR_TYPE>
PTR_TYPE gemfire::VectorT< PTR_TYPE >::at ( int32_t  n  )  [inline]

Return the n'th element with bounds checking.

template<class PTR_TYPE>
const PTR_TYPE gemfire::VectorT< PTR_TYPE >::back (  )  const [inline]

returns the last element.

template<class PTR_TYPE>
PTR_TYPE gemfire::VectorT< PTR_TYPE >::back (  )  [inline]

returns the last element.

template<class PTR_TYPE>
Iterator gemfire::VectorT< PTR_TYPE >::begin (  )  const [inline]

Get an iterator pointing to the start of vector.

template<class PTR_TYPE>
int32_t gemfire::VectorT< PTR_TYPE >::capacity (  )  const [inline]

return the number of elements allocated for this vector.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::clear (  )  [inline]

erases all elements.

template<class PTR_TYPE>
bool gemfire::VectorT< PTR_TYPE >::empty (  )  const [inline]

return true if the vector's size is 0.

template<class PTR_TYPE>
Iterator gemfire::VectorT< PTR_TYPE >::end (  )  const [inline]

Get an iterator pointing to the end of vector.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::erase ( int32_t  index  )  [inline]

Removes the object at the specified index from a vector.

template<class PTR_TYPE>
const PTR_TYPE gemfire::VectorT< PTR_TYPE >::front (  )  const [inline]

returns the first element.

template<class PTR_TYPE>
PTR_TYPE gemfire::VectorT< PTR_TYPE >::front (  )  [inline]

returns the first element.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::insert ( int32_t  index,
const PTR_TYPE &  t 
) [inline]

insert object at the given position.

template<class PTR_TYPE>
int32_t gemfire::VectorT< PTR_TYPE >::length (  )  const [inline]

synonym for size.

template<class PTR_TYPE>
int32_t gemfire::VectorT< PTR_TYPE >::max_size (  )  const [inline]

return the largest possible size of the vector.

template<class PTR_TYPE>
VectorT& gemfire::VectorT< PTR_TYPE >::operator= ( const VectorT< PTR_TYPE > &  other  )  [inline]

assignment operator

template<class PTR_TYPE>
const PTR_TYPE gemfire::VectorT< PTR_TYPE >::operator[] ( int32_t  n  )  const [inline]

Return the n'th element.

template<class PTR_TYPE>
PTR_TYPE gemfire::VectorT< PTR_TYPE >::operator[] ( int32_t  n  )  [inline]

Return the n'th element.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::pop_back (  )  [inline]

removes the last element.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::push_back ( const PTR_TYPE &  e  )  [inline]

insert a new element at the end.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::reserve ( int32_t  n  )  [inline]

reallocate a vector to hold n elements.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::resize ( int32_t  n,
const PTR_TYPE &  t = gemfire::NullSharedBase::s_instancePtr 
) [inline]

inserts or erases elements at the end such that size becomes n.

Not to be confused with reserve which simply allocates the space, resize fills the space with active elements.

template<class PTR_TYPE>
int32_t gemfire::VectorT< PTR_TYPE >::size (  )  const [inline]

return the size of the vector.

template<class PTR_TYPE>
void gemfire::VectorT< PTR_TYPE >::swap ( VectorT< PTR_TYPE > &  other  )  [inline]

swaps the contents of two vectors.


GemFire C++ Cache API Documentation