1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Artur Szostak <artursz@iafrica.com> *
6 * for The ALICE HLT Project. *
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 **************************************************************************/
17 /// @file AliHLTGlobalTriggerConfig.cxx
18 /// @author Artur Szostak <artursz@iafrica.com>
20 /// @brief Implementation of the AliHLTGlobalTriggerConfig class.
22 /// The AliHLTGlobalTriggerConfigComponent class is an interface class used to create
23 /// global HLT trigger menu configurations.
25 #include "AliHLTGlobalTriggerConfig.h"
26 #include "AliHLTTriggerMenu.h"
27 #include "Riostream.h"
29 ClassImp(AliHLTGlobalTriggerConfig)
31 AliHLTTriggerMenu* AliHLTGlobalTriggerConfig::fgMenu = NULL;
34 AliHLTGlobalTriggerConfig::AliHLTGlobalTriggerConfig(const char* name)
36 // Default constructor.
42 AliHLTGlobalTriggerConfig::~AliHLTGlobalTriggerConfig()
44 // Default destructor.
48 void AliHLTGlobalTriggerConfig::NewMenu(const char* name)
50 // Creates a new trigger menu.
57 fgMenu = new AliHLTTriggerMenu;
62 void AliHLTGlobalTriggerConfig::Clear()
64 // Deletes the current trigger menu.
74 void AliHLTGlobalTriggerConfig::AddSymbol(
75 const char* name, const char* type, const char* assignExpr,
76 const char* defaultExpr, const char* className
79 // Adds a new symbol to the trigger menu.
81 if (fgMenu == NULL) NewMenu("");
83 AliHLTTriggerMenuSymbol entry;
86 entry.ObjectClass(className);
87 entry.AssignExpression(assignExpr);
88 entry.DefaultValue(defaultExpr);
89 fgMenu->AddSymbol(entry);
93 void AliHLTGlobalTriggerConfig::AddSymbol(
94 const char* name, const char* type, const char* assignExpr,
95 const char* defaultExpr, const char* className,
96 const AliHLTComponentDataType& blockType
99 // Adds a new symbol to the trigger menu.
101 if (fgMenu == NULL) NewMenu("");
103 AliHLTTriggerMenuSymbol entry;
106 entry.ObjectClass(className);
107 entry.AssignExpression(assignExpr);
108 entry.DefaultValue(defaultExpr);
109 entry.BlockType(blockType);
110 fgMenu->AddSymbol(entry);
114 void AliHLTGlobalTriggerConfig::AddSymbol(
115 const char* name, const char* type, const char* assignExpr,
116 const char* defaultExpr, const char* className,
117 const AliHLTComponentDataType& blockType, UInt_t spec
120 // Adds a new symbol to the trigger menu.
122 if (fgMenu == NULL) NewMenu("");
124 AliHLTTriggerMenuSymbol entry;
127 entry.ObjectClass(className);
128 entry.AssignExpression(assignExpr);
129 entry.DefaultValue(defaultExpr);
130 entry.BlockType(blockType, spec);
131 fgMenu->AddSymbol(entry);
135 void AliHLTGlobalTriggerConfig::AddSymbol(
136 const char* name, const char* type, const char* assignExpr,
137 const char* defaultExpr, const char* className,
138 const char* blockType, const char* origin
141 // Adds a new symbol to the trigger menu.
143 if (fgMenu == NULL) NewMenu("");
145 AliHLTTriggerMenuSymbol entry;
148 entry.ObjectClass(className);
149 entry.AssignExpression(assignExpr);
150 entry.DefaultValue(defaultExpr);
151 entry.BlockType(blockType, origin);
152 fgMenu->AddSymbol(entry);
156 void AliHLTGlobalTriggerConfig::AddSymbol(
157 const char* name, const char* type, const char* assignExpr,
158 const char* defaultExpr, const char* className,
159 const char* blockType, const char* origin, UInt_t spec
162 // Adds a new symbol to the trigger menu.
164 if (fgMenu == NULL) NewMenu("");
166 AliHLTTriggerMenuSymbol entry;
169 entry.ObjectClass(className);
170 entry.AssignExpression(assignExpr);
171 entry.DefaultValue(defaultExpr);
172 entry.BlockType(blockType, origin, spec);
173 fgMenu->AddSymbol(entry);
177 void AliHLTGlobalTriggerConfig::AddItem(
178 const char* conditionExpr, const char* domainExpr, UInt_t prescalar,
179 const char* description
182 // Adds a new entry to the trigger menu.
184 if (fgMenu == NULL) NewMenu("");
186 AliHLTTriggerMenuItem entry;
187 entry.TriggerCondision(conditionExpr);
188 entry.MergeExpression(domainExpr);
189 entry.PreScalar(prescalar);
190 if (description != NULL) entry.Description(description);
191 fgMenu->AddItem(entry);
195 void AliHLTGlobalTriggerConfig::AddItem(
196 const char* conditionExpr, const char* domainExpr, const char* description
199 // Adds a new entry to the trigger menu.
201 if (fgMenu == NULL) NewMenu("");
203 AliHLTTriggerMenuItem entry;
204 entry.TriggerCondision(conditionExpr);
205 entry.MergeExpression(domainExpr);
206 if (description != NULL) entry.Description(description);
207 fgMenu->AddItem(entry);
211 void AliHLTGlobalTriggerConfig::Print(Option_t* option) const
213 // Prints the contents of the current trigger menu being manipulated.
217 fgMenu->Print(option);
221 cout << "No trigger menu currently being configured, it is empty." << endl;