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 AliHLTGlobalTrigger.cxx
18 /// @author Artur Szostak <artursz@iafrica.com>
20 /// @brief Implementation of the AliHLTGlobalTrigger base class.
22 /// The AliHLTGlobalTriggerComponent class is an abstract class from which a
23 /// derived class is constructed by AliHLTTriggerMenu on the fly. The derived
24 /// class then implements triggering based on the particular trigger menu.
26 #include "AliHLTGlobalTrigger.h"
27 #include "AliHLTGlobalTriggerDecision.h"
30 ClassImp(AliHLTGlobalTrigger)
32 // Static factory array.
33 AliHLTGlobalTrigger::Factory*
34 AliHLTGlobalTrigger::Factory::fFactory[AliHLTGlobalTrigger::Factory::kMaxFactories]
35 = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
38 AliHLTGlobalTrigger::AliHLTGlobalTrigger() :
41 // Default constructor.
45 AliHLTGlobalTrigger::~AliHLTGlobalTrigger()
47 // Default destructor.
51 AliHLTGlobalTrigger* AliHLTGlobalTrigger::Factory::CreateNew(const char* name)
53 // Creates a new instance of the named trigger class.
55 for (int i = 0; i < kMaxFactories; i++)
57 if (fFactory[i] != NULL)
59 if (strcmp(fFactory[i]->ClassName(), name) == 0)
61 return fFactory[i]->New();
69 AliHLTGlobalTrigger::Factory::Factory()
71 // Default constructor resisters the class factory.
73 for (int i = 0; i < kMaxFactories; i++)
75 if (fFactory[i] == NULL)
82 HLTFatal("Trying to register too many global trigger factories.");
86 AliHLTGlobalTrigger::Factory::~Factory()
88 // The default destructor deregisters the factory.
90 for (int i = 0; i < kMaxFactories; i++)
92 if (fFactory[i] == this)
99 HLTFatal("Could not find factory to deregister.");