Geant4 10.7.0
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 (void)
 
void G4AddContainer (T *NewContainer)
 
G4TableTemplateG4GetTable (void)
 
T * G4GetContainer (unsigned int WhichContainer)
 
T * G4GetNewContainer (void)
 
T * G4GetNewContainer (G4int DefaultValue)
 
G4long G4GetNumberOfElements (void)
 
 ~G4TableTemplate (void)
 

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 46 of file G4TableTemplate.hh.

Constructor & Destructor Documentation

◆ G4TableTemplate()

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

Default constructor

Definition at line 72 of file G4TableTemplate.hh.

74{
75 // Nothing to be initialized
76}

◆ ~G4TableTemplate()

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

Definition at line 130 of file G4TableTemplate.hh.

132{
133 for(unsigned int i = 0; i < ContainerTable_.size(); i++)
134 {
135 delete ContainerTable_[i];
136 }
137}

Member Function Documentation

◆ G4AddContainer()

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

Adds a container to the table

Definition at line 79 of file G4TableTemplate.hh.

81{
82 ContainerTable_.push_back(NewContainer);
83}

◆ G4GetContainer()

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

Retrieve a container from the table

Definition at line 93 of file G4TableTemplate.hh.

95{
96 if(WhichContainer < ContainerTable_.size())
97 {
98 return ContainerTable_[WhichContainer];
99 }
100
101 return NULL;
102}

Referenced by G4ENDFTapeRead::G4GetYield().

◆ G4GetNewContainer() [1/2]

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

Create a new container that is constructed with a G4int

Definition at line 114 of file G4TableTemplate.hh.

116{
117 ContainerTable_.push_back(new T(DefaultValue));
118
119 return ContainerTable_.back();
120}

◆ G4GetNewContainer() [2/2]

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

Create a new blank container

Definition at line 105 of file G4TableTemplate.hh.

107{
108 ContainerTable_.push_back(new T);
109
110 return ContainerTable_.back();
111}

◆ G4GetNumberOfElements()

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

Get the number of elements in the table

Definition at line 123 of file G4TableTemplate.hh.

125{
126 return ContainerTable_.size();
127}

Referenced by G4ENDFTapeRead::G4GetNumberOfFissionProducts().

◆ G4GetTable()

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

Gets a pointer to the table

Definition at line 86 of file G4TableTemplate.hh.

88{
89 return this;
90}

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