]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTModuleAgent.h
coding conventions and documentation
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModuleAgent.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTMODULEAGENT_H
4 #define ALIHLTMODULEAGENT_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /** @file   AliHLTModuleAgent.h
9     @author Matthias Richter
10     @date   
11     @brief  Agent helper class for component libraries.
12     @note   The class is used in Offline (AliRoot) context
13 */
14
15 #include <TObject.h>
16 #include <TList.h>
17 #include "AliHLTLogging.h"
18 #include "AliHLTConfiguration.h"
19 #include "AliHLTConfigurationHandler.h"
20
21 class AliRunLoader;
22
23 /**
24  * @class AliHLTModuleAgent
25  * @brief Agent helper class for HLT sub modules, e.g. PHOS, TPC, Trigger
26  *
27  * This class describes 
28  *
29  * There must be only one agent per module/library.
30  *
31  * @ingroup alihlt_system
32  */
33 class AliHLTModuleAgent : public TObject, public AliHLTLogging {
34  public:
35   /**
36    * standard constructor. The agent is automatically registered in the
37    * global agent manager
38    */
39   AliHLTModuleAgent();
40   /** not a valid copy constructor, defined according to effective C++ style */
41   AliHLTModuleAgent(const AliHLTModuleAgent&);
42   /** not a valid assignment op, but defined according to effective C++ style */
43   AliHLTModuleAgent& operator=(const AliHLTModuleAgent&);
44   /** destructor */
45   virtual ~AliHLTModuleAgent();
46
47   /**
48    * Print status info.
49    * Short summary on registered agents. This function acts globally on the list
50    * of agents if no specific agent is specified.
51    */
52   static void PrintStatus(const char* agent=NULL);
53
54   /**
55    * Get the first agent in the list
56    * @return  pointer to first agent in the list, NULL if empty
57    */
58   static AliHLTModuleAgent* GetFirstAgent();
59
60   /**
61    * Get the next agent in the list
62    * @return  pointer to next agent in the list, NULL if end of list
63    */
64   static AliHLTModuleAgent* GetNextAgent();
65
66   /**
67    * Register all configurations belonging to this module with the
68    * AliHLTConfigurationHandler. The agent can adapt the configurations
69    * to be registered to the current AliRoot setup by checking the
70    * runloader.
71    * @param handler   [in] the configuration handler
72    * @param runloader [in] AliRoot runloader
73    * @return neg. error code if failed
74    */
75   virtual int CreateConfigurations(AliHLTConfigurationHandler* handler,
76                                    AliRunLoader* runloader=NULL) const;
77
78   /**
79    * Get the top configurations belonging to this module.
80    * A top configuration describes a processing chain. It can simply be
81    * described by the last configuration(s) in the chain. 
82    * The agent can adapt the configurations to be registered to the current
83    * AliRoot setup by checking the runloader.
84    * @param runloader  [in] AliRoot runloader
85    * @return string containing the top configurations separated by blanks
86    */
87   virtual const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const;
88
89   /**
90    * Component libraries which the configurations of this agent depend on.
91    * @return list of component libraries as a blank-separated string.
92    */
93   virtual const char* GetRequiredComponentLibraries() const;
94
95   /**
96    * Register componets.
97    * This method can be used to register components for the module instead
98    * of the 'static object approach'. Registration is don by passing a
99    * sample object to @ref AliHLTComponentHandler::RegisterComponent<br>
100    * \em Note: The sample object is owned by the agent, make sure to delete
101    * it.
102    */
103   virtual int RegisterComponents(AliRunLoader* runloader=NULL) const;
104
105  protected:
106
107  private:
108   /**
109    * Register agent in the global list.
110    * @return neg. error code if failed
111    */
112   static int Register(AliHLTModuleAgent* pAgent);
113
114   /**
115    * Unregister agent in the global list.
116    * @return neg. error code if failed
117    */
118   static int Unregister(AliHLTModuleAgent* pAgent);
119
120   /** the list of active agents */
121   static TList fgAgentList;
122
123   /** the current object link (list position) */
124   static TObjLink* fgCurrentLnk;
125
126   ClassDef(AliHLTModuleAgent, 0);
127 };
128
129 #endif