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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /intercoms/src/G4LocalThreadCoutMessenger.cc (Version 11.3.0) and /intercoms/src/G4LocalThreadCoutMessenger.cc (Version 10.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4LocalThreadCoutMessenger                  << 
 27 //                                                 26 //
 28 // Author: M.Asai, 2013                        <<  27 // $Id: G4LocalThreadCoutMessenger.cc 66241 2012-12-13 18:34:42Z gunter $
 29 // ------------------------------------------- <<  28 //
                                                   >>  29 // 
 30                                                    30 
 31 #include "G4LocalThreadCoutMessenger.hh"           31 #include "G4LocalThreadCoutMessenger.hh"
 32                                                    32 
 33 #include "G4Tokenizer.hh"                      <<  33 #include "G4UImanager.hh"
                                                   >>  34 
                                                   >>  35 #include "G4UIdirectory.hh"
                                                   >>  36 #include "G4UIcommand.hh"
 34 #include "G4UIcmdWithABool.hh"                     37 #include "G4UIcmdWithABool.hh"
 35 #include "G4UIcmdWithAString.hh"                   38 #include "G4UIcmdWithAString.hh"
 36 #include "G4UIcmdWithAnInteger.hh"                 39 #include "G4UIcmdWithAnInteger.hh"
 37 #include "G4UIcommand.hh"                      << 
 38 #include "G4UIdirectory.hh"                    << 
 39 #include "G4UImanager.hh"                      << 
 40 #include "G4UIparameter.hh"                        40 #include "G4UIparameter.hh"
                                                   >>  41 #include "G4Tokenizer.hh"
 41                                                    42 
 42 // ------------------------------------------- << 
 43 G4LocalThreadCoutMessenger::G4LocalThreadCoutM     43 G4LocalThreadCoutMessenger::G4LocalThreadCoutMessenger()
 44 {                                              <<  44 { 
 45   coutDir = new G4UIdirectory("/control/cout/"     45   coutDir = new G4UIdirectory("/control/cout/");
 46   coutDir->SetGuidance("Control cout/cerr for      46   coutDir->SetGuidance("Control cout/cerr for local thread.");
 47                                                    47 
 48   coutFileNameCmd = new G4UIcommand("/control/ <<  48   coutFileNameCmd = new G4UIcommand("/control/cout/setCoutFile",this);
 49   coutFileNameCmd->SetGuidance("Send G4cout st     49   coutFileNameCmd->SetGuidance("Send G4cout stream to a file dedicated to a thread. ");
 50   coutFileNameCmd->SetGuidance("To have a disp     50   coutFileNameCmd->SetGuidance("To have a display output, use special keyword \"**Screen**\".");
 51   coutFileNameCmd->SetGuidance("If append flag     51   coutFileNameCmd->SetGuidance("If append flag is true output is appended to file,");
 52   coutFileNameCmd->SetGuidance("otherwise file     52   coutFileNameCmd->SetGuidance("otherwise file output is overwritten.");
 53   coutFileNameCmd->AvailableForStates(G4State_ <<  53   coutFileNameCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 54   auto* pp = new G4UIparameter("fileName", 's' <<  54   G4UIparameter* pp = new G4UIparameter("fileName",'s',true);
 55   pp->SetDefaultValue("**Screen**");               55   pp->SetDefaultValue("**Screen**");
 56   coutFileNameCmd->SetParameter(pp);               56   coutFileNameCmd->SetParameter(pp);
 57   pp = new G4UIparameter("append", 'b', true); <<  57   pp= new G4UIparameter("append",'b',true);
 58   pp->SetDefaultValue(1);                      <<  58   pp->SetDefaultValue(true);
 59   coutFileNameCmd->SetParameter(pp);               59   coutFileNameCmd->SetParameter(pp);
 60                                                    60 
 61   cerrFileNameCmd = new G4UIcommand("/control/ <<  61   cerrFileNameCmd = new G4UIcommand("/control/cout/setCerrFile",this);
 62   cerrFileNameCmd->SetGuidance("Send G4cerr st     62   cerrFileNameCmd->SetGuidance("Send G4cerr stream to a file dedicated to a thread. ");
 63   cerrFileNameCmd->SetGuidance("To have a disp     63   cerrFileNameCmd->SetGuidance("To have a display output, use special keyword \"**Screen**\".");
 64   cerrFileNameCmd->SetGuidance("If append flag     64   cerrFileNameCmd->SetGuidance("If append flag is true output is appended to file,");
 65   cerrFileNameCmd->SetGuidance("otherwise file     65   cerrFileNameCmd->SetGuidance("otherwise file output is overwritten.");
 66   cerrFileNameCmd->AvailableForStates(G4State_ <<  66   cerrFileNameCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 67   pp = new G4UIparameter("fileName", 's', true <<  67   pp = new G4UIparameter("fileName",'s',true);
 68   pp->SetDefaultValue("**Screen**");               68   pp->SetDefaultValue("**Screen**");
 69   cerrFileNameCmd->SetParameter(pp);               69   cerrFileNameCmd->SetParameter(pp);
 70   pp = new G4UIparameter("append", 'b', true); <<  70   pp= new G4UIparameter("append",'b',true);
 71   pp->SetDefaultValue(1);                      <<  71   pp->SetDefaultValue(true);
 72   cerrFileNameCmd->SetParameter(pp);               72   cerrFileNameCmd->SetParameter(pp);
 73                                                    73 
 74   bufferCoutCmd = new G4UIcmdWithABool("/contr <<  74   bufferCoutCmd = new G4UIcmdWithABool("/control/cout/useBuffer",this);
 75   bufferCoutCmd->SetGuidance("Send cout and/or     75   bufferCoutCmd->SetGuidance("Send cout and/or cerr stream to a buffer.");
 76   bufferCoutCmd->SetGuidance("The buffered tex     76   bufferCoutCmd->SetGuidance("The buffered text will be printed at the end of the job");
 77   bufferCoutCmd->SetGuidance(                  <<  77   bufferCoutCmd->SetGuidance("for each thread at a time, so that output of each thread is grouped.");
 78     "for each thread at a time, so that output << 
 79   bufferCoutCmd->SetGuidance("This command has     78   bufferCoutCmd->SetGuidance("This command has no effect if output goes to a file.");
 80   bufferCoutCmd->SetParameterName("flag", true <<  79   bufferCoutCmd->SetParameterName("flag",true);
 81   bufferCoutCmd->SetDefaultValue(true);            80   bufferCoutCmd->SetDefaultValue(true);
 82   bufferCoutCmd->AvailableForStates(G4State_Pr <<  81   bufferCoutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 83                                                    82 
 84   prefixCmd = new G4UIcmdWithAString("/control <<  83   prefixCmd = new G4UIcmdWithAString("/control/cout/prefixString",this);
 85   prefixCmd->SetGuidance("Set the prefix strin     84   prefixCmd->SetGuidance("Set the prefix string for each cout/cerr line from a thread.");
 86   prefixCmd->SetParameterName("prefix", true); <<  85   prefixCmd->SetParameterName("prefix",true);
 87   prefixCmd->SetDefaultValue("G4WT");              86   prefixCmd->SetDefaultValue("G4WT");
 88   prefixCmd->AvailableForStates(G4State_PreIni <<  87   prefixCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 89                                                    88 
 90   ignoreCmd = new G4UIcmdWithAnInteger("/contr <<  89   ignoreCmd = new G4UIcmdWithAnInteger("/control/cout/ignoreThreadsExcept",this);
 91   ignoreCmd->SetGuidance("Omit cout from threa     90   ignoreCmd->SetGuidance("Omit cout from threads except the specified one.");
 92   ignoreCmd->SetGuidance(                      <<  91   ignoreCmd->SetGuidance("This command takes effect only if cout destination is screen without buffering.");
 93     "This command takes effect only if cout de << 
 94     "is screen without buffering.");           << 
 95   ignoreCmd->SetGuidance("If specified thread      92   ignoreCmd->SetGuidance("If specified thread ID is greater than the number of threads,");
 96   ignoreCmd->SetGuidance("no cout is displayed     93   ignoreCmd->SetGuidance("no cout is displayed from worker threads. -1 to reset.");
 97   ignoreCmd->SetGuidance("This command does no     94   ignoreCmd->SetGuidance("This command does not affect to cerr.");
 98   ignoreCmd->SetParameterName("threadID", true <<  95   ignoreCmd->SetParameterName("threadID",true);
 99   ignoreCmd->SetDefaultValue(0);                   96   ignoreCmd->SetDefaultValue(0);
100   ignoreCmd->AvailableForStates(G4State_PreIni <<  97   ignoreCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
101                                                    98 
102   ignoreInitCmd = new G4UIcmdWithABool("/contr <<  99   ignoreInitCmd = new G4UIcmdWithABool("/control/cout/ignoreInitializationCout",this);
103   ignoreInitCmd->SetGuidance(                  << 100   ignoreInitCmd->SetGuidance("Omit cout from threads during initialization, as they should be identical to the masther thread.");
104     "Omit cout from threads during initializat << 101   ignoreInitCmd->SetGuidance("This command takes effect only if cout destination is screen without buffering.");
105     "they should be identical to the master th << 
106   ignoreInitCmd->SetGuidance(                  << 
107     "This command takes effect only if cout "  << 
108     "destination is screen without buffering." << 
109   ignoreInitCmd->SetGuidance("This command doe    102   ignoreInitCmd->SetGuidance("This command does not affect to cerr.");
110   ignoreInitCmd->SetParameterName("IgnoreInit" << 103   ignoreInitCmd->SetParameterName("IgnoreInit",true);
111   ignoreInitCmd->SetDefaultValue(true);           104   ignoreInitCmd->SetDefaultValue(true);
112   ignoreInitCmd->AvailableForStates(G4State_Pr << 105   ignoreInitCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
113 }                                                 106 }
114                                                   107 
115 // ------------------------------------------- << 
116 G4LocalThreadCoutMessenger::~G4LocalThreadCout    108 G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger()
117 {                                                 109 {
118   delete coutFileNameCmd;                         110   delete coutFileNameCmd;
119   delete cerrFileNameCmd;                         111   delete cerrFileNameCmd;
120   delete bufferCoutCmd;                           112   delete bufferCoutCmd;
121   delete prefixCmd;                               113   delete prefixCmd;
122   delete ignoreCmd;                               114   delete ignoreCmd;
123   delete ignoreInitCmd;                           115   delete ignoreInitCmd;
124   delete coutDir;                                 116   delete coutDir;
125 }                                                 117 }
126                                                   118 
127 // ------------------------------------------- << 119 void G4LocalThreadCoutMessenger::SetNewValue(G4UIcommand* command,G4String newVal)
128 void G4LocalThreadCoutMessenger::SetNewValue(G << 120 {  
129 {                                              << 121   G4UImanager * UI = G4UImanager::GetUIpointer();
130   G4UImanager* UI = G4UImanager::GetUIpointer( << 122   if(command == coutFileNameCmd)
131   if (command == coutFileNameCmd) {            << 123   {
132     G4Tokenizer next(newVal);                     124     G4Tokenizer next(newVal);
133     G4String fn = next();                         125     G4String fn = next();
134     G4bool af = StoB(next());                     126     G4bool af = StoB(next());
135     UI->SetCoutFileName(fn, af);               << 127     UI->SetCoutFileName(fn,af);
136   }                                               128   }
137   else if (command == cerrFileNameCmd) {       << 129   else if(command == cerrFileNameCmd)
                                                   >> 130   {
138     G4Tokenizer next(newVal);                     131     G4Tokenizer next(newVal);
139     G4String fn = next();                         132     G4String fn = next();
140     G4bool af = StoB(next());                     133     G4bool af = StoB(next());
141     UI->SetCerrFileName(fn, af);               << 134     UI->SetCerrFileName(fn,af);
142   }                                            << 
143   else if (command == bufferCoutCmd) {         << 
144     UI->SetThreadUseBuffer(StoB(newVal));      << 
145   }                                            << 
146   else if (command == prefixCmd) {             << 
147     UI->SetThreadPrefixString(newVal);         << 
148   }                                            << 
149   else if (command == ignoreCmd) {             << 
150     UI->SetThreadIgnore(StoI(newVal));         << 
151   }                                            << 
152   else if (command == ignoreInitCmd) {         << 
153     UI->SetThreadIgnoreInit(StoB(newVal));     << 
154   }                                               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)); }
155 }                                                 144 }
                                                   >> 145 
156                                                   146