FairRoot/PandaRoot
Public Member Functions | Private Attributes | Friends | List of all members
PndMQSdsHitLoader Class Reference

#include <PndMQSdsHitLoader.h>

Inheritance diagram for PndMQSdsHitLoader:

Public Member Functions

 PndMQSdsHitLoader ()
 
virtual ~PndMQSdsHitLoader ()
 
virtual void Exec (Option_t *opt)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

vector< PndSdsHitfDigiVector
 
bool fHasBoostSerialization
 

Friends

class boost::serialization::access
 

Detailed Description

Definition at line 36 of file PndMQSdsHitLoader.h.

Constructor & Destructor Documentation

PndMQSdsHitLoader::PndMQSdsHitLoader ( )
inline

Definition at line 39 of file PndMQSdsHitLoader.h.

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  {
51  }
52  }
53  }
vector< PndSdsHit > fDigiVector
virtual PndMQSdsHitLoader::~PndMQSdsHitLoader ( )
inlinevirtual

Definition at line 55 of file PndMQSdsHitLoader.h.

56  {
57  if (fDigiVector.size() > 0)
58  {
59  fDigiVector.clear();
60  }
61  }
vector< PndSdsHit > fDigiVector

Member Function Documentation

void PndMQSdsHitLoader::Exec ( Option_t *  opt)
virtual

Definition at line 11 of file PndMQSdsHitLoader.cxx.

References digi, fDigiVector, fHasBoostSerialization, and i.

12 {
13  // Default implementation of the base template Exec function using boost
14  // the condition check if the input class has a function member with name
15  // void serialize(boost::archive::binary_oarchive & ar, const unsigned int version) and if the payload are of boost type
16 
18  {
19  ostringstream buffer;
20  boost::archive::binary_oarchive OutputArchive(buffer);
21  for (Int_t i = 0; i < fInput->GetEntriesFast(); ++i)
22  {
23  PndSdsHit* digi = static_cast<PndSdsHit*>(fInput->At(i));
24  if (!digi)
25  {
26  continue;
27  }
28  fDigiVector.push_back(*digi);
29  }
30 
31  OutputArchive << fDigiVector;
32  int size = buffer.str().length();
33  fOutput = fTransportFactory->CreateMessage(size);
34  memcpy(fOutput->GetData(), buffer.str().c_str(), size);
35 
36  // delete the vector content
37  if (fDigiVector.size() > 0)
38  {
39  fDigiVector.clear();
40  }
41  }
42  else
43  {
44  LOG(ERROR) << "Boost Serialization not available";
45  }
46 }
TClonesArray * digi
Int_t i
Definition: run_full.C:25
vector< PndSdsHit > fDigiVector
template<class Archive >
void PndMQSdsHitLoader::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 66 of file PndMQSdsHitLoader.h.

67  {
68  ar& fDigiVector;
69  }
vector< PndSdsHit > fDigiVector

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 72 of file PndMQSdsHitLoader.h.

Member Data Documentation

vector<PndSdsHit> PndMQSdsHitLoader::fDigiVector
private

Definition at line 73 of file PndMQSdsHitLoader.h.

Referenced by Exec().

bool PndMQSdsHitLoader::fHasBoostSerialization
private

Definition at line 74 of file PndMQSdsHitLoader.h.

Referenced by Exec().


The documentation for this class was generated from the following files: