linked loaders at clusters level
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTDomainEntry.h
CommitLineData
dce3e5ce 1#ifndef ALIHLTDOMAINENTRY_H
2#define ALIHLTDOMAINENTRY_H
3/* This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/// @file AliHLTDomainEntry.h
8/// @author Artur Szostak <artursz@iafrica.com>
9/// @date 20 Nov 2008
10/// @brief Declaration of the AliHLTDomainEntry class used to store identifying information about HLT data blocks.
11
12#include "TObject.h"
13#include "AliHLTDataTypes.h"
14
15class AliHLTDomainEntry : public TObject
16{
17 public:
18
19 /**
20 * Default constructor.
21 */
22 AliHLTDomainEntry();
23
24 /**
25 * Copy constructor performs a deep copy.
26 * \param domain The domain entry to copy from.
27 */
28 AliHLTDomainEntry(const AliHLTDomainEntry& domain);
29
30 /**
31 * This constructs a domain entry with a particular data type and an 'any' wild
32 * card value for specification indicating any specification will match.
33 * \param type The data block type and origin to use.
34 */
35 AliHLTDomainEntry(const AliHLTComponentDataType& type);
36
37 /**
38 * This constructs a domain entry with a particular data type and origin. The
39 * specification is marked as an 'any' wild card value, indicating any data
40 * block specification will match.
41 * \param blocktype The data block type string of the data block. The value
42 * kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
43 * \param origin The origin of the data block, such as the detector name.
44 * The value kAliHLTDataOriginAny can be used to specify the any origin
45 * wild card value.
46 */
47 AliHLTDomainEntry(const char* blocktype, const char* origin);
48
49 /**
50 * This constructs a domain entry with a particular data type, origin and
51 * specification.
52 * \param type The data block type and origin to use.
53 * \param spec The data block specification to use.
54 */
55 AliHLTDomainEntry(const AliHLTComponentDataType& type, UInt_t spec);
56
57 /**
58 * This constructs a domain entry with a particular data type, origin and
59 * specification.
60 * \param blocktype The data block type string of the data block. The value
61 * kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
62 * \param origin The origin of the data block, such as the detector name.
63 * The value kAliHLTDataOriginAny can be used to specify the any origin
64 * wild card value.
65 * \param spec The data block specification to use.
66 */
67 AliHLTDomainEntry(const char* blocktype, const char* origin, UInt_t spec);
68
69 /**
70 * The constructor deep copies the domain entry but overrides the exclude flag.
71 * \param exclude The new exclude flag value to use. If 'true' then the entry
72 * forms part of a trigger domain exclusion rule.
73 * \param domain The domain entry to copy from.
74 */
75 AliHLTDomainEntry(Bool_t exclude, const AliHLTDomainEntry& domain);
76
77 /**
78 * This constructs a domain entry with a particular data type and exclude flag
79 * value, but an 'any' wild card value is used for the data block specification.
80 * \param exclude The exclude flag value to use. If 'true' then the entry forms
81 * part of a trigger domain exclusion rule.
82 * \param type The data block type and origin to use.
83 */
84 AliHLTDomainEntry(Bool_t exclude, const AliHLTComponentDataType& type);
85
86 /**
87 * This constructs a domain entry with a particular data type, origin and exclusion
88 * value. The specification is marked as an 'any' wild card value, indicating any
89 * data block specification will match.
90 * \param exclude The exclude flag value to use. If 'true' then the entry forms
91 * part of a trigger domain exclusion rule.
92 * \param blocktype The data block type string of the data block. The value
93 * kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
94 * \param origin The origin of the data block, such as the detector name.
95 * The value kAliHLTDataOriginAny can be used to specify the any origin
96 * wild card value.
97 */
98 AliHLTDomainEntry(Bool_t exclude, const char* blocktype, const char* origin);
99
100 /**
101 * This constructs a domain entry with a particular exclude flag value, data type,
102 * origin and specification.
103 * \param exclude The exclude flag value to use. If 'true' then the entry forms
104 * part of a trigger domain exclusion rule.
105 * \param type The data block type and origin to use.
106 * \param spec The data block specification to use.
107 */
108 AliHLTDomainEntry(Bool_t exclude, const AliHLTComponentDataType& type, UInt_t spec);
109
110 /**
111 * This constructs a domain entry with a particular exclude flag value, data type,
112 * origin and specification.
113 * \param exclude The exclude flag value to use. If 'true' then the entry forms
114 * part of a trigger domain exclusion rule.
115 * \param blocktype The data block type string of the data block. The value
116 * kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
117 * \param origin The origin of the data block, such as the detector name.
118 * The value kAliHLTDataOriginAny can be used to specify the any origin
119 * wild card value.
120 * \param spec The data block specification to use.
121 */
122 AliHLTDomainEntry(Bool_t exclude, const char* blocktype, const char* origin, UInt_t spec);
123
124 /**
125 * Default destructor.
126 */
127 virtual ~AliHLTDomainEntry();
128
129 /**
130 * Returns the value of the exclude flag.
131 * \return true if the domain entry is an exclusion and the matching data blocks
132 * should not form part of the trigger domain for readout.
133 */
134 Bool_t Exclusive() const { return fExclude; }
135
136 /**
137 * Sets the value of the exclude flag.
138 * \param value The value to set the flag to. If 'true' then the domain entry
139 * is an exclusion and the matching data blocks should not form part of the
140 * trigger domain for readout. If 'false' then the matching data blocks should
141 * form part of the readout.
142 */
143 void Exclusive(Bool_t value) { fExclude = value; }
144
145 /**
146 * Indicates if the domain entry is an inclusive rule.
147 * \return true if the domain entry is an inclusion and the matching data blocks
148 * should form part of the trigger domain for readout.
149 */
150 Bool_t Inclusive() const { return ! fExclude; }
151
152 /**
153 * Used to set if the domain entry should be an inclusion or exclusion.
154 * \param value The value to set. If 'true' then the domain entry is an inclusion
155 * and the matching data blocks should form part of the trigger domain for readout.
156 * If 'false' then the matching data blocks should not form part of the readout.
157 */
158 void Inclusive(Bool_t value) { fExclude = ! value; }
159
160 /**
161 * Returns the data type of the domain entry.
162 * \return The data type that data blocks are compared to.
163 */
164 const AliHLTComponentDataType& DataType() const { return fType; }
165
166 /**
167 * Indicates if the specification is used.
168 * \return true if the specification is used when matching data blocks, otherwise
169 * false, indicating that the specification is treated as a wild card value.
170 */
171 Bool_t IsValidSpecification() const { return fUseSpec; }
172
173 /**
174 * Returns the data block specification of the domain entry.
175 * \return The data block specification that data blocks are compared to.
176 */
177 UInt_t Specification() const { return fSpecification; }
178
179 /**
180 * The copy operator performs a deep copy.
181 * \param domain The domain entry to copy from.
182 */
183 AliHLTDomainEntry& operator = (const AliHLTDomainEntry& domain);
184
185 /**
186 * The comparison operator checks to see if two domain entries match.
187 * \param rhs The right hand side domain entry to compare to.
188 * \return true if the domain entries are identical or if they overlap (match)
189 * due to wild card values. False is returned if there is absolutely no
190 * overlap between this and the right hand side domain entries.
191 */
192 bool operator == (const AliHLTDomainEntry& rhs) const
193 {
194 return (fType == rhs.fType) && (fUseSpec && rhs.fUseSpec ? fSpecification == rhs.fSpecification : true);
195 }
196
197 /**
198 * The comparison operator checks to see if two domain entries do not match.
199 * \param rhs The right hand side domain entry to compare to.
200 * \return true if the domain entries do not overlap (match) in any way, also
201 * after considering any wild card values. False is returned if the entries
202 * are identical or if they overlap due to wild card values.
203 */
204 bool operator != (const AliHLTDomainEntry& rhs) const
205 {
206 return ! this->operator == (rhs);
207 }
208
209 /**
210 * The comparison operator checks to see if the data block matches the domain entry.
211 * \note The data block's specification is treated as exact and never as a wild card
212 * 'any' value. To be able to treat the specification as 'any', create a new
213 * AliHLTDomainEntry object with the
214 * \code AliHLTDomainEntry(const AliHLTComponentDataType& type) \endcode
215 * constructor, using the data blocks type for the <i>type</i> parameter.
216 * With the new AliHLTDomainEntry object one can make the required wild card comparison.
217 * \param block The data block to compare to.
218 * \return true if the data block matches the domain entry and false otherwise.
219 */
220 bool operator == (const AliHLTComponentBlockData* block) const
221 {
222 return (fType == block->fDataType) && (fUseSpec ? fSpecification == block->fSpecification : true);
223 }
224
225 /**
226 * The comparison operator checks to see if the data block does not match the domain entry.
227 * \note The data block's specification is treated as exact and never as a wild card
228 * 'any' value. To be able to make the required comparison treating the specification
229 * as 'any' try the following code:
230 * \code
231 * AliHLTComponentBlockData* block; // assumed initialised.
232 * AliHLTDomainEntry entryToCompareTo; // assumed initialised.
233 * AliHLTDomainEntry newEntryForBlock(block->fDataType);
234 * bool comparisonResult = (entryToCompareTo == newEntryForBlock);
235 * \endcode
236 * \param block The data block to compare to.
237 * \return true if the data block matches the domain entry and false otherwise.
238 */
239 bool operator != (const AliHLTComponentBlockData* block) const
240 {
241 return ! this->operator == (block);
242 }
243
244 /**
245 * This typecast operator returns the data type of the domain entry.
246 * \return Copy of the data block type structure.
247 */
248 operator AliHLTComponentDataType () const { return fType; }
249
250 /**
251 * Compares this domain entry to another to see if they are identical.
252 * \param rhs The domain entry to compare to.
253 * \return True if the two domain entries have the same data types, origins and
254 * specifications, character for character, ignoring wild card symantics.
255 * False is returned otherwise.
256 * \note No comparison is done for the exclude flag.
257 */
258 bool IdenticalTo(const AliHLTDomainEntry& rhs) const;
259
260 /**
261 * Compares this domain entry is a subset of the given entry.
262 * If we consider the possibility of wild card characters, then the domain entry
263 * can be thought of as a set of possible data block entries. This operator
264 * therefore effectively implements set logic.
265 * \param rhs The domain entry to compare to.
266 * \return True if the this domain entry is either identical to <i>rhs</i>, i.e.
267 * IdenticalTo(rhs) returns true, or if <i>rhs</i> can match to all data blocks
268 * that this domain entry can match to, but also <i>rhs</i> can match to other
269 * data blocks that this entry cannot match to.
270 * \note No comparison is done for the exclude flag.
271 */
272 bool SubsetOf(const AliHLTDomainEntry& rhs) const;
273
274 /**
275 * Finds the set intersection between this domain entry and 'rhs', and puts the
276 * intersection value into 'result'.
277 * If we consider the possibility of wild card characters, then the domain entry
278 * can be thought of as a set of possible data block entries. This operator
279 * therefore effectively implements the set intersection.
280 * \param rhs <i>[in]</i> The domain entry to compare to.
281 * \param result <i>[out]</i> The resulting intersect is written into this
282 * variable if this method returns true. The contents is not modified if
283 * there is no intersect and this method returns false.
284 * \return true is returned if there is a intersect between the domain entries
285 * and false otherwise.
286 */
287 bool IntersectWith(const AliHLTDomainEntry& rhs, AliHLTDomainEntry& result) const;
288
289 /**
290 * Inherited from TObject. Prints the domain entry in the following format:<br>
291 * \<type\>:\<origin\>:\<specification\><br>
292 * where<br>
293 * \<type\> is the 8 character data block type.<br>
294 * \<origin\> is the 4 character data block origin.<br>
295 * \<specification\> is the data block specification printed in hexadecimal format.<br>
296 * The "\0" string is printed for NULL characters in the type and origin strings.
297 * While "********" is printed for the 'any' data type wild card value, "****"
298 * is printed for the 'any' origin wild card value and "**********" is printed
299 * for the 'any' specification wild card.
300 * \param option If set to "noendl" then no end of line is printed.
301 */
302 virtual void Print(Option_t* option = "") const;
303
304 private:
305
306 Bool_t fExclude; /// Indicates if the domain entry is exclusive, indicating data blocks that should not be readout.
307 Bool_t fUseSpec; /// Indicates if the fSpecification field should be used. If not set then the specification is treated as an 'any' wild card value.
308 AliHLTComponentDataType fType; /// The HLT data block type.
309 UInt_t fSpecification; /// The data block specification to match.
310
311 ClassDef(AliHLTDomainEntry, 1) // A data block type and possible specification entry, which forms part of a trigger domain.
312};
313
314#endif // ALIHLTDOMAINENTRY_H
315