]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTriggerWrapper.h
Fixes for coverity
[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  triggerResult  The resultant decision bit of the global HLT trigger decision.
73    * \param  domain  The resultant trigger domain for the global HLT result.
74    * \param  description  The resultant description for the global HLT result.
75    * \returns true if any of the triggers in the trigger menu were matched.
76    */
77   virtual bool CalculateTriggerDecision(bool& triggerResult, AliHLTTriggerDomain& domain, TString& description);
78   
79   /**
80    * Returns the array of internal trigger counters.
81    */
82   virtual const TArrayL64& GetCounters() const;
83   
84   /**
85    * Sets the internal trigger counter values.
86    * \param counters  The array of trigger counters to use.
87    */
88   virtual void SetCounters(const TArrayL64& counters);
89   
90   /**
91    * Indicates if the CINT interpreter had problems with the interpreted class
92    * during a call to one of the interface methods overloaded from AliHLTGlobalTrigger.
93    * \returns true if there was a problem with the method call.
94    */
95   virtual bool CallFailed() const { return fCallFailed; }
96
97   /// Returns true if the wrapper object has setup the underlying object class properly.
98   bool IsValid() const;
99   
100  private:
101   
102   /// Not implemented. Do not allow copying of this object.
103   AliHLTGlobalTriggerWrapper(const AliHLTGlobalTriggerWrapper& obj);
104   /// Not implemented. Do not allow copying of this object.
105   AliHLTGlobalTriggerWrapper& operator = (const AliHLTGlobalTriggerWrapper& obj);
106   
107   TClass* fClass; /// Pointer to the object class.
108   void* fObject;  /// Pointer to the object being interfaced.
109   TMethodCall fFillFromMenuCall;  /// Method call object for FillFromMenu method.
110   TMethodCall fNewEventCall;      /// Method call object for NewEvent method.
111   TMethodCall fAddCall;           /// Method call object for Add method.
112   TMethodCall fCalculateTriggerDecisionCall;  /// Method call object for CalculateTriggerDecision method.
113   mutable TMethodCall fGetCountersCall;  /// Method call object for GetCounters method.
114   TMethodCall fSetCountersCall;  /// Method call object for SetCounters method.
115   mutable bool fCallFailed;  /// Indicates if the last method call failed or not.
116   
117   ClassDef(AliHLTGlobalTriggerWrapper, 0) // Wrapper class to interface with an interpreted global trigger class.
118 };
119
120 #endif // ALIHLTGLOBALTRIGGERWRAPPER_H