00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00036 #if !defined( _OESS_1__DB__STORAGE__IMPL__STD_ENTITY_STREAM_HPP_ )
00037 #define _OESS_1__DB__STORAGE__IMPL__STD_ENTITY_STREAM_HPP_
00038
00039 #include <oess_1/stdsn/h/serializable.hpp>
00040
00041 #include <oess_1/db/storage/h/entity_stream.hpp>
00042
00043 namespace oess_1 {
00044
00045 namespace db {
00046
00047 namespace storage {
00048
00049 namespace impl {
00050
00051
00052
00053
00054
00063 class OESS_1__DB__TYPE stream_desc_t
00064 : public oess_1::stdsn::serializable_t
00065 {
00066 typedef oess_1::stdsn::serializable_t base_type_t;
00067 OESS_SERIALIZER( stream_desc_t )
00068
00069 public :
00071 stream_desc_t();
00073 stream_desc_t(
00074 const stream_desc_t & o );
00075 virtual ~stream_desc_t();
00076
00078 stream_desc_t &
00079 operator=(
00080 const stream_desc_t & o );
00081
00083 chain_id_t
00084 first() const;
00085
00087 void
00088 set_first(
00089 const chain_id_t & chain );
00090
00092 chain_id_t
00093 last() const;
00094
00096 void
00097 set_last(
00098 const chain_id_t & chain );
00099
00100 private :
00102 chain_id_t m_first;
00104 chain_id_t m_last;
00105 };
00106
00107
00108
00109
00110
00120 class OESS_1__DB__TYPE stream_item_t
00121 : public oess_1::stdsn::serializable_t
00122 {
00123 typedef oess_1::stdsn::serializable_t base_type_t;
00124 OESS_SERIALIZER( stream_item_t )
00125
00126 public :
00128 stream_item_t();
00130 stream_item_t(
00132 const chain_id_t & description_chain,
00134 const chain_id_t & prev,
00136 oess_1::uint_t & length,
00138 const chain_id_t & entity_chain );
00140 stream_item_t(
00141 const stream_item_t & o );
00142 virtual ~stream_item_t();
00143
00144 enum
00145 {
00147
00151 length_limit = 32
00152 };
00153
00155 stream_item_t &
00156 operator=(
00157 const stream_item_t & o );
00158
00160 chain_id_t
00161 description_chain() const;
00162
00164 void
00165 set_description_chain(
00166 const chain_id_t & chain );
00167
00169 chain_id_t
00170 prev() const;
00171
00173 void
00174 set_prev(
00175 const chain_id_t & chain );
00176
00178 chain_id_t
00179 next() const;
00180
00182 void
00183 set_next(
00184 const chain_id_t & chain );
00185
00187 void
00188 set_entity_params(
00190 oess_1::uint_t length,
00192 const chain_id_t & chain );
00193
00195 oess_1::uint_t
00196 length() const;
00197
00199 const chain_id_t &
00200 entity_chain() const;
00201
00202 private :
00204 chain_id_t m_description_chain;
00206 chain_id_t m_prev;
00208 chain_id_t m_next;
00210 oess_1::uint_t m_length;
00212 chain_id_t m_entity_chain;
00213 };
00214
00215
00216
00217
00218
00229 class std_entity_stream_t
00230 : public entity_stream_t
00231 {
00232 public :
00234 std_entity_stream_t(
00236 chain_storage_t & storage,
00238 oess_1::uint_t id,
00241 const chain_id_t & description_chain );
00242 virtual ~std_entity_stream_t();
00243
00246 virtual oess_1::uint_t
00247 id() const;
00248
00249 virtual chain_id_t
00250 entity_create(
00251 oess_1::io::istream_t & ent_value,
00252 oess_1::uint_t ent_size );
00253
00254 virtual void
00255 entity_load(
00256 const chain_id_t & ent_id,
00257 oess_1::io::ostream_t & ent_value ) const;
00258
00259 virtual void
00260 entity_update(
00261 const chain_id_t & ent_id,
00262 oess_1::io::istream_t & ent_value,
00263 oess_1::uint_t ent_size );
00264
00265 virtual void
00266 entity_destroy(
00267 const chain_id_t & ent_id );
00268
00269 virtual void
00270 entity_destroy_all();
00271
00272 virtual chain_id_t
00273 entity_find_next(
00274 const chain_id_t & ent_id ) const;
00276
00277 private :
00279 chain_storage_t & m_storage;
00281 oess_1::uint_t m_id;
00284 chain_id_t m_description_chain;
00285
00287 stream_desc_t m_desc;
00288 };
00289
00290 }
00291
00292 }
00293
00294 }
00295
00296 }
00297
00298 #endif
00299