00001 #ifndef __GEMFIRE_PROPERTIES_H__
00002 #define __GEMFIRE_PROPERTIES_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00018 #include "gfcpp_globals.hpp"
00019 #include "gf_types.hpp"
00020 #include "Serializable.hpp"
00021 #include "DataInput.hpp"
00022 #include "DataOutput.hpp"
00023 #include "Cacheable.hpp"
00024 #include "CacheableKey.hpp"
00025 #include "CacheableString.hpp"
00026
00027
00028 namespace gemfire {
00029
00037 class CPPCACHE_EXPORT Properties
00038 : public Serializable
00039 {
00040 public:
00041
00042 class Visitor
00043 {
00044 public:
00045 virtual void visit( CacheableKeyPtr& key, CacheablePtr& value ) = 0;
00046 virtual ~Visitor( ) { }
00047 };
00048
00054 CacheableStringPtr find( const char* key);
00061 CacheablePtr find( const CacheableKeyPtr& key );
00062
00068 void insert( const char* key, const char* value );
00069
00075 void insert( const char* key, const int value );
00076
00082 void insert( const CacheableKeyPtr &key, const CacheablePtr &value );
00083
00089 void remove( const char* key );
00090
00096 void remove( const CacheableKeyPtr& key );
00097
00101 void foreach( Visitor& visitor ) const;
00102
00104 uint32_t getSize() const;
00105
00109 void addAll( const PropertiesPtr& other );
00110
00112 static PropertiesPtr create( );
00113
00117 void load( const char* fileName );
00118
00122 virtual void toData( DataOutput& output ) const;
00123
00127 virtual Serializable* fromData( DataInput& input );
00128
00130 static Serializable* createDeserializable( );
00131
00133 virtual int32_t classId( ) const;
00134
00136 virtual int8_t typeId( ) const;
00137
00138 virtual uint32_t objectSize() const {
00139 return 0;
00140 }
00141
00143 virtual ~Properties();
00144
00145 private:
00146
00147 Properties();
00148
00149 void * m_map;
00150
00151 private:
00152 Properties( const Properties& );
00153 const Properties& operator=( const Properties& );
00154
00155 };
00156
00157 };
00158 #endif //ifndef __GEMFIRE_PROPERTIES_H__