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
00037 #if !defined( _OESS_1__STDSN__ENT_HPP_ )
00038 #define _OESS_1__STDSN__ENT_HPP_
00039
00040 #include <cpp_util_2/h/nocopy.hpp>
00041
00042 #include <oess_1/stdsn/h/declspec.hpp>
00043
00044 #include <oess_1/io/h/stream.hpp>
00045
00046 namespace oess_1 {
00047
00048 namespace stdsn {
00049
00050 class iextension_t;
00051 class oextension_t;
00052
00053 class unknown_extension_t;
00054
00055
00056
00057
00058
00063 class OESS_1__STDSN__TYPE ient_t
00064 : private cpp_util_2::nocopy_t
00065 {
00066 public :
00067 virtual ~ient_t();
00068
00077 virtual bool
00078 obj_start(
00079 const void * object,
00080 const std::string * type_name,
00081 const std::string & scheme ) = 0;
00082
00087 virtual void
00088 obj_finish(
00089 const void * object,
00090 const std::string * type_name ) = 0;
00091
00099 virtual void
00100 obj_complete(
00101 const void * object,
00102 const std::string * type_name ) = 0;
00103
00105
00112 virtual void
00113 unpack_type_name(
00115 std::string & type_name ) = 0;
00116
00118 virtual oess_1::io::istream_t &
00119 query_stream() = 0;
00120
00129 virtual bool
00130 check_optional_attr_existence(
00132 const std::string & attr_name ) = 0;
00133
00145 virtual iextension_t *
00146 extension_start() = 0;
00147
00153 virtual void
00154 extension_finish(
00157 iextension_t & extension ) = 0;
00158 };
00159
00160
00161
00162
00163
00169 class OESS_1__STDSN__TYPE iextension_t
00170 : public ient_t
00171 {
00172 public :
00173 virtual ~iextension_t();
00174
00177 virtual bool
00178 obj_start(
00179 const void * object,
00180 const std::string * type_name,
00181 const std::string & scheme ) = 0;
00182
00183 virtual void
00184 obj_finish(
00185 const void * object,
00186 const std::string * type_name ) = 0;
00187
00188 virtual void
00189 obj_complete(
00190 const void * object,
00191 const std::string * type_name ) = 0;
00192
00193 virtual void
00194 unpack_type_name(
00195 std::string & type_name ) = 0;
00196
00197 virtual oess_1::io::istream_t &
00198 query_stream() = 0;
00199
00200 virtual bool
00201 check_optional_attr_existence(
00202 const std::string & attr_name ) = 0;
00203
00204 virtual iextension_t *
00205 extension_start() = 0;
00206
00207 virtual void
00208 extension_finish(
00209 iextension_t & extension ) = 0;
00211
00217 virtual bool
00218 is_present() const = 0;
00219
00224 virtual void
00225 unpack_opaque( unknown_extension_t & ext ) = 0;
00226 };
00227
00228
00229
00230
00231
00236 class OESS_1__STDSN__TYPE oent_t
00237 : private cpp_util_2::nocopy_t
00238 {
00239 public :
00240 virtual ~oent_t();
00241
00250 virtual bool
00251 obj_start(
00253 const void * object,
00256 const std::string * type_name,
00257 const std::string & scheme ) = 0;
00258
00260 virtual void
00261 obj_finish(
00264 const void * object,
00267 const std::string * type_name ) = 0;
00268
00276 virtual void
00277 obj_complete(
00278 const void * object,
00279 const std::string * type_name ) = 0;
00280
00282
00292 virtual void
00293 pack_type_name(
00295 const std::string & type_name,
00297 const std::string & type_scheme ) = 0;
00298
00300 virtual oess_1::io::ostream_t &
00301 query_stream() = 0;
00302
00309 virtual bool
00310 set_optional_attr_existence(
00312 const std::string & attr_name,
00315 bool existence ) = 0;
00316
00328 virtual oextension_t *
00329 extension_start() = 0;
00330
00336 virtual void
00337 extension_finish(
00340 oextension_t & extension ) = 0;
00341 };
00342
00343
00344
00345
00346
00352 class OESS_1__STDSN__TYPE oextension_t
00353 : public oent_t
00354 {
00355 public :
00356 virtual ~oextension_t();
00357
00360 virtual bool
00361 obj_start(
00362 const void * object,
00363 const std::string * type_name,
00364 const std::string & scheme ) = 0;
00365
00366 virtual void
00367 obj_finish(
00368 const void * object,
00369 const std::string * type_name ) = 0;
00370
00371 virtual void
00372 obj_complete(
00373 const void * object,
00374 const std::string * type_name ) = 0;
00375
00376 virtual void
00377 pack_type_name(
00378 const std::string & type_name,
00379 const std::string & type_scheme ) = 0;
00380
00381 virtual oess_1::io::ostream_t &
00382 query_stream() = 0;
00383
00384 virtual bool
00385 set_optional_attr_existence(
00386 const std::string & attr_name,
00387 bool existence ) = 0;
00388
00389 virtual oextension_t *
00390 extension_start() = 0;
00391
00392 virtual void
00393 extension_finish(
00394 oextension_t & extension ) = 0;
00396
00407 virtual void
00408 pack( oess_1::io::ostream_t & to ) const = 0;
00409
00421 virtual void
00422 pack_opaque( const unknown_extension_t & ext ) = 0;
00423 };
00424
00425
00426
00427
00428
00434 class OESS_1__STDSN__TYPE isubclass_extension_t
00435 {
00436 public :
00437 virtual ~isubclass_extension_t();
00438
00441 virtual void
00442 operator()( ient_t & ) = 0;
00443 };
00444
00445
00446
00447
00448
00454 class OESS_1__STDSN__TYPE osubclass_extension_t
00455 {
00456 public :
00457 virtual ~osubclass_extension_t();
00458
00461 virtual void
00462 operator()( oent_t & ) = 0;
00463 };
00464
00465
00466
00467
00468
00474 template< class T >
00475 class isubclass_extension_template_t
00476 : public isubclass_extension_t
00477 {
00478 public :
00480 typedef T object_t;
00482 typedef void (*unpack_self_t)(
00483 ient_t &, T &, isubclass_extension_t * );
00484
00486 isubclass_extension_template_t(
00488 object_t & o,
00490 unpack_self_t unpack_self,
00493 isubclass_extension_t * subclass )
00494 : m_object( o )
00495 , m_unpack_self( unpack_self )
00496 , m_subclass( subclass )
00497 {}
00498
00499 virtual void
00500 operator()( ient_t & from )
00501 {
00502 (*m_unpack_self)( from, m_object, m_subclass );
00503 }
00504
00505 private :
00507 object_t & m_object;
00509 unpack_self_t m_unpack_self;
00511
00514 isubclass_extension_t * m_subclass;
00515 };
00516
00517
00518
00519
00520
00526 template< class T >
00527 class osubclass_extension_template_t
00528 : public osubclass_extension_t
00529 {
00530 public :
00532 typedef T object_t;
00534 typedef void (*pack_self_t)(
00535 oent_t &, const T &, osubclass_extension_t * );
00536
00538 osubclass_extension_template_t(
00540 const object_t & o,
00542 pack_self_t pack_self,
00545 osubclass_extension_t * subclass )
00546 : m_object( o )
00547 , m_pack_self( pack_self )
00548 , m_subclass( subclass )
00549 {}
00550
00551 virtual void
00552 operator()( oent_t & from )
00553 {
00554 (*m_pack_self)( from, m_object, m_subclass );
00555 }
00556
00557 private :
00559 const object_t & m_object;
00561 pack_self_t m_pack_self;
00563
00566 osubclass_extension_t * m_subclass;
00567 };
00568
00569
00570 }
00571
00572 }
00573
00574 #endif