62 masterDestinationFlag = addmasterDestination;
63 masterDestinationFmtFlag = formatAlsoMaster;
66 std::ostringstream str;
80 (this->ignoreInit && this->stateMgr->GetCurrentState() ==
G4State_Init));
85 ref_defaultOut = output.get();
86 output->AddDebugTransformer(filter_out);
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();
107 (this->ignoreInit && this->stateMgr->GetCurrentState() ==
G4State_Idle));
109 forwarder->AddDebugTransformer(filter_out);
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));
167 ref_defaultOut->AddCoutTransformer([](
G4String&) {
return false; });
168 if(ref_masterOut !=
nullptr)
170 ref_masterOut->AddCoutTransformer([](
G4String&) {
return false; });
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));
189 ref_defaultOut->AddCerrTransformer([](
G4String&) {
return false; });
190 if(ref_masterOut !=
nullptr)
192 ref_masterOut->AddCerrTransformer([](
G4String&) {
return false; });
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;
300 auto cout =
dynamic_cast<G4BuffercoutDestination*
>(el.get());
303 cout->FlushG4debug();
318 msg <<
"=======================\n";
319 msg <<
"cout buffer(s) for worker with ID:" <<
id << std::endl;
322 auto cout =
dynamic_cast<G4BuffercoutDestination*
>(el.get());
340 msg <<
"=======================\n";
341 msg <<
"cerr buffer(s) for worker with ID:" <<
id <<
" (goes to std error)"
345 auto cout =
dynamic_cast<G4BuffercoutDestination*
>(el.get());
G4TemplateAutoLock< G4Mutex > G4AutoLock
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)
static G4StateManager * GetStateManager()
virtual G4int ReceiveG4cout(const G4String &msg)