Geant4-11
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends
G4EnvSettings Class Reference

#include <G4EnvironmentUtils.hh>

Public Types

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

Public Member Functions

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

Static Public Member Functions

static G4EnvSettingsGetInstance ()
 

Private Attributes

env_map_t m_env
 

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; }

References m_env.

◆ GetInstance()

static G4EnvSettings * G4EnvSettings::GetInstance ( )
inlinestatic

Definition at line 67 of file G4EnvironmentUtils.hh.

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

Referenced by G4GetDataEnv(), 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

References m_env, and G4AttDefStore::mutex.

Referenced by G4GetDataEnv(), and G4GetEnv().

Friends And Related Function 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

Field Documentation

◆ m_env

env_map_t G4EnvSettings::m_env
private

Definition at line 106 of file G4EnvironmentUtils.hh.

Referenced by get(), and insert().


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