14 #ifndef PNDSTDOUTPUTCONTAINER_HH 15 #define PNDSTDOUTPUTCONTAINER_HH 22 #include "FairLogger.h" 23 #include "FairRootManager.h" 56 virtual Bool_t
Init(
const TString &t_branchname)
final 59 FairRootManager *ioman = FairRootManager::Instance();
60 if (ioman ==
nullptr) {
61 throw std::runtime_error(
"FairRootManager::Instance() returned nullptr");
63 if (ioman->CheckBranch(t_branchname) == 0) {
64 this->fSTD =
new std::vector<T>{};
65 ioman->RegisterAny(t_branchname, this->fSTD, this->
fPersistency);
68 LOG(error) <<
"PndSTDOutputContainer<" << T().ClassName() <<
">::Init(" << t_branchname <<
"): No " << T().ClassName() <<
" array with name " << t_branchname
84 if (fSTD !=
nullptr) {
85 return &(fSTD->at(t_idx));
97 if (fSTD !=
nullptr) {
111 if (fSTD !=
nullptr) {
112 fSTD->push_back(T{t_element});
114 LOG(ERROR) <<
"PndSTDInputContainer::CreateCopy() no underlying std::vector";
127 if (this->fSTD !=
nullptr) {
128 this->fSTD->erase(this->fSTD->begin() + t_index);
144 if (this->fSTD !=
nullptr) {
154 void SetData(std::vector<T> *t_container) { fSTD = t_container; }
164 std::vector<T> *fSTD{
nullptr};
std::vector< T > * GetData()
Get the Data.
virtual void Reset() final
"Delete" all elements
virtual T * GetElement(Int_t t_idx) const final
Get the t_idx Element.
PndSTDOutputContainer(const TString &t_foldername="", Bool_t t_persistency=kTRUE)
Construct a new PndSTDOutputContainer object.
virtual void RemoveAt(Int_t t_index) final
remove t_index element
virtual ssize_t GetSize() const final
Get the number of elements.
void SetData(std::vector< T > *t_container)
Set the Data.
virtual void Compress()
Compress.
virtual ~PndSTDOutputContainer()
Destroy the PndSTDOutputContainer object.
virtual T * CreateCopy(const T &t_element)
Create a Copy object of t_element and return pointer to copy.
PndSTDOutputContainer implementation of PndOutputContainerI<T> for FairRootManager and std::vector<T>...
virtual Bool_t Init(const TString &t_branchname) final
Register t_branchname as std::vector<T> * with the FairRootManager.