64 masterDestinationFlag = addmasterDestination;
65 masterDestinationFmtFlag = formatAlsoMaster;
68 std::ostringstream str;
87 ref_defaultOut = output.get();
89 output->AddCoutTransformer(f);
90 output->AddCerrTransformer(f);
91 push_back(std::move(output));
92 if(addmasterDestination)
103 ref_masterOut = forwarder.get();
114 std::ostringstream str;
124 forwarder->AddCoutTransformer(f);
125 forwarder->AddCerrTransformer(f);
127 push_back(std::move(forwarder));
154 std::ios_base::openmode mode =
155 (ifAppend ? std::ios_base::app : std::ios_base::trunc);
160 output->AddCerrTransformer([](
G4String&) {
return false; });
161 push_back(std::move(output));
166 if(ref_masterOut !=
nullptr)
179 std::ios_base::openmode mode =
180 (ifAppend ? std::ios_base::app : std::ios_base::trunc);
182 output->AddCoutTransformer([](
G4String&) {
return false; });
183 push_back(std::move(output));
187 if(ref_masterOut !=
nullptr)
200 if(fileN !=
"**Screen**")
211 if(useBuffer && !flag)
216 else if(useBuffer && flag)
219 else if(!useBuffer && !flag)
222 else if(!useBuffer && flag)
227 const size_t infiniteSize = 0;
252 if(fileN !=
"**Screen**")
274 ignoreCout = (tid != id);
284void G4MTcoutDestination::DumpBuffer()
287 std::ostringstream msg;
288 msg <<
"=======================\n";
289 msg <<
"cout buffer(s) for worker with ID:" <<
id << std::endl;
310 msg <<
"=======================\n";
311 msg <<
"cerr buffer(s) for worker with ID:" <<
id <<
" (goes to std error)"
std::unique_ptr< G4coutDestination > G4coutDestinationUPtr
#define G4MUTEX_INITIALIZER
G4GLOB_DLL G4strstreambuf G4coutbuf
G4GLOB_DLL G4strstreambuf G4cerrbuf
virtual G4int FlushG4cerr()
virtual G4int FlushG4cout()
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)
virtual G4int ReceiveG4cout(const G4String &msg)
void AddCoutTransformer(const Transformer &t)
void SetDestination(G4coutDestination *dest)