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

Namespaces

namespace  ID
 

Typedefs

using SetupStyle_f = std::function< G4int(G4coutDestination *)>
 
using String_V = std::vector< G4String >
 

Functions

String_V Names ()
 
G4int HandleStyle (G4coutDestination *dest, const G4String &style)
 
void SetMasterStyle (const G4String &)
 
G4String GetMasterStyle ()
 
void SetupStyleGlobally (const G4String &news)
 
void RegisterNewStyle (const G4String &name, SetupStyle_f &formatter)
 

Typedef Documentation

◆ SetupStyle_f

using G4coutFormatters::SetupStyle_f = typedef std::function<G4int(G4coutDestination*)>

Definition at line 60 of file G4coutFormatters.hh.

◆ String_V

using G4coutFormatters::String_V = typedef std::vector<G4String>

Definition at line 72 of file G4coutFormatters.hh.

Function Documentation

◆ GetMasterStyle()

G4String G4coutFormatters::GetMasterStyle ( )

Definition at line 120 of file G4coutFormatters.cc.

120{ return masterStyle; }

◆ HandleStyle()

G4int G4coutFormatters::HandleStyle ( G4coutDestination dest,
const G4String style 
)

Definition at line 141 of file G4coutFormatters.cc.

142 {
143 const auto& handler = transformers.find(style);
144 return (handler != transformers.cend()) ? (handler->second)(dest) : -1;
145 }

Referenced by SetupStyleGlobally().

◆ Names()

String_V G4coutFormatters::Names ( )

Definition at line 131 of file G4coutFormatters.cc.

132 {
133 String_V result;
134 for(const auto& el : transformers)
135 {
136 result.push_back(el.first);
137 }
138 return result;
139 }
std::vector< G4String > String_V

◆ RegisterNewStyle()

void G4coutFormatters::RegisterNewStyle ( const G4String name,
SetupStyle_f formatter 
)

Definition at line 147 of file G4coutFormatters.cc.

148 {
149 if(transformers.find(name) != transformers.cend())
150 {
152 msg << "Format Style with name " << name
153 << " already exists. Replacing existing.";
154 G4Exception("G4coutFormatters::RegisterNewStyle()", "FORMATTER001",
155 JustWarning, msg);
156 }
157 // transformers.insert(std::make_pair(name,fmt));
158 transformers[name] = fmt;
159 }
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40

◆ SetMasterStyle()

void G4coutFormatters::SetMasterStyle ( const G4String news)

Definition at line 118 of file G4coutFormatters.cc.

118{ masterStyle = news; }

Referenced by SetupStyleGlobally().

◆ SetupStyleGlobally()

void G4coutFormatters::SetupStyleGlobally ( const G4String news)

Definition at line 122 of file G4coutFormatters.cc.

123 {
124 static G4coutDestination ss;
129 }
G4GLOB_DLL G4strstreambuf G4coutbuf
Definition: G4ios.cc:114
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:115
void SetDestination(G4coutDestination *dest)
void SetMasterStyle(const G4String &)
G4int HandleStyle(G4coutDestination *dest, const G4String &style)