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