BLVisManager.hh

Go to the documentation of this file.
00001 //      BLVisManager.hh
00002 /*
00003 This source file is part of G4beamline, http://g4beamline.muonsinc.com
00004 Copyright (C) 2003,2004,2005,2006 by Tom Roberts, all rights reserved.
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 http://www.gnu.org/copyleft/gpl.html
00017 */
00018 
00019 #ifndef BLVISMANAGER_H
00020 #define BLVISMANAGER_H
00021 
00022 #include <vector>
00023 
00024 #include "G4VisManager.hh"
00025 #include "G4UImanager.hh"
00026 #include "G4Run.hh"
00027 
00028 #include "BLManager.hh"
00029 
00030 #define VISUAL_DEF_FILENAME "viewer.def"
00031 
00032 /**     class BLVisManager manages the visualization drivers.
00033  **/
00034 class BLVisManager: public G4VisManager, public BLManager::RunAction {
00035         G4String viewer;
00036         G4UImanager* UI;
00037         std::vector<G4String> initCommands;
00038         std::vector<G4String> beginRunCommands;
00039         std::vector<G4String> endRunCommands;
00040         void RegisterGraphicsSystems ();
00041         static BLVisManager *manager;
00042 public:
00043         /// Default Constructor.
00044         BLVisManager() : G4VisManager(), BLManager::RunAction() {
00045                 viewer = ""; UI = 0;
00046         }
00047 
00048         /// Constructor given the name of a viewer.
00049         BLVisManager(G4String _viewer);
00050 
00051         /// get pointer to the singleton object
00052         static BLVisManager *getObject() { return manager; }
00053 
00054         /// init() will init the graphics system, and execute the "init:"
00055         /// commands of the selected viewer.
00056         void init();
00057 
00058         /// readSection() reads 1 section from VISUAL_DEF_FILENAME
00059         void readSection(G4String section);
00060 
00061         /// BeginOfRunAction() from BLManager::RunAction.
00062         /// Executes the "beginRun:" commands of the selected viewer.
00063         void BeginOfRunAction(const G4Run *run);
00064 
00065         /// EndOfRunAction() from BLManager::RunAction.
00066         /// Executes the "endRun:" commands of the selected viewer.
00067         void EndOfRunAction(const G4Run *run);
00068 };
00069 
00070 #endif // BLVISMANAGER_H
g4beamline