Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveEventManager.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveEventManager.h"
13 
14 #include "TObjString.h"
15 #include "TInterpreter.h"
16 
17 /** \class TEveEventManager
18 \ingroup TEve
19 Base class for event management and navigation.
20 */
21 
22 ClassImp(TEveEventManager);
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 /// Constructor.
26 
27 TEveEventManager::TEveEventManager(const char* n, const char* t) :
28  TEveElementList(n, t),
29  fNewEventCommands()
30 {
31 }
32 
33 ////////////////////////////////////////////////////////////////////////////////
34 /// Virtual function to be called after a new event is loaded.
35 /// It iterates over the list of registered commands
36 /// (fNewEventCommands) and executes them in given order.
37 
38 void TEveEventManager::AfterNewEventLoaded()
39 {
40  for (std::vector<TString>::iterator i = fNewEventCommands.begin(); i != fNewEventCommands.end(); ++i)
41  {
42  gInterpreter->ProcessLine(*i);
43  }
44 }
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// Register a command to be executed on each new event.
48 
49 void TEveEventManager::AddNewEventCommand(const TString& cmd)
50 {
51  fNewEventCommands.push_back(cmd);
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Remove the first command equal to cmd.
56 
57 void TEveEventManager::RemoveNewEventCommand(const TString& cmd)
58 {
59  for (std::vector<TString>::iterator i = fNewEventCommands.begin(); i != fNewEventCommands.end(); ++i)
60  {
61  if (cmd == *i) {
62  fNewEventCommands.erase(i);
63  break;
64  }
65  }
66 }
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Clear the list of commands to be executed on each new event.
70 
71 void TEveEventManager::ClearNewEventCommands()
72 {
73  fNewEventCommands.clear();
74 }