ossrv_pub/boost_apis/boost/archive/basic_binary_iarchive.hpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 #ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
       
     2 #define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
       
     3 
       
     4 // MS compatible compilers support #pragma once
       
     5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
       
     6 # pragma once
       
     7 #endif
       
     8 
       
     9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
       
    10 // basic_binary_iarchive.hpp
       
    11 //
       
    12 // archives stored as native binary - this should be the fastest way
       
    13 // to archive the state of a group of obects.  It makes no attempt to
       
    14 // convert to any canonical form.
       
    15 
       
    16 // IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
       
    17 // ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON
       
    18 
       
    19 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 
       
    20 // Use, modification and distribution is subject to the Boost Software
       
    21 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
       
    22 // http://www.boost.org/LICENSE_1_0.txt)
       
    23 
       
    24 //  See http://www.boost.org for updates, documentation, and revision history.
       
    25 //#include <cstring>
       
    26 
       
    27 #include <boost/config.hpp>
       
    28 #include <boost/detail/workaround.hpp>
       
    29 #include <boost/pfto.hpp>
       
    30 
       
    31 #include <boost/archive/detail/common_iarchive.hpp>
       
    32 #include <boost/serialization/string.hpp>
       
    33 
       
    34 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
       
    35 
       
    36 namespace boost { 
       
    37 namespace archive {
       
    38 
       
    39 /////////////////////////////////////////////////////////////////////////
       
    40 // class basic_binary_iarchive - read serialized objects from a input binary stream
       
    41 template<class Archive>
       
    42 class basic_binary_iarchive : 
       
    43     public detail::common_iarchive<Archive>
       
    44 {
       
    45 protected:
       
    46 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
       
    47 public:
       
    48 #elif defined(BOOST_MSVC)
       
    49     // for some inexplicable reason insertion of "class" generates compile erro
       
    50     // on msvc 7.1
       
    51     friend detail::interface_iarchive<Archive>;
       
    52 #else
       
    53     friend class detail::interface_iarchive<Archive>;
       
    54 #endif
       
    55     // intermediate level to support override of operators
       
    56     // fot templates in the absence of partial function 
       
    57     // template ordering. If we get here pass to base class
       
    58     // note extra nonsense to sneak it pass the borland compiers
       
    59     typedef detail::common_iarchive<Archive> detail_common_iarchive;
       
    60     template<class T>
       
    61     void load_override(T & t, BOOST_PFTO int)
       
    62     {
       
    63         this->detail_common_iarchive::load_override(t, 0);
       
    64     }
       
    65     // binary files don't include the optional information 
       
    66     void load_override(class_id_optional_type & /* t */, int){}
       
    67 
       
    68     // the following have been overridden to provide specific sizes
       
    69     // for these pseudo prmitive types.
       
    70     void load_override(version_type & t, int){ 
       
    71         // upto 255 versions
       
    72         unsigned char x;
       
    73         * this->This() >> x;
       
    74         t = version_type(x);
       
    75     }
       
    76     void load_override(class_id_type & t, int){
       
    77         // upto 32K classes
       
    78         int_least16_t x;
       
    79         * this->This() >> x;
       
    80         t = class_id_type(x);
       
    81     }
       
    82     void load_override(class_id_reference_type & t, int){
       
    83         // upto 32K classes
       
    84         int_least16_t x;
       
    85         * this->This() >> x;
       
    86         t = class_id_reference_type(x);
       
    87     }
       
    88     void load_override(object_id_type & t, int){
       
    89         // upto 2G objects
       
    90         uint_least32_t x;
       
    91         * this->This() >> x;
       
    92         t = object_id_type(x);
       
    93     }
       
    94     void load_override(object_reference_type & t, int){
       
    95         // upto 2G objects
       
    96         uint_least32_t x;
       
    97         * this->This() >> x;
       
    98         t = object_reference_type(x);
       
    99     }
       
   100     void load_override(tracking_type & t, int){
       
   101         char x;
       
   102         * this->This() >> x;
       
   103         t = (0 != x);
       
   104     }
       
   105 
       
   106     BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
       
   107     load_override(class_name_type & t, int);
       
   108     BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
       
   109     init();
       
   110    
       
   111     basic_binary_iarchive(unsigned int flags) :
       
   112         detail::common_iarchive<Archive>(flags)
       
   113     {}
       
   114 };
       
   115 
       
   116 } // namespace archive
       
   117 } // namespace boost
       
   118 
       
   119 #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
       
   120 
       
   121 #endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP