ALIROOT-5600 - skip non-participating detector modules
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTOnlineConfiguration.h
CommitLineData
ab162f34 1//-*- Mode: C++ -*-
2// $Id$
3
4#ifndef ALIHLTONLINECONFIGURATION_H
5#define ALIHLTONLINECONFIGURATION_H
6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* See cxx source for full Copyright notice *
9
f84fefa5 10/// @file AliHLTOnlineConfiguration.h
11/// @author Matthias Richter
12/// @author Lars Christian Raae
13/// @date
14/// @brief Description of the HLT online configuration
ab162f34 15
f84fefa5 16#include <vector>
17
18#include "AliHLTLogging.h"
19#include <TObject.h>
20#include <TArrayC.h>
21#include <TList.h>
22#include <TXMLNode.h>
ab162f34 23
24/**
25 * @class AliHLTOnlineConfiguration
26 * @brief Description of the HLT online configuration
27 * This class wraps an online HLT configuration file for storage in a
28 * CDB object.
29 *
30 * Ideas:
31 * The class provides easy access to the XML tags of the configuration through
32 * an XML parser.
33 *
34 * The online configuration is translated into a tree like configuration
35 * structure. The Draw function can be used to create a graph.
36 *
37 * The xml configuration is loaded into an internal TArrayC buffer, which
38 * is automatically compressed depending on the compression level used for
39 * root file storage. Later extension will be the implementation of a custom
40 * Streamer function implementing the most efficient compression.
41 */
f84fefa5 42class AliHLTOnlineConfiguration : public TObject, public AliHLTLogging {
ab162f34 43 public:
44 /// standard constructor
45 AliHLTOnlineConfiguration();
46 /// destructor
47 virtual ~AliHLTOnlineConfiguration();
48
49 /// load configuration from file
50 int LoadConfiguration(const char* filename);
51
52 /// compress the xml buffer
53 int Compress();
54
f84fefa5 55 /// uncompress the xml buffer
ab162f34 56 int Uncompress();
f84fefa5 57
58 /// parse the xml buffer
59 int Parse();
b4a85b5b 60
61 /// get default chains (sources of HLTOutFormatter)
62 const char* GetDefaultChains() const {return fDefaultChains.Data();}
63
64 /// get component libraries
fc79e537 65 TString GetComponentLibraries();
ab162f34 66
67 /// overloaded from TObject, print info
68 virtual void Print(const char* options) const;
69
70 /// overloaded from TObject, more crude data dump
71 virtual void Dump() const;
72
73 /// overloaded from TObject, clear object
74 virtual void Clear(Option_t * option="");
75
76 /// overloaded from TObject, clone object
77 virtual TObject *Clone(const char *newname="") const;
78
79 /// overloaded from TObject, copy object
80 virtual void Copy(TObject &object) const;
81
82 /// overloaded from TObject, draw graph of the configuration
83 virtual void Draw(Option_t *option="");
84
85 /// custom status bits of TObject
86 /// bit 14 to 23 can be freely used
87 /// use functions SetBit, ResetBit, TestBit
88 enum {
89 kLoaded = BIT(14), // xml buffer is loaded
90 kCompressed = BIT(15), // xml buffer is compressed
91 kParsed = BIT(16), // already parsed
92 };
93
94 private:
f84fefa5 95 /// buffer for XML configuration
96 TArrayC fXMLBuffer;
97 /// size of XML buffer
d6fd9360 98 UInt_t fXMLSize;
f84fefa5 99 /// list of parsed configuration entries
100 TList fConfEntryList;
b4a85b5b 101 /// default chains (sources of HLTOutFormatter)
102 TString fDefaultChains;
f84fefa5 103
104 /**
105 * Parse XML configuration.
106 * @param node XML root node of configuration
107 * @return
108 * -EINVAL if unparsable or empty configuration
109 * -EPROTO if no configuration is loaded
110 * 0 if any elements were successfully parsed
111 */
112 int ParseConfiguration(TXMLNode* node);
113
114 /**
115 * Parse XML configuration entry.
116 * @param node XML root node of entry
117 * @param id online component ID
b4a85b5b 118 * @param type online component type
f84fefa5 119 * @return
120 * -EINVAL if parsing error
121 * 0 if entry was successfully parsed
122 */
b4a85b5b 123 int ParseEntry(TXMLNode* node, const char* id, const char* type);
f84fefa5 124
125 /**
126 * Parse standard component configuration.
127 * @param id online component ID
b4a85b5b 128 * @param type online component type
f84fefa5 129 * @param cmd online command
130 * @param sources component sources
131 * @param nodes online computing nodes
132 * @return
133 * -EINVAL if parsing error
134 * 0 if entry was successfully parsed
135 */
b4a85b5b 136 int ParseStandardComponent(const char* id, const char* type, const char* cmd,
137 TString& sources, TString& nodes);
f84fefa5 138
139 /**
140 * Parse RORCPublisher configuration.
141 * @param id online component ID
b4a85b5b 142 * @param type online component type
f84fefa5 143 * @param cmd online command
144 * @param sources component sources
145 * @param nodes online computing nodes
146 * @return
147 * -EINVAL if parsing error
148 * 0 if entry was successfully parsed
149 */
b4a85b5b 150 int ParseRORCPublisher(const char* id, const char* type, const char* cmd,
151 TString& sources, TString& nodes);
f84fefa5 152
153 /**
154 * Parse TCPDumpSubscriber configuration.
155 * @param id online component ID
b4a85b5b 156 * @param type online component type
f84fefa5 157 * @param cmd online command
158 * @param sources component sources
159 * @param nodes online computing nodes
160 * @return
161 * -EINVAL if parsing error
162 * 0 if entry was successfully parsed
163 */
b4a85b5b 164 int ParseTCPDumpSubscriber(const char* id, const char* type, const char* cmd,
165 TString& sources, TString& nodes);
f84fefa5 166
167 /**
168 * Parse Relay configuration.
169 * @param id online component ID
b4a85b5b 170 * @param type online component type
f84fefa5 171 * @param cmd online command
172 * @param sources component sources
173 * @param nodes online computing nodes
174 * @return
175 * -EINVAL if parsing error
176 * 0 if entry was successfully parsed
177 */
b4a85b5b 178 int ParseRelay(const char* id, const char* type, const char* cmd,
179 TString& sources, TString& nodes);
f84fefa5 180
181 /**
182 * Parse HLTOutFormatter configuration.
183 * @param id online component ID
b4a85b5b 184 * @param type online component type
f84fefa5 185 * @param cmd online command
186 * @param sources component sources
187 * @param nodes online computing nodes
188 * @return
189 * -EINVAL if parsing error
190 * 0 if entry was successfully parsed
191 */
b4a85b5b 192 int ParseHLTOutFormatter(const char* id, const char* type, const char* cmd,
193 TString& sources, TString& nodes);
f84fefa5 194
195 /**
196 * Parse HLTOutWriterSubscriber configuration.
197 * @param id online component ID
b4a85b5b 198 * @param type online component type
f84fefa5 199 * @param cmd online command
200 * @param sources component sources
201 * @param nodes online computing nodes
202 * @return
203 * -EINVAL if parsing error
204 * 0 if entry was successfully parsed
205 */
b4a85b5b 206 int ParseHLTOutWriterSubscriber(const char* id, const char* type,
207 const char* cmd, TString& sources, TString& nodes);
ab162f34 208
209 ClassDef(AliHLTOnlineConfiguration, 1); // description of HLT online configuration
210};
211
212#endif