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

#include <G4UIaliasList.hh>

Public Member Functions

 G4UIaliasList ()=default
 
 ~G4UIaliasList ()
 
void RemoveAlias (const char *aliasName)
 
void ChangeAlias (const char *aliasName, const char *aliasValue)
 
G4StringFindAlias (const char *aliasName)
 
void List ()
 

Detailed Description

Definition at line 42 of file G4UIaliasList.hh.

Constructor & Destructor Documentation

◆ G4UIaliasList()

G4UIaliasList::G4UIaliasList ( )
default

◆ ~G4UIaliasList()

G4UIaliasList::~G4UIaliasList ( )

Definition at line 35 of file G4UIaliasList.cc.

36{
37 std::size_t n_treeEntry = alias.size();
38 for(std::size_t i = 0; i < n_treeEntry; ++i)
39 {
40 delete alias[i];
41 delete value[i];
42 }
43}

Member Function Documentation

◆ ChangeAlias()

void G4UIaliasList::ChangeAlias ( const char *  aliasName,
const char *  aliasValue 
)

Definition at line 87 of file G4UIaliasList.cc.

88{
89 G4int i = FindAliasID(aliasName);
90 if(i < 0)
91 {
92 AddNewAlias(aliasName, aliasValue);
93 return;
94 }
95 *(value[i]) = aliasValue;
96}
int G4int
Definition: G4Types.hh:85

Referenced by G4UImanager::SetAlias().

◆ FindAlias()

G4String * G4UIaliasList::FindAlias ( const char *  aliasName)

Definition at line 99 of file G4UIaliasList.cc.

100{
101 G4int i = FindAliasID(aliasName);
102 if(i < 0)
103 {
104 return nullptr;
105 }
106 return value[i];
107}

Referenced by G4UImanager::SolveAlias().

◆ List()

void G4UIaliasList::List ( )

Definition at line 124 of file G4UIaliasList.cc.

125{
126 std::size_t i_entry = alias.size();
127 for(std::size_t i1 = 0; i1 < i_entry - 1; ++i1)
128 {
129 for(std::size_t i2 = i1 + 1; i2 < i_entry; ++i2)
130 {
131 if(*(alias[i1]) > *(alias[i2]))
132 {
133 G4String* tmp = alias[i1];
134 alias[i1] = alias[i2];
135 alias[i2] = tmp;
136 tmp = value[i1];
137 value[i1] = value[i2];
138 value[i2] = tmp;
139 }
140 }
141 }
142
143 for(std::size_t i = 0; i < i_entry; ++i)
144 {
145 G4cout << " " << *(alias[i]) << " : " << *(value[i]) << G4endl;
146 }
147}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

Referenced by G4UImanager::ListAlias().

◆ RemoveAlias()

void G4UIaliasList::RemoveAlias ( const char *  aliasName)

Definition at line 73 of file G4UIaliasList.cc.

74{
75 G4int i = FindAliasID(aliasName);
76 if(i < 0)
77 {
78 G4cerr << "Alias <" << aliasName << "> does not exist. Command ignored."
79 << G4endl;
80 return;
81 }
82 alias.erase(alias.begin() + i);
83 value.erase(value.begin() + i);
84}
G4GLOB_DLL std::ostream G4cerr

Referenced by G4UImanager::RemoveAlias().


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