LCOV - code coverage report
Current view: top level - HLT/BASE - AliHLTHOMERLibManager.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2016-06-14 17:26:59 Functions: 1 5 20.0 %

          Line data    Source code
       1             : 
       2             : //-*- Mode: C++ -*-
       3             : // $Id$
       4             : 
       5             : #ifndef ALIHLTHOMERLIBMANAGER_H
       6             : #define ALIHLTHOMERLIBMANAGER_H
       7             : /* This file is property of and copyright by the ALICE HLT Project        * 
       8             :  * ALICE Experiment at CERN, All rights reserved.                         *
       9             :  * See cxx source for full Copyright notice                               */
      10             : 
      11             : /// @file   AliHLTHOMERLibManager.h
      12             : /// @author Matthias Richter
      13             : /// @date   
      14             : /// @brief  dynamic HLT HOMER reader/writer generation and destruction
      15             : 
      16             : #include "AliHLTDataTypes.h"
      17             : #include "TObject.h" // for ClassDef/Imp
      18             : 
      19             : class AliHLTHOMERReader;
      20             : class AliHLTHOMERWriter;
      21             : 
      22             : /**
      23             :  * @class AliHLTHOMERLibManager
      24             :  * Dynamic manager of HOMER library.
      25             :  * The class allows to generate objects of HOMER readers and writers
      26             :  * dynamically and loads also the HOMER lib. In order to write HOMER library
      27             :  * independent code it is important to use the AliHLTMonitoringWriter/
      28             :  * AliHLTMonitoringReader classes when ever class methods are used. Those
      29             :  * classes just define a virtual interface. <br>
      30             :  *
      31             :  * Instead of creating a reader or writer by \em new and deleting it with
      32             :  * \em delete, one has to use the Open and Delete methods of this class.
      33             :  *
      34             :  * <pre>
      35             :  * AliHLTHOMERLibManager manager;
      36             :  *
      37             :  * // open a HOMER reader listening at port 23000 of the localhost
      38             :  * AliHLTMonitoringReader* pReader=manager.OpenReader(localhost, 23000);
      39             :  *
      40             :  * // read next event, timeout 5s
      41             :  * while (pReader && pReader->ReadNextEvent(5000000)==0) {
      42             :  *   unsigned long count=pReader->GetBlockCnt();
      43             :  *   gSystem->Sleep(5);
      44             :  *   ...
      45             :  * }
      46             :  *
      47             :  * // delete reader
      48             :  * manager.DeleteReader(pReader);
      49             :  * </pre>
      50             :  *
      51             :  * The manager does not provide methods to create a HOMER reader on
      52             :  * basis of shared memory. This is most likely a depricated functionality,
      53             :  * although kept for the sake of completeness. However, at some point it
      54             :  * might become useful. Please notify the developers if you need that
      55             :  * functionality.
      56             :  *
      57             :  * @ingroup alihlt_homer
      58             :  */
      59             : class AliHLTHOMERLibManager {
      60             :  public:
      61             :   /** standard constructor */
      62             :   AliHLTHOMERLibManager();
      63             :   /** destructor */
      64             :   virtual ~AliHLTHOMERLibManager();
      65             : 
      66             :   /**
      67             :    * Open a homer reader working on a TCP port.
      68             :    */
      69             :   AliHLTHOMERReader* OpenReader(const char* hostname, unsigned short port );
      70             :   
      71             :   /**
      72             :    * Open a homer reader working on multiple TCP ports.
      73             :    */
      74             :   AliHLTHOMERReader* OpenReader(unsigned int tcpCnt, const char** hostnames, unsigned short* ports);
      75             :         
      76             :   /**
      77             :    * Open a HOMER reader for reading from a System V shared memory segment.
      78             :   AliHLTHOMERReader* OpenReader(key_t shmKey, int shmSize );
      79             :    */
      80             :         
      81             :   /**
      82             :    * Open a HOMER reader for reading from multiple System V shared memory segments
      83             :   AliHLTHOMERReader* OpenReader(unsigned int shmCnt, key_t* shmKey, int* shmSize );
      84             :    */
      85             :         
      86             :   /**
      87             :    * Open a HOMER reader for reading from multiple TCP ports and multiple System V shared memory segments
      88             :   AliHLTHOMERReader* OpenReader(unsigned int tcpCnt, const char** hostnames, unsigned short* ports, 
      89             :                                     unsigned int shmCnt, key_t* shmKey, int* shmSize );
      90             :    */
      91             : 
      92             :   /**
      93             :    * Open a HOMER reader.
      94             :    * Load HOMER library dynamically and create object working on the provided
      95             :    * buffer.
      96             :    */
      97             :   AliHLTHOMERReader* OpenReaderBuffer(const AliHLTUInt8_t* pBuffer, int size);
      98             : 
      99             :   /**
     100             :    * Delete a HOMER reader.
     101             :    * Clean-up of the object is done inside the HOMER library.
     102             :    */
     103             :   int DeleteReader(AliHLTHOMERReader* pReader);
     104             : 
     105             :   /**
     106             :    * Open a HOMER writer.
     107             :    * Load HOMER library dynamically and create object working on the provided
     108             :    * buffer.
     109             :    */
     110             :   AliHLTHOMERWriter* OpenWriter();
     111             : 
     112             :   /**
     113             :    * Delete a HOMER writer.
     114             :    * Clean-up of the object is done inside the HOMER library.
     115             :    */
     116             :   int DeleteWriter(AliHLTHOMERWriter* pWriter);
     117             : 
     118             :  protected:
     119             : 
     120             :  private:
     121             :   /** copy constructor prohibited */
     122             :   AliHLTHOMERLibManager(const AliHLTHOMERLibManager&);
     123             :   /** assignment operator prohibited */
     124             :   AliHLTHOMERLibManager& operator=(const AliHLTHOMERLibManager&);
     125             : 
     126             :   /**
     127             :    * Load the HOMER library.
     128             :    */
     129             :   int LoadHOMERLibrary();
     130             : 
     131             :   /**
     132             :    * Unloads the HOMER library.
     133             :    */
     134             :   int UnloadHOMERLibrary();
     135             : 
     136             :   /** status of the loading of the HOMER library */
     137             : static  int fgLibraryStatus; //!transient
     138             : 
     139             :   /** entry in the HOMER library */
     140             :   void (*fFctCreateReaderFromTCPPort)(); //!transient
     141             : 
     142             :   /** entry in the HOMER library */
     143             :   void (*fFctCreateReaderFromTCPPorts)(); //!transient
     144             : 
     145             :   /** entry in the HOMER library */
     146             :   void (*fFctCreateReaderFromBuffer)(); //!transient
     147             : 
     148             :   /** entry in the HOMER library */
     149             :   void (*fFctDeleteReader)(); //!transient
     150             : 
     151             :   /** entry in the HOMER library */
     152             :   void (*fFctCreateWriter)(); //!transient
     153             : 
     154             :   /** entry in the HOMER library */
     155             :   void (*fFctDeleteWriter)(); //!transient
     156             : 
     157             :   /** Indicates the library that was actually (and if) loaded in LoadHOMERLibrary(). */
     158             :   const char* fLoadedLib;  //!transient
     159             : 
     160             :   static const char* fgkLibraries[]; /// List of libraries to try and load.
     161             :   static int fgkLibRefCount[]; /// The library reference count to control when to unload the library.
     162             : 
     163         126 :   ClassDef(AliHLTHOMERLibManager, 0)
     164             : };
     165             : #endif

Generated by: LCOV version 1.11