/*////////////////////////////////////////////////////////////////////////////// // CMT Cosmic Muon Tomography project ////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova All rights reserved Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it > ------------------------------------------------------------------ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. //////////////////////////////////////////////////////////////////////////////*/ #ifndef U_CORE_EXPORT_H #define U_CORE_EXPORT_H #include // NULL #include #include #include #include #include #include #include #include #include #include #include #include // for guid_defined only #include #include #include #include #include "Core/Archives.h" //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// namespace uLib { namespace Archive { namespace detail { namespace extra_detail { template struct guid_initializer { void export_guid(boost::mpl::false_) const { // generates the statically-initialized objects whose constructors // register the information allowing serialization of T objects // through pointers to their base classes. boost::archive::detail::instantiate_ptr_serialization( (T *)0, 0, uLib::Archive::detail::adl_tag()); } void export_guid(boost::mpl::true_) const {} guid_initializer const &export_guid() const { BOOST_STATIC_WARNING(boost::is_polymorphic::value); // note: exporting an abstract base class will have no effect // and cannot be used to instantitiate serialization code // (one might be using this in a DLL to instantiate code) // BOOST_STATIC_WARNING(! boost::serialization::is_abstract< T >::value); export_guid(boost::serialization::is_abstract()); return *this; } }; template struct init_guid; } // namespace extra_detail } // namespace detail } // namespace Archive } // namespace uLib #define ULIB_CLASS_EXPORT_IMPLEMENT(T) \ namespace uLib { \ namespace Archive { \ namespace detail { \ namespace extra_detail { \ template <> struct init_guid { \ static guid_initializer const &g; \ }; \ guid_initializer const &init_guid::g = \ ::boost::serialization::singleton< \ guid_initializer>::get_mutable_instance() \ .export_guid(); \ } \ } \ } \ } \ /**/ #endif // EXPORT_H