]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTriggerWrapper.h
afterburner
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTriggerWrapper.h
1 //-*- Mode: C++ -*-
2 // $Id:  $
3 #ifndef ALIHLTGLOBALTRIGGERWRAPPER_H
4 #define ALIHLTGLOBALTRIGGERWRAPPER_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   AliHLTGlobalTriggerWrapper.h
10 /// @author Artur Szostak <artursz@iafrica.com>
11 /// @date   28 Oct 2009
12 /// @brief  Declaration of the AliHLTGlobalTriggerWrapper interface class.
13
14 #include "AliHLTGlobalTrigger.h"
15 #include "AliHLTLogging.h"
16 #include "TMethodCall.h"
17
18 class TClass;
19
20 /**
21  * \class AliHLTGlobalTriggerWrapper
22  * This class is used to interface with an interpreted class deriving from
23  * AliHLTGlobalTrigger. Technically the interpreted class just need to provide
24  * the same interface, i.e. the same methods set of methods as AliHLTGlobalTrigger.
25  * Direct inheritance from AliHLTGlobalTrigger and AliHLTLogging does not seam to
26  * work so providing the same set of methods is enough.
27  * The underlying class with which the wrapper interfaces is created and deleted
28  * when the wrapper is created and deleted. Thus, the underlying object has the
29  * same lifetime as the wrapper object.
30  */
31 class AliHLTGlobalTriggerWrapper : public AliHLTGlobalTrigger, public AliHLTLogging
32 {
33  public:
34   
35   /**
36    * The default constructor constructs the named underlying class and interfaces with it.
37    * \param classname  The name of the underlying class to interface with.
38    */
39   AliHLTGlobalTriggerWrapper(const char* classname);
40   
41   /// Default destructor will delete the underlying class.
42   virtual ~AliHLTGlobalTriggerWrapper();
43   
44   /**
45    * Fill values from a trigger menu. Specifically, the description
46    * strings and domain entry values will be copied over.
47    * \param  menu  The trigger menu to fill from.
48    */
49   virtual void FillFromMenu(const AliHLTTriggerMenu& menu);
50   
51   /**
52    * Method to indicate that a new event is being processed and the
53    * internal buffers should be reset.
54    */
55   virtual void NewEvent();
56   
57   /**
58    * This method is used to fill in the internal attributes from the given object
59    * which is found in the input data block list.
60    * \param  object  The object to fill from.
61    * \param  type  The data block type the object was found in.
62    * \param  spec  The data block specification the object was found in.
63    */
64   virtual void Add(
65       const TObject* object,
66       const AliHLTComponentDataType& type,
67       AliHLTUInt32_t spec
68     );
69   
70   /**
71    * Calculates the trigger decision and returns the resulting domain and description.
72    * \param  domain  The resultant trigger domain for the global HLT result.
73    * \param  description  The resultant description for the global HLT result.
74    * \returns The global HLT trigger decision result.
75    */
76   virtual bool CalculateTriggerDecision(AliHLTTriggerDomain& domain, TString& description);
77   
78   /**
79    * Returns the array of internal trigger counters.
80    */
81   virtual const TArrayL64& GetCounters() const;
82   
83   /**
84    * Sets the internal trigger counter values.
85    * \param counters  The array of trigger counters to use.
86    */
87   virtual void SetCounters(const TArrayL64& counters);
88   
89   /**
90    * Indicates if the CINT interpreter had problems with the interpreted class
91    * during a call to one of the interface methods overloaded from AliHLTGlobalTrigger.
92    * \returns true if there was a problem with the method call.
93    */
94   virtual bool CallFailed() const { return fCallFailed; }
95
96   /// Returns true if the wrapper object has setup the underlying object class properly.
97   bool IsValid() const;
98   
99  private:
100   
101   /// Not implemented. Do not allow copying of this object.
102   AliHLTGlobalTriggerWrapper(const AliHLTGlobalTriggerWrapper& obj);
103   /// Not implemented. Do not allow copying of this object.
104   AliHLTGlobalTriggerWrapper& operator = (const AliHLTGlobalTriggerWrapper& obj);
105   
106   TClass* fClass; /// Pointer to the object class.
107   void* fObject;  /// Pointer to the object being interfaced.
108   TMethodCall fFillFromMenuCall;  /// Method call object for FillFromMenu method.
109   TMethodCall fNewEventCall;      /// Method call object for NewEvent method.
110   TMethodCall fAddCall;           /// Method call object for Add method.
111   TMethodCall fCalculateTriggerDecisionCall;  /// Method call object for CalculateTriggerDecision method.
112   mutable TMethodCall fGetCountersCall;  /// Method call object for GetCounters method.
113   TMethodCall fSetCountersCall;  /// Method call object for SetCounters method.
114   mutable bool fCallFailed;  /// Indicates if the last method call failed or not.
115   
116   ClassDef(AliHLTGlobalTriggerWrapper, 0) // Wrapper class to interface with an interpreted global trigger class.
117 };
118
119 #endif // ALIHLTGLOBALTRIGGERWRAPPER_H