36 namespace G4coutFormatters
45 G4String::size_type prev_pos=0,
pos=0;
48 G4String substr( input.substr(prev_pos,
pos-prev_pos)) ;
49 output.push_back(substr);
61 std::ostringstream newm;
63 newm << std::put_time(std::localtime(&result),
"%d/%b/%Y:%H:%M:%S %z");
66 newm << time_->tm_mday <<
"/" << time_->tm_mon <<
"/" << time_->tm_year;
67 newm <<
":" << time_->tm_hour <<
":"<<time_->tm_min<<
":"<<time_->tm_sec;
69 newm<<
" "<<type<<
" [";
71 for (
const auto& el :
split(input) )
75 newm << delimiter << el ;
91 if ( dest !=
nullptr )
93 dest->AddCoutTransformer(std::bind(&
transform,std::placeholders::_1,
95 dest->AddCerrTransformer(std::bind(&
transform,std::placeholders::_1,
104 if ( dest !=
nullptr )
106 dest->ResetTransformers();
111 std::unordered_map<std::string,SetupStyle_f> transformers =
140 for (
const auto& el : transformers )
142 result.push_back(el.first);
149 const auto& handler = transformers.find(style);
150 return ( handler != transformers.end() ) ? (handler->second)(dest) : -1;
155 if ( transformers.find(name) != transformers.end() )
158 msg <<
"Format Style with name " << name
159 <<
" already exists. Replacing existing.";
160 G4Exception(
"G4coutFormatters::RegisterNewStyle()",
164 transformers[
name]=fmt;