62 masterDestinationFlag = addmasterDestination;
63 masterDestinationFmtFlag = formatAlsoMaster;
66 std::ostringstream str;
85 ref_defaultOut = output.get();
87 output->AddDebugTransformer(f);
88 output->AddCoutTransformer(filter_out);
89 output->AddCoutTransformer(f);
90 output->AddCerrTransformer(f);
91 push_back(std::move(output));
92 if(addmasterDestination)
103 ref_masterOut = forwarder.get();
110 forwarder->AddCoutTransformer(filter_out);
115 std::ostringstream str;
125 forwarder->AddDebugTransformer(f);
126 forwarder->AddCoutTransformer(f);
127 forwarder->AddCerrTransformer(f);
129 push_back(std::move(forwarder));
156 std::ios_base::openmode mode =
157 (ifAppend ? std::ios_base::app : std::ios_base::trunc);
161 output->AddDebugTransformer([](
G4String&) {
return false; });
162 output->AddCerrTransformer([](
G4String&) {
return false; });
163 push_back(std::move(output));
168 if(ref_masterOut !=
nullptr)
181 std::ios_base::openmode mode =
182 (ifAppend ? std::ios_base::app : std::ios_base::trunc);
184 output->AddDebugTransformer([](
G4String&) {
return false; });
185 output->AddCoutTransformer([](
G4String&) {
return false; });
186 push_back(std::move(output));
190 if(ref_masterOut !=
nullptr)
203 if(fileN !=
"**Screen**")
214 if(useBuffer && !flag)
219 else if(useBuffer && flag)
222 else if(!useBuffer && !flag)
225 else if(!useBuffer && flag)
230 const size_t infiniteSize = 0;
255 if(fileN !=
"**Screen**")
277 ignoreCout = (tid != id);
287void G4MTcoutDestination::DumpBuffer()
290 std::ostringstream msg;
296 msg <<
"=======================\n";
297 msg <<
"debug buffer(s) for worker with ID:" <<
id << std::endl;
303 cout->FlushG4debug();
318 msg <<
"=======================\n";
319 msg <<
"cout buffer(s) for worker with ID:" <<
id << std::endl;
340 msg <<
"=======================\n";
341 msg <<
"cerr buffer(s) for worker with ID:" <<
id <<
" (goes to std error)"
std::unique_ptr< G4coutDestination > G4coutDestinationUPtr
#define G4MUTEX_INITIALIZER
void G4iosSetDestination(G4coutDestination *sink)
void AddCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
void SetDefaultOutput(G4bool addMasterDestination=true, G4bool formatAlsoMaster=true)
~G4MTcoutDestination() override
void EnableBuffering(G4bool flag=true)
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
G4MTcoutDestination(const G4int &threadId)
void AddCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
void HandleFileCout(const G4String &fileN, G4bool appendFlag, G4bool suppressDefault)
void HandleFileCerr(const G4String &fileN, G4bool appendFlag, G4bool suppressDefault)
void SetIgnoreCout(G4int tid=0)
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
void AddMasterOutput(G4bool formatAlsoMaster)
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
void AddCerrTransformer(const Transformer &t)
void AddDebugTransformer(const Transformer &t)
virtual G4int ReceiveG4cout(const G4String &msg)
void AddCoutTransformer(const Transformer &t)