Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TableTemplate< T > Class Template Reference

#include <G4TableTemplate.hh>

Public Member Functions

 G4TableTemplate ()=default
 
void G4AddContainer (T *NewContainer)
 
G4TableTemplateG4GetTable ()
 
T * G4GetContainer (unsigned int WhichContainer)
 
T * G4GetNewContainer ()
 
T * G4GetNewContainer (G4int DefaultValue)
 
G4long G4GetNumberOfElements ()
 
 ~G4TableTemplate ()
 

Detailed Description

template<class T>
class G4TableTemplate< T >

G4TableTemplate is essentially a wrapper around a std::vector designed to work specifically with pointers.

Definition at line 45 of file G4TableTemplate.hh.

Constructor & Destructor Documentation

◆ G4TableTemplate()

template<class T >
G4TableTemplate< T >::G4TableTemplate ( )
default

Default constructor

◆ ~G4TableTemplate()

template<class T >
G4TableTemplate< T >::~G4TableTemplate ( )

Definition at line 115 of file G4TableTemplate.hh.

116{
117 for (unsigned int i = 0; i < ContainerTable_.size(); i++) {
118 delete ContainerTable_[i];
119 }
120}

Member Function Documentation

◆ G4AddContainer()

template<class T >
void G4TableTemplate< T >::G4AddContainer ( T * NewContainer)

Adds a container to the table

Definition at line 71 of file G4TableTemplate.hh.

72{
73 ContainerTable_.push_back(NewContainer);
74}

◆ G4GetContainer()

template<class T >
T * G4TableTemplate< T >::G4GetContainer ( unsigned int WhichContainer)

Retrieve a container from the table

Definition at line 83 of file G4TableTemplate.hh.

84{
85 if (WhichContainer < ContainerTable_.size()) {
86 return ContainerTable_[WhichContainer];
87 }
88
89 return nullptr;
90}

Referenced by G4ENDFTapeRead::G4GetYield().

◆ G4GetNewContainer() [1/2]

template<class T >
T * G4TableTemplate< T >::G4GetNewContainer ( )

Create a new blank container

Definition at line 93 of file G4TableTemplate.hh.

94{
95 ContainerTable_.push_back(new T);
96
97 return ContainerTable_.back();
98}

◆ G4GetNewContainer() [2/2]

template<class T >
T * G4TableTemplate< T >::G4GetNewContainer ( G4int DefaultValue)

Create a new container that is constructed with a G4int

Definition at line 101 of file G4TableTemplate.hh.

102{
103 ContainerTable_.push_back(new T(DefaultValue));
104
105 return ContainerTable_.back();
106}

◆ G4GetNumberOfElements()

template<class T >
G4long G4TableTemplate< T >::G4GetNumberOfElements ( )

Get the number of elements in the table

Definition at line 109 of file G4TableTemplate.hh.

110{
111 return ContainerTable_.size();
112}

Referenced by G4ENDFTapeRead::G4GetNumberOfFissionProducts().

◆ G4GetTable()

template<class T >
G4TableTemplate< T > * G4TableTemplate< T >::G4GetTable ( )

Gets a pointer to the table

Definition at line 77 of file G4TableTemplate.hh.

78{
79 return this;
80}

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