uLib-0.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DebugArchives.h
Go to the documentation of this file.
1 /*//////////////////////////////////////////////////////////////////////////////
2 // CMT Cosmic Muon Tomography project //////////////////////////////////////////
4 
5  Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
6  All rights reserved
7 
8  Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
9 
10  ------------------------------------------------------------------
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library.
23 
25 
26 
27 
28 #ifndef U_CORE_DEBUGARCHIVES_H
29 #define U_CORE_DEBUGARCHIVES_H
30 
31 #include <boost/archive/detail/basic_pointer_iserializer.hpp>
32 #include <boost/archive/detail/basic_pointer_oserializer.hpp>
33 
34 #include <boost/archive/text_iarchive.hpp>
35 #include <boost/archive/text_oarchive.hpp>
36 
37 #include <boost/archive/xml_iarchive.hpp>
38 #include <boost/archive/xml_oarchive.hpp>
39 
40 #include <boost/archive/detail/register_archive.hpp>
41 
42 #include <boost/archive/polymorphic_iarchive.hpp>
43 #include <boost/archive/polymorphic_oarchive.hpp>
44 #include <boost/archive/detail/polymorphic_iarchive_route.hpp>
45 #include <boost/archive/detail/polymorphic_oarchive_route.hpp>
46 
47 #include <boost/archive/polymorphic_text_oarchive.hpp>
48 
49 #include "Archives.h"
50 #include "StringReader.h"
51 
52 
53 
57 // FWD DECLARATIONS OF ARCHIVES //
58 
59 
60 namespace uLib {
61 namespace Archive {
62 
63 class Root_debug_archive;
64 
65 }
66 }
67 
68 
69 namespace boost {
70 namespace archive {
71 namespace detail {
72 template<class ArchiveImplementation> class polymorphic_oarchive_route;
73 template<class ArchiveImplementation> class polymorphic_iarchive_route;
74 }
75 }
76 }
77 
78 namespace boost {
79 namespace serialization {
80  template <typename T> struct hrp;
81 }
82 }
83 
84 
88 // ARCHIVES REGISTRATION //
89 
90 // in Archives.h
91 
92 
93 
97 // ARCHIVES IO INTERFACES //
98 
99 
100 namespace boost {
101 namespace archive {
102 namespace detail {
103 
104 
105 // DECLARE INTERFACE SPECIALIZATIONS ///////////////////////////////////////////
106 // With this declarations all uLib archive Implementation will use their own
107 // extended interface //
108 
109 template <>
110 class interface_iarchive <uLib::Archive::Root_debug_archive> : public
111  uLib_interface_iarchive <uLib::Archive::Root_debug_archive> {};
112 
113 
114 } // detail
115 } // archive
116 } // boost
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
139 // ARCHIVES DEFINITIONS //
140 
141 namespace boost {
142 namespace archive {
143 
144 //template<class Archive>
145 //inline void load_const_override(Archive & ar, const char *t ){
146 // typedef typename mpl::identity<detail::load_non_pointer_type<Archive> >::type typex;
147 // typex::invoke(ar, t);
148 //}
149 
150 //template<class Archive, class T>
151 //inline void load(Archive & ar, T &t){
152 // // if this assertion trips. It means we're trying to load a
153 // // const object with a compiler that doesn't have correct
154 // // funtion template ordering. On other compilers, this is
155 // // handled below.
156 // // detail::check_const_loading< T >();
157 // typedef
158 // BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer< T >,
159 // mpl::identity<detail::load_pointer_type<Archive> >
160 // ,//else
161 // BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array< T >,
162 // mpl::identity<detail::load_array_type<Archive> >
163 // ,//else
164 // BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum< T >,
165 // mpl::identity<detail::load_enum_type<Archive> >
166 // ,//else
167 // mpl::identity<detail::load_non_pointer_type<Archive> >
168 // >
169 // >
170 // >::type typex;
171 // typex::invoke(ar, t);
172 //}
173 
174 
175 
176 }
177 }
178 
179 // ROOT FWD
180 class TTree;
182 
183 
184 namespace uLib {
185 namespace Archive {
186 
187 namespace detail {
188 
189 class basic_Root_Ttree_oprimitive
190 {
191  TTree *m_tree;
192 
193 
194 
195 public:
196  basic_Root_Ttree_oprimitive(const char *tree_name);
197  ~basic_Root_Ttree_oprimitive();
198 
199 };
200 
201 } // detail
202 
203 
204 
208 // XML FOR LOG OUTPUT PURPOUSE //
209 
214 class Root_debug_archive :
215  /* protected ? */
216  public boost::archive::detail::common_oarchive<Archive>
217 {
218  typedef boost::archive::detail::common_oarchive<Root_debug_archive> base;
219  typedef Root_debug_archive Archive;
220 
221  // give serialization implementation access to this clas
222  friend class boost::archive::detail::interface_oarchive<Root_debug_archive>;
223  friend class boost::archive::save_access;
224 
225 public:
226 
227 // void save_override(const char *str, int v) {
228 // // Do not save any human decoration string //
229 // // basic_text_oprimitive::save(str);
230 // }
231 
232 // template<class T>
233 // void save_override(T & t, BOOST_PFTO int){
234 // base::save_override(boost::serialization::make_nvp(NULL, t), 0);
235 // }
236 
237 // // activate this if you want to trap non nvp objects //
238 // // template<class T>
239 // // void save_override(T & t, BOOST_PFTO int)
240 // // {
241 // // BOOST_MPL_ASSERT((boost::serialization::is_wrapper< T >));
242 // // // this->detail_common_oarchive::save_override(t, 0);
243 // // }
244 
245 // template<class T>
246 // void save_override(const boost::serialization::nvp<T> & t, int){
247 // base::save_override(t, 0);
248 // }
249 
250 
251 // // specific overrides for attributes - not name value pairs so we
252 // // want to trap them before the above "fall through"
253 // // since we don't want to see these in the output - make them no-ops.
254 // void save_override(const boost::archive::object_id_type & t, int) {}
255 // void save_override(const boost::archive::object_reference_type & t, int) {}
256 // void save_override(const boost::archive::version_type & t, int) {}
257 // void save_override(const boost::archive::class_id_type & t, int) {}
258 // void save_override(const boost::archive::class_id_optional_type & t, int) {}
259 // void save_override(const boost::archive::class_id_reference_type & t, int){}
260 // void save_override(const boost::archive::class_name_type & t, int) {}
261 // void save_override(const boost::archive::tracking_type & t, int) {}
262 
263 
264 //public:
265 // Root_debug_archive(std::ostream & os, unsigned int flags = 0) :
266 // boost::archive::xml_oarchive_impl<log_archive>(
267 // os,
268 // flags | boost::archive::no_header
269 // )
270 // {}
271 };
272 
273 
274 
275 
276 
277 } // Archive
278 } // uLib
279 
280 
281 
283 
284 
285 
286 
287 
288 
289 #endif // U_CORE_DEBUGARCHIVES_H
Definition: DebugArchives.h:214
#define ULIB_SERIALIZATION_REGISTER_ARCHIVE(_Archive)
Definition: Archives.h:123