Line data Source code
1 : //-*- Mode: C++ -*-
2 : // $Id$
3 : #ifndef ALIHLTTRIGGERMENUSYMBOL_H
4 : #define ALIHLTTRIGGERMENUSYMBOL_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 AliHLTTriggerMenuSymbol.h
10 : /// @author Artur Szostak <artursz@iafrica.com>
11 : /// @date 28 Dec 2008
12 : /// @brief Declaration of the AliHLTTriggerMenuSymbol class.
13 :
14 : #include "TObject.h"
15 : #include "TString.h"
16 : #include "AliHLTDataTypes.h"
17 : #include "AliHLTDomainEntry.h"
18 :
19 : /**
20 : * \class AliHLTTriggerMenuSymbol
21 : * The trigger menu symbol is used to either label a TObject variable found in
22 : * one of the input data blocks or create a constant object that can be used in
23 : * various trigger menu expressions.
24 : * It essentially represents a C++ variable with a name and type. This is filled
25 : * with the information found in an input TObject, as specified by the
26 : * <i>AssignExpression()</i> method. If nothing can be assigned because an
27 : * appropriate TObject cannot be found, then a default value is used.
28 : * The correct TObject is found by searching for a TObject with a matching class
29 : * type as given by <i>ObjectClass()</i> from the input data blocks. The input
30 : * data block must also have the data block type and specification match those
31 : * given in the <i>BlockType()</i> method.
32 : *
33 : * The symbol name should normally be a valid C++ symbol name. This normally
34 : * excludes the minus sign from being used in the name. However, since CTP trigger
35 : * names use the minus sign extensively, the minus sign is also allowed in HLT
36 : * trigger menu symbol names. This is implicitly converted to an underscore in the
37 : * name. However, the original name with minus signs is retained and available
38 : * with the <i>RealName()</i> method. In addition, the <i>RealName</i> is used
39 : * for display purposes.
40 : * \note Trigger menu symbols names that use minus signs are synonymous to those
41 : * that use understores in the same locations. For this reason it is better to use
42 : * one or the other form, but not both at the same time.
43 : * \note The following symbol names are reserved and should not be used:
44 : * _domain_
45 : * _description_
46 : * _item_result_
47 : * _group_result_
48 : * _previous_match_
49 : * _trigger_matched_
50 : * FillFromMenu
51 : * NewEvent
52 : * Add
53 : * CalculateTriggerDecision
54 : * GetCounters
55 : * SetCounters
56 : * CreateNew
57 : */
58 0 : class AliHLTTriggerMenuSymbol : public TObject
59 : {
60 : public:
61 :
62 : /**
63 : * Default constructor.
64 : */
65 : AliHLTTriggerMenuSymbol();
66 :
67 : /**
68 : * Default destructor.
69 : */
70 : virtual ~AliHLTTriggerMenuSymbol();
71 :
72 : /**
73 : * Inherited from TObject, this prints the contents of the symbol.
74 : * \param option Can be "compact", which will print in the compact format.
75 : */
76 : virtual void Print(Option_t* option = "") const;
77 :
78 : /**
79 : * Returns the real name which can differ from the symbol name
80 : * by '-' characters instead of '_'. This approach has been introduced
81 : * to allow trigger and item names containing '-' characters and thus
82 : * violating the C++ naming conventions.
83 : */
84 : const char* RealName() const;
85 :
86 : /**
87 : * Returns the valid C++ symbol name.
88 : */
89 0 : const char* Name() const { return fName.Data(); }
90 :
91 : /**
92 : * Set the symbol name. It can contain '-' characters.
93 : */
94 : void Name(const char* value);
95 :
96 : /**
97 : * Returns the symbol data type.
98 : */
99 0 : const char* Type() const { return fType.Data(); }
100 :
101 : /**
102 : * Set the symbol data type.
103 : */
104 0 : void Type(const char* value) { fType = value; }
105 :
106 : /**
107 : * Returns the data block type and specification from which the symbol is fetched.
108 : */
109 0 : const AliHLTDomainEntry& BlockType() const { return fBlockType; }
110 :
111 : /**
112 : * Set the data block type and specification from which the symbol is fetched.
113 : * \param type The data block type and origin to use.
114 : */
115 : void BlockType(const AliHLTComponentDataType& type)
116 : {
117 0 : fBlockType = AliHLTDomainEntry(type);
118 0 : }
119 :
120 : /**
121 : * Set the data block type and specification from which the symbol is fetched.
122 : * \param blocktype The data block type string of the data block. The value
123 : * kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
124 : * \param origin The origin of the data block, such as the detector name.
125 : * The value kAliHLTDataOriginAny can be used to specify the any origin
126 : * wild card value.
127 : */
128 : void BlockType(const char* blocktype, const char* origin)
129 : {
130 0 : fBlockType = AliHLTDomainEntry(blocktype, origin);
131 0 : }
132 :
133 : /**
134 : * Set the data block type and specification from which the symbol is fetched.
135 : * \param type The data block type and origin to use.
136 : * \param spec The data block specification to use.
137 : */
138 : void BlockType(const AliHLTComponentDataType& type, UInt_t spec)
139 : {
140 0 : fBlockType = AliHLTDomainEntry(type, spec);
141 0 : }
142 :
143 : /**
144 : * Set the data block type and specification from which the symbol is fetched.
145 : * \param blocktype The data block type string of the data block. The value
146 : * kAliHLTAnyDataTypeID can be used to specify the any type wild card value.
147 : * \param origin The origin of the data block, such as the detector name.
148 : * The value kAliHLTDataOriginAny can be used to specify the any origin
149 : * wild card value.
150 : * \param spec The data block specification to use.
151 : */
152 : void BlockType(const char* blocktype, const char* origin, UInt_t spec)
153 : {
154 0 : fBlockType = AliHLTDomainEntry(blocktype, origin, spec);
155 0 : }
156 :
157 : /**
158 : * Returns the class name of the object in the data block.
159 : */
160 0 : const char* ObjectClass() const { return fClass.Data(); }
161 :
162 : /**
163 : * Set the class name of the object in the data block.
164 : */
165 0 : void ObjectClass(const char* value) { fClass = value; }
166 :
167 : /**
168 : * Returns the expression to assign the symbol value.
169 : */
170 0 : const char* AssignExpression() const { return fAssignExpr.Data(); }
171 :
172 : /**
173 : * Set the expression to assign the symbol value.
174 : * The keyword 'this' is used as the place holder of the object in the matched
175 : * data block. For example if we want to get a public attribute names xyz from
176 : * the object to assign to the symbol we would write the assignment expression
177 : * as "this->xyz".
178 : */
179 0 : void AssignExpression(const char* value) { fAssignExpr = value; }
180 :
181 : /**
182 : * Returns the default value expression.
183 : */
184 0 : const char* DefaultValue() const { return fDefaultValue.Data(); }
185 :
186 : /**
187 : * Set the default value expression.
188 : */
189 0 : void DefaultValue(const char* value) { fDefaultValue = value; }
190 :
191 : private:
192 :
193 : TString fName; /// The name of the symbol (Must be a valid C++ variable name but can contain the '-' character as an extention).
194 : TString fType; /// The data type of the symbol (Must be a valid C++ type name).
195 : AliHLTDomainEntry fBlockType; /// The data block type and specification this symbol is fetched from.
196 : TString fClass; /// The class name of the object to read from (Must be a valid C++ class name).
197 : TString fAssignExpr; /// The expression to assign to the symbol (Must be a valid C++ expression).
198 : TString fDefaultValue; /// The default value this symbol is set to (this must be a valid C++ expression).
199 : TString fRealName; /// The name of the symbol, differs from fName by replaced '-' chars.
200 :
201 222 : ClassDef(AliHLTTriggerMenuSymbol, 4) // Trigger menu item for global HLT trigger.
202 : };
203 :
204 : #endif // ALIHLTTRIGGERMENUSYMBOL_H
205 :
|