BOSS 8.0.0
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 rm = v;
11
12 shell = new G4UIcommand( "/shell", this );
13 shell->SetGuidance( "Invokes a shell command" );
14 G4UIparameter* parameter;
15 G4bool omitable;
16 parameter = new G4UIparameter( "Command", 's', omitable = false );
17 shell->SetParameter( parameter );
18
19 echo = new G4UIcommand( "/echo", this );
20 echo->SetGuidance( "Echoes a string" );
21 echo->SetParameter( parameter );
22
23 edit = new G4UIcommand( "/edit", this );
24 edit->SetGuidance( "Invokes the chosen editor" );
25 parameter = new G4UIparameter( "File to be edited", 's', omitable = false );
26 edit->SetParameter( parameter );
27
28 quit = new G4UIcommand( "/quit", this );
29 quit->SetGuidance( "quits the application" );
30
31 load = new G4UIcommand( "/load", this );
32 load->SetGuidance( "Dynamically loads a shared library" );
33 parameter = new G4UIparameter( "Library to be loaded", 's', omitable = false );
34 load->SetParameter( parameter );
35
36 unload = new G4UIcommand( "/unload", this );
37 unload->SetGuidance( "Drops a shared library" );
38 parameter = new G4UIparameter( "Library to be dropped", 's', omitable = false );
39 unload->SetParameter( parameter );
40}
41
43 delete shell;
44 delete echo;
45 delete edit;
46 delete load;
47 delete unload;
48 delete quit;
49}
50
51void GoofyMessenger::SetNewValue( G4UIcommand* command, G4String newValues ) {
52 if ( command == shell )
53 {
54 std::string temp( newValues );
55 unsigned int i = temp.find_first_not_of( '"' );
56 if ( i != std::string::npos )
57 {
58 if ( i > 0 ) temp = temp.substr( i );
59 i = temp.find_last_not_of( '"' );
60 if ( i < temp.size() ) temp = temp.substr( 0, i + 1 );
61 }
62 i = Goofy::Shell( temp );
63 }
64 else if ( command == echo )
65 {
66 std::string temp( newValues );
67 unsigned int i = temp.find_first_not_of( '"' );
68 if ( i != std::string::npos )
69 {
70 if ( i > 0 ) temp = temp.substr( i );
71 i = temp.find_last_not_of( '"' );
72 if ( i < temp.size() ) temp = temp.substr( 0, i + 1 );
73 }
74 i = Goofy::Shell( "echo " + temp );
75 }
76 else if ( command == quit )
77 {
78 G4UImanager* man = G4UImanager::GetUIpointer();
79 man->ApplyCommand( "/exit" );
80 }
81 else if ( command == edit )
82 {
83 std::string s = "$GOOFY_EDITOR " + newValues + " &";
84 Goofy::Shell( s );
85 }
86 else if ( command == load ) { PackageLoader a( newValues.c_str() ); }
87 else if ( command == unload )
88 {
89 bool test;
90 PackageLoader a;
91 test = a.unload( newValues );
92 }
93}
94
95G4String GoofyMessenger::GetCurrentValue( G4UIcommand* command ) {
96 G4String s = "Undefined";
97 return s;
98}
std::string test
XmlRpcServer s
**********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:58