/*////////////////////////////////////////////////////////////////////////////// // 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_DEBUGARCHIVES_H #define U_CORE_DEBUGARCHIVES_H #include #include #include #include #include #include #include #include #include #include #include #include #include "Archives.h" #include "StringReader.h" //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // FWD DECLARATIONS OF ARCHIVES // namespace uLib { namespace Archive { class Root_debug_archive; } } namespace boost { namespace archive { namespace detail { template class polymorphic_oarchive_route; template class polymorphic_iarchive_route; } } } namespace boost { namespace serialization { template struct hrp; } } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // ARCHIVES REGISTRATION // // in Archives.h //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // ARCHIVES IO INTERFACES // namespace boost { namespace archive { namespace detail { // DECLARE INTERFACE SPECIALIZATIONS /////////////////////////////////////////// // With this declarations all uLib archive Implementation will use their own // extended interface // template <> class interface_iarchive : public uLib_interface_iarchive {}; } // detail } // archive } // boost //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // ARCHIVES DEFINITIONS // namespace boost { namespace archive { //template //inline void load_const_override(Archive & ar, const char *t ){ // typedef typename mpl::identity >::type typex; // typex::invoke(ar, t); //} //template //inline void load(Archive & ar, T &t){ // // if this assertion trips. It means we're trying to load a // // const object with a compiler that doesn't have correct // // funtion template ordering. On other compilers, this is // // handled below. // // detail::check_const_loading< T >(); // typedef // BOOST_DEDUCED_TYPENAME mpl::eval_if, // mpl::identity > // ,//else // BOOST_DEDUCED_TYPENAME mpl::eval_if, // mpl::identity > // ,//else // BOOST_DEDUCED_TYPENAME mpl::eval_if, // mpl::identity > // ,//else // mpl::identity > // > // > // >::type typex; // typex::invoke(ar, t); //} } } // ROOT FWD class TTree; /////////// namespace uLib { namespace Archive { namespace detail { class basic_Root_Ttree_oprimitive { TTree *m_tree; public: basic_Root_Ttree_oprimitive(const char *tree_name); ~basic_Root_Ttree_oprimitive(); }; } // detail //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // XML FOR LOG OUTPUT PURPOUSE // /////////////////////////////////////////////////////////////////////////// //// log data to an output stream. This illustrates a simpler implemenation //// of text output which is useful for getting a formatted display of //// any serializable class. Intended to be useful as a debugging aid. class Root_debug_archive : /* protected ? */ public boost::archive::detail::common_oarchive { typedef boost::archive::detail::common_oarchive base; typedef Root_debug_archive Archive; // give serialization implementation access to this clas friend class boost::archive::detail::interface_oarchive; friend class boost::archive::save_access; public: // void save_override(const char *str, int v) { // // Do not save any human decoration string // // // basic_text_oprimitive::save(str); // } // template // void save_override(T & t, BOOST_PFTO int){ // base::save_override(boost::serialization::make_nvp(NULL, t), 0); // } // // activate this if you want to trap non nvp objects // // // template // // void save_override(T & t, BOOST_PFTO int) // // { // // BOOST_MPL_ASSERT((boost::serialization::is_wrapper< T >)); // // // this->detail_common_oarchive::save_override(t, 0); // // } // template // void save_override(const boost::serialization::nvp & t, int){ // base::save_override(t, 0); // } // // specific overrides for attributes - not name value pairs so we // // want to trap them before the above "fall through" // // since we don't want to see these in the output - make them no-ops. // void save_override(const boost::archive::object_id_type & t, int) {} // void save_override(const boost::archive::object_reference_type & t, int) {} // void save_override(const boost::archive::version_type & t, int) {} // void save_override(const boost::archive::class_id_type & t, int) {} // void save_override(const boost::archive::class_id_optional_type & t, int) {} // void save_override(const boost::archive::class_id_reference_type & t, int){} // void save_override(const boost::archive::class_name_type & t, int) {} // void save_override(const boost::archive::tracking_type & t, int) {} //public: // Root_debug_archive(std::ostream & os, unsigned int flags = 0) : // boost::archive::xml_oarchive_impl( // os, // flags | boost::archive::no_header // ) // {} }; } // Archive } // uLib ULIB_SERIALIZATION_REGISTER_ARCHIVE(uLib::Archive::Root_debug_archive) #endif // U_CORE_DEBUGARCHIVES_H