PandaRoot
PndContainerI.h
Go to the documentation of this file.
1 
15 #ifndef PNDCONTAINERI_H
16 #define PNDCONTAINERI_H
17 
18 #include <vector>
19 
20 #include "TString.h"
21 
22 template <class T>
23 class PndContainerI {
24 
25  public:
37  virtual ~PndContainerI(){};
38 
44  virtual Bool_t Init(const TString &t_branchname) = 0;
45 
51  virtual ssize_t GetSize() const = 0;
52 
59  virtual T const *GetConstElementPtr(Int_t t_index) const = 0;
60 
66  std::vector<T const *> GetVectorOfPtrToConst() const
67  {
68  std::vector<T const *> result{};
69  result.reserve(this->GetSize());
70  for (Int_t i = 0; i < this->GetSize(); ++i) {
71  result.push_back(this->GetConstElementPtr(i));
72  }
73  return result;
74  }
75 
81  const TString &GetBranchName() const { return fBranchName; }
82 
83  protected:
84  TString fBranchName{""};
85 };
86 
87 #endif /*PNDCONTAINERI_H*/
virtual T const * GetConstElementPtr(Int_t t_index) const =0
Get the Element object at t_index.
TString fBranchName
Definition: PndContainerI.h:84
unsigned int i
Definition: P4_F32vec4.h:21
virtual ssize_t GetSize() const =0
Get the number of members in internal data.
std::vector< T const * > GetVectorOfPtrToConst() const
return vector of const ptrs pointing at internal data, to be used to access data independent of under...
Definition: PndContainerI.h:66
virtual ~PndContainerI()
Destroy the PndContainerI object.
Definition: PndContainerI.h:37
const TString & GetBranchName() const
Get the BranchName.
Definition: PndContainerI.h:81
PndContainerI()
Construct a new PndContainerI object.
Definition: PndContainerI.h:32
virtual Bool_t Init(const TString &t_branchname)=0
Init internal data.