PandaRoot
PndSTDMutableContainer< T > Class Template Reference

PndSTDMutableContainer implementation of PndMutableContainerI<T> for FairRootManager and std::vector<T> More...

#include <PndSTDMutableContainer.h>

Inheritance diagram for PndSTDMutableContainer< T >:
PndMutableContainerI< T > PndContainerI< T > PndContainerBaseI

Public Member Functions

 PndSTDMutableContainer (const TString &t_foldername="", Bool_t t_persistency=kTRUE)
 Construct a new PndSTDMutableContainer object. More...
 
virtual ~PndSTDMutableContainer ()
 Destroy the PndSTDMutableContainer object. More...
 
virtual T * GetElement (Int_t t_idx) const final
 Get the t_idx Element. More...
 
virtual ssize_t GetSize () const final
 Get the number of elements. More...
 
virtual T * CreateCopy (const T &t_element)
 Create a Copy object of t_element and return pointer to copy. More...
 
virtual void RemoveAt (Int_t t_index) final
 remove t_index element More...
 
virtual void Compress ()
 Compress. More...
 
virtual void Reset () final
 "Delete" all elements More...
 
void SetData (std::vector< T > *t_container)
 Set the Data. More...
 
std::vector< T > * GetData ()
 Get the Data. More...
 
- Public Member Functions inherited from PndMutableContainerI< T >
 PndMutableContainerI (const TString &t_foldername="", Bool_t t_persistency=kTRUE)
 Construct a new PndMutableContainerI object. More...
 
 fFolderName (t_foldername)
 
 fPersistency (t_persistency)
 
virtual ~PndMutableContainerI ()
 Destroy the PndMutableContainerI object. More...
 
virtual T const * GetConstElementPtr (Int_t t_index) const
 Get the Element object at t_index. More...
 
std::vector< T * > GetVector () const
 return vector of ptrs pointing at internal data, to be used to access data independent of underlying data container More...
 
void SetFolderName (const TString &t_foldername)
 Set the FolderName. More...
 
void SetPersistency (Bool_t t_persistency)
 Set the Persistency of the data. More...
 
const TString & GetFolderName () const
 Get the Folder Name. More...
 
Bool_t GetPersistency () const
 Get the Persistency of the data. More...
 
- Public Member Functions inherited from PndContainerI< T >
 PndContainerI ()
 Construct a new PndContainerI object. More...
 
virtual ~PndContainerI ()
 Destroy the PndContainerI object. More...
 
std::vector< T const * > GetVectorOfPtrToConst () const
 return vector of const ptrs pointing at internal data, to be used to access data independent of underlying data container More...
 
TString GetClassName () const
 
- Public Member Functions inherited from PndContainerBaseI
 PndContainerBaseI ()
 Construct a new PndContainerBaseI object. More...
 
virtual ~PndContainerBaseI ()
 Destroy the PndContainerBaseI object. More...
 
const TString & GetBranchName () const
 Get the BranchName. More...
 
void SetBranchName (const TString &t_branchname)
 Set the Branch Name. More...
 

Additional Inherited Members

- Protected Attributes inherited from PndMutableContainerI< T >
TString fFolderName {""}
 
Bool_t fPersistency {kFALSE}
 
- Protected Attributes inherited from PndContainerBaseI
TString fBranchName {""}
 

Detailed Description

template<class T>
class PndSTDMutableContainer< T >

PndSTDMutableContainer implementation of PndMutableContainerI<T> for FairRootManager and std::vector<T>

Output data registered with FairRootManager as (std::vector<T> *)

Template Parameters
T

Definition at line 49 of file PndSTDMutableContainer.h.

Constructor & Destructor Documentation

◆ PndSTDMutableContainer()

template<class T>
PndSTDMutableContainer< T >::PndSTDMutableContainer ( const TString &  t_foldername = "",
Bool_t  t_persistency = kTRUE 
)
inline

Construct a new PndSTDMutableContainer object.

Parameters
constTString &t_foldername = ""
Bool_tt_persistency = kTRUE

Definition at line 57 of file PndSTDMutableContainer.h.

◆ ~PndSTDMutableContainer()

template<class T>
virtual PndSTDMutableContainer< T >::~PndSTDMutableContainer ( )
inlinevirtual

Destroy the PndSTDMutableContainer object.

Definition at line 63 of file PndSTDMutableContainer.h.

63 {}

Member Function Documentation

◆ Compress()

template<class T>
virtual void PndSTDMutableContainer< T >::Compress ( )
inlinevirtual

Compress.

Reimplemented from PndMutableContainerI< T >.

Definition at line 125 of file PndSTDMutableContainer.h.

125 {}

◆ CreateCopy()

template<class T>
virtual T* PndSTDMutableContainer< T >::CreateCopy ( const T &  t_element)
inlinevirtual

Create a Copy object of t_element and return pointer to copy.

Parameters
constT &t_element
Returns
T*

Implements PndMutableContainerI< T >.

Definition at line 98 of file PndSTDMutableContainer.h.

Referenced by TestOutWithSTDTask::Exec().

99  {
100  if (fSTD != nullptr) {
101  fSTD->push_back(T{t_element});
102  } else {
103  LOG(error) << "PndSTDMutableContainer::CreateCopy() no underlying std::vector";
104  return nullptr;
105  }
106  return GetElement(GetSize() - 1);
107  }
virtual ssize_t GetSize() const final
Get the number of elements.
virtual T * GetElement(Int_t t_idx) const final
Get the t_idx Element.

◆ GetData()

template<class T>
std::vector<T>* PndSTDMutableContainer< T >::GetData ( )
inline

Get the Data.

Returns
std::vector<T>*

Definition at line 150 of file PndSTDMutableContainer.h.

150 { return fSTD; }

◆ GetElement()

template<class T>
virtual T* PndSTDMutableContainer< T >::GetElement ( Int_t  t_idx) const
inlinefinalvirtual

Get the t_idx Element.

Parameters
Int_tt_idx
Returns
T*

Implements PndMutableContainerI< T >.

Definition at line 71 of file PndSTDMutableContainer.h.

Referenced by PndSTDMutableContainer< FairTimeStamp >::CreateCopy().

72  {
73  if (fSTD != nullptr) {
74  return &(fSTD->at(t_idx));
75  }
76  return nullptr;
77  }

◆ GetSize()

template<class T>
virtual ssize_t PndSTDMutableContainer< T >::GetSize ( ) const
inlinefinalvirtual

Get the number of elements.

Returns
ssize_t

Implements PndContainerBaseI.

Definition at line 84 of file PndSTDMutableContainer.h.

Referenced by PndSTDMutableContainer< FairTimeStamp >::CreateCopy().

85  {
86  if (fSTD != nullptr) {
87  return fSTD->size();
88  }
89  return 0;
90  }

◆ RemoveAt()

template<class T>
virtual void PndSTDMutableContainer< T >::RemoveAt ( Int_t  t_index)
inlinefinalvirtual

remove t_index element

Parameters
Int_tt_index

Implements PndMutableContainerI< T >.

Definition at line 114 of file PndSTDMutableContainer.h.

115  {
116  if (this->fSTD != nullptr) {
117  this->fSTD->erase(this->fSTD->begin() + t_index);
118  }
119  }

◆ Reset()

template<class T>
virtual void PndSTDMutableContainer< T >::Reset ( )
inlinefinalvirtual

"Delete" all elements

Implements PndMutableContainerI< T >.

Definition at line 131 of file PndSTDMutableContainer.h.

Referenced by TestOutWithSTDTask::Exec().

132  {
133  if (this->fSTD != nullptr) {
134  this->fSTD->clear();
135  }
136  }

◆ SetData()

template<class T>
void PndSTDMutableContainer< T >::SetData ( std::vector< T > *  t_container)
inline

Set the Data.

Parameters
std::vector<T>*t_container

Definition at line 143 of file PndSTDMutableContainer.h.

Referenced by TestOutWithSTDTask::Init().

143 { fSTD = t_container; }

The documentation for this class was generated from the following file: