common_iarchive.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP
  2. #define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER)
  5. # pragma once
  6. #endif
  7. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  8. // common_iarchive.hpp
  9. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  10. // Use, modification and distribution is subject to the Boost Software
  11. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. // See http://www.boost.org for updates, documentation, and revision history.
  14. #include <boost/config.hpp>
  15. #include <boost/archive/detail/basic_iarchive.hpp>
  16. #include <boost/archive/detail/basic_pointer_iserializer.hpp>
  17. #include <boost/archive/detail/interface_iarchive.hpp>
  18. #ifdef BOOST_MSVC
  19. # pragma warning(push)
  20. # pragma warning(disable : 4511 4512)
  21. #endif
  22. namespace boost {
  23. namespace archive {
  24. namespace detail {
  25. class extended_type_info;
  26. // note: referred to as Curiously Recurring Template Patter (CRTP)
  27. template<class Archive>
  28. class BOOST_SYMBOL_VISIBLE common_iarchive :
  29. public basic_iarchive,
  30. public interface_iarchive<Archive>
  31. {
  32. friend class interface_iarchive<Archive>;
  33. friend class basic_iarchive;
  34. private:
  35. void vload(version_type & t) BOOST_OVERRIDE {
  36. * this->This() >> t;
  37. }
  38. void vload(object_id_type & t) BOOST_OVERRIDE {
  39. * this->This() >> t;
  40. }
  41. void vload(class_id_type & t) BOOST_OVERRIDE {
  42. * this->This() >> t;
  43. }
  44. void vload(class_id_optional_type & t) BOOST_OVERRIDE {
  45. * this->This() >> t;
  46. }
  47. void vload(tracking_type & t) BOOST_OVERRIDE {
  48. * this->This() >> t;
  49. }
  50. void vload(class_name_type &s) BOOST_OVERRIDE {
  51. * this->This() >> s;
  52. }
  53. protected:
  54. // default processing - invoke serialization library
  55. template<class T>
  56. void load_override(T & t){
  57. archive::load(* this->This(), t);
  58. }
  59. // default implementations of functions which emit start/end tags for
  60. // archive types that require them.
  61. void load_start(const char * /*name*/){}
  62. void load_end(const char * /*name*/){}
  63. // default archive initialization
  64. common_iarchive(unsigned int flags = 0) :
  65. basic_iarchive(flags),
  66. interface_iarchive<Archive>()
  67. {}
  68. };
  69. } // namespace detail
  70. } // namespace archive
  71. } // namespace boost
  72. #ifdef BOOST_MSVC
  73. #pragma warning(pop)
  74. #endif
  75. #endif // BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP