ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4UIGainServer.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4UIGainServer.hh
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
//
28
29
30
#ifndef G4UIGainServer_h
31
#define G4UIGainServer_h 1
32
33
#ifndef WIN32
34
35
#include <stdio.h>
36
#include <sys/types.h>
37
#include <sys/socket.h>
38
//#include <sys/un.h>
39
#include <netinet/in.h>
40
#include <unistd.h>
41
42
#include <iostream>
43
#include <fstream>
44
#include "
globals.hh
"
45
#include "
G4UImanager.hh
"
46
#include "
G4VBasicShell.hh
"
47
48
#define SOCK_NAME "/tmp/socket"
49
#define DEFAULT_PORT 40000;
50
51
enum
UImode
{
terminal_mode
,
java_mode
,
tcl_mode
};
52
enum
ChangeOfTree
{
notChanged
=0,
added
,
deleted
,
addedAndDeleted
};
53
54
// class description:
55
//
56
// This class is similar to G4UIGAG.
57
// While G4UIGAG provides direct connection to GAG via pipe,
58
// G4UIGainServer provides socket connection to remote Gain client.
59
// Gain = Geant4 adaptive interface for network
60
// Its usage is same as G4UIGAG, except that Geant4 application waits
61
// a connection from a Gain client.
62
63
class
G4UIGainServer
:
public
G4VBasicShell
{
64
private
:
65
G4String
prefix
;
66
G4String
promptCharacter
;
67
G4UImanager
*
UI
;
68
UImode
uiMode
;
69
G4String
JVersion
;
70
G4String
TVersion
;
71
72
// shell
73
// G4VUIshell* shell;
74
75
// program states
76
G4bool
iExit
;
77
G4bool
iCont
;
78
79
// need for socket
80
int
socketD
[3];
81
int
port
;
82
struct
sockaddr_in
saddr
;
83
struct
sockaddr_in
caddr
;
84
int
len
;
85
int
ret
;
86
char
buf
[1024];
87
88
// --- the following are used by Notify*Update() and *Updated()
89
void
GetNewTreeStructure
(
G4UIcommandTree
*,
int
recursiveLevel);
90
void
GetNewTreeValues
(
G4UIcommandTree
*,
int
recursiveLevel);
91
92
std::vector<G4String>
previousTreeCommands
;
93
std::vector<G4String>
newTreeCommands
;
94
std::vector<G4String>
previousTreeParams
;
95
std::vector<G4String>
newTreeParams
;
96
std::vector<G4UIcommand*>
previousTreePCP
;
97
std::vector<G4UIcommand*>
newTreePCP
;
98
99
public
:
100
// These methods are implementation of corresponding virtual methods
101
// of G4UIsession class.
102
103
// A GainServer session "gainSession" is instantiated.
104
// G4cout stream is redirected by default to the constructed instance.
105
// Usage: G4UIsession * gainSession = new G4UIGainServer();
106
// "gainSession" is started.
107
// Usage: gainSession->SessionStart();
108
// "gainSession" is deleted.
109
// Usage: delete gainSession;
110
//
111
112
G4UIsession
*
SessionStart
();
113
virtual
void
PauseSessionStart
(
const
G4String
& msg);
114
virtual
G4int
ReceiveG4cout
(
const
G4String
& coutString);
115
virtual
G4int
ReceiveG4cerr
(
const
G4String
& cerrString);
116
117
public
:
118
// G4UIGainServer(G4VUIshell* aShell=0);
119
G4UIGainServer
();
120
//G4UIGainServer(void){}
121
~G4UIGainServer
();
122
//~G4UIGainServer(void){}
123
124
// void SetPrompt(const G4String& prompt);
125
void
SessionTerminate
();
126
void
Prompt
(
G4String
);
127
G4String
GetCommand
();
128
129
private
:
130
virtual
void
ExecuteCommand
(
const
G4String
& aCommand);
131
virtual
G4bool
GetHelpChoice
(
G4int
& aInt);
132
virtual
void
ExitHelp
()
const
;
133
bool
SetUPServer
();
134
void
WaitingConnection
();
135
void
CloseConnection
();
136
137
void
ChangeDirectory
(
G4String
);
138
void
ListDirectory
(
G4String
);
139
void
TerminalHelp
(
G4String
);
140
G4String
ModifyPrefix
(
G4String
);
141
G4UIcommandTree
*
FindDirPath
(
G4String
);
142
void
ShowCurrent
(
G4String
);
143
G4String
GetFullPath
(
G4String
);
144
145
void
SendCommandProperties
(
G4UIcommandTree
*);
146
void
SendParameterProperties
(
G4UIcommandTree
*);
147
void
SendAParamProperty
(
G4UIcommand
*);
148
void
SendATclParamProperty
(
G4UIcommand
*);
149
void
CodeGenJavaTree
(
G4UIcommandTree
*,
int
recursiveLevel);
150
void
CodeGenJavaParams
(
G4UIcommandTree
*,
int
recursiveLevel);
151
void
CodeGenTclTree
(
G4UIcommandTree
*,
int
recursiveLevel);
152
void
CodeGenTclParams
(
G4UIcommandTree
*,
int
recursiveLevel);
153
void
SendDisableList
(
G4UIcommandTree
*,
int
recursiveLevel);
154
155
void
NotifyStateChange
(
void
);
156
void
NotifyCommandUpdate
(
void
);
157
void
NotifyParameterUpdate
(
G4UIcommand
*);
158
159
int
CommandUpdated
(
void
);
160
void
UpdateState
(
void
);
161
void
UpdateParamVal
(
void
);
// if param is updated,
162
// call NotifyParameterUpdate()
163
164
165
};
166
167
#endif
168
169
#endif
170
171
geant4
tree
geant4-10.6-release
source
interfaces
GAG
include
G4UIGainServer.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:22
using
1.8.2 with
ECCE GitHub integration