00001 #ifndef __GEMFIRE_PROPERTIES_H__
00002 #define __GEMFIRE_PROPERTIES_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 #include "gfcpp_globals.hpp"
00017 #include "gf_types.hpp"
00018 #include "Serializable.hpp"
00019 #include "DataInput.hpp"
00020 #include "DataOutput.hpp"
00021 #include "Cacheable.hpp"
00022 #include "CacheableKey.hpp"
00023 #include "CacheableString.hpp"
00024
00025
00026 namespace gemfire {
00027
00033 class CPPCACHE_EXPORT Properties
00034 : public Serializable
00035 {
00036 public:
00037
00038 class Visitor
00039 {
00040 public:
00041 virtual void visit( CacheableKeyPtr& key, CacheablePtr& value ) = 0;
00042 virtual ~Visitor( ) { }
00043 };
00044
00050 CacheableStringPtr find( const char* key);
00057 CacheablePtr find( const CacheableKeyPtr& key );
00058
00064 void insert( const char* key, const char* value );
00065
00071 void insert( const char* key, const int value );
00072
00078 void insert( const CacheableKeyPtr &key, const CacheablePtr &value );
00079
00085 void remove( const char* key );
00086
00092 void remove( const CacheableKeyPtr& key );
00093
00097 void foreach( Visitor& visitor ) const;
00098
00100 uint32_t getSize() const;
00101
00105 void addAll( const PropertiesPtr& other );
00106
00108 static PropertiesPtr create( );
00109
00113 void load( const char* fileName );
00114
00118 virtual void toData( DataOutput& output ) const;
00119
00123 virtual Serializable* fromData( DataInput& input );
00124
00126 static Serializable* createDeserializable( );
00127
00129 virtual int32_t classId( ) const;
00130
00132 virtual int8_t typeId( ) const;
00133
00134 virtual uint32_t objectSize() const {
00135 return 0;
00136 }
00137
00139 virtual ~Properties();
00140
00141 private:
00142
00143 Properties();
00144
00145 void * m_map;
00146
00147 };
00148
00149 };
00150 #endif //ifndef __GEMFIRE_PROPERTIES_H__