PandaRoot
PndMutableContainer.h
Go to the documentation of this file.
1 
14 #ifndef PNDMUTABLECONTAINER_HH
15 #define PNDMUTABLECONTAINER_HH
16 
17 #include <vector>
18 
19 #include "PndContainerI.h"
20 #include "PndSTDMutableContainer.h"
21 #include "PndTCAMutableContainer.h"
22 
23 template <class T>
25 
26  public:
33  PndMutableContainer(const TString &t_foldername = "", Bool_t t_persistency = kTRUE) : PndMutableContainerI<T>(t_foldername, t_persistency) {}
34 
39  virtual ~PndMutableContainer(){};
40 
46  void SetContainer(PndMutableContainerI<T> *t_container) { this->fImp.reset(t_container); }
47 
54  virtual void Reset() final
55  {
56  if (this->fImp != nullptr) {
57  this->fImp->Reset();
58  }
59  }
60 
67  virtual T *CreateCopy(const T &t_data) final
68  {
69  if (this->fImp != nullptr) {
70  return this->fImp->CreateCopy(t_data);
71  }
72  return nullptr;
73  }
74 
80  virtual void RemoveAt(Int_t t_index) final
81  {
82  if (this->fImp != nullptr) {
83  this->fImp->RemoveAt(t_index);
84  }
85  }
86 
92  virtual ssize_t GetSize() const final
93  {
94  if (this->fImp != nullptr) {
95  return this->fImp->GetSize();
96  }
97  return 0;
98  }
99 
106  virtual T *GetElement(Int_t t_index) const final
107  {
108  if (this->fImp != nullptr) {
109  return this->fImp->GetElement(t_index);
110  }
111  return nullptr;
112  }
113 
118  virtual void Compress()
119  {
120  if (this->fImp != nullptr) {
121  this->fImp->Compress();
122  }
123  }
124 
125  protected:
126  std::unique_ptr<PndMutableContainerI<T>> fImp{nullptr};
127 };
128 
129 #endif /*PNDMUTABLECONTAINER_HH*/
PndMutableContainer(const TString &t_foldername="", Bool_t t_persistency=kTRUE)
Construct a new PndMutableContainer object.
virtual void Compress()
Compress.
Input and Output Container implementation of PndMutableContainerI using an underlying TClonesArray...
virtual ~PndMutableContainer()
Destroy the PndMutableContainer object.
virtual void RemoveAt(Int_t t_index) final
Delete object at t_index in internal data.
virtual T * CreateCopy(const T &t_data) final
Create a copy of t_data in internal data and return ptr to it.
Input and Output Container implementation of PndMutableContainerI using an underlying std::vector<T> ...
virtual ssize_t GetSize() const final
Get the number of members in internal data.
virtual void Reset() final
Reset data.
Interface to a datacontainer to be used in PandaROOT.
std::unique_ptr< PndMutableContainerI< T > > fImp
virtual T * GetElement(Int_t t_index) const final
Get the Element object at t_index.
void SetContainer(PndMutableContainerI< T > *t_container)
Set the Output Container object.