]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTGlobalTriggerConfig.cxx
Adding an extra AddSymbol method for convenience.
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTriggerConfig.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * ALICE Experiment at CERN, All rights reserved.                         *
4  *                                                                        *
5  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
6  *                  for The ALICE HLT Project.                            *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /// @file   AliHLTGlobalTriggerConfig.cxx
18 /// @author Artur Szostak <artursz@iafrica.com>
19 /// @date   28 Dec 2008
20 /// @brief  Implementation of the AliHLTGlobalTriggerConfig class.
21 ///
22 /// The AliHLTGlobalTriggerConfigComponent class is an interface class used to create
23 /// global HLT trigger menu configurations.
24
25 #include "AliHLTGlobalTriggerConfig.h"
26 #include "AliHLTTriggerMenu.h"
27 #include "Riostream.h"
28
29 ClassImp(AliHLTGlobalTriggerConfig)
30
31 AliHLTTriggerMenu* AliHLTGlobalTriggerConfig::fgMenu = NULL;
32
33
34 AliHLTGlobalTriggerConfig::AliHLTGlobalTriggerConfig(const char* name)
35 {
36   // Default constructor.
37   
38   NewMenu(name);
39 }
40
41
42 AliHLTGlobalTriggerConfig::~AliHLTGlobalTriggerConfig()
43 {
44   // Default destructor.
45 }
46
47
48 void AliHLTGlobalTriggerConfig::NewMenu(const char* name)
49 {
50   // Creates a new trigger menu.
51   
52   if (fgMenu != NULL)
53   {
54     delete fgMenu;
55     fgMenu = NULL;
56   }
57   fgMenu = new AliHLTTriggerMenu;
58   fgMenu->Name(name);
59 }
60
61
62 void AliHLTGlobalTriggerConfig::Clear()
63 {
64   // Deletes the current trigger menu.
65   
66   if (fgMenu != NULL)
67   {
68     delete fgMenu;
69     fgMenu = NULL;
70   }
71 }
72
73
74 void AliHLTGlobalTriggerConfig::AddSymbol(
75     const char* name, const char* type, const char* defaultExpr
76   )
77 {
78   // Adds a new constant symbol to the trigger menu.
79   
80   if (fgMenu == NULL) NewMenu("");
81   
82   AliHLTTriggerMenuSymbol entry;
83   entry.Name(name);
84   entry.Type(type);
85   entry.ObjectClass("");
86   entry.AssignExpression("");
87   entry.DefaultValue(defaultExpr);
88   fgMenu->AddSymbol(entry);
89 }
90
91
92 void AliHLTGlobalTriggerConfig::AddSymbol(
93     const char* name, const char* type, const char* assignExpr,
94     const char* defaultExpr, const char* className
95   )
96 {
97   // Adds a new symbol to the trigger menu.
98   
99   if (fgMenu == NULL) NewMenu("");
100   
101   AliHLTTriggerMenuSymbol entry;
102   entry.Name(name);
103   entry.Type(type);
104   entry.ObjectClass(className);
105   entry.AssignExpression(assignExpr);
106   entry.DefaultValue(defaultExpr);
107   fgMenu->AddSymbol(entry);
108 }
109
110
111 void AliHLTGlobalTriggerConfig::AddSymbol(
112     const char* name, const char* type, const char* assignExpr,
113     const char* defaultExpr, const char* className,
114     const AliHLTComponentDataType& blockType
115   )
116 {
117   // Adds a new symbol to the trigger menu.
118   
119   if (fgMenu == NULL) NewMenu("");
120   
121   AliHLTTriggerMenuSymbol entry;
122   entry.Name(name);
123   entry.Type(type);
124   entry.ObjectClass(className);
125   entry.AssignExpression(assignExpr);
126   entry.DefaultValue(defaultExpr);
127   entry.BlockType(blockType);
128   fgMenu->AddSymbol(entry);
129 }
130
131
132 void AliHLTGlobalTriggerConfig::AddSymbol(
133     const char* name, const char* type, const char* assignExpr,
134     const char* defaultExpr, const char* className,
135     const AliHLTComponentDataType& blockType, UInt_t spec
136   )
137 {
138   // Adds a new symbol to the trigger menu.
139   
140   if (fgMenu == NULL) NewMenu("");
141   
142   AliHLTTriggerMenuSymbol entry;
143   entry.Name(name);
144   entry.Type(type);
145   entry.ObjectClass(className);
146   entry.AssignExpression(assignExpr);
147   entry.DefaultValue(defaultExpr);
148   entry.BlockType(blockType, spec);
149   fgMenu->AddSymbol(entry);
150 }
151
152
153 void AliHLTGlobalTriggerConfig::AddSymbol(
154     const char* name, const char* type, const char* assignExpr,
155     const char* defaultExpr, const char* className,
156     const char* blockType, const char* origin
157   )
158 {
159   // Adds a new symbol to the trigger menu.
160   
161   if (fgMenu == NULL) NewMenu("");
162   
163   AliHLTTriggerMenuSymbol entry;
164   entry.Name(name);
165   entry.Type(type);
166   entry.ObjectClass(className);
167   entry.AssignExpression(assignExpr);
168   entry.DefaultValue(defaultExpr);
169   entry.BlockType(blockType, origin);
170   fgMenu->AddSymbol(entry);
171 }
172
173
174 void AliHLTGlobalTriggerConfig::AddSymbol(
175     const char* name, const char* type, const char* assignExpr,
176     const char* defaultExpr, const char* className,
177     const char* blockType, const char* origin, UInt_t spec
178   )
179 {
180   // Adds a new symbol to the trigger menu.
181   
182   if (fgMenu == NULL) NewMenu("");
183   
184   AliHLTTriggerMenuSymbol entry;
185   entry.Name(name);
186   entry.Type(type);
187   entry.ObjectClass(className);
188   entry.AssignExpression(assignExpr);
189   entry.DefaultValue(defaultExpr);
190   entry.BlockType(blockType, origin, spec);
191   fgMenu->AddSymbol(entry);
192 }
193
194
195 void AliHLTGlobalTriggerConfig::AddItem(
196     const char* conditionExpr, const char* domainExpr, UInt_t prescalar,
197     const char* description
198   )
199 {
200   // Adds a new entry to the trigger menu.
201   
202   if (fgMenu == NULL) NewMenu("");
203   
204   AliHLTTriggerMenuItem entry;
205   entry.TriggerCondision(conditionExpr);
206   entry.MergeExpression(domainExpr);
207   entry.PreScalar(prescalar);
208   if (description != NULL) entry.Description(description);
209   fgMenu->AddItem(entry);
210 }
211
212
213 void AliHLTGlobalTriggerConfig::AddItem(
214     const char* conditionExpr, const char* domainExpr, const char* description
215   )
216 {
217   // Adds a new entry to the trigger menu.
218   
219   if (fgMenu == NULL) NewMenu("");
220   
221   AliHLTTriggerMenuItem entry;
222   entry.TriggerCondision(conditionExpr);
223   entry.MergeExpression(domainExpr);
224   if (description != NULL) entry.Description(description);
225   fgMenu->AddItem(entry);
226 }
227
228
229 void AliHLTGlobalTriggerConfig::SetDefaultTriggerDescription(const char* description)
230 {
231   // Sets the default trigger decription.
232   
233   if (fgMenu == NULL) NewMenu("");
234   fgMenu->DefaultDescription(description);
235 }
236
237
238 void AliHLTGlobalTriggerConfig::SetDefaultTriggerDomain(const AliHLTTriggerDomain& domain)
239 {
240   // Sets the default trigger domain.
241   
242   if (fgMenu == NULL) NewMenu("");
243   fgMenu->DefaultTriggerDomain(domain);
244 }
245
246
247 AliHLTTriggerDomain& AliHLTGlobalTriggerConfig::DefaultTriggerDomain()
248 {
249   // Returns the default trigger domain for the current trigger menu.
250   
251   if (fgMenu == NULL) NewMenu("");
252   return fgMenu->DefaultTriggerDomain();
253 }
254
255
256 void AliHLTGlobalTriggerConfig::Print(Option_t* option) const
257 {
258   // Prints the contents of the current trigger menu being manipulated.
259   
260   if (fgMenu != NULL)
261   {
262     fgMenu->Print(option);
263   }
264   else
265   {
266     cout << "No trigger menu currently being configured, it is empty." << endl;
267   }
268 }
269