Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:11

0001 #ifndef CondFormats_External_ECALDETID_H
0002 #define CondFormats_External_ECALDETID_H
0003 
0004 #include <boost/serialization/base_object.hpp>
0005 #include <boost/serialization/nvp.hpp>
0006 #include <boost/serialization/split_free.hpp>
0007 
0008 // std::vector used in DataFormats/EcalDetId/interface/EcalContainer.h
0009 #include <boost/serialization/vector.hpp>
0010 #include <boost/serialization/string.hpp>
0011 #include <boost/serialization/map.hpp>
0012 
0013 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0014 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0015 #include "DataFormats/EcalDetId/interface/EcalContainer.h"
0016 
0017 // for base class
0018 #include "CondFormats/External/interface/DetID.h"
0019 
0020 namespace boost {
0021   namespace serialization {
0022 
0023     /*
0024  * Note regarding object tracking: all autos used here
0025  * must resolve to untracked types, since we use local
0026  * variables in the stack which could end up with the same
0027  * address. For the moment, all types resolved by auto here
0028  * are primitive types, which are untracked by default
0029  * by Boost Serialization.
0030  */
0031 
0032     // DataFormats/EcalDetId/interface/EBDetId.h
0033     template <class Archive>
0034     void serialize(Archive& ar, EBDetId& obj, const unsigned int) {
0035       ar& boost::serialization::make_nvp("DetId", boost::serialization::base_object<DetId>(obj));
0036       ;
0037     }
0038 
0039     // DataFormats/EcalDetId/interface/EEDetId.h
0040     template <class Archive>
0041     void serialize(Archive& ar, EEDetId& obj, const unsigned int) {
0042       ar& boost::serialization::make_nvp("DetId", boost::serialization::base_object<DetId>(obj));
0043       ;
0044     }
0045 
0046     // DataFormats/EcalDetId/interface/EcalContainer.h
0047     template <class Archive, typename DetIdT, typename T>
0048     void save(Archive& ar, const EcalContainer<DetIdT, T>& obj, const unsigned int) {
0049       ar& boost::serialization::make_nvp("m_items", obj.items());
0050     }
0051 
0052     template <class Archive, typename DetIdT, typename T>
0053     void load(Archive& ar, EcalContainer<DetIdT, T>& obj, const unsigned int) {
0054       // FIXME: avoid copying if we are OK getting a non-const reference
0055       typename EcalContainer<DetIdT, T>::Items m_items;
0056       ar& boost::serialization::make_nvp("m_items", m_items);
0057       obj.setItems(m_items);
0058     }
0059 
0060     template <class Archive, typename DetIdT, typename T>
0061     void serialize(Archive& ar, EcalContainer<DetIdT, T>& obj, const unsigned int v) {
0062       split_free(ar, obj, v);
0063     }
0064 
0065   }  // namespace serialization
0066 }  // namespace boost
0067 
0068 #endif