PandaRoot
PndSTDConstContainer.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
37 #ifndef PNDSTDCONSTCONTAINER_HH
38 #define PNDSTDCONSTCONTAINER_HH
39 
40 #include <stdexcept>
41 #include <vector>
42 
43 #include "TString.h"
44 
45 #include "FairLogger.h"
46 #include "FairRootManager.h"
47 
48 #include "PndConstContainerI.h"
49 
59 template <class T>
61  public:
71  virtual ~PndSTDConstContainer(){};
72 
79  virtual T const *GetElement(Int_t t_idx) const final
80  {
81  if (fSTD != nullptr) {
82  return &(fSTD->at(t_idx));
83  }
84 
85  return nullptr;
86  }
87 
93  virtual ssize_t GetSize() const final
94  {
95  if (fSTD != nullptr) {
96  return fSTD->size();
97  }
98  return 0;
99  }
105  void SetData(std::vector<T> const *t_container) { fSTD = t_container; }
106 
112  std::vector<T> const *GetData() { return fSTD; }
113 
114  private:
115  std::vector<T> const *fSTD{nullptr};
116 };
117 
118 #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.