Geant4-11
Namespaces | Typedefs | Functions
G4coutFormatters Namespace Reference

Namespaces

namespace  anonymous_namespace{G4coutFormatters.cc}
 
namespace  ID
 

Typedefs

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

Functions

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

Typedef Documentation

◆ SetupStyle_f

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 ( )

◆ 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 }
std::unordered_map< std::string, SetupStyle_f > transformers

References G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transformers.

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

References G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transformers.

◆ 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:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
const char * name(G4int ptype)

References G4Exception(), JustWarning, G4InuclParticleNames::name(), and G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transformers.

◆ SetMasterStyle()

void G4coutFormatters::SetMasterStyle ( const G4String news)

◆ 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:108
G4GLOB_DLL G4strstreambuf G4cerrbuf
Definition: G4ios.cc:109
void SetDestination(G4coutDestination *dest)
void SetMasterStyle(const G4String &)
G4int HandleStyle(G4coutDestination *dest, const G4String &style)

References G4cerrbuf, G4coutbuf, HandleStyle(), G4strstreambuf::SetDestination(), and SetMasterStyle().