evio
6.0
|
These routines handle opening the ev lib for reading from a file, buffer, or socket. More...
Functions | |
int | evRead (int handle, uint32_t *buffer, uint32_t buflen) |
This routine reads from an evio format file/socket/buffer opened with routines evOpen, evOpenBuffer, or evOpenSocket and returns the next event in the buffer arg. More... | |
int | evReadAlloc (int handle, uint32_t **buffer, uint32_t *buflen) |
This routine reads an evio bank from an evio format file/socket/buffer opened with routines evOpen, evOpenBuffer, or evOpenSocket, allocates a buffer and fills it with the bank. More... | |
int | evReadNoCopy (int handle, const uint32_t **buffer, uint32_t *buflen) |
This routine reads from an evio format file/buffer/socket opened with routines evOpen, evOpenBuffer, or evOpenSocket and returns a pointer to the next event residing in an internal buffer. More... | |
int | evReadRandom (int handle, const uint32_t **pEvent, uint32_t *buflen, uint32_t eventNumber) |
This routine does a random access read from an evio format file/buffer opened with routines evOpen or evOpenBuffer. More... | |
int | evBufToStrings (char *buffer, int bufLen, char ***pStrArray, int *strCount) |
This routine unpacks/parses an evio format buffer containing strings into an array of strings. More... | |
These routines handle opening the ev lib for reading from a file, buffer, or socket.
int evBufToStrings | ( | char * | buffer, |
int | bufLen, | ||
char *** | pStrArray, | ||
int * | strCount | ||
) |
This routine unpacks/parses an evio format buffer containing strings into an array of strings.
Evio string data is endian independent. The array pointed to in pStrArray is allocated here and needs to be freed by the caller. All strings contained in the array also need to be freed by the caller.
buffer | buffer containing evio format string data (NOT including header) |
bufLen | length of string data in bytes |
pStrArray | address of string array which gets filled parsed strings |
strCount | pointer to int which get filled with the number of strings in string array |
References S_EVFILE_BADARG, S_FAILURE, and S_SUCCESS.
This routine reads from an evio format file/socket/buffer opened with routines evOpen, evOpenBuffer, or evOpenSocket and returns the next event in the buffer arg.
Works with all versions of evio. A status is returned.
handle | evio handle |
buffer | pointer to buffer |
buflen | length of buffer in 32 bit words |
References evfilestruct::byte_swapped, EV_READBUF, EV_READFILE, EV_READPIPE, EV_READSOCK, EVIO_SWAP32, evioswap(), evfilestruct::left, evfilestruct::next, evfilestruct::randomAccess, evfilestruct::rw, S_EVFILE_BADARG, S_EVFILE_BADHANDLE, S_EVFILE_BADMODE, S_EVFILE_TRUNC, S_SUCCESS, and evfilestruct::version.
This routine reads an evio bank from an evio format file/socket/buffer opened with routines evOpen, evOpenBuffer, or evOpenSocket, allocates a buffer and fills it with the bank.
Works with all versions of evio. A status is returned. Cannot use with random access.
handle | evio handle |
buffer | pointer to pointer to buffer gets filled with pointer to allocated buffer (caller must free) |
buflen | pointer to int gets filled with length of buffer in 32 bit words including the full (8 byte) bank header |
References S_EVFILE_BADHANDLE.
This routine reads from an evio format file/buffer/socket opened with routines evOpen, evOpenBuffer, or evOpenSocket and returns a pointer to the next event residing in an internal buffer.
If the data needs to be swapped, it is swapped in place. Any other calls to read routines may cause the data to be overwritten. No writing to the returned pointer is allowed. Works only with evio version 4 and up. A status is returned. Caller must free the buffer when finished with it. Cannot use this routine for random access reading.
handle | evio handle |
buffer | pointer to pointer to buffer gets filled with pointer to location in internal buffer which is guaranteed to be valid only until the next evRead, evReadAlloc, or evReadNoCopy call. |
buflen | pointer to int gets filled with length of buffer in 32 bit words including the full (8 byte) bank header |
References evfilestruct::byte_swapped, EV_READBUF, EV_READFILE, EV_READPIPE, EV_READSOCK, EVIO_SWAP32, evioswap(), evfilestruct::left, evfilestruct::next, evfilestruct::randomAccess, evfilestruct::rw, S_EVFILE_BADARG, S_EVFILE_BADFILE, S_EVFILE_BADHANDLE, S_EVFILE_BADMODE, S_SUCCESS, and evfilestruct::version.
This routine does a random access read from an evio format file/buffer opened with routines evOpen or evOpenBuffer.
It returns a pointer to the desired event residing in either a memory mapped file or buffer when opened in random access mode.
If reading a file from a remote machine, it is not wise to use the "ra" flag in evOpen. This memory maps the file which is not ideal over the network.
If the data needs to be swapped, it is swapped in place. No writing to the returned pointer is allowed. Works only with evio version 4 and up. A status is returned.
handle | evio handle |
pEvent | pointer which gets filled with pointer to event in buffer or memory mapped file |
buflen | pointer to int gets filled with length of buffer in 32 bit words including the full (8 byte) bank header |
eventNumber | the number of the event to be read (returned) starting at 1. |
References evfilestruct::byte_swapped, EV_READBUF, EV_READFILE, evfilestruct::eventCount, EVIO_SWAP32, evioswap(), evfilestruct::pTable, evfilestruct::randomAccess, evfilestruct::rw, S_EVFILE_BADARG, S_EVFILE_BADFILE, S_EVFILE_BADHANDLE, S_EVFILE_BADMODE, S_FAILURE, S_SUCCESS, and evfilestruct::version.