]>
Commit | Line | Data |
---|---|---|
e2bb8ddd | 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" | |
52f67e50 | 15 | #include "AliHLTTriggerMenuSymbol.h" |
e2bb8ddd | 16 | #include "AliHLTTriggerMenuItem.h" |
17 | ||
18 | /** | |
19 | * \class AliHLTTriggerMenu | |
20 | * This class is an abstract class. Classes which derive from this class should | |
21 | * implement the logic for a particular trigger menu. The AliHLTTriggerMenu class | |
22 | * creates a class deriving from AliHLTTriggerMenu on the fly to implement the | |
23 | * trigger logic for that particular trigger menu. | |
24 | */ | |
25 | class AliHLTTriggerMenu : public TObject | |
26 | { | |
27 | public: | |
28 | ||
29 | /** | |
30 | * Default constructor. | |
31 | */ | |
32 | AliHLTTriggerMenu(); | |
33 | ||
34 | /** | |
35 | * Default destructor. | |
36 | */ | |
37 | virtual ~AliHLTTriggerMenu(); | |
38 | ||
39 | /** | |
40 | * Inherited from TObject, this prints the contents of the trigger menu. | |
41 | * \param option Can be "short" which will print the short format. | |
42 | */ | |
43 | virtual void Print(Option_t* option = "") const; | |
44 | ||
45 | /** | |
46 | * Copy constructor performs a deep copy of the object. | |
47 | * \param obj Object to copy from. | |
48 | */ | |
49 | AliHLTTriggerMenu(const AliHLTTriggerMenu& obj); | |
50 | ||
51 | /** | |
52 | * Assignment operator performs a deep copy of the object. | |
53 | * \param obj Object to copy from. | |
54 | * \return This object is returned after being replaced by a copy of <i>obj</i>. | |
55 | */ | |
56 | AliHLTTriggerMenu& operator = (const AliHLTTriggerMenu& obj); | |
57 | ||
58 | /** | |
59 | * Inherited from TObject. Returns the name of the trigger menu. | |
60 | */ | |
61 | virtual const char* GetName() const { return fName.Data(); } | |
62 | ||
63 | /** | |
64 | * Returns the name of the trigger menu. | |
65 | */ | |
66 | const char* Name() const { return fName.Data(); } | |
67 | ||
68 | /** | |
69 | * Sets the name of the trigger menu. | |
70 | */ | |
71 | void Name(const char* name) { fName = name; } | |
72 | ||
52f67e50 | 73 | /** |
74 | * Returns the number of symbols in the trigger menu. | |
75 | */ | |
76 | UInt_t NumberOfSymbols() const { return UInt_t(fSymbols.GetEntriesFast()); } | |
77 | ||
78 | /** | |
79 | * Fetches the i'th trigger menu symbol. | |
80 | */ | |
81 | const AliHLTTriggerMenuSymbol* Symbol(UInt_t i) const | |
82 | { | |
83 | if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL; | |
84 | return static_cast<const AliHLTTriggerMenuSymbol*>( fSymbols.UncheckedAt(Int_t(i)) ); | |
85 | } | |
86 | ||
87 | /** | |
88 | * Fetches the i'th trigger menu symbol for editing. | |
89 | */ | |
90 | AliHLTTriggerMenuSymbol* Symbol(UInt_t i) | |
91 | { | |
92 | if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL; | |
93 | return static_cast<AliHLTTriggerMenuSymbol*>( fSymbols.UncheckedAt(Int_t(i)) ); | |
94 | } | |
95 | ||
96 | /** | |
97 | * Adds a new symbol to the trigger menu. | |
98 | */ | |
99 | void AddSymbol(const AliHLTTriggerMenuSymbol& entry) | |
100 | { | |
101 | new (fSymbols[fSymbols.GetEntriesFast()]) AliHLTTriggerMenuSymbol(entry); | |
102 | } | |
103 | ||
104 | /** | |
105 | * Returns the array of symbols. | |
106 | */ | |
107 | const TClonesArray& SymbolArray() const { return fSymbols; } | |
108 | ||
e2bb8ddd | 109 | /** |
110 | * Returns the number of items in the trigger menu. | |
111 | */ | |
112 | UInt_t NumberOfItems() const { return UInt_t(fItems.GetEntriesFast()); } | |
113 | ||
114 | /** | |
115 | * Fetches the i'th trigger menu item. | |
116 | */ | |
117 | const AliHLTTriggerMenuItem* Item(UInt_t i) const | |
118 | { | |
119 | if (i >= UInt_t(fItems.GetEntriesFast())) return NULL; | |
120 | return static_cast<const AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) ); | |
121 | } | |
122 | ||
123 | /** | |
124 | * Fetches the i'th trigger menu item for editing. | |
125 | */ | |
126 | AliHLTTriggerMenuItem* Item(UInt_t i) | |
127 | { | |
128 | if (i >= UInt_t(fItems.GetEntriesFast())) return NULL; | |
129 | return static_cast<AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) ); | |
130 | } | |
131 | ||
132 | /** | |
133 | * Adds a new entry to the trigger menu. | |
134 | */ | |
135 | void AddItem(const AliHLTTriggerMenuItem& entry) | |
136 | { | |
137 | new (fItems[fItems.GetEntriesFast()]) AliHLTTriggerMenuItem(entry); | |
138 | } | |
139 | ||
52f67e50 | 140 | /** |
141 | * Returns the array of menu items. | |
142 | */ | |
143 | const TClonesArray& ItemsArray() const { return fItems; } | |
144 | ||
e2bb8ddd | 145 | private: |
146 | ||
147 | TString fName; /// Name of the trigger menu. | |
52f67e50 | 148 | TClonesArray fSymbols; /// List of symbols used in trigger expressions. |
e2bb8ddd | 149 | TClonesArray fItems; /// List of trigger menu items. |
150 | ||
52f67e50 | 151 | ClassDef(AliHLTTriggerMenu, 2) // Trigger menu for the global HLT trigger. |
e2bb8ddd | 152 | }; |
153 | ||
154 | #endif // ALIHLTTRIGGERMENU_H | |
155 |