Geant4  10.02.p03
G4LocalThreadCoutMessenger Class Reference

#include <G4LocalThreadCoutMessenger.hh>

Inheritance diagram for G4LocalThreadCoutMessenger:
Collaboration diagram for G4LocalThreadCoutMessenger:

Public Member Functions

 G4LocalThreadCoutMessenger ()
 
 ~G4LocalThreadCoutMessenger ()
 
void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Attributes

G4UIdirectorycoutDir
 
G4UIcommandcoutFileNameCmd
 
G4UIcommandcerrFileNameCmd
 
G4UIcmdWithABoolbufferCoutCmd
 
G4UIcmdWithAStringprefixCmd
 
G4UIcmdWithAnIntegerignoreCmd
 
G4UIcmdWithABoolignoreInitCmd
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 48 of file G4LocalThreadCoutMessenger.hh.

Constructor & Destructor Documentation

◆ G4LocalThreadCoutMessenger()

G4LocalThreadCoutMessenger::G4LocalThreadCoutMessenger ( )

Definition at line 43 of file G4LocalThreadCoutMessenger.cc.

44 {
45  coutDir = new G4UIdirectory("/control/cout/");
46  coutDir->SetGuidance("Control cout/cerr for local thread.");
47 
48  coutFileNameCmd = new G4UIcommand("/control/cout/setCoutFile",this);
49  coutFileNameCmd->SetGuidance("Send G4cout stream to a file dedicated to a thread. ");
50  coutFileNameCmd->SetGuidance("To have a display output, use special keyword \"**Screen**\".");
51  coutFileNameCmd->SetGuidance("If append flag is true output is appended to file,");
52  coutFileNameCmd->SetGuidance("otherwise file output is overwritten.");
54  G4UIparameter* pp = new G4UIparameter("fileName",'s',true);
55  pp->SetDefaultValue("**Screen**");
57  pp= new G4UIparameter("append",'b',true);
58  pp->SetDefaultValue(true);
60 
61  cerrFileNameCmd = new G4UIcommand("/control/cout/setCerrFile",this);
62  cerrFileNameCmd->SetGuidance("Send G4cerr stream to a file dedicated to a thread. ");
63  cerrFileNameCmd->SetGuidance("To have a display output, use special keyword \"**Screen**\".");
64  cerrFileNameCmd->SetGuidance("If append flag is true output is appended to file,");
65  cerrFileNameCmd->SetGuidance("otherwise file output is overwritten.");
67  pp = new G4UIparameter("fileName",'s',true);
68  pp->SetDefaultValue("**Screen**");
70  pp= new G4UIparameter("append",'b',true);
71  pp->SetDefaultValue(true);
73 
74  bufferCoutCmd = new G4UIcmdWithABool("/control/cout/useBuffer",this);
75  bufferCoutCmd->SetGuidance("Send cout and/or cerr stream to a buffer.");
76  bufferCoutCmd->SetGuidance("The buffered text will be printed at the end of the job");
77  bufferCoutCmd->SetGuidance("for each thread at a time, so that output of each thread is grouped.");
78  bufferCoutCmd->SetGuidance("This command has no effect if output goes to a file.");
79  bufferCoutCmd->SetParameterName("flag",true);
82 
83  prefixCmd = new G4UIcmdWithAString("/control/cout/prefixString",this);
84  prefixCmd->SetGuidance("Set the prefix string for each cout/cerr line from a thread.");
85  prefixCmd->SetParameterName("prefix",true);
86  prefixCmd->SetDefaultValue("G4WT");
88 
89  ignoreCmd = new G4UIcmdWithAnInteger("/control/cout/ignoreThreadsExcept",this);
90  ignoreCmd->SetGuidance("Omit cout from threads except the specified one.");
91  ignoreCmd->SetGuidance("This command takes effect only if cout destination is screen without buffering.");
92  ignoreCmd->SetGuidance("If specified thread ID is greater than the number of threads,");
93  ignoreCmd->SetGuidance("no cout is displayed from worker threads. -1 to reset.");
94  ignoreCmd->SetGuidance("This command does not affect to cerr.");
95  ignoreCmd->SetParameterName("threadID",true);
98 
99  ignoreInitCmd = new G4UIcmdWithABool("/control/cout/ignoreInitializationCout",this);
100  ignoreInitCmd->SetGuidance("Omit cout from threads during initialization, as they should be identical to the masther thread.");
101  ignoreInitCmd->SetGuidance("This command takes effect only if cout destination is screen without buffering.");
102  ignoreInitCmd->SetGuidance("This command does not affect to cerr.");
103  ignoreInitCmd->SetParameterName("IgnoreInit",true);
106 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *theDefaultValue)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
void SetDefaultValue(const char *defVal)
void SetDefaultValue(G4int defVal)
Here is the call graph for this function:

◆ ~G4LocalThreadCoutMessenger()

G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger ( )

Definition at line 108 of file G4LocalThreadCoutMessenger.cc.

109 {
110  delete coutFileNameCmd;
111  delete cerrFileNameCmd;
112  delete bufferCoutCmd;
113  delete prefixCmd;
114  delete ignoreCmd;
115  delete ignoreInitCmd;
116  delete coutDir;
117 }

Member Function Documentation

◆ SetNewValue()

void G4LocalThreadCoutMessenger::SetNewValue ( G4UIcommand command,
G4String  newVal 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 119 of file G4LocalThreadCoutMessenger.cc.

120 {
122  if(command == coutFileNameCmd)
123  {
124  G4Tokenizer next(newVal);
125  G4String fn = next();
126  G4bool af = StoB(next());
127  UI->SetCoutFileName(fn,af);
128  }
129  else if(command == cerrFileNameCmd)
130  {
131  G4Tokenizer next(newVal);
132  G4String fn = next();
133  G4bool af = StoB(next());
134  UI->SetCerrFileName(fn,af);
135  }
136  else if(command == bufferCoutCmd)
137  { UI->SetThreadUseBuffer(StoB(newVal)); }
138  else if(command == prefixCmd)
139  { UI->SetThreadPrefixString(newVal); }
140  else if(command == ignoreCmd)
141  { UI->SetThreadIgnore(StoI(newVal)); }
142  else if(command == ignoreInitCmd)
143  { UI->SetThreadIgnoreInit(StoB(newVal)); }
144 }
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:775
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:745
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:782
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:760
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4bool StoB(G4String s)
void SetThreadIgnoreInit(G4bool flg=true)
Definition: G4UImanager.cc:800
bool G4bool
Definition: G4Types.hh:79
G4int StoI(G4String s)
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:789
Here is the call graph for this function:

Member Data Documentation

◆ bufferCoutCmd

G4UIcmdWithABool* G4LocalThreadCoutMessenger::bufferCoutCmd
private

Definition at line 60 of file G4LocalThreadCoutMessenger.hh.

◆ cerrFileNameCmd

G4UIcommand* G4LocalThreadCoutMessenger::cerrFileNameCmd
private

Definition at line 59 of file G4LocalThreadCoutMessenger.hh.

◆ coutDir

G4UIdirectory* G4LocalThreadCoutMessenger::coutDir
private

Definition at line 57 of file G4LocalThreadCoutMessenger.hh.

◆ coutFileNameCmd

G4UIcommand* G4LocalThreadCoutMessenger::coutFileNameCmd
private

Definition at line 58 of file G4LocalThreadCoutMessenger.hh.

◆ ignoreCmd

G4UIcmdWithAnInteger* G4LocalThreadCoutMessenger::ignoreCmd
private

Definition at line 62 of file G4LocalThreadCoutMessenger.hh.

◆ ignoreInitCmd

G4UIcmdWithABool* G4LocalThreadCoutMessenger::ignoreInitCmd
private

Definition at line 63 of file G4LocalThreadCoutMessenger.hh.

◆ prefixCmd

G4UIcmdWithAString* G4LocalThreadCoutMessenger::prefixCmd
private

Definition at line 61 of file G4LocalThreadCoutMessenger.hh.


The documentation for this class was generated from the following files: