PandaRoot
PndConstContainerI.h
Go to the documentation of this file.
1 #ifndef PNDCONSTCONTAINERI_HH
2 #define PNDCONSTCONTAINERI_HH
3 
4 #include "PndContainerI.h"
5 
6 template <class T>
7 class PndConstContainerI : public PndContainerI<T> {
8 
9  public:
18  virtual ~PndConstContainerI(){};
19 
26  virtual T const *GetElement(Int_t t_index) const = 0;
27 
34  virtual T const *GetConstElementPtr(Int_t t_index) const { return this->GetElement(t_index); }
35 
41  std::vector<T const *> GetVector() const
42  {
43  std::vector<T const *> result{};
44  result.reserve(this->GetSize());
45  for (Int_t i = 0; i < this->GetSize(); ++i) {
46  result.push_back(this->GetElement(i));
47  }
48  return result;
49  }
50 };
51 
52 #endif /*PNDCONSTCONTAINERI_HH*/
PndConstContainerI()
Construct a new PndConstContainerI object.
virtual T const * GetConstElementPtr(Int_t t_index) const
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
virtual T const * GetElement(Int_t t_index) const =0
Get the Element object at t_index.
Interface to a datacontainer to be used in PandaROOT.
std::vector< T const * > GetVector() const
return vector of ptrs pointing at internal data, to be used to access data independent of underlying ...