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  public:
38  PndMQSdsHitLoader() : FairMQSamplerTask("Load class PndSdsHit"), fDigiVector(), fHasBoostSerialization(false)
39  {
40  using namespace baseMQ::tools::resolve;
41  // coverity[pointless_expression]: suppress coverity warnings on apparant if(const).
42  if (is_same<boost::archive::binary_oarchive, boost::archive::binary_oarchive>::value || is_same<boost::archive::binary_oarchive, boost::archive::text_oarchive>::value) {
43  if (has_BoostSerialization<PndSdsHit, void(boost::archive::binary_oarchive &, const unsigned int)>::value == 1) {
44  fHasBoostSerialization = true;
45  }
46  }
47  }
48 
50  {
51  if (fDigiVector.size() > 0) {
52  fDigiVector.clear();
53  }
54  }
55 
56  virtual void Exec(Option_t *opt);
57 
58  template <class Archive>
59  void serialize(Archive &ar, const unsigned int version)
60  {
61  ar &fDigiVector;
62  }
63 
64  private:
65  friend class boost::serialization::access;
66  vector<PndSdsHit> fDigiVector;
67  bool fHasBoostSerialization;
68 };
69 
70 #endif /* FAIRTESTDETECTORDIGILOADER_H */
STL namespace.
void serialize(Archive &ar, const unsigned int version)
virtual ~PndMQSdsHitLoader()