]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTHOMERLibManager.h
e26c98120435a1d02ab8771a783f67619c410746
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTHOMERLibManager.h
1 //-*- Mode: C++ -*-
2 // @(#) $Id$
3
4 #ifndef ALIHLTHOMERLIBMANAGER_H
5 #define ALIHLTHOMERLIBMANAGER_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
10 /** @file   AliHLTHOMERLibManager.h
11     @author Matthias Richter
12     @date   
13     @brief  dynamic HLT HOMER reader/writer generation and destruction
14
15 // see below for class documentation
16 // or
17 // refer to README to build package
18 // or
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
20                                                                           */
21
22 #include "AliHLTLogging.h"
23
24 class AliHLTHOMERReader;
25 class AliHLTHOMERWriter;
26
27 /**
28  * @class AliHLTHOMERLibManager
29  * Dynamic manager of HOMER library.
30  * The class allows to generate objects of HOMER readers and writers
31  * dynamically and loads also the HOMER lib. In order to write HOMER library
32  * independent code it is important to use the AliHLTMonitoringWriter/
33  * AliHLTMonitoringReader classes when ever class methods are used. Those
34  * classes just define a virtual interface. <br>
35  *
36  * Instead of creating a reader or writer by \em new and deleting it with
37  * \em delete, one has to use the Open and Delete methods of this class.
38  *
39  * <pre>
40  * AliHLTHOMERLibManager manager;
41  *
42  * // open a HOMER reader listening at port 23000 of the localhost
43  * AliHLTMonitoringReader* pReader=manager.OpenReader(localhost, 23000);
44  *
45  * // read next event, timeout 5s
46  * while (pReader && pReader->ReadNextEvent(5000000)) {
47  *   unsigned long count=pReader->GetBlockCnt();
48  *   ...
49  * }
50  *
51  * // delete reader
52  * manager.DeleteReader(pReader);
53  * </pre>
54  *
55  * The manager does not not provide methods to create a HOMER reader on
56  * basis of shared memory. This is most likely a depricated functionality,
57  * although kept for the sake of completeness.
58  */
59 class AliHLTHOMERLibManager : public AliHLTLogging {
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* OpenReader(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   /** status of the loading of the HOMER library */
132   int fLibraryStatus; //!transient
133
134   /** entry in the HOMER library */
135   void* fFctCreateReaderFromTCPPort; //!transient
136
137   /** entry in the HOMER library */
138   void* fFctCreateReaderFromTCPPorts; //!transient
139
140   /** entry in the HOMER library */
141   void* fFctCreateReaderFromBuffer; //!transient
142
143   /** entry in the HOMER library */
144   void* fFctDeleteReader; //!transient
145
146   /** entry in the HOMER library */
147   void* fFctCreateWriter; //!transient
148
149   /** entry in the HOMER library */
150   void* fFctDeleteWriter; //!transient
151
152   ClassDef(AliHLTHOMERLibManager, 0)
153 };
154 #endif