1 #ifndef PNDCONTAINERREGISTER_HH 2 #define PNDCONTAINERREGISTER_HH 4 #include <RtypesCore.h> 10 #include "FairLogger.h" 29 auto pos = fRequests.find(t_container.
GetKey());
30 if (pos != fRequests.end()) {
31 if ((*pos).second.fClassType != t_container.
fClassType) {
32 LOG(fatal) <<
"Attempting to request branch " << t_container.
fBranchname <<
" for " << t_container.
fClassType <<
" but branchname already used for " 33 << (*pos).second.fClassType <<
". Ignoring this request!";
35 (*pos).second.fIsOutput |= t_container.
fIsOutput;
37 LOG(debug) <<
"Setting request for an output branch " << t_container.
fBranchname <<
" for " << t_container.
fClassType;
40 fRequests[t_container.
GetKey()] = t_container;
41 LOG(debug) <<
"Setting request for branch " << t_container.
fBranchname <<
" for " << t_container.
fClassType;
47 auto pos = fInputs.find(t_branchname);
48 if (pos != fInputs.end()) {
49 return (pos->second) !=
nullptr;
51 auto opos = fOutputs.find(t_branchname);
52 if (opos != fOutputs.end()) {
53 return (opos->second) !=
nullptr;
61 LOG(debug) <<
"PndContainerRegister::GetOutput(" << t_branchname <<
") for " << T{}.ClassName();
63 if (t_branchname ==
"" || fDefaultBranches[T{}.ClassName()] == t_branchname) {
64 LOG(debug) <<
"PndContainerRegister::GetOutput(" << t_branchname <<
") from default register";
65 auto *defaultBranch = GetDefaultBranch<T>();
69 LOG(error) <<
"Attempted to cast a InputContainer " << t_branchname <<
") for " << T{}.ClassName() <<
" to PndMutableContainerI! Returning nullptr!";
80 fOutputs[t_branchname] = t_ptr;
81 if (fDefaultBranches.find(classname) == fDefaultBranches.end()) {
89 LOG(debug) <<
"PndContainerRegister::GetInput(" << t_branchname <<
") for " << T{}.ClassName();
90 if (t_branchname ==
"" || fDefaultBranches[T{}.ClassName()] == t_branchname) {
91 LOG(debug) <<
"PndContainerRegister::GetInput(" << t_branchname <<
") from default register";
102 fInputs[t_branchname] = t_ptr;
103 if (fDefaultBranches.find(classname) == fDefaultBranches.end()) {
110 LOG(info) <<
"PndContainerRegister::SetAsDefaultBranchFor() Setting " << t_branchname <<
" as active branch for " << t_class;
111 fDefaultBranches[t_class] = t_branchname;
117 const TString classname = T{}.ClassName();
118 const TString &defaultBranch = fDefaultBranches[classname];
119 LOG(debug) <<
"PndContainerRegister::GetDefaultBranch() Returning default branch " << defaultBranch <<
" for " << classname;
121 auto pos = fInputs.find(defaultBranch);
122 if (pos != fInputs.end()) {
133 const TString classname = T{}.ClassName();
137 const std::map<TString, PndContainerType_t> &
GetRequests() {
return fRequests; }
138 const std::map<TString, TString> &
GetBranches() {
return fContainerOfType; }
139 std::map<TString, PndContainerBaseI *> &
Inputs() {
return fInputs; }
140 std::map<TString, PndContainerBaseI *> &
Outputs() {
return fOutputs; }
143 std::map<TString, PndContainerType_t> fRequests{};
144 std::map<TString, TString> fDefaultBranches{};
145 std::map<TString, TString> fContainerOfType{};
146 std::map<TString, PndContainerBaseI *> fInputs{};
147 std::map<TString, PndContainerBaseI *> fOutputs{};
PndContainerI< T > * GetDefaultBranch()
const std::map< TString, PndContainerType_t > & GetRequests()
void SetInput(const TString &t_branchname, PndContainerI< T > *t_ptr)
Container to wrap PndTCA/STDMutableContainer (not needed anymore)
void SetOutput(const TString &t_branchname, PndContainerI< T > *t_ptr)
void Request(const PndContainerType_t &t_container)
Interface to a datacontainer to be used in PandaROOT.
Bool_t RequestsSpecificBranch() const
const TString & GetCurrentDefaultBranchName(const TString &t_classname) const
std::map< TString, PndContainerBaseI * > & Inputs()
TString GetClassName() const
const std::map< TString, TString > & GetBranches()
PndContainerI< T > * GetInput(const TString &t_branchname)
const TString & GetCurrentDefaultBranchName() const
PndMutableContainerI< T > * GetOutput(const TString &t_branchname)
std::map< TString, PndContainerBaseI * > & Outputs()
Bool_t IsBranchSet(const TString &t_branchname) const
void SetAsDefaultBranchFor(const TString &t_branchname, const TString &t_class)