Logo ROOT   6.14/05
Reference Guide
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 
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 
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 
50 {
51  fNewEventCommands.push_back(cmd);
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Remove the first command equal to cmd.
56 
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 
72 {
73  fNewEventCommands.clear();
74 }
Base class for event management and navigation.
virtual void ClearNewEventCommands()
Clear the list of commands to be executed on each new event.
Basic string class.
Definition: TString.h:131
std::vector< TString > fNewEventCommands
#define gInterpreter
Definition: TInterpreter.h:527
A list of TEveElements.
Definition: TEveElement.h:459
virtual void AddNewEventCommand(const TString &cmd)
Register a command to be executed on each new event.
TEveEventManager(const char *n="TEveEventManager", const char *t="")
Constructor.
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void AfterNewEventLoaded()
Virtual function to be called after a new event is loaded.
const Int_t n
Definition: legend1.C:16
virtual void RemoveNewEventCommand(const TString &cmd)
Remove the first command equal to cmd.