evio
5.2
|
These routines handle getting and setting evio parameters. More...
Functions | |
int | evGetFileName (int handle, char *name, size_t maxLength) |
This routine gets the name of the file currently being written to and opened with evOpen, Returned string may NOT be written into. More... | |
int | evGetBufferLength (int handle, uint32_t *length) |
This routine returns the number of bytes written into a buffer so far when given a handle provided by calling evOpenBuffer. More... | |
int | evIoctl (int handle, char *request, void *argp) |
This routine changes various evio parameters used in reading and writing. More... | |
int | evGetRandomAccessTable (int handle, uint32_t ***const table, uint32_t *len) |
This routine gets an array of event pointers if the handle was opened in random access mode. More... | |
int | evGetDictionary (int handle, char **dictionary, uint32_t *len) |
This routine gets the dictionary associated with this handle if there is any. More... | |
const char * | evGetTypename (int type) |
This routine returns a string representation of an evio type. More... | |
int | evIsContainer (int type) |
This routine return true (1) if given type is a container, else returns false (0). More... | |
char * | evPerror (int error) |
This routine returns a string describing the given error value. More... | |
These routines handle getting and setting evio parameters.
int evGetBufferLength | ( | int | handle, |
uint32_t * | length | ||
) |
This routine returns the number of bytes written into a buffer so far when given a handle provided by calling evOpenBuffer.
After the handle is closed, this no longer returns anything valid.
handle | evio handle |
length | pointer to int which gets filled with number of bytes written to buffer so far |
References evfilestruct::rwBytesOut, S_EVFILE_BADHANDLE, and S_SUCCESS.
int evGetDictionary | ( | int | handle, |
char ** | dictionary, | ||
uint32_t * | len | ||
) |
This routine gets the dictionary associated with this handle if there is any.
Memory must be freed by caller if a dictionary was successfully returned.
handle | evio handle |
dictionary | pointer to string which gets filled with dictionary string (xml) if it exists, else gets filled with NULL. Memory for dictionary allocated here, must be freed by caller. |
len | pointer to int which gets filled with dictionary string length (# chars) if there is one, else filled with 0. If this arg = NULL, no len is returned. |
References evfilestruct::dictionary, S_EVFILE_ALLOCFAIL, S_EVFILE_BADARG, S_EVFILE_BADHANDLE, and S_SUCCESS.
int evGetFileName | ( | int | handle, |
char * | name, | ||
size_t | maxLength | ||
) |
This routine gets the name of the file currently being written to and opened with evOpen, Returned string may NOT be written into.
handle | evio handle |
name | caller's char array which gets filled with file name or NULL if there is no name. |
maxLength | length of array being passed in. |
References EV_WRITEFILE, evfilestruct::fileName, evfilestruct::rw, S_EVFILE_BADHANDLE, S_EVFILE_BADMODE, S_EVFILE_TRUNC, S_FAILURE, and S_SUCCESS.
This routine gets an array of event pointers if the handle was opened in random access mode.
User must not change the pointers in the array or the data being pointed to (hence the consts in the second parameter).
handle | evio handle |
table | pointer to array of uint32_t pointers which gets filled with an array of event pointers. If this arg = NULL, error is returned. |
len | pointer to int which gets filled with the number of pointers in the array. If this arg = NULL, error is returned. |
References evfilestruct::eventCount, evfilestruct::pTable, evfilestruct::randomAccess, S_EVFILE_BADARG, S_EVFILE_BADHANDLE, S_EVFILE_BADMODE, and S_SUCCESS.
const char* evGetTypename | ( | int | type | ) |
This routine returns a string representation of an evio type.
type | numerical value of an evio type |
int evIoctl | ( | int | handle, |
char * | request, | ||
void * | argp | ||
) |
This routine changes various evio parameters used in reading and writing.
It changes the target block size (in 32-bit words) for writes if request = "B". If setting block size fails, writes can still continue with original block size. Minimum size = EV_BLOCKSIZE_MIN (1024) words. Max size = EV_BLOCKSIZE_MAX (33554432) words.
It changes size of buffer (in 32-bit words) for writing to file/socket/pipe if request = "W". Must be >= target block size (see above) + header (EV_HDSIZ). Max size = EV_BLOCKSIZE_MAX + EV_HDSIZ (33554444) words.
It changes the maximum number of events/block if request = "N". It only goes up to EV_EVENTS_MAX (100,000). Used only in version 4.
It sets the run number used when auto naming while splitting files being written to if request = "R". Used only in version 4.
It sets the run type used when auto naming while splitting files being written to if request = "T". Used only in version 4.
It changes the number of bytes at which to split a file being written to if request = "S". If unset with this function, it defaults to EV_SPLIT_SIZE (2GB). NOTE: argp must point to 64 bit integer (not 32 bit)! Used only in version 4.
It sets the stream id used when auto naming files being written to if request = "M". Used only in version 4.
It returns the version number if request = "V".
It returns a pointer to the EV_HDSIZ block header ints if request = "H". This pointer must be freed by the caller to avoid a memory leak.
It returns the total number of events in a file/buffer opened for reading or writing if request = "E". Includes any event added with evWrite call. Used only in version 4.
NOTE: all request strings are case insensitive. All version 4 commands to version 3 files are ignored.
handle | evio handle |
request | case independent string value of:
|
argp |
|
References evfilestruct::append, evfilestruct::blkEvCount, evfilestruct::blkEvMax, evfilestruct::blknum, evfilestruct::blkSizeTarget, evfilestruct::buf, evfilestruct::bufRealSize, evfilestruct::bufSize, evfilestruct::currentHeader, EV_BLOCKSIZE_MAX, EV_BLOCKSIZE_MIN, EV_EVENTS_MAX, EV_HD_VER, EV_HDSIZ, EV_READBUF, EV_READFILE, EV_READPIPE, EV_READSOCK, EV_VERSION_MASK, EV_WRITEBUF, EV_WRITEFILE, EV_WRITEPIPE, EV_WRITESOCK, initBlockHeader2, evfilestruct::left, evfilestruct::next, evfilestruct::runNumber, evfilestruct::runType, evfilestruct::rw, S_EVFILE_ALLOCFAIL, S_EVFILE_BADARG, S_EVFILE_BADHANDLE, S_EVFILE_BADSIZEREQ, S_EVFILE_UNKOPTION, S_SUCCESS, evfilestruct::split, evfilestruct::streamId, and UINT64_MAX.
Referenced by evioctl_().
int evIsContainer | ( | int | type | ) |
This routine return true (1) if given type is a container, else returns false (0).
type | numerical value of an evio type (eg. type = 0x10 = bank, returns 1) |
char* evPerror | ( | int | error | ) |
This routine returns a string describing the given error value.
The returned string is a static char array. This means it is not thread-safe and will be overwritten on subsequent calls.
error | error condition |
References S_EVFILE, S_EVFILE_ALLOCFAIL, S_EVFILE_BADARG, S_EVFILE_BADBLOCK, S_EVFILE_BADFILE, S_EVFILE_BADHANDLE, S_EVFILE_BADMODE, S_EVFILE_BADSIZEREQ, S_EVFILE_TRUNC, S_EVFILE_UNKOPTION, S_EVFILE_UNXPTDEOF, S_FAILURE, and S_SUCCESS.