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 #include "PndContainerBaseI.h"
22 
23 template <class T>
24 class PndContainerI : public PndContainerBaseI {
25 
26  public:
38  virtual ~PndContainerI(){};
39 
46  virtual T const *GetConstElementPtr(Int_t t_index) const = 0;
47 
53  std::vector<T const *> GetVectorOfPtrToConst() const
54  {
55  std::vector<T const *> result{};
56  result.reserve(this->GetSize());
57  for (Int_t i = 0; i < this->GetSize(); ++i) {
58  result.push_back(this->GetConstElementPtr(i));
59  }
60  return result;
61  }
62 
63  TString GetClassName() const { return T{}.ClassName(); }
64 };
65 
66 #endif /*PNDCONTAINERI_H*/
virtual T const * GetConstElementPtr(Int_t t_index) const =0
Get the Element object at t_index.
virtual ssize_t GetSize() const =0
Get the number of members in internal data.
unsigned int i
Definition: P4_F32vec4.h:21
Interface to a datacontainer to be used in PandaROOT.
TString GetClassName() const
Definition: PndContainerI.h:63
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:53
virtual ~PndContainerI()
Destroy the PndContainerI object.
Definition: PndContainerI.h:38
PndContainerI()
Construct a new PndContainerI object.
Definition: PndContainerI.h:33