Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions parbase/FairContFact.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,19 @@ void FairContFact::print()
c->print();
}
}

Bool_t FairContFact::AddContainer(FairContainer* cont)
{
// Check if a container already exist in the List of containers
// If it alread exist print an error message and return kFALSE
// such that the user can handle the issue
if (nullptr != containers->FindObject(cont)) {
LOG(error) << "The container " << cont->GetName() << " already exist in the "
<< "container factory " << GetName() << ".\n"
<< "Duplicate container is not added.";
return kFALSE;
}

containers->Add(cont);
return kTRUE;
}
2 changes: 2 additions & 0 deletions parbase/FairContFact.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class FairContFact : public TNamed
FairParSet* getContainer(const char*);
virtual FairParSet* createContainer(FairContainer*) { return 0; }
virtual void activateParIo(FairParIo*) {}
/// @param[in] container Transfers ownership if return value is true
Bool_t AddContainer(FairContainer*);

protected:
TList* containers; // all parameter containers managed by this factory
Expand Down