37 namespace G4coutFormatters
46 G4String::size_type prev_pos=0,
pos=0;
47 while( (
pos=input.find(separator,
pos))!=G4String::npos)
49 G4String substr( input.substr(prev_pos,
pos-prev_pos)) ;
50 output.push_back(substr);
61 std::time_t
result = std::time(
nullptr);
62 std::ostringstream newm;
64 newm << std::put_time(std::localtime(&result),
"%d/%b/%Y:%H:%M:%S %z");
67 newm << time_->tm_mday <<
"/" << time_->tm_mon <<
"/" << time_->tm_year;
68 newm <<
":" << time_->tm_hour <<
":"<<time_->tm_min<<
":"<<time_->tm_sec;
70 newm<<
" "<<type<<
" [";
72 for (
const auto& el : split(input) )
76 newm << delimiter << el ;
92 if ( dest !=
nullptr )
94 dest->AddCoutTransformer(std::bind(&transform,std::placeholders::_1,
96 dest->AddCerrTransformer(std::bind(&transform,std::placeholders::_1,
105 if ( dest !=
nullptr )
107 dest->ResetTransformers();
112 std::unordered_map<std::string,SetupStyle_f> transformers =
141 for (
const auto& el : transformers )
143 result.push_back(el.first);
150 const auto& handler = transformers.find(style);
151 return ( handler != transformers.end() ) ? (handler->second)(dest) : -1;
156 if ( transformers.find(name) != transformers.end() )
159 msg <<
"Format Style with name " << name
160 <<
" already exists. Replacing existing.";
161 G4Exception(
"G4coutFormatters::RegisterNewStyle()",
165 transformers[
name]=fmt;
std::ostringstream G4ExceptionDescription
static const G4double pos
void SetDestination(G4coutDestination *dest)
G4double G4ParticleHPJENDLHEData::G4double result
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)