//-*- Mode: C++ -*- // $Id:$ #ifndef ALIHLTTRIGGERMENU_H #define ALIHLTTRIGGERMENU_H /* This file is property of and copyright by the ALICE HLT Project * * ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ /// @file AliHLTTriggerMenu.h /// @author Artur Szostak /// @date 19 Dec 2008 /// @brief Declaration of the AliHLTTriggerMenu base class. #include "TObject.h" #include "TString.h" #include "TClonesArray.h" #include "AliHLTTriggerMenuSymbol.h" #include "AliHLTTriggerMenuItem.h" #include "AliHLTTriggerDomain.h" /** * \class AliHLTTriggerMenu * This class is an abstract class. Classes which derive from this class should * implement the logic for a particular trigger menu. The AliHLTTriggerMenu class * creates a class deriving from AliHLTTriggerMenu on the fly to implement the * trigger logic for that particular trigger menu. */ class AliHLTTriggerMenu : public TObject { public: /** * Default constructor. */ AliHLTTriggerMenu(); /** * Default destructor. */ virtual ~AliHLTTriggerMenu(); /** * Inherited from TObject, this prints the contents of the trigger menu. * \param option Can be "short" which will print the short format. */ virtual void Print(Option_t* option = "") const; /** * This method removes all items and symbols from the trigger menu. * \note The name and default values are not changed. Only the items and symbol * lists are cleared. * \param option This is passed onto the internal fSymbols and fItems TClonesArrays. * The method is inherited from TObject. */ virtual void Clear(Option_t* option = ""); /** * Copy constructor performs a deep copy of the object. * \param obj Object to copy from. */ AliHLTTriggerMenu(const AliHLTTriggerMenu& obj); /** * Assignment operator performs a deep copy of the object. * \param obj Object to copy from. * \return This object is returned after being replaced by a copy of obj. */ AliHLTTriggerMenu& operator = (const AliHLTTriggerMenu& obj); /** * Inherited from TObject. Returns the name of the trigger menu. */ virtual const char* GetName() const { return fName.Data(); } /** * Returns the name of the trigger menu. */ const char* Name() const { return fName.Data(); } /** * Sets the name of the trigger menu. */ void Name(const char* name) { fName = name; } /** * Returns the number of symbols in the trigger menu. */ UInt_t NumberOfSymbols() const { return UInt_t(fSymbols.GetEntriesFast()); } /** * Fetches the i'th trigger menu symbol. */ const AliHLTTriggerMenuSymbol* Symbol(UInt_t i) const { if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL; return static_cast( fSymbols.UncheckedAt(Int_t(i)) ); } /** * Fetches the i'th trigger menu symbol for editing. */ AliHLTTriggerMenuSymbol* Symbol(UInt_t i) { if (i >= UInt_t(fSymbols.GetEntriesFast())) return NULL; return static_cast( fSymbols.UncheckedAt(Int_t(i)) ); } /** * Adds a new symbol to the trigger menu. */ void AddSymbol(const AliHLTTriggerMenuSymbol& entry) { new (fSymbols[fSymbols.GetEntriesFast()]) AliHLTTriggerMenuSymbol(entry); } /** * Returns the array of symbols. */ const TClonesArray& SymbolArray() const { return fSymbols; } /** * Returns the number of items in the trigger menu. */ UInt_t NumberOfItems() const { return UInt_t(fItems.GetEntriesFast()); } /** * Fetches the i'th trigger menu item. */ const AliHLTTriggerMenuItem* Item(UInt_t i) const { if (i >= UInt_t(fItems.GetEntriesFast())) return NULL; return static_cast( fItems.UncheckedAt(Int_t(i)) ); } /** * Fetches the i'th trigger menu item for editing. */ AliHLTTriggerMenuItem* Item(UInt_t i) { if (i >= UInt_t(fItems.GetEntriesFast())) return NULL; return static_cast( fItems.UncheckedAt(Int_t(i)) ); } /** * Adds a new entry to the trigger menu. */ void AddItem(const AliHLTTriggerMenuItem& entry) { new (fItems[fItems.GetEntriesFast()]) AliHLTTriggerMenuItem(entry); } /** * Returns the array of menu items. */ const TClonesArray& ItemsArray() const { return fItems; } /** * Sets the default trigger description to use if the global trigger does not * fire and returns a negative result. */ void DefaultDescription(const char* value) { fDefaultDescription = value; } /** * Returns the default trigger description to use if the global trigger does not * fire and returns a negative result. */ const char* DefaultDescription() const { return fDefaultDescription.Data(); } /** * Sets the default trigger domain to use if the global trigger does not * fire and returns a negative result. */ void DefaultTriggerDomain(const AliHLTTriggerDomain& value) { fDefaultDomain = value; } /** * Returns the default trigger domain to use if the global trigger does not * fire and returns a negative result. */ const AliHLTTriggerDomain& DefaultTriggerDomain() const { return fDefaultDomain; } /** * Returns the default trigger domain for modification. */ AliHLTTriggerDomain& DefaultTriggerDomain() { return fDefaultDomain; } private: TString fName; /// Name of the trigger menu. TClonesArray fSymbols; /// List of symbols used in trigger expressions. TClonesArray fItems; /// List of trigger menu items. TString fDefaultDescription; /// The default trigger description to use for negative global triggers. AliHLTTriggerDomain fDefaultDomain; /// The default trigger domain to use for negative global triggers. ClassDef(AliHLTTriggerMenu, 2) // Trigger menu for the global HLT trigger. }; #endif // ALIHLTTRIGGERMENU_H