FairRoot/PandaRoot
PndMQSdsHitLoader.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
14 #ifndef PNDMQSDSHITLOADER_H
15 #define PNDMQSDSHITLOADER_H
16 
17 #include <iostream>
18 #include <type_traits>
19 
20 #include <boost/timer/timer.hpp>
21 #include <boost/archive/text_oarchive.hpp>
22 #include <boost/archive/binary_oarchive.hpp>
23 #include <boost/serialization/vector.hpp>
24 
25 #include "TMessage.h"
26 
27 #include "PndSdsHit.h"
28 
29 #include "FairMQSamplerTask.h"
30 #include "FairMQLogger.h"
31 
32 #include "baseMQtools.h"
33 
34 using namespace std;
35 
36 class PndMQSdsHitLoader : public FairMQSamplerTask
37 {
38  public:
40  : FairMQSamplerTask("Load class PndSdsHit")
41  , fDigiVector()
42  , fHasBoostSerialization(false)
43  {
44  using namespace baseMQ::tools::resolve;
45  // coverity[pointless_expression]: suppress coverity warnings on apparant if(const).
46  if (is_same<boost::archive::binary_oarchive, boost::archive::binary_oarchive>::value || is_same<boost::archive::binary_oarchive, boost::archive::text_oarchive>::value)
47  {
48  if (has_BoostSerialization<PndSdsHit, void(boost::archive::binary_oarchive&, const unsigned int)>::value == 1)
49  {
50  fHasBoostSerialization = true;
51  }
52  }
53  }
54 
56  {
57  if (fDigiVector.size() > 0)
58  {
59  fDigiVector.clear();
60  }
61  }
62 
63  virtual void Exec(Option_t* opt);
64 
65  template <class Archive>
66  void serialize(Archive& ar, const unsigned int version)
67  {
68  ar& fDigiVector;
69  }
70 
71  private:
72  friend class boost::serialization::access;
73  vector<PndSdsHit> fDigiVector;
75 };
76 
77 
78 
79 #endif /* FAIRTESTDETECTORDIGILOADER_H */
vector< PndSdsHit > fDigiVector
void serialize(Archive &ar, const unsigned int version)
virtual ~PndMQSdsHitLoader()