63 masterDestinationFlag = addmasterDestination;
64 masterDestinationFmtFlag = formatAlsoMaster;
67 std::ostringstream str;
77 if(this->ignoreCout ||
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();
105 if(this->ignoreCout ||
117 std::ostringstream str;
125 forwarder->AddCoutTransformer(f);
126 forwarder->AddCerrTransformer(f);
128 push_back(std::move(forwarder));
153 std::ios_base::openmode mode =
154 (ifAppend ? std::ios_base::app : std::ios_base::trunc);
159 output->AddCerrTransformer([](
G4String&) {
return false; });
160 push_back(std::move(output));
176 std::ios_base::openmode mode =
177 (ifAppend ? std::ios_base::app : std::ios_base::trunc);
179 output->AddCoutTransformer([](
G4String&) {
return false; });
180 push_back(std::move(output));
195 if(fileN !=
"**Screen**")
206 if(useBuffer && !flag)
211 else if(useBuffer && flag)
214 else if(!useBuffer && !flag)
217 else if(!useBuffer && flag)
222 const size_t infiniteSize = 0;
247 if(fileN !=
"**Screen**")
269 ignoreCout = (tid != id);
279void G4MTcoutDestination::DumpBuffer()
282 std::ostringstream msg;
283 msg <<
"=======================\n";
284 msg <<
"cout buffer(s) for worker with ID:" <<
id << std::endl;
305 msg <<
"=======================\n";
306 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)
void HandleFileCout(G4String fileN, G4bool appendFlag, G4bool suppressDefault)
void EnableBuffering(G4bool flag=true)
void HandleFileCerr(G4String fileN, G4bool appendFlag, G4bool suppressDefault)
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 SetIgnoreCout(G4int tid=0)
virtual ~G4MTcoutDestination()
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)