CMS 3D CMS Logo

EcalDetID.h
Go to the documentation of this file.
1 #ifndef CondFormats_External_ECALDETID_H
2 #define CondFormats_External_ECALDETID_H
3 
4 #include <boost/serialization/base_object.hpp>
5 #include <boost/serialization/nvp.hpp>
6 #include <boost/serialization/split_free.hpp>
7 
8 // std::vector used in DataFormats/EcalDetId/interface/EcalContainer.h
9 #include <boost/serialization/vector.hpp>
10 #include <boost/serialization/string.hpp>
11 #include <boost/serialization/map.hpp>
12 
16 
17 // for base class
19 
20 namespace boost {
21 namespace serialization {
22 
23 /*
24  * Note regarding object tracking: all autos used here
25  * must resolve to untracked types, since we use local
26  * variables in the stack which could end up with the same
27  * address. For the moment, all types resolved by auto here
28  * are primitive types, which are untracked by default
29  * by Boost Serialization.
30  */
31 
32 // DataFormats/EcalDetId/interface/EBDetId.h
33 template<class Archive>
34 void serialize(Archive & ar, EBDetId & obj, const unsigned int)
35 {
36  ar & boost::serialization::make_nvp("DetId", boost::serialization::base_object<DetId>(obj));;
37 }
38 
39 // DataFormats/EcalDetId/interface/EEDetId.h
40 template<class Archive>
41 void serialize(Archive & ar, EEDetId & obj, const unsigned int)
42 {
43  ar & boost::serialization::make_nvp("DetId", boost::serialization::base_object<DetId>(obj));;
44 }
45 
46 
47 // DataFormats/EcalDetId/interface/EcalContainer.h
48 template<class Archive, typename DetIdT, typename T>
49 void save(Archive & ar, const EcalContainer<DetIdT, T> & obj, const unsigned int)
50 {
51  ar & boost::serialization::make_nvp("m_items", obj.items());
52 }
53 
54 template<class Archive, typename DetIdT, typename T>
55 void load(Archive & ar, EcalContainer<DetIdT, T> & obj, const unsigned int)
56 {
57  // FIXME: avoid copying if we are OK getting a non-const reference
58  typename EcalContainer<DetIdT, T>::Items m_items;
59  ar & boost::serialization::make_nvp("m_items", m_items);
60  obj.setItems(m_items);
61 }
62 
63 template<class Archive, typename DetIdT, typename T>
64 void serialize(Archive & ar, EcalContainer<DetIdT, T> & obj, const unsigned int v)
65 {
66  split_free(ar, obj, v);
67 }
68 
69 } // namespace serialization
70 } // namespace boost
71 
72 #endif
Definition: CLHEP.h:16
void setItems(const std::vector< Item > &items)
void serialize(Archive &ar, CLHEP::Hep3Vector &obj, const unsigned int v)
Definition: CLHEP.h:53
const Items & items() const
Definition: EcalContainer.h:45
void load(Archive &ar, CLHEP::Hep3Vector &obj, const unsigned int)
Definition: CLHEP.h:41
void save(Archive &ar, const CLHEP::Hep3Vector &obj, const unsigned int)
Definition: CLHEP.h:30
std::vector< Item > Items
Definition: EcalContainer.h:25