]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTTriggerMenu.h
- setting properties for keyword substitution
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTriggerMenu.h
1 //-*- Mode: C++ -*-
2 // $Id:$
3 #ifndef ALIHLTTRIGGERMENU_H
4 #define ALIHLTTRIGGERMENU_H
5 /* This file is property of and copyright by the ALICE HLT Project        *
6  * ALICE Experiment at CERN, All rights reserved.                         *
7  * See cxx source for full Copyright notice                               */
8
9 /// @file   AliHLTTriggerMenu.h
10 /// @author Artur Szostak <artursz@iafrica.com>
11 /// @date   19 Dec 2008
12 /// @brief  Declaration of the AliHLTTriggerMenu base class.
13
14 #include "TObject.h"
15 #include "TString.h"
16 #include "TClonesArray.h"
17 #include "AliHLTTriggerMenuSymbol.h"
18 #include "AliHLTTriggerMenuItem.h"
19 #include "AliHLTTriggerDomain.h"
20
21 /**
22  * \class AliHLTTriggerMenu
23  * This class is an abstract class. Classes which derive from this class should
24  * implement the logic for a particular trigger menu. The AliHLTTriggerMenu class
25  * creates a class deriving from AliHLTTriggerMenu on the fly to implement the
26  * trigger logic for that particular trigger menu.
27  */
28 class AliHLTTriggerMenu : public TObject
29 {
30  public:
31   
32   /**
33    * Default constructor.
34    */
35   AliHLTTriggerMenu();
36   
37   /**
38    * Default destructor.
39    */
40   virtual ~AliHLTTriggerMenu();
41   
42   /**
43    * Inherited from TObject, this prints the contents of the trigger menu.
44    * \param option  Can be "short" which will print the short format.
45    */
46   virtual void Print(Option_t* option = "") const;
47   
48   /**
49    * This method removes all items and symbols from the trigger menu.
50    * \note The name and default values are not changed. Only the items and symbol
51    *    lists are cleared.
52    * \param  option  This is passed onto the internal fSymbols and fItems TClonesArrays.
53    * The method is inherited from TObject.
54    */
55   virtual void Clear(Option_t* option = "");
56
57   /**
58    * Copy constructor performs a deep copy of the object.
59    * \param  obj  Object to copy from.
60    */
61   AliHLTTriggerMenu(const AliHLTTriggerMenu& obj);
62   
63   /**
64    * Assignment operator performs a deep copy of the object.
65    * \param  obj  Object to copy from.
66    * \return  This object is returned after being replaced by a copy of <i>obj</i>.
67    */
68   AliHLTTriggerMenu& operator = (const AliHLTTriggerMenu& obj);
69   
70   /**
71    * Inherited from TObject. Returns the name of the trigger menu.
72    */
73   virtual const char* GetName() const { return fName.Data(); }
74   
75   /**
76    * Returns the name of the trigger menu.
77    */
78   const char* Name() const { return fName.Data(); }
79   
80   /**
81    * Sets the name of the trigger menu.
82    */
83   void Name(const char* name) { fName = name; }
84   
85   /**
86    * Returns the number of symbols in the trigger menu.
87    */
88   UInt_t NumberOfSymbols() const { return UInt_t(fSymbols.GetEntriesFast()); }
89   
90   /**
91    * Fetches the i'th trigger menu symbol.
92    */
93   const AliHLTTriggerMenuSymbol* Symbol(UInt_t i) const
94   {
95     if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL;
96     return static_cast<const AliHLTTriggerMenuSymbol*>( fSymbols.UncheckedAt(Int_t(i)) );
97   }
98   
99   /**
100    * Fetches the i'th trigger menu symbol for editing.
101    */
102   AliHLTTriggerMenuSymbol* Symbol(UInt_t i)
103   {
104     if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL;
105     return static_cast<AliHLTTriggerMenuSymbol*>( fSymbols.UncheckedAt(Int_t(i)) );
106   }
107   
108   /**
109    * Adds a new symbol to the trigger menu.
110    */
111   void AddSymbol(const AliHLTTriggerMenuSymbol& entry)
112   {
113     new (fSymbols[fSymbols.GetEntriesFast()]) AliHLTTriggerMenuSymbol(entry);
114   }
115   
116   /**
117    * Returns the array of symbols.
118    */
119   const TClonesArray& SymbolArray() const { return fSymbols; }
120   
121   /**
122    * Returns the number of items in the trigger menu.
123    */
124   UInt_t NumberOfItems() const { return UInt_t(fItems.GetEntriesFast()); }
125   
126   /**
127    * Fetches the i'th trigger menu item.
128    */
129   const AliHLTTriggerMenuItem* Item(UInt_t i) const
130   {
131     if (i >= UInt_t(fItems.GetEntriesFast())) return NULL;
132     return static_cast<const AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) );
133   }
134   
135   /**
136    * Fetches the i'th trigger menu item for editing.
137    */
138   AliHLTTriggerMenuItem* Item(UInt_t i)
139   {
140     if (i >= UInt_t(fItems.GetEntriesFast())) return NULL;
141     return static_cast<AliHLTTriggerMenuItem*>( fItems.UncheckedAt(Int_t(i)) );
142   }
143   
144   /**
145    * Adds a new entry to the trigger menu.
146    */
147   void AddItem(const AliHLTTriggerMenuItem& entry)
148   {
149     new (fItems[fItems.GetEntriesFast()]) AliHLTTriggerMenuItem(entry);
150   }
151   
152   /**
153    * Returns the array of menu items.
154    */
155   const TClonesArray& ItemsArray() const { return fItems; }
156   
157   /**
158    * Sets the default trigger description to use if the global trigger does not
159    * fire and returns a negative result.
160    */
161   void DefaultDescription(const char* value) { fDefaultDescription = value; }
162   
163   /**
164    * Returns the default trigger description to use if the global trigger does not
165    * fire and returns a negative result.
166    */
167   const char* DefaultDescription() const { return fDefaultDescription.Data(); }
168   
169   /**
170    * Sets the default trigger domain to use if the global trigger does not
171    * fire and returns a negative result.
172    */
173   void DefaultTriggerDomain(const AliHLTTriggerDomain& value) { fDefaultDomain = value; }
174   
175   /**
176    * Returns the default trigger domain to use if the global trigger does not
177    * fire and returns a negative result.
178    */
179   const AliHLTTriggerDomain& DefaultTriggerDomain() const { return fDefaultDomain; }
180   
181   /**
182    * Returns the default trigger domain for modification.
183    */
184   AliHLTTriggerDomain& DefaultTriggerDomain() { return fDefaultDomain; }
185   
186  private:
187   
188   TString fName;  /// Name of the trigger menu.
189   TClonesArray fSymbols;  /// List of symbols used in trigger expressions.
190   TClonesArray fItems;  /// List of trigger menu items.
191   TString fDefaultDescription; /// The default trigger description to use for negative global triggers.
192   AliHLTTriggerDomain fDefaultDomain;  /// The default trigger domain to use for negative global triggers.
193   
194   ClassDef(AliHLTTriggerMenu, 2) // Trigger menu for the global HLT trigger.
195 };
196
197 #endif // ALIHLTTRIGGERMENU_H
198