BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
GoofyMessenger.cpp
Go to the documentation of this file.
1#include "G4Svc/GoofyMessenger.h"
2#include "G4Svc/Goofy.h"
3
4#include "G4UIcommand.hh"
5#include "G4UImanager.hh"
6
7#include "FadsPackageLoader/PackageLoader.h"
8
10{
11 rm=v;
12
13 shell=new G4UIcommand("/shell",this);
14 shell->SetGuidance("Invokes a shell command");
15 G4UIparameter* parameter;
16 G4bool omitable;
17 parameter = new G4UIparameter ("Command", 's', omitable = false);
18 shell->SetParameter(parameter);
19
20 echo=new G4UIcommand("/echo",this);
21 echo->SetGuidance("Echoes a string");
22 echo->SetParameter(parameter);
23
24 edit=new G4UIcommand("/edit",this);
25 edit->SetGuidance("Invokes the chosen editor");
26 parameter = new G4UIparameter ("File to be edited", 's', omitable = false);
27 edit->SetParameter(parameter);
28
29 quit=new G4UIcommand("/quit",this);
30 quit->SetGuidance("quits the application");
31
32 load=new G4UIcommand("/load",this);
33 load->SetGuidance("Dynamically loads a shared library");
34 parameter = new G4UIparameter ("Library to be loaded", 's', omitable = false);
35 load->SetParameter(parameter);
36
37 unload=new G4UIcommand("/unload",this);
38 unload->SetGuidance("Drops a shared library");
39 parameter = new G4UIparameter ("Library to be dropped", 's', omitable = false);
40 unload->SetParameter(parameter);
41}
42
44{
45 delete shell;
46 delete echo;
47 delete edit;
48 delete load;
49 delete unload;
50 delete quit;
51}
52
53void GoofyMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
54{
55 if (command==shell)
56 {
57 std::string temp(newValues);
58 unsigned int i=temp.find_first_not_of ('"');
59 if (i != std::string::npos)
60 {
61 if (i>0) temp = temp.substr (i);
62 i = temp.find_last_not_of ('"');
63 if (i < temp.size ()) temp = temp.substr (0, i + 1);
64 }
65 i=Goofy::Shell(temp);
66 }
67 else if (command==echo)
68 {
69 std::string temp(newValues);
70 unsigned int i=temp.find_first_not_of ('"');
71 if (i != std::string::npos)
72 {
73 if (i>0) temp = temp.substr (i);
74 i = temp.find_last_not_of ('"');
75 if (i < temp.size ()) temp = temp.substr (0, i + 1);
76 }
77 i=Goofy::Shell("echo "+temp);
78 }
79 else if (command==quit)
80 {
81 G4UImanager *man=G4UImanager::GetUIpointer();
82 man->ApplyCommand("/exit");
83 }
84 else if (command==edit)
85 {
86 std::string s="$GOOFY_EDITOR "+newValues+" &";
88 }
89 else if (command==load)
90 {
91 PackageLoader a(newValues.c_str());
92 }
93 else if (command==unload)
94 {
95 bool test;
96 PackageLoader a;
97 test=a.unload(newValues);
98 }
99}
100
101G4String GoofyMessenger::GetCurrentValue(G4UIcommand * command)
102{
103 G4String s="Undefined";
104 return s;
105}
std::string test
Definition: CalibModel.cxx:43
XmlRpcServer s
Definition: HelloServer.cpp:11
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
GoofyMessenger(Goofy *v)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValues)
Definition: Goofy.h:13
static int Shell(std::string s)
Definition: Goofy.cpp:62
double precision pisqo6 parameter(pi=3.14159265358979d0, pisq=pi *pi, pisqo6=pisq/6d0) double precision zip