Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4VBasicShell.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 
0029 #ifndef G4VBasicShell_H
0030 #define G4VBasicShell_H 1
0031 
0032 class G4UIcommandTree;
0033 class G4UIcommand;
0034 
0035 #include "G4UIsession.hh"
0036 #include "globals.hh"
0037 
0038 // Class description :
0039 //
0040 //  G4VBasicShell : a base class to extract common things to various
0041 // sessions.
0042 //
0043 //  It handles "seek" completion logic, help logic.
0044 //  VBasicShell handles also commands like "cd, ls, pwd"
0045 // without passing by a Geant4 "intercom" command. This feature,
0046 // which is similar to a UNIX shell one, had given.
0047 // its name to the class.
0048 //
0049 // Class description - end :
0050 
0051 class G4VBasicShell : public G4UIsession
0052 {
0053  public:
0054   G4VBasicShell();
0055   ~G4VBasicShell() override;
0056 
0057   G4UIsession* SessionStart() override = 0;
0058   // null should be returned for interactive session
0059 
0060   void PauseSessionStart(const G4String& Prompt) override = 0;
0061   // Prompt string can be ignored
0062 
0063  protected:
0064   // convert "BeamOn 10" to "/run/BeamOn 10" if the
0065   // current working directory is "/run/"
0066   G4String ModifyToFullPathCommand(const char* aCommandLine) const;
0067 
0068   // directory string starts with '/' and ends with '/'
0069   G4String GetCurrentWorkingDirectory() const;
0070 
0071   // change directory to newDir
0072   // false will be returned if the target directory doesn't exist
0073   G4bool ChangeDirectory(const char* newDir);
0074 
0075   // find G4UIcommandTree object
0076   // null returned if the taregt does not exist
0077   G4UIcommandTree* FindDirectory(const char* dirName) const;
0078 
0079   // find G4UIcommand object
0080   // null returned if the target does not exist
0081   G4UIcommand* FindCommand(const char* commandName) const;
0082 
0083   // command completion
0084   G4String Complete(const G4String&);
0085 
0086   G4String FindMatchingPath(G4UIcommandTree*, const G4String&);
0087 
0088   /////////////////////////////////////////////
0089   // Methods involving an interactive G4cout //
0090   /////////////////////////////////////////////
0091   virtual void ExecuteCommand(const G4String&);
0092   virtual G4bool GetHelpChoice(G4int&) = 0;
0093   virtual void ExitHelp() const = 0;
0094   void ApplyShellCommand(const G4String&, G4bool&, G4bool&);
0095   void ShowCurrent(const G4String&) const;
0096   void ChangeDirectoryCommand(const G4String&);
0097   void ListDirectory(const G4String&) const;
0098   void TerminalHelp(const G4String&);
0099 
0100  private:
0101   G4String ModifyPath(const G4String& tempPath) const;
0102 
0103   G4String currentDirectory;
0104 };
0105 
0106 #endif