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  ar& boost::serialization::make_nvp("DetId", boost::serialization::base_object<DetId>(obj));
36  ;
37  }
38 
39  // DataFormats/EcalDetId/interface/EEDetId.h
40  template <class Archive>
41  void serialize(Archive& ar, EEDetId& obj, const unsigned int) {
42  ar& boost::serialization::make_nvp("DetId", boost::serialization::base_object<DetId>(obj));
43  ;
44  }
45 
46  // DataFormats/EcalDetId/interface/EcalContainer.h
47  template <class Archive, typename DetIdT, typename T>
48  void save(Archive& ar, const EcalContainer<DetIdT, T>& obj, const unsigned int) {
49  ar& boost::serialization::make_nvp("m_items", obj.items());
50  }
51 
52  template <class Archive, typename DetIdT, typename T>
53  void load(Archive& ar, EcalContainer<DetIdT, T>& obj, const unsigned int) {
54  // FIXME: avoid copying if we are OK getting a non-const reference
55  typename EcalContainer<DetIdT, T>::Items m_items;
56  ar& boost::serialization::make_nvp("m_items", m_items);
57  obj.setItems(m_items);
58  }
59 
60  template <class Archive, typename DetIdT, typename T>
61  void serialize(Archive& ar, EcalContainer<DetIdT, T>& obj, const unsigned int v) {
62  split_free(ar, obj, v);
63  }
64 
65  } // namespace serialization
66 } // namespace boost
67 
68 #endif
Definition: CLHEP.h:16
void setItems(const std::vector< Item > &items)
Definition: EcalContainer.h:86
void serialize(Archive &ar, CLHEP::Hep3Vector &obj, const unsigned int v)
Definition: CLHEP.h:51
const Items & items() const
Definition: EcalContainer.h:36
void load(Archive &ar, CLHEP::Hep3Vector &obj, const unsigned int)
Definition: CLHEP.h:40
void save(Archive &ar, const CLHEP::Hep3Vector &obj, const unsigned int)
Definition: CLHEP.h:30
std::vector< Item > Items
Definition: EcalContainer.h:21