Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4LocalThreadCoutMessenger Class Reference

#include <G4LocalThreadCoutMessenger.hh>

Inheritance diagram for G4LocalThreadCoutMessenger:
G4UImessenger

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
 

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
 

Detailed Description

Definition at line 48 of file G4LocalThreadCoutMessenger.hh.

Constructor & Destructor Documentation

G4LocalThreadCoutMessenger::G4LocalThreadCoutMessenger ( )

Definition at line 43 of file G4LocalThreadCoutMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, G4State_PreInit, G4InuclParticleNames::pp, G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcmdWithAString::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), and G4UIcmdWithABool::SetParameterName().

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**");
56  coutFileNameCmd->SetParameter(pp);
57  pp= new G4UIparameter("append",'b',true);
58  pp->SetDefaultValue(true);
59  coutFileNameCmd->SetParameter(pp);
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**");
69  cerrFileNameCmd->SetParameter(pp);
70  pp= new G4UIparameter("append",'b',true);
71  pp->SetDefaultValue(true);
72  cerrFileNameCmd->SetParameter(pp);
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);
80  bufferCoutCmd->SetDefaultValue(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);
96  ignoreCmd->SetDefaultValue(0);
98 }
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:225
void SetDefaultValue(const char *defVal)
void SetDefaultValue(G4int defVal)
G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger ( )

Definition at line 100 of file G4LocalThreadCoutMessenger.cc.

101 {
102  delete coutFileNameCmd;
103  delete cerrFileNameCmd;
104  delete bufferCoutCmd;
105  delete prefixCmd;
106  delete ignoreCmd;
107  delete coutDir;
108 }

Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 110 of file G4LocalThreadCoutMessenger.cc.

References G4UImanager::GetUIpointer(), G4UImanager::SetCerrFileName(), G4UImanager::SetCoutFileName(), G4UImanager::SetThreadIgnore(), G4UImanager::SetThreadPrefixString(), G4UImanager::SetThreadUseBuffer(), G4UImessenger::StoB(), and G4UImessenger::StoI().

111 {
113  if(command == coutFileNameCmd)
114  {
115  G4Tokenizer next(newVal);
116  G4String fn = next();
117  G4bool af = StoB(next());
118  UI->SetCoutFileName(fn,af);
119  }
120  else if(command == cerrFileNameCmd)
121  {
122  G4Tokenizer next(newVal);
123  G4String fn = next();
124  G4bool af = StoB(next());
125  UI->SetCerrFileName(fn,af);
126  }
127  else if(command == bufferCoutCmd)
128  { UI->SetThreadUseBuffer(StoB(newVal)); }
129  else if(command == prefixCmd)
130  { UI->SetThreadPrefixString(newVal); }
131  else if(command == ignoreCmd)
132  { UI->SetThreadIgnore(StoI(newVal)); }
133 }
void SetThreadPrefixString(const G4String &s="W")
Definition: G4UImanager.cc:738
void SetCoutFileName(const G4String &fileN="G4cout.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:708
void SetThreadUseBuffer(G4bool flg=true)
Definition: G4UImanager.cc:745
void SetCerrFileName(const G4String &fileN="G4cerr.txt", G4bool ifAppend=true)
Definition: G4UImanager.cc:723
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4bool StoB(G4String s)
bool G4bool
Definition: G4Types.hh:79
G4int StoI(G4String s)
void SetThreadIgnore(G4int tid=0)
Definition: G4UImanager.cc:752

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