]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTTriggerMenu.h
Adding the trigger menu for the HLT global trigger.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerMenu.h
1 #ifndef ALIHLTTRIGGERMENU_H
2 #define ALIHLTTRIGGERMENU_H
3 /* This file is property of and copyright by the ALICE HLT Project        *
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  * See cxx source for full Copyright notice                               */
6
7 /// @file   AliHLTTriggerMenu.h
8 /// @author Artur Szostak <artursz@iafrica.com>
9 /// @date   19 Dec 2008
10 /// @brief  Declaration of the AliHLTTriggerMenu base class.
11
12 #include "TObject.h"
13 #include "TString.h"
14 #include "TClonesArray.h"
15 #include "AliHLTTriggerMenuItem.h"
16
17 /**
18  * \class AliHLTTriggerMenu
19  * This class is an abstract class. Classes which derive from this class should
20  * implement the logic for a particular trigger menu. The AliHLTTriggerMenu class
21  * creates a class deriving from AliHLTTriggerMenu on the fly to implement the
22  * trigger logic for that particular trigger menu.
23  */
24 class AliHLTTriggerMenu : public TObject
25 {
26  public:
27   
28   /**
29    * Default constructor.
30    */
31   AliHLTTriggerMenu();
32   
33   /**
34    * Default destructor.
35    */
36   virtual ~AliHLTTriggerMenu();
37   
38   /**
39    * Inherited from TObject, this prints the contents of the trigger menu.
40    * \param option  Can be "short" which will print the short format.
41    */
42   virtual void Print(Option_t* option = "") const;
43
44   /**
45    * Copy constructor performs a deep copy of the object.
46    * \param  obj  Object to copy from.
47    */
48   AliHLTTriggerMenu(const AliHLTTriggerMenu& obj);
49   
50   /**
51    * Assignment operator performs a deep copy of the object.
52    * \param  obj  Object to copy from.
53    * \return  This object is returned after being replaced by a copy of <i>obj</i>.
54    */
55   AliHLTTriggerMenu& operator = (const AliHLTTriggerMenu& obj);
56   
57   /**
58    * Inherited from TObject. Returns the name of the trigger menu.
59    */
60   virtual const char* GetName() const { return fName.Data(); }
61   
62   /**
63    * Returns the name of the trigger menu.
64    */
65   const char* Name() const { return fName.Data(); }
66   
67   /**
68    * Sets the name of the trigger menu.
69    */
70   void Name(const char* name) { fName = name; }
71   
72   /**
73    * Returns the number of items in the trigger menu.
74    */
75   UInt_t NumberOfItems() const { return UInt_t(fItems.GetEntriesFast()); }
76   
77   /**
78    * Fetches the i'th trigger menu item.
79    */
80   const AliHLTTriggerMenuItem* Item(UInt_t i) const
81   {
82     if (i >= UInt_t(fItems.GetEntriesFast())) return NULL;
83     return static_cast<const AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) );
84   }
85   
86   /**
87    * Fetches the i'th trigger menu item for editing.
88    */
89   AliHLTTriggerMenuItem* Item(UInt_t i)
90   {
91     if (i >= UInt_t(fItems.GetEntriesFast())) return NULL;
92     return static_cast<AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) );
93   }
94   
95   /**
96    * Adds a new entry to the trigger menu.
97    */
98   void AddItem(const AliHLTTriggerMenuItem& entry)
99   {
100     new (fItems[fItems.GetEntriesFast()]) AliHLTTriggerMenuItem(entry);
101   }
102   
103  private:
104   
105   TString fName;  /// Name of the trigger menu.
106   TClonesArray fItems;  /// List of trigger menu items.
107   
108   ClassDef(AliHLTTriggerMenu, 1) // Trigger menu for the global HLT trigger.
109 };
110
111 #endif // ALIHLTTRIGGERMENU_H
112