archive_serializer_map.ipp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  2. // archive_serializer_map.ipp:
  3. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  4. // Distributed under the Boost Software License, Version 1.0. (See
  5. // accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. // See http://www.boost.org for updates, documentation, and revision history.
  8. //////////////////////////////////////////////////////////////////////
  9. // implementation of basic_text_iprimitive overrides for the combination
  10. // of template parameters used to implement a text_iprimitive
  11. #include <boost/config.hpp>
  12. #include <boost/archive/detail/archive_serializer_map.hpp>
  13. #include <boost/archive/detail/basic_serializer_map.hpp>
  14. #include <boost/serialization/singleton.hpp>
  15. namespace boost {
  16. namespace archive {
  17. namespace detail {
  18. #ifdef BOOST_MSVC
  19. # pragma warning(push)
  20. # pragma warning(disable : 4511 4512)
  21. #endif
  22. namespace extra_detail { // anon
  23. template<class Archive>
  24. class map : public basic_serializer_map
  25. {};
  26. }
  27. #ifdef BOOST_MSVC
  28. # pragma warning(pop)
  29. #endif
  30. template<class Archive>
  31. BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool)
  32. archive_serializer_map<Archive>::insert(const basic_serializer * bs){
  33. return boost::serialization::singleton<
  34. extra_detail::map<Archive>
  35. >::get_mutable_instance().insert(bs);
  36. }
  37. template<class Archive>
  38. BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
  39. archive_serializer_map<Archive>::erase(const basic_serializer * bs){
  40. if(boost::serialization::singleton<
  41. extra_detail::map<Archive>
  42. >::is_destroyed())
  43. return;
  44. boost::serialization::singleton<
  45. extra_detail::map<Archive>
  46. >::get_mutable_instance().erase(bs);
  47. }
  48. template<class Archive>
  49. BOOST_ARCHIVE_OR_WARCHIVE_DECL(const basic_serializer *)
  50. archive_serializer_map<Archive>::find(
  51. const boost::serialization::extended_type_info & eti
  52. ) {
  53. return boost::serialization::singleton<
  54. extra_detail::map<Archive>
  55. >::get_const_instance().find(eti);
  56. }
  57. } // namespace detail
  58. } // namespace archive
  59. } // namespace boost