PandaRoot
PndConstContainer.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 
26 #ifndef PNDCONSTCONTAINER_HH
27 #define PNDCONSTCONTAINER_HH
28 
29 #include <vector>
30 
31 #include "PndContainerI.h"
32 #include "PndSTDConstContainer.h"
33 #include "PndTCAConstContainer.h"
34 
35 template <class T>
37 
38  public:
46 
51  virtual ~PndConstContainer(){};
52 
58  void SetConstContainer(PndConstContainerI<T> *t_container) { this->fImp.reset(t_container); }
59 
65  virtual ssize_t GetSize() const final
66  {
67  if (this->fImp != nullptr) {
68  return this->fImp->GetSize();
69  }
70  return 0;
71  }
72 
79  virtual T const *GetElement(Int_t t_index) const final
80  {
81  if (this->fImp != nullptr) {
82  return this->fImp->GetElement(t_index);
83  }
84  return nullptr;
85  }
86 
87  protected:
88  std::unique_ptr<PndConstContainerI<T>> fImp{nullptr};
89 };
90 
91 #endif /*PNDCONSTCONTAINER_HH*/
Input and Output Container implementation of PndConstContainerI using an underlying std::vector<T> (c...
virtual T const * GetElement(Int_t t_index) const final
Get the Element object at t_index.
void SetConstContainer(PndConstContainerI< T > *t_container)
Set the Input Container object.
virtual ~PndConstContainer()
Destroy the PndConstContainer object.
std::unique_ptr< PndConstContainerI< T > > fImp
Interface to a datacontainer to be used in PandaROOT.
virtual ssize_t GetSize() const final
Get the number of members in internal data.
Input and Output Container implementation of PndConstContainerI using an underlying TClonesArray...
PndConstContainer()
Construct a new PndConstContainer object.