ent.hpp

См. документацию.
00001 /*
00002 
00003 Copyright (c) 2002-2005, Yauheni Akhotnikau
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009 - Redistributions of source code must retain the above copyright notice, this
00010 list of conditions and the following disclaimer.
00011 
00012 - Redistributions in binary form must reproduce the above copyright notice, this
00013 list of conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.
00015 
00016 - The name of the author may not be used to endorse or promote products derived
00017 from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00022 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00024 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00027 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00028 OF SUCH DAMAGE.
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 // ient_t
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 // iextension_t
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 // oent_t
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 // oextension_t
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 // isubclass_extension_t
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 // osubclass_extension_t
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 // isubclass_extension_template_t
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 // osubclass_extension_template_t
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 } /* namespace stdsn */
00571 
00572 } /* namespace oess_1 */
00573 
00574 #endif

Документация по ObjESSty. Последние изменения: Fri Oct 13 18:35:36 2006. Создано системой  doxygen 1.4.7
Hosted by uCoz