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