]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTConfiguration.h
- added libAliHLTRCU to default libraries
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTConfiguration.h
index 4da96ef86c444d13c94ed5355050b4335b5eeaae..5a0d4e459f4b26ff82a1072bd7e5bb0adc3c7f09 100644 (file)
+//-*- 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                               */
 
-/* AliHLTConfiguration
-   base class for HLT configurations
- */
+/** @file   AliHLTConfiguration.h
+    @author Matthias Richter
+    @date   
+    @brief  Base class and handling of HLT configurations.
+    @note   The class is used in Offline (AliRoot) context
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
 
-#include <cerrno>
+#include <vector>
 #include <TObject.h>
 #include <TList.h>
 #include "AliHLTDataTypes.h"
 #include "AliHLTLogging.h"
+#include "AliHLTDataBuffer.h"
 
 class AliHLTConfigurationHandler;
-/*****************************************************************************************************
+
+/**
+ * @class AliHLTConfiguration
+ * @brief Description of HLT processing chains.
  *
- * AliHLTConfiguration
+ * This class describes a certain configuration af an HLT processing step
+ * by the following parameters:
+ * - a unique id string/name
+ * - the id of the component
+ * - the ids of the configurations it requires input from
+ * - the arguments, which are passed to the component when it is initialized
  *
- * this class describes a certain configuration af an HLT processing step by the following parameters:
- *  - a unique id string/name
- *  - the id of the component
- *  - the ids of the configurations it requires input from
- *  - the arguments, which are passed to the component when it is initialized
+ * The setup of a configuration requires simply the creation of a global object
+ * of @ref AliHLTConfiguration. The Configuration is automatically registered
+ * in the list of available configurations maintained by the @ref
+ * AliHLTConfigurationHandler. The list is used by to resolve the dependencies
+ * on other configurations. Hierarchies can be built up in an easy way.
  *
- * The setup of a configuration requires simply the creation of a global object of class AliHLTConfiguration.
- * The Configuration is automatically registered in the list of available configurations. The list is used
- * by the handler to resolve the dependencies upon other configurations. Hierarchies can be built up in
- * an easy way.
+ * A configuration is interpreted by the @ref AliHLTConfigurationHandler and
+ * transformed into a Task List.
  *
- * A configuration is interpreted by the Configuration Handler and transformed into a Task List.
+ * @note This class is only used for the @ref alihlt_system.
+ *
+ * @ingroup alihlt_system
  */
 class AliHLTConfiguration : public TObject, public AliHLTLogging {
  public:
+  /**
+   * standard constructor. The configuration is automatically registered in the
+   * global configuration manager
+   */
   AliHLTConfiguration();
-  AliHLTConfiguration(const char* id, const char* component, const char* sources, const char* arguments);
+  /**
+   * constructor. The configuration is automatically registered in the
+   * global configuration manager
+   * @param id         unique id of the configuration
+   * @param component  component id
+   * @param sources    blank separated list of source configuration ids
+   * @param arguments  argument string passed to the component at initialization
+   */
+  AliHLTConfiguration(const char* id, const char* component,
+                     const char* sources, const char* arguments);
+  /** copy constructor */
+  AliHLTConfiguration(const AliHLTConfiguration& src);
+  /** assignment op */
+  AliHLTConfiguration& operator=(const AliHLTConfiguration& src);
+  /** destructor */
   virtual ~AliHLTConfiguration();
 
-  /****************************************************************************************************
+  /*****************************************************************************
    * global initialization
    */
+
+  /**
+   * Global initialization of the configuration handler.
+   */
   static int GlobalInit(AliHLTConfigurationHandler* pHandler);
 
-  static int GlobalDeinit();
+  /**
+   * Global de-init and cleanup of the global configuration handler
+   */
+  static int GlobalDeinit(AliHLTConfigurationHandler* pHandler);
 
-  /****************************************************************************************************
-   * properties
+  /*****************************************************************************
+   * properties of the configuration
    */
 
-  // configuration id, a unique name
-  // overridden TObject function in order to return the configuration name instead of the class name
-  // enables use of TList standard functions
+  /**
+   * Get configuration id, a unique name
+   * This is an overridden TObject function in order to return the configuration
+   * name instead of the class name. Enables use of TList standard functions.
+   * @return configuration id
+   */
   const char *GetName() const;
 
-  // id of the component
-  const char* GetComponentID() {return fComponent;}
+  /**
+   * Get id of the component.
+   * The id is a unique string.
+   * @return id of the component
+   */
+  const char* GetComponentID() const {return fComponent;}
 
-  // print status info
+  /**
+   * Print status info.
+   * Short summary on id, component, sources and unresolved sources.
+   */
   void PrintStatus();
 
-  // get a certain source
+  /**
+   * Get a certain source.
+   * @param  id of the source configuration
+   * @result pointer to the corresponding configuration descriptor
+   */
   AliHLTConfiguration* GetSource(const char* id);
 
-  // try to find a dependency recursively in the list of sources
-  // parameter:
-  //   id - the source to search for
-  //   pTgtList - (optional) target list to receive the dependency tree
-  // result:
-  //   0 if not found
-  //   n found in the n-th level
-  //   dependency list in the target list  
+  /**
+   * Try to find a dependency recursively in the list of sources.
+   * @param id       the source to search for
+   * @param pTgtList (optional) target list to receive the dependency tree
+   * @return
+   *   0 if not found
+   *   n found in the n-th level
+   *   dependency list in the target list  
+   */
   int FollowDependency(const char* id, TList* pTgtList=NULL);
 
-  // get the number of resolved sources
+  /**
+   * Get the number of resolved sources.
+   * @return number of resolved sources
+   */
   int GetNofSources() {return fListSources.size();}
 
-  // 1 if all sources are resolved
-  // try to resolve if bAuto==1 
+  /**
+   * Check resolving status.
+   * @param bAuto resolve if ==1 
+   * @return 1 if all sources resolved
+   */
   int SourcesResolved(int bAuto=0);
 
-  // start iteration and get the first source
+  /**
+   * Start iteration and get the first source.
+   * @result pointer to the first configuration descriptor
+   */
   AliHLTConfiguration* GetFirstSource();
 
-  // continue iteration and get the next source
+  /**
+   * Continue iteration and get the next source.
+   * @result pointer to the next configuration descriptor in the list
+   */
   AliHLTConfiguration* GetNextSource();
 
-  // invalidate a dependency and mark the configuration to be re-evaluted 
+  /**
+   * Invalidate a dependency and mark the configuration to be re-evaluted. 
+   * @param pConf pointer to configuration descriptor
+   */
   int InvalidateSource(AliHLTConfiguration* pConf);
 
-  // mark the configuration to be re-evaluted 
+  /**
+   * Mark the configuration to be re-evaluted.
+   */
   int InvalidateSources() {fNofSources=-1; return 0;}
 
-  // return the arguments array
-  int GetArguments(int* pArgc, const char*** pArgv);
+  /**
+   * Get the arguments array.
+   * @param pArgv   pointer to receive argument array pointer
+   * @return argc if succeeded, neg. error code if failed
+   */
+  int GetArguments(const char*** pArgv);
 
  protected:
   
@@ -108,193 +189,43 @@ class AliHLTConfiguration : public TObject, public AliHLTLogging {
    */
   int ExtractArguments();
 
-  /* helper function to build a vector from an argument string
+  /**
+   * Helper function to build a vector from an argument string
+   * @param arg       pointer to argument string
+   * @param argList   target to receive the argument list
    */
   int InterpreteString(const char* arg, vector<char*>& argList);
 
-  const char* fID;                  // id of this configuration
-  const char* fComponent;           // component id of this configuration
-
-  const char* fStringSources;                             // the 'sources' string as passed to the constructor
-  int fNofSources;
-  vector<AliHLTConfiguration*> fListSources;              // list of sources
-  vector<AliHLTConfiguration*>::iterator fListSrcElement; // iterator for the above list
-
-  const char* fArguments;           // the arguments string as passed to the constructor
-  int fArgc;                        // number of arguments
-  char** fArgv;                     // argument array
-
-  static AliHLTConfigurationHandler* fConfigurationHandler;
+  /** id of this configuration */
+  TString fID;                                                     // see above
+  /** component id of this configuration */
+  TString fComponent;                                              // see above
+
+  /** the <i>sources</i> string as passed to the constructor */
+  TString fStringSources;                                          // see above
+  /** number of resolved sources, -1 indicates re-evaluation */
+  int fNofSources;                                                 // see above
+  /** list of sources */
+  vector<AliHLTConfiguration*> fListSources;                       // see above
+  /** iterator for the above list */
+  vector<AliHLTConfiguration*>::iterator fListSrcElement;          // see above
+
+  /**
+   * The argument string as passed to the constructor.
+   * Specifies the arguments for the Analysys component. The string will
+   * be parsed and the separated arguments stored in the @ref fArgv array
+   * and @ref fArgc member.
+   */
+  TString fArguments;                                              // see above
+  /** number of arguments */
+  int fArgc;                                                       // see above
+  /** argument array */
+  char** fArgv;                                                    // see above
+
+  /** the instance of the global configuration handler */
+  static AliHLTConfigurationHandler* fgConfigurationHandler;       //! transient
 
   ClassDef(AliHLTConfiguration, 0);
 };
 
-struct AliHLTComponent_BlockData;
-class AliHLTComponent;
-class AliHLTComponentHandler;
-
-/*****************************************************************************************************
- *
- * AliHLTTask
- *
- * a task collects all the information which is necessary to process a certain step in the HLT data
- * processing chain:
- * 1. the instance of the component
- * 2. the data buffer which receives the result of the component and provides the data to other
- *    tasks/components
- * 3. a list of all dependencies
- * 4. a list of consumers
- * 5. the task object holds the configuration object 
- */
-class AliHLTTask : public TObject, public AliHLTLogging {
- public:
-  AliHLTTask();
-  AliHLTTask(AliHLTConfiguration* fConf, AliHLTComponentHandler* pCH);
-  virtual ~AliHLTTask();
-
-  /* initialize the task
-   */
-  int Init(AliHLTConfiguration* fConf, AliHLTComponentHandler* pCH);
-
-  // overridden TObject function in order to return the configuration name instead of the class name
-  // enables use of TList standard functions
-  const char *GetName() const;
-
-  /* return pointer to configuration
-   * the tasks holds internally the configuration object, which is returned by the function
-   */
-  AliHLTConfiguration* GetConf();
-
-  /* return pointer to component, which the task internally holds
-   */
-  AliHLTComponent* GetComponent();
-
-  /* find a dependency with name/id 
-   * searches in the list of dependencies for a task
-   * NOTE: the id specifies a CONFIGURATION not a COMPONENT
-   */
-  AliHLTTask* FindDependency(const char* id);
-
-  /* insert block data to the list
-   * the data has to come from a task the current one depend on
-   * result:
-   *    -EEXIST : the block data from this task has already been inserted
-   *    -ENOENT : no dependencies to the task the data is coming from
-   */
-  int InsertBlockData(AliHLTComponent_BlockData* pBlock, AliHLTTask* pSource);
-
-  /* add a dependency for the task
-   * the task which the current task depends on is added to the list
-   * result: 0 if suceeded, neg error code if failed
-   *    -EEXIST : the dependencies already exists
-   *
-   */
-  int SetDependency(AliHLTTask* pDep);
-
-  /* return number of unresolved dependencies
-   * iterate through all the configurations the task depends on and check whether a corresponding
-   * task is available in the list
-   */
-  int CheckDependencies();
-
-  /* check whether the current task depends on the task pTask
-   * result:
-   *     1 the current task depends upon pTask
-   *     0 no dependency
-   *     neg error code if failure
-   */
-  int Depends(AliHLTTask* pTask);
-
-  /* find a target
-   */
-  AliHLTTask* FindTarget(const char* id);
-
-  /* insert task into target list
-   */
-  int SetTarget(AliHLTTask* pDep);
-
-  // build a monolithic array of block data
-  // result: array size, pointer to array in the target pTgt
-  //
-  int BuildBlockDataArray(AliHLTComponent_BlockData*& pTgt);
-
-  /* process the task if all dependencies are resolved
-   * reset the source block data list
-   */
-  //int ProcessTask(...);
-
-  // clear the list of source data blocks
-  // the list of source data blocks has to be cleared at the beginning of 
-  // a new event
-  int ClearSourceBlocks();
-
-  // print the status of the task with component, dependencies and targets
-  void PrintStatus();
-
-  // search task dependency list recursively to find a dependency 
-  // parameter:
-  //   id - the task to search for
-  //   pTgtList - (optional) target list to receive the dependency tree
-  // result:
-  //   0 if not found
-  //   n found in the n-th level
-  //   dependency list in the target list  
-  int FollowDependency(const char* id, TList* pTgtList=NULL);
-
-  // print the tree for a certain dependency either from the task or configuration list
-  // each task posseses two "link lists": The configurations are the the origin of the 
-  // task list. In case of an error during the built of the task list, the dependencies 
-  // for the task list might be incomplete. In this case the configurations can give 
-  // infomation on the error reason  
-  // parameter:
-  //   id - the dependency to search for
-  //   bFromConfiguration (default=0) - if 0 the task dependency list is used, if one the configuration list is used
-  void PrintDependencyTree(const char* id, int bFromConfiguration=0);
-
- private:
-  AliHLTConfiguration* fpConfiguration;
-  AliHLTComponent* fpComponent;
-  vector<AliHLTComponent_BlockData*> fSources;
-  TList fListTargets;
-  TList fListDependencies;
-
-  AliHLTComponent_BlockData* fpBlockDataArray;
-
-  ClassDef(AliHLTTask, 0);
-};
-
-class AliHLTConfigurationHandler : public AliHLTLogging {
- public:
-  AliHLTConfigurationHandler();
-  //AliHLTConfigurationHandler(AliHLTConfiguration* pConf);
-  virtual ~AliHLTConfigurationHandler();
-
-  /****************************************************************************************************
-   * registration
-   */
-
-  // register a configuration to the global list of configurations
-  int RegisterConfiguration(AliHLTConfiguration* pConf);
-
-  // create a configuration and register it
-  int CreateConfiguration(const char* id, const char* component, const char* sources, const char* arguments);
-
-  // remove a configuration from the global list
-  int RemoveConfiguration(AliHLTConfiguration* pConf);
-  int RemoveConfiguration(const char* id);
-
-  // find a configuration from the global list
-  AliHLTConfiguration* FindConfiguration(const char* id);
-
-  // print the registered configurations to the logging function
-  void PrintConfigurations();
-
-
- private:
-  static TList fListConfigurations; // the list of registered configurations
-  static TList fListDynamicConfigurations; // the list of dynamic configurations (for proper cleanup)
-
-  ClassDef(AliHLTConfigurationHandler, 0);
-};
-
 #endif