PandaRoot
PndSTDConstContainer.h
Go to the documentation of this file.
1 
25 #ifndef PNDSTDCONSTCONTAINER_HH
26 #define PNDSTDCONSTCONTAINER_HH
27 
28 #include <stdexcept>
29 #include <vector>
30 
31 #include "TString.h"
32 
33 #include "FairLogger.h"
34 #include "FairRootManager.h"
35 
36 #include "PndConstContainerI.h"
37 
47 template <class T>
49  public:
59  virtual ~PndSTDConstContainer(){};
60 
67  virtual T const *GetElement(Int_t t_idx) const final
68  {
69  if (fSTD != nullptr) {
70  return &(fSTD->at(t_idx));
71  }
72 
73  return nullptr;
74  }
75 
81  virtual ssize_t GetSize() const final
82  {
83  if (fSTD != nullptr) {
84  return fSTD->size();
85  }
86  return 0;
87  }
93  void SetData(std::vector<T> const *t_container) { fSTD = t_container; }
94 
100  std::vector<T> const *GetData() { return fSTD; }
101 
102  private:
103  std::vector<T> const *fSTD{nullptr};
104 };
105 
106 #endif /*PNDSTDCONSTCONTAINER_HH*/
PndSTDConstContainer implementation of PndConstContainerI<T> for FairRootManager and std::vector<T> ...
virtual ~PndSTDConstContainer()
Destroy the PndSTDConstContainer object.
virtual ssize_t GetSize() const final
Get the number of elements.
PndSTDConstContainer()
Construct a new PndSTDConstContainer object.
std::vector< T > const * GetData()
Get the Data.
void SetData(std::vector< T > const *t_container)
Set the Data.
virtual T const * GetElement(Int_t t_idx) const final
Get the t_idx Element.