5 #ifndef __pinocchio_serialization_archive_hpp__ 
    6 #define __pinocchio_serialization_archive_hpp__ 
   15 #include <boost/archive/text_oarchive.hpp> 
   16 #include <boost/archive/text_iarchive.hpp> 
   17 #include <boost/archive/xml_iarchive.hpp> 
   18 #include <boost/archive/xml_oarchive.hpp> 
   19 #include <boost/archive/binary_iarchive.hpp> 
   20 #include <boost/archive/binary_oarchive.hpp> 
   22 #if BOOST_VERSION / 100 % 1000 == 78 && __APPLE__ 
   25   #ifndef BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC 
   26     #define DEFINE_BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC 
   27     #define BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC 
   30   #include <boost/asio/streambuf.hpp> 
   32   #ifdef DEFINE_BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC 
   33     #undef BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC 
   37   #include <boost/asio/streambuf.hpp> 
   40 #include <boost/iostreams/device/array.hpp> 
   41 #include <boost/iostreams/stream.hpp> 
   42 #include <boost/iostreams/stream_buffer.hpp> 
   45 #include <boost/math/special_functions/nonfinite_num_facets.hpp> 
   66         std::locale 
const new_loc(ifs.getloc(), 
new boost::math::nonfinite_num_get<char>);
 
   68         boost::archive::text_iarchive ia(ifs, boost::archive::no_codecvt);
 
   73         const std::string exception_message(
filename + 
" does not seem to be a valid file.");
 
   74         throw std::invalid_argument(exception_message);
 
   87     inline void saveToText(
const T & 
object, 
const std::string & filename)
 
   92         boost::archive::text_oarchive oa(ofs);
 
   97         const std::string exception_message(
filename + 
" does not seem to be a valid file.");
 
   98         throw std::invalid_argument(exception_message);
 
  113       boost::archive::text_iarchive ia(is, boost::archive::no_codecvt);
 
  128       boost::archive::text_oarchive oa(ss);
 
  143       std::istringstream is(
str);
 
  159       std::stringstream ss;
 
  174     inline void loadFromXML(
T & 
object, 
const std::string & filename, 
const std::string & tag_name)
 
  178       std::ifstream ifs(
filename.c_str());
 
  181         std::locale 
const new_loc(ifs.getloc(), 
new boost::math::nonfinite_num_get<char>);
 
  183         boost::archive::xml_iarchive ia(ifs, boost::archive::no_codecvt);
 
  188         const std::string exception_message(
filename + 
" does not seem to be a valid file.");
 
  189         throw std::invalid_argument(exception_message);
 
  204     saveToXML(
const T & 
object, 
const std::string & filename, 
const std::string & tag_name)
 
  208       std::ofstream ofs(
filename.c_str());
 
  211         boost::archive::xml_oarchive oa(ofs);
 
  216         const std::string exception_message(
filename + 
" does not seem to be a valid file.");
 
  217         throw std::invalid_argument(exception_message);
 
  232       std::ifstream ifs(
filename.c_str(), std::ios::binary);
 
  235         boost::archive::binary_iarchive ia(ifs);
 
  240         const std::string exception_message(
filename + 
" does not seem to be a valid file.");
 
  241         throw std::invalid_argument(exception_message);
 
  256       std::ofstream ofs(
filename.c_str(), std::ios::binary);
 
  259         boost::archive::binary_oarchive oa(ofs);
 
  264         const std::string exception_message(
filename + 
" does not seem to be a valid file.");
 
  265         throw std::invalid_argument(exception_message);
 
  280       boost::archive::binary_iarchive ia(buffer);
 
  295       boost::archive::binary_oarchive oa(buffer);
 
  311       boost::iostreams::stream_buffer<boost::iostreams::basic_array<char>> stream(
 
  314       boost::archive::binary_iarchive ia(stream);
 
  330       boost::iostreams::stream_buffer<boost::iostreams::basic_array<char>> stream(
 
  333       boost::archive::binary_oarchive oa(stream);
 
  340 #endif // ifndef __pinocchio_serialization_archive_hpp__