+//-*- Mode: C++ -*-
// @(#) $Id$
#ifndef ALIHLTCONFIGURATION_H
#define ALIHLTCONFIGURATION_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/** @file AliHLTConfiguration.h
@note The class is used in Offline (AliRoot) context
*/
-#include <cerrno>
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
#include <vector>
#include <TObject.h>
#include <TList.h>
* @param component component id
* @param sources blank separated list of source configuration ids
* @param arguments argument string passed to the component at initialization
+ * @param bufsize size of the output buffer in byte, the string can contain a
+ * number prepended by a unit, e.g. 1M, allowed units 'k' and 'M'
*/
AliHLTConfiguration(const char* id, const char* component,
- const char* sources, const char* arguments);
- /** not a valid copy constructor, defined according to effective C++ style */
- AliHLTConfiguration(const AliHLTConfiguration&);
- /** not a valid assignment op, but defined according to effective C++ style */
- AliHLTConfiguration& operator=(const AliHLTConfiguration&);
- /** destructor */
+ const char* sources, const char* arguments,
+ const char* bufsize=NULL);
+ /** copy constructor */
+ AliHLTConfiguration(const AliHLTConfiguration& src);
+ /** assignment op */
+ AliHLTConfiguration& operator=(const AliHLTConfiguration& src);
/** destructor */
virtual ~AliHLTConfiguration();
/**
* Global de-init and cleanup of the global configuration handler
*/
- static int GlobalDeinit();
+ static int GlobalDeinit(AliHLTConfigurationHandler* pHandler);
/*****************************************************************************
* properties of the configuration
* The id is a unique string.
* @return id of the component
*/
- const char* GetComponentID() {return fComponent;}
+ const char* GetComponentID() const {return fComponent;}
+
+ /**
+ * Return the source string.
+ */
+ const char* GetSourceSettings() const {return fStringSources;}
+
+ /**
+ * Return the argument string.
+ */
+ const char* GetArgumentSettings() const {return fArguments;}
/**
* Print status info.
*/
int GetArguments(const char*** pArgv);
+ /**
+ * Get output buffer size.
+ * @return size in byte or -1 if not specified
+ */
+ int GetOutputBufferSize() const {return fBufferSize;}
+
+ /**
+ * Two configurations are considered equal if all properties match
+ */
+ bool operator==(const AliHLTConfiguration& c) const {
+ return (fID==c.fID) && (fComponent==c.fComponent) && (fStringSources==c.fStringSources) && (fArguments==c.fArguments);
+ }
+ bool operator!=(const AliHLTConfiguration& c) const {
+ return !(*this==c);
+ }
+
+ /**
+ * Helper function to build a vector from an argument string.
+ * The function allocates memory for each token. The caller is responsible
+ * for cleaning the strings recursively.
+ * @param arg pointer to argument string
+ * @param argList target to receive the argument list
+ */
+ static int InterpreteString(const char* arg, vector<char*>& argList);
+
protected:
*/
int ExtractArguments();
- /* helper function to build a vector from an argument string
+ /**
+ * Convert buffer size string to number
*/
- int InterpreteString(const char* arg, vector<char*>& argList);
+ int ConvertSizeString(const char* strSize) const;
/** id of this configuration */
- const char* fID;
+ TString fID; // see above
/** component id of this configuration */
- const char* fComponent;
+ TString fComponent; // see above
/** the <i>sources</i> string as passed to the constructor */
- const char* fStringSources;
+ TString fStringSources; // see above
/** number of resolved sources, -1 indicates re-evaluation */
- int fNofSources;
+ int fNofSources; // see above
/** list of sources */
- vector<AliHLTConfiguration*> fListSources;
+ vector<AliHLTConfiguration*> fListSources; // see above
/** iterator for the above list */
- vector<AliHLTConfiguration*>::iterator fListSrcElement;
+ vector<AliHLTConfiguration*>::iterator fListSrcElement; // see above
/**
* The argument string as passed to the constructor.
* be parsed and the separated arguments stored in the @ref fArgv array
* and @ref fArgc member.
*/
- const char* fArguments;
+ TString fArguments; // see above
/** number of arguments */
- int fArgc;
+ int fArgc; // see above
/** argument array */
- char** fArgv;
+ char** fArgv; // see above
+
+ /** size of the output buffer */
+ int fBufferSize; // see above
- static AliHLTConfigurationHandler* fConfigurationHandler;
+ /** the instance of the global configuration handler */
+ static AliHLTConfigurationHandler* fgConfigurationHandler; //! transient
ClassDef(AliHLTConfiguration, 0);
};