Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ProcessVector Class Reference

#include <G4ProcessVector.hh>

Public Member Functions

 G4ProcessVector ()
 
 G4ProcessVector (std::size_t)
 
 G4ProcessVector (const G4ProcessVector &)
 
virtual ~G4ProcessVector ()
 
G4ProcessVectoroperator= (const G4ProcessVector &right)
 
G4bool operator== (const G4ProcessVector &right) const
 
std::size_t entries () const
 
std::size_t length () const
 
std::size_t size () const
 
std::size_t index (G4VProcess *aProcess) const
 
G4bool contains (G4VProcess *aProcess) const
 
G4bool insert (G4VProcess *aProcess)
 
G4bool insertAt (G4int i, G4VProcess *aProcess)
 
G4VProcessremoveAt (G4int i)
 
G4VProcessremoveLast ()
 
void clear ()
 
G4VProcess *const & operator[] (G4int i) const
 
G4VProcess *const & operator() (G4int i) const
 
G4VProcess *& operator[] (G4int i)
 
G4VProcess *& operator() (G4int i)
 

Protected Types

using G4ProcVector = std::vector< G4VProcess * >
 

Protected Attributes

G4ProcVectorpProcVector = nullptr
 

Detailed Description

Definition at line 44 of file G4ProcessVector.hh.

Member Typedef Documentation

◆ G4ProcVector

using G4ProcessVector::G4ProcVector = std::vector<G4VProcess*>
protected

Definition at line 98 of file G4ProcessVector.hh.

Constructor & Destructor Documentation

◆ G4ProcessVector() [1/3]

G4ProcessVector::G4ProcessVector ( )

Definition at line 37 of file G4ProcessVector.cc.

38{
40}
G4ProcVector * pProcVector
std::vector< G4VProcess * > G4ProcVector

◆ G4ProcessVector() [2/3]

G4ProcessVector::G4ProcessVector ( std::size_t  siz)
explicit

Definition at line 42 of file G4ProcessVector.cc.

43{
44 pProcVector = new G4ProcVector(siz);
45}

◆ G4ProcessVector() [3/3]

G4ProcessVector::G4ProcessVector ( const G4ProcessVector right)

Definition at line 47 of file G4ProcessVector.cc.

48 : pProcVector(nullptr)
49{
51
52 // copy all contents in pProcVector
53 //
54 for (auto i=right.pProcVector->cbegin(); i!=right.pProcVector->cend(); ++i)
55 {
56 pProcVector->push_back(*i);
57 }
58}

◆ ~G4ProcessVector()

G4ProcessVector::~G4ProcessVector ( )
virtual

Definition at line 63 of file G4ProcessVector.cc.

64{
65 // delete pProcVector
66 //
67 if (pProcVector != nullptr )
68 {
69 pProcVector->clear();
70 delete pProcVector;
71 }
72}

Member Function Documentation

◆ clear()

void G4ProcessVector::clear ( )
inline

◆ contains()

G4bool G4ProcessVector::contains ( G4VProcess aProcess) const

Definition at line 114 of file G4ProcessVector.cc.

115{
116 for (auto it=pProcVector->cbegin();it!=pProcVector->cend(); ++it)
117 {
118 if (*(*it)==*aProcess) return true;
119 }
120 return false;
121}

Referenced by G4GlobalFastSimulationManager::ShowSetup().

◆ entries()

◆ index()

std::size_t G4ProcessVector::index ( G4VProcess aProcess) const

Definition at line 102 of file G4ProcessVector.cc.

103{
104 std::size_t j=0;
105 for (auto it=pProcVector->cbegin();it!=pProcVector->cend(); ++j, ++it)
106 {
107 if (*(*it)==*aProcess) return j;
108 }
109 return -1;
110}

◆ insert()

G4bool G4ProcessVector::insert ( G4VProcess aProcess)
inline

◆ insertAt()

G4bool G4ProcessVector::insertAt ( G4int  i,
G4VProcess aProcess 
)

Definition at line 125 of file G4ProcessVector.cc.

126{
127 if ( (i<0) || (i>G4int(pProcVector->size())) ) return false;
128 if (i==G4int(pProcVector->size()))
129 {
130 pProcVector->push_back(aProcess);
131 }
132 else
133 {
134 auto it=pProcVector->cbegin();
135 for(G4int j=0; j!=i; ++j) ++it;
136 pProcVector->insert(it, aProcess);
137 }
138 return true;
139}
int G4int
Definition: G4Types.hh:85

◆ length()

std::size_t G4ProcessVector::length ( ) const
inline

◆ operator()() [1/2]

G4VProcess *& G4ProcessVector::operator() ( G4int  i)
inline

◆ operator()() [2/2]

G4VProcess *const & G4ProcessVector::operator() ( G4int  i) const
inline

◆ operator=()

G4ProcessVector & G4ProcessVector::operator= ( const G4ProcessVector right)

Definition at line 77 of file G4ProcessVector.cc.

78{
79 if (this != &right)
80 {
81 // delete pProcVector
82 if (pProcVector != nullptr )
83 {
84 pProcVector->clear();
85 delete pProcVector;
86 }
87
89
90 // copy all contents in pProcVector
91 //
92 for (auto i=right.pProcVector->cbegin(); i!=right.pProcVector->cend(); ++i)
93 {
94 pProcVector->push_back(*i);
95 }
96 }
97 return *this;
98}

◆ operator==()

G4bool G4ProcessVector::operator== ( const G4ProcessVector right) const
inline

◆ operator[]() [1/2]

G4VProcess *& G4ProcessVector::operator[] ( G4int  i)
inline

◆ operator[]() [2/2]

G4VProcess *const & G4ProcessVector::operator[] ( G4int  i) const
inline

◆ removeAt()

G4VProcess * G4ProcessVector::removeAt ( G4int  i)

Definition at line 143 of file G4ProcessVector.cc.

144{
145 auto it=pProcVector->cbegin();
146 for(std::size_t j=0; j<pProcVector->size() && G4int(j)<i; ++j) ++it;
147 G4VProcess* rValue = *it;
148 pProcVector->erase(it);
149 return rValue;
150}

Referenced by G4ProcessManager::RemoveProcess().

◆ removeLast()

G4VProcess * G4ProcessVector::removeLast ( )
inline

◆ size()

std::size_t G4ProcessVector::size ( ) const
inline

Member Data Documentation

◆ pProcVector

G4ProcVector* G4ProcessVector::pProcVector = nullptr
protected

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