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 */
10 /** @file AliHLTHOMERLibManager.h
11 @author Matthias Richter
13 @brief dynamic HLT HOMER reader/writer generation and destruction
15 // see below for class documentation
17 // refer to README to build package
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
22 #include "AliHLTLogging.h"
24 class AliHLTHOMERReader;
25 class AliHLTHOMERWriter;
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>
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.
40 * AliHLTHOMERLibManager manager;
42 * // open a HOMER reader listening at port 23000 of the localhost
43 * AliHLTMonitoringReader* pReader=manager.OpenReader(localhost, 23000);
45 * // read next event, timeout 5s
46 * while (pReader && pReader->ReadNextEvent(5000000)) {
47 * unsigned long count=pReader->GetBlockCnt();
52 * manager.DeleteReader(pReader);
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.
59 class AliHLTHOMERLibManager : public AliHLTLogging {
61 /** standard constructor */
62 AliHLTHOMERLibManager();
64 virtual ~AliHLTHOMERLibManager();
67 * Open a homer reader working on a TCP port.
69 AliHLTHOMERReader* OpenReader(const char* hostname, unsigned short port );
72 * Open a homer reader working on multiple TCP ports.
74 AliHLTHOMERReader* OpenReader(unsigned int tcpCnt, const char** hostnames, unsigned short* ports);
77 * Open a HOMER reader for reading from a System V shared memory segment.
78 AliHLTHOMERReader* OpenReader(key_t shmKey, int shmSize );
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 );
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 );
93 * Open a HOMER reader.
94 * Load HOMER library dynamically and create object working on the provided
97 AliHLTHOMERReader* OpenReader(const AliHLTUInt8_t* pBuffer, int size);
100 * Delete a HOMER reader.
101 * Clean-up of the object is done inside the HOMER library.
103 int DeleteReader(AliHLTHOMERReader* pReader);
106 * Open a HOMER writer.
107 * Load HOMER library dynamically and create object working on the provided
110 AliHLTHOMERWriter* OpenWriter();
113 * Delete a HOMER writer.
114 * Clean-up of the object is done inside the HOMER library.
116 int DeleteWriter(AliHLTHOMERWriter* pWriter);
121 /** copy constructor prohibited */
122 AliHLTHOMERLibManager(const AliHLTHOMERLibManager&);
123 /** assignment operator prohibited */
124 AliHLTHOMERLibManager& operator=(const AliHLTHOMERLibManager&);
127 * Load the HOMER library.
129 int LoadHOMERLibrary();
131 /** status of the loading of the HOMER library */
132 int fLibraryStatus; //!transient
134 /** entry in the HOMER library */
135 void* fFctCreateReaderFromTCPPort; //!transient
137 /** entry in the HOMER library */
138 void* fFctCreateReaderFromTCPPorts; //!transient
140 /** entry in the HOMER library */
141 void* fFctCreateReaderFromBuffer; //!transient
143 /** entry in the HOMER library */
144 void* fFctDeleteReader; //!transient
146 /** entry in the HOMER library */
147 void* fFctCreateWriter; //!transient
149 /** entry in the HOMER library */
150 void* fFctDeleteWriter; //!transient
152 ClassDef(AliHLTHOMERLibManager, 0)