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

#include <G4EnvironmentUtils.hh>

Public Types

using string_t = std::string
 
using env_map_t = std::map<string_t, string_t>
 
using env_pair_t = std::pair<string_t, string_t>
 

Public Member Functions

template<typename _Tp >
void insert (const std::string &env_id, _Tp val)
 
const env_map_tget () const
 

Static Public Member Functions

static G4EnvSettingsGetInstance ()
 

Friends

std::ostream & operator<< (std::ostream &os, const G4EnvSettings &env)
 

Detailed Description

Definition at line 57 of file G4EnvironmentUtils.hh.

Member Typedef Documentation

◆ env_map_t

Definition at line 64 of file G4EnvironmentUtils.hh.

◆ env_pair_t

Definition at line 65 of file G4EnvironmentUtils.hh.

◆ string_t

using G4EnvSettings::string_t = std::string

Definition at line 63 of file G4EnvironmentUtils.hh.

Member Function Documentation

◆ get()

const env_map_t & G4EnvSettings::get ( ) const
inline

Definition at line 86 of file G4EnvironmentUtils.hh.

86{ return m_env; }

◆ GetInstance()

static G4EnvSettings * G4EnvSettings::GetInstance ( )
inlinestatic

Definition at line 67 of file G4EnvironmentUtils.hh.

68 {
69 static auto* _instance = new G4EnvSettings();
70 return _instance;
71 }

Referenced by G4GetDataEnv(), G4GetEnv(), G4GetEnv(), G4GetEnv(), and G4PrintEnv().

◆ insert()

template<typename _Tp >
void G4EnvSettings::insert ( const std::string & env_id,
_Tp val )
inline

Definition at line 74 of file G4EnvironmentUtils.hh.

75 {
76 std::stringstream ss;
77 ss << val;
78 // lock for MT mode, use C++ type not Geant4 because this file
79 // is included by the those headers
80 static std::mutex _mutex;
81 _mutex.lock();
82 m_env.insert(env_pair_t(env_id, ss.str()));
83 _mutex.unlock();
84 }
std::pair< string_t, string_t > env_pair_t

Referenced by G4GetDataEnv(), G4GetEnv(), G4GetEnv(), and G4GetEnv().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4EnvSettings & env )
friend

Definition at line 88 of file G4EnvironmentUtils.hh.

89 {
90 std::stringstream filler;
91 filler.fill('#');
92 filler << std::setw(90) << "";
93 std::stringstream ss;
94 ss << filler.str() << "\n# Environment settings:\n";
95 for(const auto& itr : env.get())
96 {
97 ss << "# " << std::setw(35) << std::right << itr.first << "\t = \t"
98 << std::left << itr.second << "\n";
99 }
100 ss << filler.str();
101 os << ss.str() << std::endl;
102 return os;
103 }
const env_map_t & get() const

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