]>
Commit | Line | Data |
---|---|---|
2be16a33 | 1 | |
2 | \documentclass[a4paper,twoside]{article} | |
3 | ||
4 | %\sloppy | |
5 | ||
6 | %\renewcommand{\baselinestretch}{1.5} | |
7 | ||
8 | \usepackage{graphics} | |
9 | \usepackage{textcomp} | |
10 | \usepackage{times} | |
11 | %\usepackage[light]{draftcopy} | |
12 | \usepackage[english]{babel} | |
13 | ||
14 | %\usepackage[margin=20pt,head=20pt,headsep=20pt,foot=20pt]{geometry} | |
15 | %\usepackage[text={16.8cm,24.8cm}]{geometry} | |
16 | %\usepackage[text={16.9cm,24.8cm}]{geometry} | |
17 | \usepackage{geometry} | |
18 | ||
19 | ||
20 | ||
21 | ||
22 | \title{HLT Online Monitoring Environment including ROOT \\ --- \\ Reader Interface \\ --- \\ Version 0.2} | |
23 | \author{Timm M. Steinbeck, Heinz Tilsner} | |
24 | ||
25 | \begin{document} | |
26 | \maketitle | |
27 | ||
28 | \section{Preliminaries} | |
29 | \subsection{Disclaimer} | |
30 | This document is not complete. It is a design document describing an interface to be developed. We have tried to make it as complete as possible to the best of our knowledge but shortcomings of the defined subject may appear during its implementation or use. | |
31 | The document may therefore be subject to change as required, although we will try to minimize the impact of changes on existing code. | |
32 | However, no guarantee about the described subject can be made. | |
33 | \subsection{Copyright} | |
34 | This document is copyright by the Computer Science/Computer Engineering group of the Kirchhoff Institute of Physics of the Ruprecht-Karls-University Heidelberg, Germany. It may be distributed | |
35 | via any medium as a whole. Parts maybe quoted provided that the document with the original authors and their institute above are referenced properly. | |
36 | \subsection{Terminology} | |
37 | As the whole interface described is a class API method, member function, and function will be used interchangeably. | |
38 | ||
39 | \section{Overview} | |
40 | ||
41 | This document defines an C++ class API to read data in an HLT Online Monitoring Environment including ROOT (HOMER). The API is structured into two parts: | |
42 | \begin{enumerate} | |
43 | \item An abstract base class defining an interface for reading via abstract functions. The functions defined here are kept generic so that they should be usable also with other monitoring environments. This class is called \texttt{Moni\-tor\-ing\-Read\-er}. | |
44 | \item A derived class with implementations for the defined abstract functions for HOMER. In addition, further functions are defined here that are considered to be too specific to the HOMER system to be included in the abstract interface definition. This class is called \texttt{HOMER\-Read\-er}. | |
45 | \end{enumerate} | |
46 | The purpose of splitting up the API into these two parts is to allow future additions in the form of other derived classes for further data sources in addition to HOMER. These classes, derived fromthe class MonitoringReader, could then read data from these other sources and provide them via an identical interface. This allows to add different data sources in to existing code (and support them in new code) with minimal code changes. Other possibilities for data sources could for example be the Mood DATE monitoring package or even offline data storage. | |
47 | ||
48 | The purpose of the API as such is to provide an easy way to access the monitoring data from various taps in the HLT system (and as described above potentially other sources) in analysis packages and code. | |
49 | ||
50 | \section{MonitoringReader} | |
51 | ||
52 | The class \texttt{MonitoringReader} defines the abstract interface for monitoring data reader classes. It is shown in Fig. \ref{Fig:MonitoringReader}. | |
53 | ||
54 | \begin{figure}[hbt] | |
55 | %\begin{center} | |
56 | {\footnotesize | |
57 | \begin{verbatim} | |
58 | ||
59 | class MonitoringReader | |
60 | { | |
61 | public: | |
62 | MonitoringReader(); | |
63 | virtual ~MonitoringReader(); | |
64 | ||
65 | /* Read in the next available event */ | |
66 | virtual int ReadNextEvent() = 0; | |
67 | /* Read in the next available event, | |
68 | wait max. timeout microsecs. */ | |
69 | virtual int ReadNextEvent( unsigned long timeout_us ) = 0; | |
70 | ||
71 | /* Return the ID of the current event */ | |
72 | virtual uint64 GetEventID() const = 0; | |
73 | ||
74 | /* Return the number of data blocks in the | |
75 | current event */ | |
76 | virtual unsigned long GetBlockCnt() const = 0; | |
77 | ||
78 | /* Return the size (in bytes) of the current | |
79 | event's data block with the given block | |
80 | index (starting at 0). */ | |
81 | virtual unsigned long GetBlockDataLength( unsigned long ndx ) const = 0; | |
82 | /* Return a pointer to the start of the current | |
83 | event's data block with the given block index | |
84 | (starting at 0). */ | |
85 | virtual const void* GetBlockData( unsigned long ndx ) const = 0; | |
86 | /* Return IP address or hostname of node which | |
87 | received the current event's data block with | |
88 | the given block index (starting at 0). */ | |
89 | virtual const char* GetBlockSendNodeID( unsigned long ndx ) const = 0; | |
90 | /* Return byte order of the data stored in the | |
91 | current event's data block with the given block | |
92 | index (starting at 0). | |
93 | 0 is unknown alignment, | |
94 | 1 ist little endian, | |
95 | 2 is big endian. */ | |
96 | virtual uint8 GetBlockByteOrder( unsigned long ndx ) const = 0; | |
97 | /* Return the alignment (in bytes) of the given datatype | |
98 | in the data stored in the current event's data block | |
99 | with the given block index (starting at 0). | |
100 | Possible values for the data type are | |
101 | 0: uint64 | |
102 | 1: uint32 | |
103 | 2: uin16 | |
104 | 3: uint8 | |
105 | 4: double | |
106 | 5: float | |
107 | */ | |
108 | virtual uint8 GetBlockTypeAlignment( unsigned long ndx, uint8 dataType ) const = 0; | |
109 | ||
110 | }; | |
111 | ||
112 | \end{verbatim} | |
113 | } | |
114 | \parbox{0.90\columnwidth}{ | |
115 | \caption{\label{Fig:MonitoringReader}The API defined by the class \texttt{MonitoringReader}.} | |
116 | } | |
117 | %\end{center} | |
118 | \end{figure} | |
119 | ||
120 | The methods in the API will be discussed in the following subsections. | |
121 | ||
122 | ||
123 | \subsection{MonitoringReader()} | |
124 | ||
125 | \texttt{MonitoringReader()} | |
126 | ||
127 | The default constructor. Initializes anything required in the base class. Should not need to do much. | |
128 | ||
129 | \begin{description} | |
130 | \item[Parameters:] None | |
131 | \item[Return value:] None | |
132 | \item[State after completion:] The object is created | |
133 | \end{description} | |
134 | ||
135 | ||
136 | \subsection{\~{ }MonitoringReader()} | |
137 | ||
138 | \texttt{virtual \~{ }MonitoringReader()} | |
139 | ||
140 | Destructor. Cleans up anything allocated/opened/initialized in the base class. Should not need to do much. | |
141 | ||
142 | \begin{description} | |
143 | \item[Parameters:] None | |
144 | \item[Return value:] None | |
145 | \item[State after completion:] The object is destroyed | |
146 | \end{description} | |
147 | ||
148 | ||
149 | \subsection{ReadNextEvent()} | |
150 | \label{Subsec:MonitoringReader::ReadNextEvent} | |
151 | \texttt{virtual int ReadNextEvent()} | |
152 | ||
153 | This functions triggers reading in the next event from data sources defined by the derived class implementation. | |
154 | The function will try indefinitely respectively until a permanent unresolvable error occurs. | |
155 | Implementations of the function in derived classes may define an internal maximum timeout whose expiration is treated as a permanent error. After | |
156 | this function completes successfully the event's data is stored in the object and can be accessed by the class's other methods. It returns an | |
157 | indicator signalling successful completion or the occurence of an error. | |
158 | ||
159 | \begin{description} | |
160 | \item[Parameters:] None | |
161 | \item[Return value:] An integer (\texttt{int}) signalling completion status. This is 0 on success or a non-zero integer value according to the values defined in the | |
162 | include file \texttt{errno.h} to signal the type of error that occured. | |
163 | \item[State after successful completion:] The event that was read in from the data sources is stored in the object and can be accessed by the class's other methods. | |
164 | \item[State after unsuccessful completion:] The state after an error occured during reading is undefined. | |
165 | \end{description} | |
166 | ||
167 | ||
168 | \subsection{ReadNextEvent( unsigned long )} | |
169 | \label{Subsec:MonitoringReader::ReadNextEvent:unsignedlong} | |
170 | \texttt{virtual int ReadNextEvent( unsigned long timeout\_us )} | |
171 | ||
172 | This function triggers reading in the next event from data sources defined by the derived class implementation. | |
173 | The function will try until the given timeout expires or permanent unresolvable error occurs. | |
174 | In addition to the specified timeout implementations of the function in derived classes may | |
175 | define an internal maximum timeout whose expiration is treated as a permanent error. After | |
176 | this function completes successfully the event's data is stored in the object and can be accessed by the class's other methods. It returns an | |
177 | indicator signalling successful completion or the occurence of an error. | |
178 | ||
179 | \begin{description} | |
180 | \item[Parameters:] | |
181 | \begin{description} | |
182 | \item[\texttt{timeout\_us}:] An unsigned long integer (\texttt{unsigned long}) holding the timeout value in microseconds. When this timeout elapses the method will return | |
183 | even if no event has been received yet. Expiration of the timeout will be indicated by setting the return status to \texttt{ETIMEDOUT} as defined in the | |
184 | include file \texttt{errno.h}. | |
185 | \end{description} | |
186 | \item[Return value:] An integer (\texttt{int}) signalling completion status. This is 0 on success or a non-zero integer value according to the values defined in the | |
187 | include file \texttt{errno.h} to signal the type of error that occured. \texttt{ETIMEDOUT} will be returned if the specified timeout expired before an event was received. | |
188 | \item[State after successful completion:] The event that was read in from the data sources is stored in the object and can be accessed by the class's other methods. | |
189 | \item[State after unsuccessful completion:] The state after an error occured during reading is undefined. | |
190 | \end{description} | |
191 | ||
192 | ||
193 | \subsection{GetEventID()} | |
194 | \label{Subsec:MonitoringReader::GetEventID} | |
195 | \texttt{virtual uint64 GetEventID() const} | |
196 | ||
197 | This function returns the ID of the event that was last successfully read in. If no event has yet been read in or if the last read attempt failed, | |
198 | invalid event ID (\texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) will be returned. | |
199 | ||
200 | \begin{description} | |
201 | \item[Parameters:] None | |
202 | \item[Return value:] A 64~bit unsigned integer (\texttt{uint64}) that holds the ID of the last event that could be successfully read in. If no event has yet been read in or if the last read attempt failed, | |
203 | invalid event ID (\texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) will be returned. | |
204 | \item[State after successful completion:] No change | |
205 | \item[State after unsuccessful completion:] No change | |
206 | \end{description} | |
207 | ||
208 | ||
209 | \subsection{GetBlockCnt()} | |
210 | \label{Subsec:MonitoringReader::GetBlockCnt} | |
211 | \texttt{virtual unsigned long GetBlockCnt() const} | |
212 | ||
213 | This function returns the number of data blocks in the current event. If no event has yet been read in or if the last read attempt failed | |
214 | zero (\texttt{0}) data blocks will be reported. | |
215 | ||
216 | \begin{description} | |
217 | \item[Parameters:] None | |
218 | \item[Return value:] An unsigned long integer (\texttt{unsigned long}) that holds the number of data blocks contained in the last event that could be successfully read in. | |
219 | If no event has yet been read in or if the last read attempt failed, zero (\texttt{0}) will be returned. | |
220 | \item[State after successful completion:] No change | |
221 | \item[State after unsuccessful completion:] No change | |
222 | \end{description} | |
223 | ||
224 | ||
225 | \subsection{GetBlockDataLength( unsigned long )} | |
226 | \label{Subsec:MonitoringReader::GetBlockDataLength} | |
227 | \texttt{virtual unsigned long GetBlockDataLength( unsigned long ndx ) const} | |
228 | ||
229 | This function returns the size in bytes of the data block in the current event with the specified index. Indexing of data blocks starts at zero. | |
230 | If no event has yet been read in or if the last read attempt failed, a size of zero (\texttt{0}) bytes will be reported. | |
231 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) a size of | |
232 | zero (\texttt{0}) bytes will be reported. | |
233 | ||
234 | \begin{description} | |
235 | \item[Parameters:] | |
236 | \begin{description} | |
237 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose size is | |
238 | to be reported. This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) | |
239 | \end{description} | |
240 | \item[Return value:] An unsigned long integer (\texttt{unsigned long}) that holds the size in bytes of the data block with the specified index | |
241 | contained in the last event that could be successfully read in. | |
242 | If no event has yet been read in or if the last read attempt failed, a size of zero (\texttt{0}) bytes will be returned. | |
243 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) a size of | |
244 | zero (\texttt{0}) bytes will be returned. | |
245 | \item[State after successful completion:] No change | |
246 | \item[State after unsuccessful completion:] No change | |
247 | \end{description} | |
248 | ||
249 | ||
250 | \subsection{GetBlockData( unsigned long )} | |
251 | \label{Subsec:MonitoringReader::GetBlockData} | |
252 | \texttt{virtual const void* GetBlockData( unsigned long ndx ) const} | |
253 | ||
254 | This function returns a pointer to the beginning of data contained in the data block in the current event with the specified index. | |
255 | Indexing of data blocks starts at zero. | |
256 | If no event has yet been read in or if the last read attempt failed, a \texttt{NULL} pointer will be returned. | |
257 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
258 | a \texttt{NULL} pointer will be returned. | |
259 | ||
260 | \begin{description} | |
261 | \item[Parameters:] | |
262 | \begin{description} | |
263 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose data pointer is | |
264 | to be returned. This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) | |
265 | \end{description} | |
266 | \item[Return value:] An unsigned long integer (\texttt{unsigned long}) that holds a pointer to the beginning of the data block | |
267 | with the specified index contained in the last event that could be successfully read in. | |
268 | If no event has yet been read in or if the last read attempt failed, a \texttt{NULL} pointer will be returned. | |
269 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
270 | a \texttt{NULL} pointer will be returned. | |
271 | \item[State after successful completion:] No change | |
272 | \item[State after unsuccessful completion:] No change | |
273 | \end{description} | |
274 | ||
275 | ||
276 | \subsection{GetBlockSendNodeID( unsigned long )} | |
277 | \label{Subsec:MonitoringReader::GetBlockSendNodeID} | |
278 | \texttt{virtual const char* GetBlockSendNodeID( unsigned long ndx ) const} | |
279 | ||
280 | This functions returns a pointer to a string holding an ID of the node which as sent the data block with the specified index. | |
281 | Indexing of data blocks starts at zero. The node ID will be given in the string either as an IP address (e.g. ``\texttt{192.168.100.1}'') | |
282 | or as a hostname (e.g. ``\texttt{hlt42.alice.cern.ch}''). The string will be suitable as a parameter for the system call \texttt{gethostbyname}. | |
283 | If no event has yet been read in or if the last read attempt failed, a \texttt{NULL} pointer will be returned. | |
284 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
285 | a \texttt{NULL} pointer will be returned. | |
286 | ||
287 | \begin{description} | |
288 | \item[Parameters:] | |
289 | \begin{description} | |
290 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose sending node's ID is | |
291 | to be returned. This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) | |
292 | \end{description} | |
293 | \item[Return value:] A pointer to a string (\texttt{char*}) holding ID of the node that sent the data block | |
294 | with the specified index contained in the last event that could be successfully read in. | |
295 | If no event has yet been read in or if the last read attempt failed, a \texttt{NULL} pointer will be returned. | |
296 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
297 | a \texttt{NULL} pointer will be returned. | |
298 | \item[State after successful completion:] No change | |
299 | \item[State after unsuccessful completion:] No change | |
300 | \end{description} | |
301 | ||
302 | \subsection{GetBlockByteOrder( unsigned long )} | |
303 | \label{Subsec:MonitoringReader::GetBlockByteOrder} | |
304 | \texttt{virtual uint8 GetBlockByteOrder( unsigned long ndx ) const} | |
305 | ||
306 | This function returns a character stating the byte order in which the data of the data block in the current event | |
307 | with the given index is stored. | |
308 | ||
309 | The following values are returned: | |
310 | \begin{description} | |
311 | \item[0] specifies an unknown byte order | |
312 | \item[1] specifies little endian byte order | |
313 | \item[2] specifies big endian byte order | |
314 | \end{description} | |
315 | ||
316 | \begin{description} | |
317 | \item[Parameters:] | |
318 | \begin{description} | |
319 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose sending node's ID is | |
320 | to be returned. This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) | |
321 | \end{description} | |
322 | \item[Return value:] An unsigned character (\texttt{uint8}) specifying the byte order of the data stored in the current event's data block with the | |
323 | specified index. Possible values are | |
324 | \begin{description} | |
325 | \item[0] for an unknown byte order | |
326 | \item[1] for little endian byte order | |
327 | \item[2] for big endian byte order | |
328 | \end{description} | |
329 | If no event has yet been read in or if the last read attempt failed, a value of zero specifying an unknown byte order will be returned. | |
330 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
331 | a value of zero specifying an unknown byte order will be returned. | |
332 | \item[State after successful completion:] No change | |
333 | \item[State after unsuccessful completion:] No change | |
334 | \end{description} | |
335 | ||
336 | ||
337 | \subsection{GetBlockTypeAlignment( unsigned long, uint8 )} | |
338 | \label{Subsec:MonitoringReader::GetBlockTypeAlignment} | |
339 | \texttt{virtual uint8 GetBlockTypeAlignment( unsigned long ndx, uint8 dataType ) const} | |
340 | ||
341 | This functions returns an indicator for the alignment in bytes of the given data type in the data of the data block in the current event | |
342 | with the given index. | |
343 | ||
344 | Possible values for the data type are | |
345 | \begin{description} | |
346 | \item[0]: unsigned 64 bit integer (\texttt{uint64}) | |
347 | \item[1]: unsigned 32 bit integer (\texttt{uint32}) | |
348 | \item[2]: unsigned 16 bit integer (\texttt{uint16}) | |
349 | \item[3]: unsigned 8 bit integer (\texttt{uint8}) | |
350 | \item[4]: 64 bit floating point (\texttt{double}) | |
351 | \item[5]: 32 bit floating point (\texttt{float}) | |
352 | \end{description} | |
353 | ||
354 | \begin{description} | |
355 | \item[Parameters:] | |
356 | \begin{description} | |
357 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose sending node's ID is | |
358 | to be returned. This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) | |
359 | \end{description} | |
360 | \begin{description} | |
361 | \item[dataType:] An unsigned character (\texttt{uint8}) specifying the type of data whose alignment is queried. Possible values are | |
362 | \begin{description} | |
363 | \item[0] for unsigned 64 bit integer (\texttt{uint64}) | |
364 | \item[1] for unsigned 32 bit integer (\texttt{uint32}) | |
365 | \item[2] for unsigned 16 bit integer (\texttt{uint16}) | |
366 | \item[3] for unsigned 8 bit integer (\texttt{uint8}) | |
367 | \item[4] for 64 bit floating point (\texttt{double}) | |
368 | \item[5] for 32 bit floating point (\texttt{float}) | |
369 | \end{description} | |
370 | \end{description} | |
371 | \item[Return value:] An unsigned character (\texttt{uint8}) specifying the alignment in bytes of the given data type in the data stored in the current event's data block with the | |
372 | specified index. | |
373 | If no event has yet been read in or if the last read attempt failed, a value of zero will be returned. | |
374 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
375 | a value of zero will be returned. If an undefined value is specified for the data type (greater than 5) a value of zero will be returned. | |
376 | \item[State after successful completion:] No change | |
377 | \item[State after unsuccessful completion:] No change | |
378 | \end{description} | |
379 | ||
380 | ||
381 | ||
382 | \section{HOMERReader} | |
383 | ||
384 | The class \texttt{HOMERReader} implements the abstract interface defined by the class \texttt{MonitoringReader} for the HLT Online Monitoring Environment. | |
385 | It is shown in Fig. \ref{Fig:HOMERReader}. | |
386 | ||
387 | \begin{figure}[hbt] | |
388 | %\begin{center} | |
389 | {\footnotesize | |
390 | \begin{verbatim} | |
391 | ||
392 | class HOMERReader: public MonitoringReader | |
393 | { | |
394 | public: | |
395 | /* Constructors & destructors */ | |
396 | /* For reading from a TCP port */ | |
397 | HOMERReader( const char* hostname, unsigned short port ); | |
398 | /* For reading from multiple TCP ports */ | |
399 | HOMERReader( unsigned int tcpCnt, const char** hostnames, unsigned short* ports ); | |
400 | /* For reading from a System V shared memory segment */ | |
401 | HOMERReader( key_t shmKey, int shmSize ); | |
402 | /* For reading from multiple System V shared memory segments */ | |
403 | HOMERReader( unsigned int shmCnt, key_t* shmKey, int* shmSize ); | |
404 | /* For reading from multiple TCP ports and multiple System V shared memory segments */ | |
405 | HOMERReader( unsigned int tcpCnt, const char** hostnames, unsigned short* ports, | |
406 | unsigned int shmCnt, key_t* shmKey, int* shmSize ); | |
407 | virtual ~HOMERReader(); | |
408 | ||
409 | /* Return the status of the connection as established by one of the constructors. | |
410 | 0 means connection is ok, non-zero specifies the type of error that occured. */ | |
411 | int GetConnectionStatus() const; | |
412 | ||
413 | /* Return the index of the connection for which an error given by the above | |
414 | function occured. */ | |
415 | unsigned int GetErrorConnectionNdx() const; | |
416 | ||
417 | ... | |
418 | Functions defined in MonitoringReader left out for clarity | |
419 | ... | |
420 | ||
421 | /* Return the type of the data in the current event's data | |
422 | block with the given block index (starting at 0). */ | |
423 | uint64 GetBlockDataType( unsigned long ndx ) const; | |
424 | /* Return the origin of the data in the current event's data | |
425 | block with the given block index (starting at 0). */ | |
426 | uint32 GetBlockDataOrigin( unsigned long ndx ) const; | |
427 | /* Return a specification of the data in the current event's data | |
428 | block with the given block index (starting at 0). */ | |
429 | uint32 GetBlockDataSpec( unsigned long ndx ) const; | |
430 | ||
431 | /* Find the next data block in the current event with the given | |
432 | data type, origin, and specification. Returns the block's | |
433 | index. */ | |
434 | unsigned long FindBlockNdx( uint64 type, uint32 origin, | |
435 | uint32 spec, unsigned long startNdx=0 ) const; | |
436 | ||
437 | /* Return the ID of the node that actually produced this data block. | |
438 | This may be different from the node which sent the data to this | |
439 | monitoring object as returned by GetBlockSendNodeID. */ | |
440 | const char* GetBlockCreateNodeID( unsigned long ndx ) const; | |
441 | ||
442 | }; | |
443 | ||
444 | \end{verbatim} | |
445 | } | |
446 | \parbox{0.90\columnwidth}{ | |
447 | \caption[The API defined by the class \texttt{HOMERReader}.]{\label{Fig:HOMERReader}The API defined by the class \texttt{HOMERReader}. Only those functions which are declared | |
448 | in addition to those inherited from the class \texttt{MonitoringReader} are shown. } | |
449 | } | |
450 | %\end{center} | |
451 | \end{figure} | |
452 | ||
453 | Objects of this class are able to read in events from one or more monitoring ``taps'' attached in a | |
454 | data flow constructed using the Publisher/Subscriber framework. These monitoring taps can provide the | |
455 | data to be monitored either in System V Shared Memory segments or on TCP ports. The objects of the | |
456 | class \texttt{HOMERReader} can read data from both types. If multiple sources are specified for an object, | |
457 | it will only deliver events with matching event IDs for the blocks from the different sources. | |
458 | ||
459 | The methods in the API will be discussed in the following subsections. | |
460 | ||
461 | \subsection{HOMERReader( const char*, unsigned short )} | |
462 | ||
463 | \texttt{HOMERReader( const char* hostname, unsigned short port )} | |
464 | ||
465 | This constructor connects the new object to one TCP data source specified by the given hostname and TCP port number. The status of the connection after object creation can be queried | |
466 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
467 | ||
468 | \begin{description} | |
469 | \item[Parameters:] | |
470 | \begin{description} | |
471 | \item[hostname:] A string (\texttt{const char*}) holding a valid hostname on which the TCP monitoring source can be accessed. | |
472 | \item[port:] The port number (\texttt{unsigned short}) on which the TCP monitoring source waits for incoming connections/requests. | |
473 | \end{description} | |
474 | \item[Return value:] None | |
475 | \item[State after completion:] The object is created. The connection status of the specified connection can be queried | |
476 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
477 | \end{description} | |
478 | ||
479 | ||
480 | \subsection{HOMERReader( unsigned int, const char**, unsigned short* )} | |
481 | ||
482 | \texttt{HOMERReader( unsigned int tcpCnt, const char** hostnames, unsigned short* ports )} | |
483 | ||
484 | This constructor connects the new object to multiple TCP data sources specified by the given hostnames and port numbers. The status of the connection after object creation can be queried | |
485 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). The object will only deliver events with matching event IDs for the blocks from the | |
486 | different sources. | |
487 | ||
488 | \begin{description} | |
489 | \item[Parameters:] | |
490 | \begin{description} | |
491 | \item[tcpCnt:] The number of data sources specified. The number of hostnames and port numbers specified in the following | |
492 | two parameters must be equal to this number. | |
493 | \item[hostname:] An array of strings (\texttt{const char*}s)holding valid hostnames on which the TCP monitoring sources can be accessed. The number of hostnames | |
494 | specified must be equal to the \texttt{tcpCnt} parameter. | |
495 | \item[port:] An array of port numbers (\texttt{unsigned short}s) on which the TCP monitoring sources wait for incoming connections/requests. The number of port numbers | |
496 | specified must be equal to the \texttt{tcpCnt} parameter. | |
497 | \end{description} | |
498 | \item[Return value:] None | |
499 | \item[State after completion:] The object is created. The connection status of the specified connection can be queried | |
500 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
501 | \end{description} | |
502 | ||
503 | ||
504 | \subsection{HOMERReader( key\_t, int )} | |
505 | ||
506 | \texttt{HOMERReader( key\_t shmKey, int shmSize )} | |
507 | ||
508 | This constructor connects the new object to one System V shared memory segment. The status of the connection after object creation can be queried | |
509 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
510 | ||
511 | \begin{description} | |
512 | \item[Parameters:] | |
513 | \begin{description} | |
514 | \item[shmKey:] A key (\texttt{key\_t} specifying the shared memory segment to which the object should attach. | |
515 | \item[shmSize:] An integer (\texttt{int}) specifying the size of the shared memory segment to which the object should attach. | |
516 | \end{description} | |
517 | \item[Return value:] None | |
518 | \item[State after completion:] The object is created. The connection status of the specified connection can be queried | |
519 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
520 | \end{description} | |
521 | ||
522 | ||
523 | \subsection{HOMERReader( unsigned int, key\_t*, int* )} | |
524 | ||
525 | \texttt{HOMERReader( unsigned int shmCnt, key\_t* shmKey, int* shmSize )} | |
526 | ||
527 | This constructor connects the new object to multiple System V shared memory segments. The status of the connection after object creation can be queried | |
528 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). The object will only deliver events with matching event IDs for the blocks from the | |
529 | different sources. | |
530 | ||
531 | \begin{description} | |
532 | \item[Parameters:] | |
533 | \begin{description} | |
534 | \item[shmCnt:] The number of data sources specified. The number of shared memory keys and sizes specified in the following | |
535 | two parameters must be equal to this number. | |
536 | \item[shmKey:] An array of keys (\texttt{key\_t} specifying the shared memory segments to which the object should attach. The number of keys | |
537 | specified must be equal to the \texttt{shmCnt} parameter. | |
538 | \item[shmSize:] An array of integers (\texttt{int}) specifying the sizes of the shared memory segments to which the object should attach. | |
539 | The number of sizes specified must be equal to the \texttt{shmCnt} parameter. | |
540 | \end{description} | |
541 | \item[Return value:] None | |
542 | \item[State after completion:] The object is created. The connection status of the specified connection can be queried | |
543 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
544 | \end{description} | |
545 | ||
546 | ||
547 | \subsection{HOMERReader( unsigned int, const char**, unsigned short*, unsigned int, key\_t*, int* )} | |
548 | ||
549 | \texttt{HOMERReader( unsigned int tcpCnt, const char** hostnames, unsigned short* ports, unsigned int shmCnt, key\_t* shmKey, int* shmSize )} | |
550 | ||
551 | This constructor connects the new object to multiple TCP data sources specified by the given hostnames and port numbers and | |
552 | multiple System V shared memory segments. The status of the connection after object creation can be queried | |
553 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). The object will only deliver events with matching event IDs for the blocks from the | |
554 | different sources. | |
555 | ||
556 | \begin{description} | |
557 | \item[Parameters:] | |
558 | \begin{description} | |
559 | \item[tcpCnt:] The number of TCP data sources specified. The number of hostnames and port numbers specified in the following | |
560 | two parameters must be equal to this number. | |
561 | \item[hostname:] An array of strings (\texttt{const char*}s)holding valid hostnames on which the TCP monitoring sources can be accessed. The number of hostnames | |
562 | specified must be equal to the \texttt{tcpCnt} parameter. | |
563 | \item[port:] An array of port numbers (\texttt{unsigned short}s) on which the TCP monitoring sources wait for incoming connections/requests. The number of port numbers | |
564 | specified must be equal to the \texttt{tcpCnt} parameter. | |
565 | \item[shmCnt:] The number of shared memory data sources specified. The number of shared memory keys and sizes specified in the following | |
566 | two parameters must be equal to this number. | |
567 | \item[shmKey:] An array of keys (\texttt{key\_t} specifying the shared memory segments to which the object should attach. The number of keys | |
568 | specified must be equal to the \texttt{shmCnt} parameter. | |
569 | \item[shmSize:] An array of integers (\texttt{int}) specifying the sizes of the shared memory segments to which the object should attach. | |
570 | The number of sizes specified must be equal to the \texttt{shmCnt} parameter. | |
571 | \end{description} | |
572 | \item[Return value:] None | |
573 | \item[State after completion:] The object is created. The connection status of the specified connection can be queried | |
574 | using the function \texttt{GetConnectionStatus()} (\ref{Subsec:HOMERReader::GetConnectionStatus}). | |
575 | \end{description} | |
576 | ||
577 | ||
578 | \subsection{\~{ }HOMERReader()} | |
579 | ||
580 | \texttt{virtual \~{ }HOMERReader()} | |
581 | ||
582 | The destructor. Cleans up anything from the established connections. | |
583 | ||
584 | \begin{description} | |
585 | \item[Parameters:] None | |
586 | \item[Return value:] None | |
587 | \item[State after completion:] The object is destroyed. | |
588 | \end{description} | |
589 | ||
590 | ||
591 | \subsection{GetConnectionStatus()} | |
592 | \label{Subsec:HOMERReader::GetConnectionStatus} | |
593 | \texttt{int GetConnectionStatus() const} | |
594 | ||
595 | This functions returns the status of the connection to one or more data sources as specified in one of the class's constructors. 0 means the connection(s) | |
596 | could be successfully established, non-zero specified the error that occured, according to the definitions in the system include file \texttt{errno.h}. | |
597 | ||
598 | \begin{description} | |
599 | \item[Parameters:] None | |
600 | \item[Return value:] An integer (\texttt{int}) given the status of the connection(s) specified to one of the constructors. A value of 0 signals no errors. | |
601 | Non-zero specifies the error that occured according to the constants defined in the system include file \texttt{errno.h}. | |
602 | \item[State after successful completion:] No change | |
603 | \item[State after unsuccessful completion:] No change | |
604 | \end{description} | |
605 | ||
606 | ||
607 | \subsection{GetErrorConnectionNdx()} | |
608 | ||
609 | \texttt{unsigned int GetErrorConnectionNdx() const} | |
610 | ||
611 | This functions returns the index of the connection that produced an error returned by the function \texttt{GetConnectionStatus()} | |
612 | (\ref{Subsec:HOMERReader::GetConnectionStatus}). If no error occured the value returned is \texttt{\~{ }(unsigned long)0} respectively \texttt{(unsigned long)-1}. | |
613 | ||
614 | Numbering is done as follows: TCP connections are numbered from zero up to the number of TCP sources minus 1. Shm connections are numbered | |
615 | starting at the number of TCP sources up to the number of TCP sources plus the number of Shm sources minus 1. If {\em tcpCnt} TCP sources and | |
616 | {\em shmCnt} shared memory sources are used then the indices for TCP and shared memory sources $ndx_{tcp}$ and $ndx_{shm}$ | |
617 | respectively have ranges as follows: | |
618 | $$ 0 \le ndx_{tcp} < tcpCnt $$ | |
619 | $$ tcpCnt \le ndx_{shm} < shmCnt $$ | |
620 | For the constructors connecting only to TCP or shared memory sources the corresponding other count is assumed to be 0. | |
621 | ||
622 | \begin{description} | |
623 | \item[Parameters:] None | |
624 | \item[Return value:] An unsigned integer (\texttt{unsigned int}) given the index of the connection that produced an error reportedby the function \texttt{GetConnectionStatus()} | |
625 | (\ref{Subsec:HOMERReader::GetConnectionStatus}). If no error occured the value returned is \texttt{\~{ }(unsigned long)0} respectively \texttt{(unsigned long)-1}. The numbering scheme is defined above. | |
626 | \item[State after successful completion:] No change | |
627 | \item[State after unsuccessful completion:] No change | |
628 | \end{description} | |
629 | ||
630 | ||
631 | \subsection{ReadNextEvent()} | |
632 | ||
633 | \texttt{virtual int ReadNextEvent()} | |
634 | ||
635 | This function is an implementation of the interface defined by \texttt{MonitoringReader::ReadNextEvent()} (\ref{Subsec:MonitoringReader::ReadNextEvent}). | |
636 | ||
637 | ||
638 | \subsection{ReadNextEvent( unsigned long )} | |
639 | ||
640 | \texttt{virtual int ReadNextEvent( unsigned long timeout\_us )} | |
641 | ||
642 | This function is an implementation of the interface defined by \texttt{MonitoringReader::ReadNextEvent( unsigned long )} (\ref{Subsec:MonitoringReader::ReadNextEvent:unsignedlong}). | |
643 | ||
644 | ||
645 | \subsection{GetEventID()} | |
646 | ||
647 | \texttt{virtual uint64 GetEventID() const} | |
648 | ||
649 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetEventID()} (\ref{Subsec:MonitoringReader::GetEventID}). | |
650 | ||
651 | ||
652 | \subsection{GetBlockCnt()} | |
653 | ||
654 | \texttt{virtual unsigned long GetBlockCnt() const} | |
655 | ||
656 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}). | |
657 | ||
658 | ||
659 | \subsection{GetBlockDataLength( unsigned long )} | |
660 | ||
661 | \texttt{virtual unsigned long GetBlockDataLength( unsigned long ndx ) const} | |
662 | ||
663 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetBlockDataLength()} (\ref{Subsec:MonitoringReader::GetBlockDataLength}). | |
664 | ||
665 | ||
666 | \subsection{GetBlockData( unsigned long )} | |
667 | ||
668 | \texttt{virtual const void* GetBlockData( unsigned long ndx ) const} | |
669 | ||
670 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetBlockData()} (\ref{Subsec:MonitoringReader::GetBlockData}). | |
671 | ||
672 | ||
673 | \subsection{GetBlockSendNodeID( unsigned long )} | |
674 | ||
675 | \texttt{virtual const char* GetBlockSendNodeID( unsigned long ndx ) const} | |
676 | ||
677 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetBlockSendNodeID} (\ref{Subsec:MonitoringReader::GetBlockSendNodeID}). | |
678 | ||
679 | ||
680 | \subsection{GetBlockByteOrder( unsigned long )} | |
681 | ||
682 | \texttt{virtual uint8 GetBlockByteOrder( unsigned long ndx ) const} | |
683 | ||
684 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetBlockByteOrder} (\ref{Subsec:MonitoringReader::GetBlockByteOrder}). | |
685 | ||
686 | ||
687 | \subsection{GetBlockTypeAlignment( unsigned long, uint8 )} | |
688 | ||
689 | \texttt{virtual uint8 GetBlockTypeAlignment( unsigned long ndx, uint8 dataType ) const} | |
690 | ||
691 | This function is an implementation of the interface defined by \texttt{MonitoringReader::GetBlockTypeAlignment} (\ref{Subsec:MonitoringReader::GetBlockTypeAlignment}). | |
692 | ||
693 | ||
694 | \subsection{GetBlockDataType( unsigned long )} | |
695 | ||
696 | \texttt{uint64 GetBlockDataType( unsigned long ndx ) const} | |
697 | ||
698 | This function returns the data type of the data block in the current event with the specified index. The type of the data is returned as a 64~bit unsigned integer | |
699 | that is often also interpreted as an 8 character array. | |
700 | Indexing of data blocks starts at zero. | |
701 | If no event has yet been read in or if the last read attempt failed, an invalid type of (\texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) | |
702 | will be returned. | |
703 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) an | |
704 | invalid type of (\texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) will be returned. | |
705 | ||
706 | \begin{description} | |
707 | \item[Parameters:] | |
708 | \begin{description} | |
709 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose data type is queried. | |
710 | This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}). | |
711 | \end{description} | |
712 | \item[Return value:] A 64~bit unsigned integer (\texttt{uint64}) holding the type of the data block with the specified index. The value is often also interpreted as an 8 | |
713 | character array. | |
714 | If no event has yet been read in or if the last read attempt failed, an invalid type of (\texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) | |
715 | will be returned. | |
716 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
717 | an invalid type of (\texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) will be returned. | |
718 | \item[State after successful completion:] No change | |
719 | \item[State after unsuccessful completion:] No change | |
720 | \end{description} | |
721 | ||
722 | ||
723 | \subsection{GetBlockDataOrigin( unsigned long )} | |
724 | ||
725 | \texttt{uint32 GetBlockDataOrigin( unsigned long ndx ) const} | |
726 | ||
727 | This function returns the origin of the data block in the current event with the specified index. The origin of the data is returned as a 32~bit unsigned integer | |
728 | that is often also interpreted as a 4 character array. | |
729 | Indexing of data blocks starts at zero. | |
730 | If no event has yet been read in or if the last read attempt failed, an invalid value of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) | |
731 | will be returned. | |
732 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) an | |
733 | invalid value of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) will be returned. | |
734 | ||
735 | \begin{description} | |
736 | \item[Parameters:] | |
737 | \begin{description} | |
738 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose origin is queried. | |
739 | This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}). | |
740 | \end{description} | |
741 | \item[Return value:] A 32~bit unsigned integer (\texttt{uint32}) holding the origin of the data block with the specified index. The value is often also interpreted as a 4 | |
742 | character array. | |
743 | If no event has yet been read in or if the last read attempt failed, an invalid value of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) | |
744 | will be returned. | |
745 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
746 | an invalid value of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) will be returned. | |
747 | \item[State after successful completion:] No change | |
748 | \item[State after unsuccessful completion:] No change | |
749 | \end{description} | |
750 | ||
751 | ||
752 | \subsection{GetBlockDataSpec( unsigned long )} | |
753 | ||
754 | \texttt{uint32 GetBlockDataSpec( unsigned long ndx ) const} | |
755 | ||
756 | This function returns a specification of the data block in the current event with the specified index. This specification of the data is returned as a 32~bit unsigned integer | |
757 | that is often also interpreted as a 4 character array. | |
758 | Indexing of data blocks starts at zero. | |
759 | If no event has yet been read in or if the last read attempt failed, an invalid value of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) | |
760 | will be returned. | |
761 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) an | |
762 | invalid value of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) will be returned. | |
763 | ||
764 | \begin{description} | |
765 | \item[Parameters:] | |
766 | \begin{description} | |
767 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose specification is queried. | |
768 | This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}). | |
769 | \end{description} | |
770 | \item[Return value:] A 32~bit unsigned integer (\texttt{uint32}) holding the specification of the data block with the specified index. The value is often also interpreted as a 4 | |
771 | character array. | |
772 | If no event has yet been read in or if the last read attempt failed, an invalid type of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) | |
773 | will be returned. | |
774 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
775 | an invalid type of (\texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) will be returned. | |
776 | \item[State after successful completion:] No change | |
777 | \item[State after unsuccessful completion:] No change | |
778 | \end{description} | |
779 | ||
780 | ||
781 | \subsection{FindBlockNdx( uint64, uint32, uint32, unsigned long )} | |
782 | ||
783 | \texttt{unsigned long FindBlockNdx( uint64 type, uint32 origin, uint32 spec, unsigned long startNdx=0 ) const} | |
784 | ||
785 | This function searches for the next data block in the current event with the given data type, origin, and specification. Wildcards can be given | |
786 | for each of these parameters. An index at which the search is to be started can optionally also be specified. This parameter is 0 by default, | |
787 | starting the search at the beginning. By passing the result indices of previous searches increased by one as the start index all blocks can be searched. | |
788 | ||
789 | \begin{description} | |
790 | \item[Parameters:] | |
791 | \begin{description} | |
792 | \item[type:] A 64~bit unsigned integer (\texttt{uint64}) specifying the data type of the block to be searched. A value of | |
793 | \texttt{0xFF\-FF\-FF\-FF\-FF\-FF\-FF\-FF} / \texttt{\~{ }(uint64)0}) is treated as a wildcard. | |
794 | \item[origin:] A 32~bit unsigned integer (\texttt{uint32}) specifying the origin of the block to be searched. A value of | |
795 | \texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) is treated as a wildcard. | |
796 | \item[spec:] A 32~bit unsigned integer (\texttt{uint32}) specifying the data specification of the block to be searched. A value of | |
797 | \texttt{0xFF\-FF\-FF\-FF} / \texttt{\~{ }(uint32)0}) is treated as a wildcard. | |
798 | \item[startNdx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block where the search is to be started. | |
799 | If this value is greater than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) the | |
800 | search immediately terminates. | |
801 | \end{description} | |
802 | \item[Return value:] An 32~bit unsigned long integer (\texttt{unsigned long}) holding the index of a block matching the specified criteria. If no block could be found | |
803 | an invalid index of \texttt{\~{ }(unsigned long)0} / \texttt{(unsigned long)-1} is returned. | |
804 | \item[State after successful completion:] No change | |
805 | \item[State after unsuccessful completion:] No change | |
806 | \end{description} | |
807 | ||
808 | ||
809 | \subsection{GetBlockCreateNodeID( unsigned long )} | |
810 | ||
811 | \texttt{const char* GetBlockCreateNodeID( unsigned long ndx ) const} | |
812 | ||
813 | This functions returns a pointer to a string holding an ID of the node which created the data block with the specified index. | |
814 | Indexing of data blocks starts at zero. The node ID will be given in the string either as an IP address (e.g. ``\texttt{192.168.100.1}'') | |
815 | or as a hostname (e.g. ``\texttt{hlt42.alice.cern.ch}''). The string will be suitable as a parameter for the system call \texttt{gethostbyname}. | |
816 | If no event has yet been read in or if the last read attempt failed, a \texttt{NULL} pointer will be returned. | |
817 | If the block index is out of range (larger than or equal to the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
818 | a \texttt{NULL} pointer will be returned. | |
819 | ||
820 | This node ID can be different from the one returned by GetBlockSendNodeID() (\ref{Subsec:MonitoringReader::GetBlockSendNodeID}) if the Publisher/Subscriber | |
821 | framework component that produced or created the data is running on a different node than the one the monitoring component is running on. | |
822 | ||
823 | \begin{description} | |
824 | \item[Parameters:] | |
825 | \begin{description} | |
826 | \item[ndx:] An unsigned long integer (\texttt{unsigned long}) specifying the index of the block whose creator node's ID is | |
827 | to be returned. This value must be less than the value returned by \texttt{GetBlockCnt()} (\ref{Subsec:MonitoringReader::GetBlockCnt}) | |
828 | \end{description} | |
829 | \item[Return value:] A pointer to a string (\texttt{char*}) holding ID of the node that created the data block | |
830 | with the specified index contained in the last event that could be successfully read in. | |
831 | If no event has yet been read in or if the last read attempt failed, a \texttt{NULL} pointer will be returned. | |
832 | If the block index is out of range (larger than the value returned by \texttt{GetBlockCnt} (\ref{Subsec:MonitoringReader::GetBlockCnt})) | |
833 | a \texttt{NULL} pointer will be returned. | |
834 | \item[State after successful completion:] No change | |
835 | \item[State after unsuccessful completion:] No change | |
836 | \end{description} | |
837 | ||
838 | \section{History} | |
839 | ||
840 | \begin{description} | |
841 | \item[0.1] Initial version | |
842 | \item[0.2] Added the \texttt{GetBlockByteOrder} and \texttt{GetBlockTypeAlignment} methods; tried to clarify the reason for splitting the API into two classes | |
843 | \end{description} | |
844 | ||
845 | ||
846 | \end{document} |