00001
00002 #ifndef _GEMFIRE_VECTOROFSHAREDBASE_HPP_
00003 #define _GEMFIRE_VECTOROFSHAREDBASE_HPP_
00004
00005
00006
00007
00008
00009
00010
00011 #include "gfcpp_globals.hpp"
00012
00013 #include "SharedPtr.hpp"
00014 #ifdef BUILD_CPPCACHE
00015 #include <vector>
00016 #endif
00017
00021 namespace gemfire {
00022
00023 #ifdef BUILD_CPPCACHE
00024 typedef std::vector< gemfire::SharedBasePtr > VofSBP;
00025 typedef VofSBP::const_iterator VofSBPIterator;
00026 #else
00027 class VofSBP;
00028 class VofSBPIterator;
00029 #endif
00030
00033 class CPPCACHE_EXPORT VectorOfSharedBase
00034 {
00035 private:
00036 VofSBP* m_stdvector;
00037
00038 public:
00039
00041 class CPPCACHE_EXPORT Iterator
00042 {
00043 private:
00044
00045 VofSBPIterator* m_iter;
00046
00047 Iterator( const VofSBPIterator& iter );
00048
00049 Iterator( );
00050
00051
00052 public:
00053
00054 Iterator( const Iterator& other );
00055
00056 const SharedBasePtr operator * ( ) const;
00057
00058 Iterator& operator ++ ( );
00059
00060 void operator ++ ( int );
00061
00062 bool operator == ( const Iterator& other ) const;
00063
00064 bool operator != ( const Iterator& other ) const;
00065
00066 ~Iterator( );
00067
00068
00069 friend class VectorOfSharedBase;
00070 };
00071
00073 size_t size( ) const;
00074
00076 size_t max_size( ) const;
00077
00079 size_t capacity( ) const;
00080
00082 bool empty( ) const;
00083
00085 SharedBasePtr& operator [] ( size_t n );
00086
00088 const SharedBasePtr& operator [] ( size_t n ) const;
00089
00091 SharedBasePtr& at( size_t n );
00092
00094 SharedBasePtr& at( size_t n ) const;
00095
00097 Iterator begin( ) const;
00098
00100 Iterator end( ) const;
00101
00103 VectorOfSharedBase( );
00104
00106 VectorOfSharedBase( size_t n );
00107
00109 VectorOfSharedBase( size_t n, const SharedBasePtr& t );
00110
00112 VectorOfSharedBase( const VectorOfSharedBase& other );
00113
00115 ~VectorOfSharedBase( );
00116
00118 VectorOfSharedBase& operator = ( const VectorOfSharedBase& other );
00119
00121 void reserve( size_t n );
00122
00124 SharedBasePtr& front( );
00125
00127 const SharedBasePtr& front( ) const;
00128
00130 SharedBasePtr& back( );
00131
00133 const SharedBasePtr& back( ) const;
00134
00136 void push_back( const SharedBasePtr& e );
00137
00139 void pop_back( );
00140
00142 void swap( VectorOfSharedBase& other );
00143
00145 void clear( );
00146
00150 void resize(size_t n, const SharedBasePtr& t = NULLPTR);
00151
00153 void insert( size_t index, const SharedBasePtr& t );
00154
00157 void erase( size_t index );
00158
00159 };
00160
00161 }
00162
00163 #endif
00164