tagged_scalar_wrapper.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__TLV__TAGGED_SCALAR_WRAPPER_HPP_ )
00038 #define _OESS_1__TLV__TAGGED_SCALAR_WRAPPER_HPP_
00039 
00040 #include <oess_1/tlv/h/declspec.hpp>
00041 
00042 #include <string>
00043 
00044 #include <oess_1/tlv/h/base.hpp>
00045 #include <oess_1/tlv/h/default_processors.hpp>
00046 #include <oess_1/tlv/h/errno.hpp>
00047 
00048 namespace oess_1
00049 {
00050 
00051 namespace tlv
00052 {
00053 
00054 //
00055 // tagged_scalar_wrapper_t
00056 //
00057 
00060 
00095 template< default_tag_type_t Tag_value,
00096   class Serializer >
00097 class tagged_scalar_wrapper_t :
00098   public tlv_base_t
00099 {
00100   public :
00102     typedef typename Serializer::value_type_t
00103       value_type_t;
00104 
00107     typedef tagged_scalar_wrapper_t< Tag_value,
00108         Serializer >
00109       self_t;
00110 
00111   private :
00113     Serializer  m_tlv;
00114 
00115   public :
00117     tagged_scalar_wrapper_t()
00118       :
00119         m_tlv( Tag_value )
00120     {
00121     }
00122 
00124     tagged_scalar_wrapper_t(
00125       const value_type_t & value )
00126       :
00127         m_tlv( Tag_value, value )
00128     {
00129     }
00130 
00132     tagged_scalar_wrapper_t(
00133       const self_t & o )
00134       :
00135         m_tlv( o.m_tlv )
00136     {
00137     }
00138 
00139     virtual ~tagged_scalar_wrapper_t()
00140     {
00141     }
00142 
00144     self_t &
00145     operator=( const self_t & o )
00146     {
00147       if( &o != this )
00148       {
00149         m_tlv = o.m_tlv;
00150       }
00151       return *this;
00152     }
00153 
00155     const value_type_t &
00156     query_value() const
00157     {
00158       return m_tlv.query_value();
00159     }
00160 
00162     void
00163     set_value(
00165       const value_type_t & value )
00166     {
00167       m_tlv.set_value( value );
00168     }
00169 
00171     virtual default_tag_type_t
00172     tlv_tag() const
00173     {
00174       return Tag_value;
00175     }
00176 
00180     virtual size_t
00181     tlv_size() const
00182     {
00183       return m_tlv.tlv_size();
00184     }
00185 
00187 
00190     virtual void
00191     tlv_unpack(
00194       oess_1::io::ibinstream_t & s,
00196       default_tag_type_t t)
00197     {
00198       m_tlv.tlv_unpack( s, t );
00199     }
00200 
00202     virtual void
00203     tlv_pack(
00206       oess_1::io::obinstream_t & s ) const
00207     {
00208       m_tlv.tlv_pack( s );
00209     }
00210 };
00211 
00212 } /* namespace tlv */
00213 
00214 } /* namespace oess_1 */
00215 
00216 #endif
00217 

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