FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairOnlineSink.cxx
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  ********************************************************************************/
15 #include "FairOnlineSink.h"
16 
17 #include "FairMQRunDevice.h"
18 #include "FairRootManager.h"
19 
20 #include <FairMQLogger.h>
21 
23  : FairSink()
24  , fMQRunDevice(nullptr)
25 {}
26 
28  : FairSink()
29  , fMQRunDevice(nullptr)
30 {}
31 
32 //_____________________________________________________________________________
33 void FairOnlineSink::RegisterImpl(const char*, const char*, void*) { return; }
34 
35 //_____________________________________________________________________________
36 void FairOnlineSink::RegisterAny(const char* brname, const std::type_info& oi, const std::type_info& pi, void* obj)
37 {
38  fPersistentBranchesMap[brname] = std::unique_ptr<TypeAddressPair const>(new TypeAddressPair(oi, pi, obj));
39 }
40 
41 //_____________________________________________________________________________
43 {
44  if (fPersistentBranchesMap.find(name) == fPersistentBranchesMap.end()) {
45  return false;
46  }
47  return true;
48 }
49 
50 //_____________________________________________________________________________
51 void FairOnlineSink::EmitPersistentBranchWrongTypeWarning(const char* brname,
52  const char* type1,
53  const char* type2) const
54 {
55  LOG(warn) << "Trying to read from persistent branch " << brname << " with wrong type " << type1
56  << " (expexted: " << type2 << " )";
57 }
58 
59 //_____________________________________________________________________________
61 {
63  LOG(debug) << "[" << FairRootManager::Instance()->GetInstanceId() << "] called FairOnlineSink::Fill()!!!!";
64 
65  if (fMQRunDevice)
66  fMQRunDevice->SendBranches();
67 }
68 
69 //_____________________________________________________________________________
71 {
73  FairOnlineSink* newSink = new FairOnlineSink(*this);
74  newSink->SetMQRunDevice(this->GetMQRunDevice());
75  LOG(info) << "[" << tempMan->GetInstanceId() << "] FairOnlineSink::CloneSink() setting MQRunDevice to "
76  << this->GetMQRunDevice();
77 
78  return newSink;
79 }
80 //_____________________________________________________________________________
static FairRootManager * Instance()
virtual FairMQRunDevice * GetMQRunDevice()
virtual void RegisterImpl(const char *, const char *, void *)
virtual void RegisterAny(const char *brname, const std::type_info &oi, const std::type_info &pi, void *obj)
virtual void SendBranches()
virtual void SetMQRunDevice(FairMQRunDevice *mrs)
Int_t GetInstanceId() const
virtual void Fill()
bool IsPersistentBranchAny(const char *name)
std::map< std::string, std::unique_ptr< TypeAddressPair const > > fPersistentBranchesMap
Definition: FairSink.h:89
virtual FairSink * CloneSink()