00001 // @(#)root/eve:$Id: TEveEventManager.cxx 27157 2009-01-15 14:05:12Z brun $ 00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #include "TEveEventManager.h" 00013 00014 #include "TObjString.h" 00015 #include "TInterpreter.h" 00016 00017 //______________________________________________________________________________ 00018 // TEveEventManager 00019 // 00020 // Base class for event management and navigation. 00021 00022 ClassImp(TEveEventManager) 00023 00024 //______________________________________________________________________________ 00025 TEveEventManager::TEveEventManager(const char* n, const char* t) : 00026 TEveElementList(n, t), 00027 fNewEventCommands() 00028 { 00029 // Constructor. 00030 } 00031 00032 /******************************************************************************/ 00033 00034 //______________________________________________________________________________ 00035 void TEveEventManager::AfterNewEventLoaded() 00036 { 00037 // Virtual function to be called after a new event is loaded. 00038 // It iterates over the list of registered commands 00039 // (fNewEventCommands) and executes them in given order. 00040 00041 for (std::vector<TString>::iterator i = fNewEventCommands.begin(); i != fNewEventCommands.end(); ++i) 00042 { 00043 gInterpreter->ProcessLine(*i); 00044 } 00045 } 00046 00047 //______________________________________________________________________________ 00048 void TEveEventManager::AddNewEventCommand(const TString& cmd) 00049 { 00050 // Register a command to be executed on each new event. 00051 00052 fNewEventCommands.push_back(cmd); 00053 } 00054 00055 //______________________________________________________________________________ 00056 void TEveEventManager::RemoveNewEventCommand(const TString& cmd) 00057 { 00058 // Remove the first command equal to cmd. 00059 00060 for (std::vector<TString>::iterator i = fNewEventCommands.begin(); i != fNewEventCommands.end(); ++i) 00061 { 00062 if (cmd == *i) { 00063 fNewEventCommands.erase(i); 00064 break; 00065 } 00066 } 00067 } 00068 00069 //______________________________________________________________________________ 00070 void TEveEventManager::ClearNewEventCommands() 00071 { 00072 // Clear the list of commands to be executed on each new event. 00073 00074 fNewEventCommands.clear(); 00075 }