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
21 #include "AliHLTDataTypes.h"
22 #include "TObject.h" // for ClassDef/Imp
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)==0) {
47 * unsigned long count=pReader->GetBlockCnt();
53 * manager.DeleteReader(pReader);
56 * The manager does not not provide methods to create a HOMER reader on
57 * basis of shared memory. This is most likely a depricated functionality,
58 * although kept for the sake of completeness.
60 class AliHLTHOMERLibManager {
62 /** standard constructor */
63 AliHLTHOMERLibManager();
65 virtual ~AliHLTHOMERLibManager();
68 * Open a homer reader working on a TCP port.
70 AliHLTHOMERReader* OpenReader(const char* hostname, unsigned short port );
73 * Open a homer reader working on multiple TCP ports.
75 AliHLTHOMERReader* OpenReader(unsigned int tcpCnt, const char** hostnames, unsigned short* ports);
78 * Open a HOMER reader for reading from a System V shared memory segment.
79 AliHLTHOMERReader* OpenReader(key_t shmKey, int shmSize );
83 * Open a HOMER reader for reading from multiple System V shared memory segments
84 AliHLTHOMERReader* OpenReader(unsigned int shmCnt, key_t* shmKey, int* shmSize );
88 * Open a HOMER reader for reading from multiple TCP ports and multiple System V shared memory segments
89 AliHLTHOMERReader* OpenReader(unsigned int tcpCnt, const char** hostnames, unsigned short* ports,
90 unsigned int shmCnt, key_t* shmKey, int* shmSize );
94 * Open a HOMER reader.
95 * Load HOMER library dynamically and create object working on the provided
98 AliHLTHOMERReader* OpenReaderBuffer(const AliHLTUInt8_t* pBuffer, int size);
101 * Delete a HOMER reader.
102 * Clean-up of the object is done inside the HOMER library.
104 int DeleteReader(AliHLTHOMERReader* pReader);
107 * Open a HOMER writer.
108 * Load HOMER library dynamically and create object working on the provided
111 AliHLTHOMERWriter* OpenWriter();
114 * Delete a HOMER writer.
115 * Clean-up of the object is done inside the HOMER library.
117 int DeleteWriter(AliHLTHOMERWriter* pWriter);
122 /** copy constructor prohibited */
123 AliHLTHOMERLibManager(const AliHLTHOMERLibManager&);
124 /** assignment operator prohibited */
125 AliHLTHOMERLibManager& operator=(const AliHLTHOMERLibManager&);
128 * Load the HOMER library.
130 int LoadHOMERLibrary();
132 /** status of the loading of the HOMER library */
133 int fLibraryStatus; //!transient
135 /** entry in the HOMER library */
136 void* fFctCreateReaderFromTCPPort; //!transient
138 /** entry in the HOMER library */
139 void* fFctCreateReaderFromTCPPorts; //!transient
141 /** entry in the HOMER library */
142 void* fFctCreateReaderFromBuffer; //!transient
144 /** entry in the HOMER library */
145 void* fFctDeleteReader; //!transient
147 /** entry in the HOMER library */
148 void* fFctCreateWriter; //!transient
150 /** entry in the HOMER library */
151 void* fFctDeleteWriter; //!transient
153 ClassDef(AliHLTHOMERLibManager, 0)