LCOV - code coverage report
Current view: top level - HLT/BASE/util - AliHLTMonitoringRelay.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 6 33.3 %
Date: 2016-06-14 17:26:59 Functions: 2 10 20.0 %

          Line data    Source code
       1             : // -*- Mode: C++ -*-
       2             : // $Id$
       3             : 
       4             : #ifndef ALIHLTMONITORINGRELAY_H
       5             : #define ALIHLTMONITORINGRELAY_H
       6             : //* This file is property of and copyright by the                          * 
       7             : //* ALICE Experiment at CERN, All rights reserved.                         *
       8             : //* See cxx source for full Copyright notice                               *
       9             : 
      10             : /// @file   AliHLTMonitoringRelay.h
      11             : /// @author Matthias Richter
      12             : /// @date   2009-11-11
      13             : /// @brief  Relay components for monitoring objects.
      14             : ///
      15             : 
      16             : #include "AliHLTProcessor.h"
      17             : #include "TString.h"
      18             : #include <vector>
      19             : 
      20             : using std::vector;
      21             : 
      22             : class TArrayC;
      23             : class TObject;
      24             : 
      25             : /**
      26             :  * @class AliHLTMonitoringRelay
      27             :  * A relay component for monitoring data objects.
      28             :  * It keeps a copy of the last block of every parent and forwards all
      29             :  * the blocks together. By that, the output of histograms (rarely to
      30             :  * be published but for every event filled.
      31             :  *
      32             :  * Input data blocks must be uniquely identified by the combination of
      33             :  * - data type (id and origin)
      34             :  * - block specification
      35             :  * - object name
      36             :  * - object title
      37             :  *
      38             :  * <h2>General properties:</h2>
      39             :  *
      40             :  * Component ID: \b MonitoringRelay                                         <br>
      41             :  * Library: \b libAliHLTUtil.so                                         <br>
      42             :  * Input Data Types: kAliHLTAnyDataType                                 <br>
      43             :  * Output Data Types: according to input blocks         <br>
      44             :  *
      45             :  * <h2>Mandatory arguments:</h2>
      46             :  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
      47             :  *      
      48             :  * <h2>Optional arguments:</h2>
      49             :  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
      50             :  * \li -verbose                                                         <br>
      51             :  *      print out some more info messages, mainly for the sake of tutorials
      52             :  * \li -check-object                                                    <br>
      53             :  *      unpack the object from the binary block and use also object name
      54             :  *      and title for indexing
      55             :  *
      56             :  * <h2>Configuration:</h2>
      57             :  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
      58             :  * Configuration by component arguments.
      59             :  *
      60             :  * <h2>Default CDB entries:</h2>
      61             :  * The component loads no CDB entries.
      62             :  *
      63             :  * <h2>Performance:</h2>
      64             :  * Low profile: input objects are unpacked and binary copied, no streaming
      65             :  * of obejcts.
      66             :  *
      67             :  * <h2>Memory consnumption:</h2>
      68             :  * The component allocates memory of the maximum size for every input
      69             :  * object.
      70             :  *
      71             :  * <h2>Output size:</h2>
      72             :  * 
      73             :  * @ingroup alihlt_util_components
      74             :  */
      75             : class AliHLTMonitoringRelay : public AliHLTProcessor
      76             : {
      77             :  public:
      78             :   /// standard constructor
      79             :   AliHLTMonitoringRelay();
      80             :   /// destructor
      81             :   virtual ~AliHLTMonitoringRelay();
      82             : 
      83             :   /// inherited from AliHLTComponent, get component id
      84         612 :   virtual const char* GetComponentID() {return "MonitoringRelay";};
      85             : 
      86             :   /// inherited from AliHLTComponent, get the input data type
      87             :   void GetInputDataTypes( AliHLTComponentDataTypeList& );
      88             : 
      89             :   /// inherited from AliHLTComponent, get the output data type
      90             :   AliHLTComponentDataType GetOutputDataType();
      91             : 
      92             :   /// inherited from AliHLTComponent, get the output data size estimator
      93             :   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
      94             : 
      95             :   /// inherited from AliHLTComponent, create a component
      96           0 :   virtual AliHLTComponent* Spawn() {return new AliHLTMonitoringRelay;}
      97             : 
      98             :   enum {
      99             :     kCheckObject = 0x1
     100             :   };
     101             : 
     102             :   /// descriptor of monitoring items
     103             :   class AliHLTMonitoringItem {
     104             :   public:
     105             :     // standard constructor
     106             :     AliHLTMonitoringItem();
     107             :     // constructor
     108             :     AliHLTMonitoringItem(const AliHLTComponentBlockData* pBlock, const TObject* pObject);
     109             :     // destructor
     110             :     ~AliHLTMonitoringItem();
     111             : 
     112             :     /// copy data from buffer
     113             :     int SetData(void* pBuffer, int size);
     114             : 
     115             :     /// get buffer pointer of the current data
     116             :     void* GetBuffer() const;
     117             :     /// get size of the current data
     118             :     unsigned GetSize() const;
     119             :     /// get data type
     120             :     const AliHLTComponentDataType& GetDataType() const;
     121             :     /// get specification
     122             :     AliHLTUInt32_t GetSpecification() const;
     123             :     /// get object name
     124           0 :     const TString& GetObjectName() const {return fName;}
     125             : 
     126             :     bool operator==(const AliHLTComponentBlockData& bd) const;
     127             :     bool operator!=(const AliHLTComponentBlockData& bd) const;
     128             :     bool operator==(const TObject& object) const;
     129             :     bool operator!=(const TObject& object) const;
     130             : 
     131             :   protected:
     132             :   private:
     133             :     /// copy constructor prohibited
     134             :     AliHLTMonitoringItem(const AliHLTMonitoringItem&);
     135             :     /// assignment operator prohibited
     136             :     AliHLTMonitoringItem& operator=(const AliHLTMonitoringItem&);
     137             : 
     138             :     AliHLTComponentDataType fDt;                //! transient
     139             :     AliHLTUInt32_t          fSpecification;     //! transient
     140             :     TString                 fName;              //! transient
     141             :     TString                 fTitle;             //! transient
     142             :     TArrayC*                fData;              //! transient
     143             :     int                     fDataSize;          //! transient
     144             :   };
     145             :   typedef vector<AliHLTMonitoringItem*>  AliHLTMonitoringItemPList;
     146             :  protected:
     147             : 
     148             :   /// inherited from AliHLTProcessor, data processing
     149             :   int DoEvent( const AliHLTComponentEventData& evtData,
     150             :                AliHLTComponentTriggerData& trigData );
     151             :   
     152             :   using AliHLTProcessor::DoEvent;
     153             : 
     154             :   /// inherited from AliHLTComponent, component initialisation
     155             :   int DoInit( int argc, const char** argv );
     156             : 
     157             :   /// inherited from AliHLTComponent, scan argument
     158             :   int ScanConfigurationArgument(int argc, const char** argv);
     159             : 
     160             :   /// inherited from AliHLTComponent, component cleanup.
     161             :   int DoDeinit();
     162             : 
     163             :  private:
     164             :   /// copy constructor prohibited
     165             :   AliHLTMonitoringRelay(const AliHLTMonitoringRelay&);
     166             :   /// assignment operator prohibited
     167             :   AliHLTMonitoringRelay& operator=(const AliHLTMonitoringRelay&);
     168             : 
     169             :   /// find a block of data type and specificaton
     170             :   AliHLTMonitoringItem* FindItem(const AliHLTComponentBlockData* pBlock, const TObject* pObject) const;
     171             : 
     172           0 :   void SetFlag(unsigned flag) {fFlags|=flag;}
     173           0 :   bool CheckFlag(unsigned flag) const {return (fFlags&flag)!=0;}
     174             : 
     175             :   /// the list of items
     176             :   AliHLTMonitoringItemPList  fItems; //! transient
     177             :   /// actual size of the data sample
     178             :   unsigned fOutputSize; //! transient
     179             :   /// operation flags
     180             :   unsigned fFlags; //! transient
     181             : 
     182           8 :   ClassDef(AliHLTMonitoringRelay, 0)
     183             : };
     184             : #endif

Generated by: LCOV version 1.11