1 #ifndef ALITRIGDEVICE_H
2 #define ALITRIGDEVICE_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 // Author: Andrei Gheata, 27/07/2009
9 //==============================================================================
10 // AliTrigDevice - Base class for a generic device.
11 //==============================================================================
17 class AliTrigScheduler;
19 class AliTrigDevice : public TNamed {
22 AliTrigDevice() : TNamed(), fNinputs(0), fNoutputs(0) {}
23 AliTrigDevice(const char *name, UInt_t ninputs, UInt_t noutputs)
24 : TNamed(name,""), fNinputs(ninputs), fNoutputs(noutputs) {}
25 AliTrigDevice(const AliTrigDevice &other);
26 virtual ~AliTrigDevice();
27 AliTrigDevice &operator=(const AliTrigDevice &other);
29 virtual void AddDevice(AliTrigDevice *other);
30 Int_t GetNcomponents() const;
31 AliTrigDevice *GetComponent(Int_t n);
32 //____________________________________________________________________________
33 // Connectivity to other devices. The method will create a connector between
34 // an output of this device to one input of the other.
35 virtual Bool_t Connect(UInt_t output, AliTrigDevice *other, UInt_t at_input) = 0;
37 //____________________________________________________________________________
38 // Response functions to be overloaded by specific devices. Has to propagate
39 // the response to all connected devices. Representing the output #n of the device.
40 virtual Bool_t Response(UInt_t output = 0) = 0;
42 //____________________________________________________________________________
43 // Register the response functions to be replayed by the global scheduler.
44 // The delay argument is in arbitrary time units with respect to the startup
46 Bool_t RegisterResponseFunction(AliTrigScheduler *calendar, UInt_t output, Int_t delay, Int_t group) const;
48 //____________________________________________________________________________
49 // Setting the value for a given input for digital devices of general ones
50 // that are handling generic signals.
51 virtual const char *GetOutputType(UInt_t output) {return 0;}
52 virtual Bool_t SetInputType(UInt_t input, const char *classname) = 0;
53 virtual Bool_t SetInputValue(UInt_t input, Bool_t value) = 0;
54 virtual Bool_t SetInputValue(UInt_t input, AliTrigSignal *signal) = 0;
56 //____________________________________________________________________________
57 // Device-dependent inputs reset method
58 virtual void ResetInputs() = 0;
60 UInt_t GetNinputs() const {return fNinputs;}
61 UInt_t GetNoutputs() const {return fNoutputs;}
64 UInt_t fNinputs; // Number of inputs.
65 UInt_t fNoutputs; // Number of outputs.
66 TObjArray *fComponents; // Component devices if any
68 ClassDef(AliTrigDevice,1) // Base class for trigger devices