]>
Commit | Line | Data |
---|---|---|
79e35bac | 1 | #ifndef ALITRIGSCHEDULER_H |
2 | #define ALITRIGSCHEDULER_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | // Author: Andrei Gheata, 27/07/2009 | |
8 | ||
9 | #ifndef ROOT_TNamed | |
10 | #include "TNamed.h" | |
11 | #endif | |
12 | ||
13 | //============================================================================== | |
14 | // | |
15 | // AliTrigScheduledGroup - A group of scheduled entries that will simply be | |
16 | // fired-up sequentially. The group delay in global time | |
17 | // units is the latest start time of the contained | |
18 | // entries. A group has a priority assigned by the | |
19 | // owner scheduler object. Groups are fired-up according | |
20 | // a programable sequence. | |
21 | // | |
22 | //============================================================================== | |
23 | ||
24 | class TObjArray; | |
25 | class AliTrigScheduledEntry; | |
26 | class AliTrigScheduler; | |
27 | ||
28 | //______________________________________________________________________________ | |
29 | class AliTrigScheduledGroup : public TNamed { | |
30 | ||
31 | private: | |
32 | Int_t fPriority; // Group priority | |
33 | Int_t fDelay; // Group max. delay. | |
34 | TObjArray *fEntries; // List of scheduled entries | |
35 | ||
36 | private: | |
37 | AliTrigScheduledGroup(const AliTrigScheduledGroup &other); | |
38 | AliTrigScheduledGroup &operator=(const AliTrigScheduledGroup &other); | |
39 | ||
40 | public: | |
41 | AliTrigScheduledGroup(); | |
42 | AliTrigScheduledGroup(const char *name, Int_t priority=0); | |
43 | virtual ~AliTrigScheduledGroup(); | |
44 | ||
45 | void AddEntry(AliTrigScheduledEntry *entry); | |
46 | void FireUp(Int_t time); | |
47 | TObjArray *GetScheduledEntries() const {return fEntries;} | |
48 | Int_t GetNentries() const; | |
49 | Int_t GetPriority() const {return fPriority;} | |
50 | Int_t GetDelay() const {return fDelay;} | |
51 | virtual void Print(Option_t *option) const; | |
52 | void RemoveEntry(AliTrigScheduledEntry *entry); | |
53 | void SetPriority(Int_t priority) {fPriority = priority;} | |
54 | ||
55 | ClassDef(AliTrigScheduledGroup, 1) // Groups of scheduled response functions | |
56 | }; | |
57 | ||
58 | //============================================================================== | |
59 | // | |
60 | // AliTrigScheduledSequence - A programable group sequence. Scheduled groups | |
61 | // are owned and controlled by a trigger scheduler. They | |
62 | // are fired-up in such a sequence. A sequence supports some | |
63 | // default modes but can also be programed manually. | |
64 | // | |
65 | //============================================================================== | |
66 | ||
67 | //______________________________________________________________________________ | |
68 | class AliTrigScheduledSequence : public TNamed { | |
69 | ||
70 | public: | |
71 | enum ESortingType { | |
72 | kDefault = 0, | |
73 | kTimeInc = 1, | |
74 | kTimeDec = 2, | |
75 | kPriorityInc = 3, | |
76 | kPriorityDec = 4, | |
77 | kCustom = 5 | |
78 | }; | |
79 | ||
80 | private: | |
81 | AliTrigScheduler *fScheduler; // Scheduler to which the sequence applies | |
82 | Int_t fNgroups; // Number of groups | |
83 | ESortingType fType; // Sorting type | |
84 | Int_t *fArray; //[fNgroups] Array specifying the sequence | |
85 | ||
86 | private: | |
87 | AliTrigScheduledSequence(const AliTrigScheduledSequence &other); | |
88 | AliTrigScheduledSequence &operator=(const AliTrigScheduledSequence &other); | |
89 | void SortArray(Int_t *array, Bool_t increasing); | |
90 | ||
91 | public: | |
92 | AliTrigScheduledSequence(); | |
93 | AliTrigScheduledSequence(const char *name, AliTrigScheduler *scheduler); | |
94 | virtual ~AliTrigScheduledSequence(); | |
95 | ||
96 | Int_t *GetArray() const {return fArray;} | |
97 | Int_t GetNgroups() const {return fNgroups;} | |
98 | AliTrigScheduler *GetScheduler() const {return fScheduler;} | |
99 | ESortingType GetSortingType() const {return fType;} | |
100 | virtual void Print(Option_t *option) const; | |
101 | void Sort(ESortingType type, Int_t *sequence=0); | |
102 | ||
103 | ClassDef(AliTrigScheduledSequence, 1) // Class for a scheduled group sequence | |
104 | }; | |
105 | ||
106 | //============================================================================== | |
107 | // | |
108 | // AliTrigScheduler - Device response function scheduler. Every device has a | |
109 | // scheduler, but the same scheduler can replay responses of | |
110 | // several devices. A scheduler holds groups of scheduled | |
111 | // entries. The groups can be replayed in programable | |
112 | // sequences. A default group and sequence are always created. | |
113 | // | |
114 | //============================================================================== | |
115 | ||
116 | class AliTrigScheduledGroup; | |
117 | class AliTrigScheduledSequence; | |
118 | ||
119 | //______________________________________________________________________________ | |
120 | class AliTrigScheduler : public TNamed { | |
121 | ||
122 | private: | |
123 | Int_t fNgroups; // Number of scheduled groups (at least one) | |
124 | TObjArray *fGroups; // List of groups of response functions | |
125 | TObjArray *fSequences; // List of group replay sequences | |
126 | AliTrigScheduledSequence *fCurrentSequence; // Current group replay sequence | |
127 | ||
128 | private: | |
129 | AliTrigScheduler(const AliTrigScheduler &other); | |
130 | AliTrigScheduler &operator=(const AliTrigScheduler &other); | |
131 | ||
132 | public: | |
133 | AliTrigScheduler(); | |
134 | AliTrigScheduler(const char *name); | |
135 | virtual ~AliTrigScheduler(); | |
136 | ||
137 | void AddScheduledEntry(AliTrigScheduledEntry *entry, const char *togroup="default"); | |
138 | AliTrigScheduledGroup *AddGroup(const char *groupname); | |
139 | AliTrigScheduledGroup *AddGroup(AliTrigScheduledGroup *group); | |
140 | AliTrigScheduledSequence *AddSequence(const char *seqname, AliTrigScheduledSequence::ESortingType type=AliTrigScheduledSequence::kDefault, | |
141 | Int_t *sequence = 0); | |
142 | void FireUp(Int_t time); | |
143 | AliTrigScheduledSequence *GetCurrentSequence() const {return fCurrentSequence;} | |
144 | Int_t GetNgroups() const {return fNgroups;} | |
145 | TObjArray *GetScheduledGroups() const {return fGroups;} | |
146 | AliTrigScheduledGroup *GetScheduledGroup(Int_t i) const; | |
147 | AliTrigScheduledGroup *GetScheduledGroup(const char *name) const; | |
148 | void SetCurrentSequence(AliTrigScheduledSequence *seq) {fCurrentSequence = seq;} | |
149 | void SetGroupPriority(const char *groupname, Int_t priority); | |
150 | ||
151 | ClassDef(AliTrigScheduler,1) // Trigger scheduler class | |
152 | }; | |
153 | #endif |