#include "TNamed.h"
#endif
+class AliTrigEvent;
class AliTrigScheduler;
+class AliTrigScheduledResponse;
class AliTrigDevice : public TNamed {
-public:
- AliTrigDevice() : TNamed(), fNinputs(0), fNoutputs(0) {}
- AliTrigDevice(const char *name, UInt_t ninputs, UInt_t noutputs)
- : TNamed(name,""), fNinputs(ninputs), fNoutputs(noutputs) {}
+private:
AliTrigDevice(const AliTrigDevice &other);
- virtual ~AliTrigDevice();
AliTrigDevice &operator=(const AliTrigDevice &other);
+public:
+ AliTrigDevice();
+ AliTrigDevice(const char *name, Int_t ninputs, Int_t noutputs);
+ virtual ~AliTrigDevice();
+
virtual void AddDevice(AliTrigDevice *other);
Int_t GetNcomponents() const;
AliTrigDevice *GetComponent(Int_t n);
+ AliTrigScheduledResponse *GetResponseFunction(const char *name);
+ AliTrigScheduler *GetScheduler() const {return fScheduler;}
+
+ //____________________________________________________________________________
+ // Device creation method to be implemented by derived classes. The response
+ // functions are registered here. Connections between component devices should
+ // also be handled in this method.
+ virtual Bool_t CreateDevice() {return kTRUE;}
//____________________________________________________________________________
// Connectivity to other devices. The method will create a connector between
// an output of this device to one input of the other.
- virtual Bool_t Connect(UInt_t output, AliTrigDevice *other, UInt_t at_input) = 0;
+ virtual Bool_t Connect(Int_t /*output*/, AliTrigDevice */*other*/, Int_t /*at_input*/) {return kTRUE;}
//____________________________________________________________________________
- // Response functions to be overloaded by specific devices. Has to propagate
+ // Response functions to be implemented by specific devices. Has to propagate
// the response to all connected devices. Representing the output #n of the device.
- virtual Bool_t Response(UInt_t output = 0) = 0;
+ virtual Bool_t Response(Int_t output = 0) = 0;
//____________________________________________________________________________
- // Register the response functions to be replayed by the global scheduler.
+ // Create the response functions of the device.
// The delay argument is in arbitrary time units with respect to the startup
- // reference.
- Bool_t RegisterResponseFunction(AliTrigScheduler *calendar, UInt_t output, Int_t delay, Int_t group) const;
+ // reference. Note that the created scheduled entry must be registered to the
+ // device scheduler via: fDevice->AddScheduledEntry() method
+ AliTrigScheduledResponse *RegisterResponseFunction(const char *name, Int_t output, Int_t delay);
//____________________________________________________________________________
// Setting the value for a given input for digital devices of general ones
// that are handling generic signals.
- virtual const char *GetOutputType(UInt_t output) {return 0;}
- virtual Bool_t SetInputType(UInt_t input, const char *classname) = 0;
- virtual Bool_t SetInputValue(UInt_t input, Bool_t value) = 0;
- virtual Bool_t SetInputValue(UInt_t input, AliTrigSignal *signal) = 0;
+ virtual const char *GetOutputType(Int_t /*output*/) {return 0;}
+ virtual Bool_t SetInputType(Int_t input, const char *classname) = 0;
+ virtual Bool_t SetInputValue(Int_t input, Bool_t value) = 0;
+ virtual Bool_t SetInputValue(Int_t input, AliTrigEvent *event) = 0;
//____________________________________________________________________________
// Device-dependent inputs reset method
virtual void ResetInputs() = 0;
- UInt_t GetNinputs() const {return fNinputs;}
- UInt_t GetNoutputs() const {return fNoutputs;}
+ void SetNinputs(Int_t ninputs) {fNinputs = ninputs;}
+ void SetNoutputs(Int_t noutputs) {fNoutputs = noutputs;}
+ Int_t GetNinputs() const {return fNinputs;}
+ Int_t GetNoutputs() const {return fNoutputs;}
protected:
- UInt_t fNinputs; // Number of inputs.
- UInt_t fNoutputs; // Number of outputs.
- TObjArray *fComponents; // Component devices if any
+ Int_t fNinputs; // Number of inputs
+ Int_t fNoutputs; // Number of outputs
+ AliTrigScheduler *fScheduler; // Device scheduler
+ TObjArray *fComponents; // Component devices
+ TObjArray *fResponseFunctions; // List of response functions
ClassDef(AliTrigDevice,1) // Base class for trigger devices
};