Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# G4UIGAG.hh

Go to the documentation of this file.

    00001 //
    00002 // ********************************************************************
    00003 // * License and Disclaimer                                           *
    00004 // *                                                                  *
    00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
    00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
    00007 // * conditions of the Geant4 Software License,  included in the file *
    00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
    00009 // * include a list of copyright holders.                             *
    00010 // *                                                                  *
    00011 // * Neither the authors of this software system, nor their employing *
    00012 // * institutes,nor the agencies providing financial support for this *
    00013 // * work  make  any representation or  warranty, express or implied, *
    00014 // * regarding  this  software system or assume any liability for its *
    00015 // * use.  Please see the license in the file  LICENSE  and URL above *
    00016 // * for the full disclaimer and the limitation of liability.         *
    00017 // *                                                                  *
    00018 // * This  code  implementation is the result of  the  scientific and *
    00019 // * technical work of the GEANT4 collaboration.                      *
    00020 // * By using,  copying,  modifying or  distributing the software (or *
    00021 // * any work based  on the software)  you  agree  to acknowledge its *
    00022 // * use  in  resulting  scientific  publications,  and indicate your *
    00023 // * acceptance of all terms of the Geant4 Software license.          *
    00024 // ********************************************************************
    00025 //
    00026 //
    00027 // $Id: G4UIGAG.hh,v 1.7 2006/06/29 19:09:18 gunter Exp $
    00028 // GEANT4 tag $Name: geant4-08-01-patch-01 $
    00029 //
    00030 // G4UIGAG.hh
    00031 // GAG(Geant4 adaptive GUI) interface class
    00032 // 18.Feb.98 Y.Nagamatu and T.Kodama created G4UIGAG from G4UIterminal
    00033
    00034 // If you want to use GAG (Tcl and JAVA version),
    00035 // read a document file README_Momo.html.
    00036
    00037 #ifndef G4UIGAG_h
    00038 #define G4UIGAG_h 1
    00039
    00040 #include "G4UIsession.hh"
    00041 #include "G4UImanager.hh"
    00042 #include <fstream>
    00043 #include <vector>
    00044
    00045 enum UImode { terminal_mode , java_mode, tcl_mode };
    00046 enum ChangeOfTree  { notChanged=0, added, deleted, addedAndDeleted };
    00047
    00048 // class description:
    00049 //
    00050 // This class inherits the class G4UIsession.
    00051 // This is the class which is the front-end to GAG (Geant4 Adaptive GUI).
    00052 // Its usage is quite similar to G4UIterminal.
    00053
    00054 class G4UIGAG : public G4UIsession
    00055 {
    00056       public: // with description
    00057       G4UIGAG();
    00058       ~G4UIGAG();
    00059
    00060       G4UIsession * SessionStart();
    00061
    00062       // A GAG session  "gagSession" is instantiated.
    00063       // G4cout stream is redirected by default to the constructed instance.
    00064       // Usage:  G4UIsession * gagSession = new G4UIGAG;
    00065       // "gagSession" is started.
    00066       // Usage: gagSession->SessionStart();
    00067       // "gagSession"  is deleted.
    00068       // Usage: delete gagSession;
    00069       //
    00070       void PauseSessionStart(G4String);
    00071       G4int ReceiveG4cout(G4String);
    00072       G4int ReceiveG4cerr(G4String);
    00073       // These methods are implementation of the virtual methods of
    00074       // G4UIsession class.
    00075       //
    00076       void SessionTerminate();
    00077       void Prompt(G4String);
    00078       G4String GetCommand();
    00079       // These methods are not for users.
    00080   private:
    00081       G4String prefix;
    00082       G4UImanager * UI;
    00083       G4String promptCharacter;
    00084       G4bool iExit;
    00085       G4bool iCont;
    00086       UImode uiMode;
    00087
    00088   private:
    00089       G4String JVersion;
    00090       G4String TVersion;
    00091       void ExecuteCommand(G4String);
    00092       void ChangeDirectory(G4String);
    00093       void ListDirectory(G4String);
    00094       void TerminalHelp(G4String);
    00095       G4String ModifyPrefix(G4String);
    00096       G4UIcommandTree * FindDirPath(G4String);
    00097       void ShowCurrent(G4String);
    00098       G4String GetFullPath(G4String);
    00099
    00100     void SendCommandProperties(G4UIcommandTree *);
    00101     void SendParameterProperties(G4UIcommandTree *);
    00102     void SendAParamProperty(G4UIcommand *);
    00103     void SendATclParamProperty(G4UIcommand *);
    00104     void CodeGenJavaTree(G4UIcommandTree *,int recursiveLevel);
    00105     void CodeGenJavaParams(G4UIcommandTree *,int recursiveLevel);
    00106     void CodeGenTclTree(G4UIcommandTree *, int recursiveLevel);
    00107     void CodeGenTclParams(G4UIcommandTree *, int recursiveLevel);
    00108     void SendDisableList(G4UIcommandTree *, int recursiveLevel);
    00109
    00110     void NotifyStateChange(void);
    00111     void NotifyCommandUpdate(void);
    00112     void NotifyParameterUpdate(G4UIcommand *);
    00113
    00114     int CommandUpdated(void);
    00115     void UpdateState(void);
    00116     void UpdateParamVal(void);  // if param is updated,
    00117                                // call NotifyParameterUpdate()
    00118
    00119     // --- the following are used by Notify*Update() and *Updated()
    00120     void GetNewTreeStructure( G4UIcommandTree*,int recursiveLevel);
    00121     void GetNewTreeValues( G4UIcommandTree*,int recursiveLevel);
    00122
    00123     std::vector<G4String> previousTreeCommands;
    00124     std::vector<G4String> newTreeCommands;
    00125     std::vector<G4String> previousTreeParams;
    00126     std::vector<G4String> newTreeParams;
    00127     std::vector<G4UIcommand*> previousTreePCP;
    00128     std::vector<G4UIcommand*> newTreePCP;
    00129
    00130 };
    00131
    00132 #endif