#include <G4UIGainServer.hh>
Definition at line 64 of file G4UIGainServer.hh.
◆ G4UIGainServer()
G4UIGainServer::G4UIGainServer |
( |
| ) |
|
Definition at line 43 of file G4UIGainServer.cc.
57 UI-> SetSession(
this);
58 UI-> SetCoutDestination(
this);
std::vector< G4UIcommand * > newTreePCP
std::vector< G4String > previousTreeCommands
G4String GetStateString(G4ApplicationState aState) const
static G4UImanager * GetUIpointer()
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
static G4StateManager * GetStateManager()
std::vector< G4UIcommand * > previousTreePCP
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree() const
std::vector< G4String > previousTreeParams
std::vector< G4String > newTreeCommands
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
std::vector< G4String > newTreeParams
G4ApplicationState GetCurrentState() const
◆ ~G4UIGainServer()
G4UIGainServer::~G4UIGainServer |
( |
| ) |
|
Definition at line 77 of file G4UIGainServer.cc.
82 UI-> SetSession(NULL);
83 UI-> SetCoutDestination(NULL);
void SetSession(G4UIsession *const value)
static G4UImanager * GetUIpointer()
void SetCoutDestination(G4UIsession *const value)
◆ ChangeDirectory()
void G4UIGainServer::ChangeDirectory |
( |
G4String |
newCommand | ) |
|
|
private |
Definition at line 476 of file G4UIGainServer.cc.
479 if( newCommand.length() <= 3 )
483 G4String aNewPrefix = newCommand(3,newCommand.length()-3);
485 if( newPrefix(0) ==
'/' )
487 else if( newPrefix(0) !=
'.' )
G4UIcommandTree * FindDirPath(G4String)
G4String strip(G4int strip_Type=trailing, char c=' ')
G4GLOB_DLL std::ostream G4cout
G4String ModifyPrefix(G4String)
◆ CloseConnection()
void G4UIGainServer::CloseConnection |
( |
| ) |
|
|
private |
◆ CodeGenJavaParams()
void G4UIGainServer::CodeGenJavaParams |
( |
G4UIcommandTree * |
tree, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
Definition at line 690 of file G4UIGainServer.cc.
692 int treeEntry,commandEntry,i;
698 for(i=0;i<commandEntry; i++){
701 if(treeEntry ==0)
return;
703 for(i=0;i<treeEntry; i++){
G4UIcommand * GetCommand(G4int i)
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
const G4String GetPathName() const
G4int GetCommandEntry() const
void SendAParamProperty(G4UIcommand *)
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
G4int GetTreeEntry() const
const G4String GetTitle() const
◆ CodeGenJavaTree()
void G4UIGainServer::CodeGenJavaTree |
( |
G4UIcommandTree * |
tree, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
Definition at line 671 of file G4UIGainServer.cc.
673 int treeEntry, commandEntry;
678 for(
int i=0; i<commandEntry; i++){
682 if(treeEntry == 0)
return;
684 for(
int j=0; j<treeEntry; j++){
void CodeGenJavaTree(G4UIcommandTree *, int recursiveLevel)
G4UIcommand * GetCommand(G4int i)
G4int GetCommandEntry() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
const G4String & GetCommandPath() const
G4int GetTreeEntry() const
◆ CodeGenTclParams()
void G4UIGainServer::CodeGenTclParams |
( |
G4UIcommandTree * |
, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
◆ CodeGenTclTree()
void G4UIGainServer::CodeGenTclTree |
( |
G4UIcommandTree * |
, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
◆ CommandUpdated()
int G4UIGainServer::CommandUpdated |
( |
void |
| ) |
|
|
private |
Definition at line 827 of file G4UIGainServer.cc.
833 for( i=0; i<pEntry; i++) {
834 for( j=0; j<nEntry; j++) {
842 for( i=0; i<nEntry; i++) {
843 for( j=0; j<pEntry; j++) {
std::vector< G4String > previousTreeCommands
G4GLOB_DLL std::ostream G4cout
std::vector< G4String > newTreeCommands
◆ ExecuteCommand()
void G4UIGainServer::ExecuteCommand |
( |
const G4String & |
aCommand | ) |
|
|
privatevirtual |
Reimplemented from G4VBasicShell.
Definition at line 131 of file G4UIGainServer.cc.
134 if(aCommand.length()<2)
return;
137 if(aCommand.length()<2)
return;
139 G4int paramIndex = returnVal % 100;
142 G4int commandStatus = returnVal - paramIndex;
147 switch(commandStatus) {
164 G4cerr <<
"@@ErrResult \"illegal application state -- command refused.\"" <<
G4endl;
167 G4cout <<
"@@ErrResult \"Parameter Out of Range.\"" <<
G4endl;
170 G4cout <<
"@@ErrResult \"Parameter is wrong type and/or is not omittable.\""<<
G4endl;
173 G4cerr <<
"@@ErrResult \"Parameter is out of candidate.\"" <<
G4endl;
177 G4cerr <<
"command refused (" << commandStatus <<
")" <<
G4endl;
std::vector< G4UIcommand * > newTreePCP
std::vector< G4String > previousTreeCommands
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
std::vector< G4UIcommand * > previousTreePCP
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree() const
std::vector< G4String > previousTreeParams
std::vector< G4String > newTreeCommands
G4String SolveAlias(const char *aCmd)
void NotifyCommandUpdate(void)
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
std::vector< G4String > newTreeParams
void UpdateParamVal(void)
G4int ApplyCommand(const char *aCommand)
G4GLOB_DLL std::ostream G4cerr
◆ ExitHelp()
void G4UIGainServer::ExitHelp |
( |
| ) |
const |
|
privatevirtual |
◆ FindDirPath()
Definition at line 626 of file G4UIGainServer.cc.
630 while( idx < newCommand.length()-1 )
632 int i = newCommand.
index(
"/",idx);
634 if( comTree == NULL )
str_size index(const char *, G4int pos=0) const
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * GetTree() const
◆ GetCommand()
Definition at line 183 of file G4UIGainServer.cc.
213 if (!
G4cin.good()) {
G4cin.clear(); newCommand = nullString;
iExit=
false;
break;}
216 if( newCommand.length() < 1) {
break; }
218 while( newCommand(newCommand.length()-1) ==
'_' )
221 newCommand.
remove(newCommand.length()-1);
223 if (!
G4cin.good()) {
G4cin.clear(); newCommand = nullString;
iExit=
false;
break;}
224 newCommand.
append(newLine);
228 if( nC.length() < 1) {
break; }
231 if( nC ==
"@@GainmodeJAVA" ) {
237 else if( nC ==
"@@GainmodeTcl" ) {
243 else if( nC(0) ==
'#' )
246 else if( nC ==
"ls" || nC(0,3) ==
"ls " )
248 else if( nC ==
"pwd" )
250 else if( nC(0,2) ==
"cd" || nC(0,3) ==
"cd " )
252 else if( nC ==
"help" || nC(0,5) ==
"help ")
254 else if( nC(0) ==
'?' )
256 else if( nC(0,4) ==
"hist" || nC ==
"history")
259 for(
int i=0;i<nh;i++)
262 else if( nC(0) ==
'!' )
267 std::istringstream is((
char*)tt);
277 {
G4cerr <<
"history " << vl <<
" is not found." <<
G4endl; }
279 else if( nC(0,4) ==
"exit" )
285 G4cerr <<
"Please abrot it using \"/run/abort\" command first" <<
G4endl;
286 G4cerr <<
" and use \"continue\" command until the application" <<
G4endl;
289 G4cout <<
"@@ErrResult \"You are now processing RUN.\"" <<
G4endl;
297 newCommand = nullString;
301 else if( nC ==
"cont" || nC ==
"continue" )
304 newCommand = nullString;
G4String & remove(str_size)
void TerminalHelp(G4String)
G4String strip(G4int strip_Type=trailing, char c=' ')
std::istream & readLine(std::istream &, G4bool skipWhite=true)
G4GLOB_DLL std::ostream G4cout
void SendCommandProperties(G4UIcommandTree *)
G4UIcommandTree * GetTree() const
void ShowCurrent(G4String)
G4int GetNumberOfHistory() const
G4String & append(const G4String &)
G4String GetFullPath(G4String)
void NotifyStateChange(void)
G4String GetPreviousCommand(G4int i) const
void ChangeDirectory(G4String)
G4GLOB_DLL std::ostream G4cerr
void ListDirectory(G4String)
◆ GetFullPath()
Definition at line 418 of file G4UIGainServer.cc.
422 if( newCommand(0) ==
'/' )
423 { tmpString = newCommand; }
424 else if( newCommand(0,3) ==
"../" )
427 unsigned i_direc = 0;
428 while( i_direc < newCommand.length() )
430 if( newCommand(i_direc,3) ==
"../" )
439 tmpString.
append( newCommand( i_direc, newCommand.length()-i_direc ) );
445 tmpString.
append( newCommand );
G4String strip(G4int strip_Type=trailing, char c=' ')
G4String ModifyPrefix(G4String)
G4String & append(const G4String &)
◆ GetHelpChoice()
◆ GetNewTreeStructure()
void G4UIGainServer::GetNewTreeStructure |
( |
G4UIcommandTree * |
tree, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
Definition at line 858 of file G4UIGainServer.cc.
868 for(
int com=0; com<commandEntry; com++){
874 if(treeEntry == 0)
return;
876 for(
int i=0; i< treeEntry; i++){
G4UIcommand * GetCommand(G4int i)
const G4String GetTitle() const
const G4String GetPathName() const
G4int GetCommandEntry() const
void GetNewTreeStructure(G4UIcommandTree *, int recursiveLevel)
G4UIcommandTree * GetTree(G4int i)
std::vector< G4String > newTreeCommands
const G4String & GetCommandPath() const
G4int GetTreeEntry() const
const G4String GetTitle() const
◆ GetNewTreeValues()
void G4UIGainServer::GetNewTreeValues |
( |
G4UIcommandTree * |
tree, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
Definition at line 907 of file G4UIGainServer.cc.
920 for(
int com=0; com<commandEntry; com++) {
924 param = commandPath +
" ";
925 for(
int par=0; par< parameterEntry; par++) {
937 if( treeEntry == 0 )
return;
938 for(
int i=0; i< treeEntry; i++) {
std::vector< G4UIcommand * > newTreePCP
G4String GetDefaultValue() const
G4String GetParameterRange() const
G4UIcommand * GetCommand(G4int i)
char GetParameterType() const
G4UIparameter * GetParameter(G4int i) const
G4int GetCommandEntry() const
G4UIcommandTree * GetTree(G4int i)
G4String GetParameterName() const
G4String GetParameterCandidates() const
const G4String & GetCommandPath() const
G4int GetParameterEntries() const
void GetNewTreeValues(G4UIcommandTree *, int recursiveLevel)
std::vector< G4String > newTreeParams
G4int GetTreeEntry() const
◆ ListDirectory()
void G4UIGainServer::ListDirectory |
( |
G4String |
newCommand | ) |
|
|
private |
Definition at line 503 of file G4UIGainServer.cc.
506 if( newCommand.length() <= 3 )
510 G4String newPrefix = newCommand(3,newCommand.length()-3);
512 if( newPrefix(0) ==
'/' )
513 { targetDir = newPrefix; }
514 else if( newPrefix(0) !=
'.' )
517 targetDir += newPrefix;
522 if( targetDir( targetDir.length() - 1 ) !=
'/' )
523 { targetDir +=
"/"; }
525 if( commandTree == NULL )
526 {
G4cout <<
"Directory <" << targetDir <<
"> is not found." <<
G4endl; }
G4UIcommandTree * FindDirPath(G4String)
G4String strip(G4int strip_Type=trailing, char c=' ')
G4GLOB_DLL std::ostream G4cout
G4String ModifyPrefix(G4String)
◆ ModifyPrefix()
Definition at line 603 of file G4UIGainServer.cc.
607 if(newCommand(0,2) ==
".."){
609 G4String tmpString = newPrefix(0,newPrefix.length()-1);
610 newPrefix = newPrefix(0,tmpString.
last(
'/')+1);
614 newPrefix += newCommand;
617 if(newCommand ==
".." || newCommand ==
"../"){
620 newCommand=newCommand(3,newCommand.length()-3);
◆ NotifyCommandUpdate()
void G4UIGainServer::NotifyCommandUpdate |
( |
void |
| ) |
|
|
private |
Definition at line 812 of file G4UIGainServer.cc.
void SendCommandProperties(G4UIcommandTree *)
G4UIcommandTree * GetTree() const
◆ NotifyParameterUpdate()
void G4UIGainServer::NotifyParameterUpdate |
( |
G4UIcommand * |
com | ) |
|
|
private |
◆ NotifyStateChange()
void G4UIGainServer::NotifyStateChange |
( |
void |
| ) |
|
|
private |
Definition at line 796 of file G4UIGainServer.cc.
804 G4cout <<
"@@State \"" << stateString <<
"\"" <<
G4endl;
G4String GetStateString(G4ApplicationState aState) const
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree() const
G4ApplicationState GetCurrentState() const
void SendDisableList(G4UIcommandTree *, int recursiveLevel)
◆ PauseSessionStart()
void G4UIGainServer::PauseSessionStart |
( |
const G4String & |
msg | ) |
|
|
virtual |
Implements G4VBasicShell.
Definition at line 113 of file G4UIGainServer.cc.
125 strcpy(
buf,
"nowIdle");
virtual void ExecuteCommand(const G4String &aCommand)
G4GLOB_DLL std::ostream G4cout
◆ Prompt()
void G4UIGainServer::Prompt |
( |
G4String |
| ) |
|
◆ ReceiveG4cerr()
G4int G4UIGainServer::ReceiveG4cerr |
( |
const G4String & |
cerrString | ) |
|
|
virtual |
◆ ReceiveG4cout()
G4int G4UIGainServer::ReceiveG4cout |
( |
const G4String & |
coutString | ) |
|
|
virtual |
◆ SendAParamProperty()
void G4UIGainServer::SendAParamProperty |
( |
G4UIcommand * |
Comp | ) |
|
|
private |
Definition at line 713 of file G4UIGainServer.cc.
715 int guidanceEntry, parameterEntry;
724 for (
int j=0; j<guidanceEntry; j++){
728 for(
int i=0; i< (int)title.length(); i++){
731 if ( c[0] ==
'\n' || c[0] ==
'\r') {
741 for(
int par=0; par<parameterEntry; par++) {
G4int GetGuidanceEntries() const
G4String GetDefaultValue() const
G4String GetParameterRange() const
const G4String GetParameterGuidance() const
const G4String & GetGuidanceLine(G4int i) const
G4bool IsOmittable() const
char GetParameterType() const
G4UIparameter * GetParameter(G4int i) const
G4GLOB_DLL std::ostream G4cout
const G4String & GetRange() const
G4String GetParameterName() const
G4String GetParameterCandidates() const
G4String & append(const G4String &)
const G4String & GetCommandPath() const
G4int GetParameterEntries() const
◆ SendATclParamProperty()
void G4UIGainServer::SendATclParamProperty |
( |
G4UIcommand * |
| ) |
|
|
private |
◆ SendCommandProperties()
Definition at line 644 of file G4UIGainServer.cc.
void CodeGenJavaTree(G4UIcommandTree *, int recursiveLevel)
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
G4GLOB_DLL std::ostream G4cout
G4GLOB_DLL std::ostream G4cerr
◆ SendDisableList()
void G4UIGainServer::SendDisableList |
( |
G4UIcommandTree * |
tree, |
|
|
int |
recursiveLevel |
|
) |
| |
|
private |
Definition at line 755 of file G4UIGainServer.cc.
757 int treeEntry, commandEntry;
762 for(
int com=0; com<commandEntry; com++) {
768 if( treeEntry == 0 )
return;
770 for(
int i=0; i<treeEntry; i++) {
G4UIcommand * GetCommand(G4int i)
G4int GetCommandEntry() const
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
const G4String & GetCommandPath() const
G4int GetTreeEntry() const
void SendDisableList(G4UIcommandTree *, int recursiveLevel)
◆ SendParameterProperties()
Definition at line 659 of file G4UIGainServer.cc.
void CodeGenJavaParams(G4UIcommandTree *, int recursiveLevel)
G4GLOB_DLL std::ostream G4cerr
◆ SessionStart()
Implements G4VBasicShell.
Definition at line 94 of file G4UIGainServer.cc.
G4String GetStateString(G4ApplicationState aState) const
virtual void ExecuteCommand(const G4String &aCommand)
static G4StateManager * GetStateManager()
G4ApplicationState GetCurrentState() const
◆ SessionTerminate()
void G4UIGainServer::SessionTerminate |
( |
| ) |
|
◆ SetUPServer()
bool G4UIGainServer::SetUPServer |
( |
| ) |
|
|
private |
Definition at line 361 of file G4UIGainServer.cc.
364 socketD[0] = socket(AF_INET,SOCK_STREAM,0);
367 perror(
"server:socket");
372 memset( (
char *)&
saddr,
'\0',
sizeof(saddr)) ;
374 saddr.sin_family = AF_INET;
375 saddr.sin_addr.s_addr = INADDR_ANY;
376 saddr.sin_port = htons(
port);
379 if(bind(
socketD[0] , (
struct sockaddr *)&saddr ,
sizeof(saddr))<0){
G4GLOB_DLL std::ostream G4cout
◆ ShowCurrent()
void G4UIGainServer::ShowCurrent |
( |
G4String |
newCommand | ) |
|
|
private |
Definition at line 458 of file G4UIGainServer.cc.
462 if( ! (curV.
isNull()||curV(0)==
'\0' ) ) {
464 G4cout <<
"Current value(s) of the parameter(s) : " << curV <<
G4endl;
471 G4cout <<
"@@ErrResult \"Current value is not available.\"" <<
G4endl;
G4GLOB_DLL std::ostream G4cout
G4String GetCurrentValues(const char *aCommand)
G4String GetFullPath(G4String)
◆ TerminalHelp()
void G4UIGainServer::TerminalHelp |
( |
G4String |
newCommand | ) |
|
|
private |
Definition at line 532 of file G4UIGainServer.cc.
537 if(i!=std::string::npos){
538 G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
540 if(newValue(0)!=
'/'){
544 if(theCommand !=NULL){
549 G4cout<<
"Command<" << newValue <<
"is not found."<<
G4endl;
557 unsigned prefixIndex = 1;
558 while(prefixIndex<
prefix.length()-1){
559 int ii =
prefix.index(
"/",prefixIndex);
568 G4cout<<
G4endl <<
"Type the number (0:end, -n:n level back) :"<<std::flush;
572 G4cin.ignore(30,
'\n');
577 if(iFloor <0) iFloor =0;
580 else if(j==0){
break;}
584 if(j<=n_tree+floor[iFloor]->GetCommandEntry()){
589 floor[iFloor+1] = floor[iFloor]->
GetTree(j);
598 G4cin.getline(temp,100);
G4String strip(G4int strip_Type=trailing, char c=' ')
G4UIcommand * GetCommand(G4int i)
std::string::size_type str_size
str_size index(const char *, G4int pos=0) const
G4String & prepend(const char *)
G4GLOB_DLL std::ostream G4cout
G4UIcommandTree * GetTree(G4int i)
G4UIcommandTree * GetTree() const
G4UIcommand * FindPath(const char *commandPath) const
G4int GetTreeEntry() const
void ListCurrentWithNum() const
◆ UpdateParamVal()
void G4UIGainServer::UpdateParamVal |
( |
void |
| ) |
|
|
private |
Definition at line 886 of file G4UIGainServer.cc.
895 if (pEntry != nEntry)
return;
896 for( i=0; i<nEntry; i++) {
900 <<
" command is updated." <<
G4endl;
std::vector< G4UIcommand * > newTreePCP
void NotifyParameterUpdate(G4UIcommand *)
G4GLOB_DLL std::ostream G4cout
std::vector< G4String > previousTreeParams
const G4String & GetCommandPath() const
std::vector< G4String > newTreeParams
◆ UpdateState()
void G4UIGainServer::UpdateState |
( |
void |
| ) |
|
|
private |
Definition at line 781 of file G4UIGainServer.cc.
788 if( newState != previousState )
791 previousState = newState;
static G4StateManager * GetStateManager()
void NotifyStateChange(void)
G4ApplicationState GetCurrentState() const
◆ WaitingConnection()
void G4UIGainServer::WaitingConnection |
( |
| ) |
|
|
private |
Definition at line 396 of file G4UIGainServer.cc.
400 for(
int i=1;i<=2;i++){
401 #if defined __APPLE__ && (__GNUC__<4) 404 if((
socketD[i] = accept(
socketD[0], (
struct sockaddr *)&caddr,(socklen_t *)&len))<0){
411 "Invalid Socket. Cannot establish connection");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4GLOB_DLL std::ostream G4cerr
◆ buf
char G4UIGainServer::buf[1024] |
|
private |
◆ caddr
struct sockaddr_in G4UIGainServer::caddr |
|
private |
◆ iCont
◆ iExit
◆ JVersion
◆ len
◆ newTreeCommands
std::vector<G4String> G4UIGainServer::newTreeCommands |
|
private |
◆ newTreeParams
std::vector<G4String> G4UIGainServer::newTreeParams |
|
private |
◆ newTreePCP
◆ port
◆ prefix
◆ previousTreeCommands
std::vector<G4String> G4UIGainServer::previousTreeCommands |
|
private |
◆ previousTreeParams
std::vector<G4String> G4UIGainServer::previousTreeParams |
|
private |
◆ previousTreePCP
std::vector<G4UIcommand*> G4UIGainServer::previousTreePCP |
|
private |
◆ promptCharacter
G4String G4UIGainServer::promptCharacter |
|
private |
◆ ret
◆ saddr
struct sockaddr_in G4UIGainServer::saddr |
|
private |
◆ socketD
int G4UIGainServer::socketD[3] |
|
private |
◆ TVersion
◆ UI
◆ uiMode
The documentation for this class was generated from the following files: