Equalizer  1.4.1
dataIStreamArchive.h
00001 
00002 /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@googlemail.com>
00003  *               2012, Stefan Eilemann <eile@eyescale.ch>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 // Based on portable_iarchive.hpp
00020 // https://github.com/boost-vault/serialization/eos_portable_archive.zip
00021 // Copyright Christian Pfligersdorffer, 2007. All rights reserved.
00022 //
00023 // Distributed under the Boost Software License, Version 1.0. (See
00024 // accompanying file LICENSE_1_0.txt or copy at
00025 // http://www.boost.org/LICENSE_1_0.txt)
00026 
00027 #ifndef CO_DATAISTREAMARCHIVE_H
00028 #define CO_DATAISTREAMARCHIVE_H
00029 
00030 #include <co/api.h>
00031 #include <co/dataIStream.h>
00032 #include <co/dataStreamArchiveException.h>
00033 
00034 #pragma warning( push )
00035 #pragma warning( disable: 4800 )
00036 #include <boost/archive/basic_binary_iarchive.hpp>
00037 #pragma warning( pop )
00038 #include <boost/archive/detail/register_archive.hpp>
00039 #include <boost/archive/shared_ptr_helper.hpp>
00040 #include <boost/serialization/is_bitwise_serializable.hpp>
00041 
00042 #include <boost/spirit/home/support/detail/endian.hpp>
00043 #include <boost/spirit/home/support/detail/math/fpclassify.hpp>
00044 
00045 #include <boost/type_traits/is_integral.hpp>
00046 #include <boost/type_traits/is_unsigned.hpp>
00047 #include <boost/type_traits/is_floating_point.hpp>
00048 
00049 
00050 namespace co
00051 {
00053 class DataIStreamArchive
00054     : public boost::archive::basic_binary_iarchive< DataIStreamArchive >
00055     , public boost::archive::detail::shared_ptr_helper
00056 {
00057     typedef boost::archive::basic_binary_iarchive< DataIStreamArchive > Super;
00058 
00059 public:
00061     CO_API DataIStreamArchive( DataIStream& stream );
00062 
00064     CO_API void load_binary( void* data, std::size_t size );
00065 
00067     template< typename T >
00068     void load_array( boost::serialization::array< T >& a, unsigned int );
00069 
00071     struct use_array_optimization
00072     {
00073         template< class T >
00074         struct apply
00075             : public boost::serialization::is_bitwise_serializable< T > {};
00076     };
00077 
00078 private:
00079     friend class boost::archive::load_access;
00080 
00088     CO_API void load( bool& b );
00089 
00091     template< class C, class T, class A >
00092     void load( std::basic_string< C, T, A >& s );
00093 
00101     template< typename T >
00102     typename boost::enable_if< boost::is_integral<T> >::type load( T& t );
00103 
00131     template< typename T >
00132     typename boost::enable_if< boost::is_floating_point<T> >::type load( T& t );
00133 
00134 #if BOOST_VERSION >= 104400
00135     // in boost 1.44 version_type was splitted into library_version_type and
00136     // item_version_type, plus a whole bunch of additional strong typedefs
00137     CO_API void load( boost::archive::library_version_type& version );
00138     CO_API void load( boost::archive::class_id_type& class_id );
00139     CO_API void load( boost::serialization::item_version_type& version );
00140     CO_API void load( boost::serialization::collection_size_type& version );
00141     CO_API void load( boost::archive::object_id_type& object_id );
00142     CO_API void load( boost::archive::version_type& version );
00143 #endif
00144 
00145     CO_API signed char _loadSignedChar();
00146 
00147     DataIStream& _stream;
00148 };
00149 
00150 #include "dataIStreamArchive.ipp" // template implementation
00151 
00152 }
00153 
00154 // contains load_override impl for class_name_type
00155 #include <boost/archive/impl/basic_binary_iarchive.ipp>
00156 
00157 BOOST_SERIALIZATION_REGISTER_ARCHIVE(co::DataIStreamArchive)
00158 BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(co::DataIStreamArchive)
00159 
00160 #endif //CO_DATAISTREAMARCHIVE_H
Generated on Mon Nov 26 2012 14:41:48 for Equalizer 1.4.1 by  doxygen 1.7.6.1