Equalizer  1.2.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 #ifndef CO_DATAISTREAMARCHIVE_H
00020 #define CO_DATAISTREAMARCHIVE_H
00021 
00022 #include <co/defines.h>
00023 #ifdef CO_USE_BOOST_SERIALIZATION
00024 
00025 #include <co/api.h>
00026 #include <co/dataIStream.h>
00027 
00028 #pragma warning( push )
00029 #pragma warning( disable: 4800 )
00030 #include <boost/archive/basic_binary_iarchive.hpp>
00031 #pragma warning( pop )
00032 #include <boost/archive/detail/register_archive.hpp>
00033 #include <boost/archive/shared_ptr_helper.hpp>
00034 
00035 namespace co
00036 {
00038     class DataIStreamArchive
00039         : public boost::archive::basic_binary_iarchive< DataIStreamArchive >
00040         , public boost::archive::detail::shared_ptr_helper
00041     {
00042         typedef boost::archive::basic_binary_iarchive<DataIStreamArchive> Super;
00043 
00044     public:
00046         CO_API DataIStreamArchive( DataIStream& stream );
00047 
00049         CO_API void load_binary( void* data, std::size_t size );
00050 
00051     private:
00052         friend class boost::archive::load_access;
00053 
00054         template<class T>
00055         void load( T& t )
00056         {
00057             _stream >> t;
00058         }
00059 
00060         DataIStream& _stream;
00061     };
00062 }
00063 
00064 // contains load_override impl for class_name_type
00065 #include <boost/archive/impl/basic_binary_iarchive.ipp>
00066 
00067 BOOST_SERIALIZATION_REGISTER_ARCHIVE(co::DataIStreamArchive)
00068 
00069 #endif //CO_USE_BOOST_SERIALIZATION
00070 #endif //CO_DATAISTREAMARCHIVE_H
Generated on Fri Jun 8 2012 15:44:30 for Equalizer 1.2.1 by  doxygen 1.8.0