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 37 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 45 of file PndSTDMutableContainer.h.

45 : PndMutableContainerI<T>(t_foldername, t_persistency) {}

◆ ~PndSTDMutableContainer()

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

Destroy the PndSTDMutableContainer object.

Definition at line 51 of file PndSTDMutableContainer.h.

51 {}

Member Function Documentation

◆ Compress()

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

Compress.

Reimplemented from PndMutableContainerI< T >.

Definition at line 113 of file PndSTDMutableContainer.h.

113 {}

◆ 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 86 of file PndSTDMutableContainer.h.

Referenced by TestOutWithSTDTask::Exec().

87  {
88  if (fSTD != nullptr) {
89  fSTD->push_back(T{t_element});
90  } else {
91  LOG(error) << "PndSTDMutableContainer::CreateCopy() no underlying std::vector";
92  return nullptr;
93  }
94  return GetElement(GetSize() - 1);
95  }
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 138 of file PndSTDMutableContainer.h.

138 { 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 59 of file PndSTDMutableContainer.h.

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

60  {
61  if (fSTD != nullptr) {
62  return &(fSTD->at(t_idx));
63  }
64  return nullptr;
65  }

◆ 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 72 of file PndSTDMutableContainer.h.

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

73  {
74  if (fSTD != nullptr) {
75  return fSTD->size();
76  }
77  return 0;
78  }

◆ 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 102 of file PndSTDMutableContainer.h.

103  {
104  if (this->fSTD != nullptr) {
105  this->fSTD->erase(this->fSTD->begin() + t_index);
106  }
107  }

◆ Reset()

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

"Delete" all elements

Implements PndMutableContainerI< T >.

Definition at line 119 of file PndSTDMutableContainer.h.

Referenced by TestOutWithSTDTask::Exec().

120  {
121  if (this->fSTD != nullptr) {
122  this->fSTD->clear();
123  }
124  }

◆ 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 131 of file PndSTDMutableContainer.h.

Referenced by TestOutWithSTDTask::Init().

131 { fSTD = t_container; }

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