evio  6.0
 All Data Structures Files Functions Variables Typedefs Macros Groups
write routines

These routines handle opening the ev lib for writing to a file, buffer, or socket. More...

Functions

int evWrite (int handle, const uint32_t *buffer)
 This routine writes an evio event to an internal buffer containing evio data. More...
 
int evFlush (int handle)
 This function flushes any remaining internally buffered data to file/socket. More...
 
int evStringsToBuf (uint32_t *buffer, int bufLen, char **strings, int stringCount, int *dataLen)
 This routine writes an array of strings, in evio format, into the given buffer. More...
 

Detailed Description

These routines handle opening the ev lib for writing to a file, buffer, or socket.

Function Documentation

int evFlush ( int  handle)

This function flushes any remaining internally buffered data to file/socket.

Calling evClose automatically does this so it isn't necessary to call before closing. This method should only be used when writing events at such a low rate that it takes an inordinate amount of time for internally buffered data to be written to the file.

Calling this can kill performance if writing to a hard disk!

Parameters
handleevio handle
Returns
S_SUCCESS if successful
S_EVFILE_BADHANDLE if bad handle arg
S_FAILURE error occurred during writing

References EV_WRITEFILE, EV_WRITEPIPE, EV_WRITESOCK, evfilestruct::lastEmptyBlockHeaderExists, evfilestruct::rw, S_EVFILE_BADHANDLE, and S_SUCCESS.

int evStringsToBuf ( uint32_t buffer,
int  bufLen,
char **  strings,
int  stringCount,
int *  dataLen 
)

This routine writes an array of strings, in evio format, into the given buffer.

This does NOT include any bank, segment, or tagsegment header. The length of the written data in bytes is returned in the "dataLen" arg. The written data is endian independent.

Parameters
bufferbuffer in which to place the evio format string data
bufLenlength of available room in which to write data in buffer in bytes
stringsarray of strings to write as data
stringCountnumber of strings in string array
dataLenpointer to int which gets filled the length of the written data in bytes
Returns
S_SUCCESS if successful
S_EVFILE_BADARG if buffer or dataLen arg is NULL, bufLen < 4, stringCount < 0, or a string is NULL
S_EVFILE_TRUNC if not enough room in buffer

References S_EVFILE_BADARG, S_EVFILE_TRUNC, and S_SUCCESS.

int evWrite ( int  handle,
const uint32_t buffer 
)

This routine writes an evio event to an internal buffer containing evio data.

If that internal buffer is full, it is flushed to the final destination file/socket/buffer/pipe opened with routines evOpen, evOpenBuffer, or evOpenSocket. It writes data in evio version 4 format and returns a status.

Parameters
handleevio handle
bufferpointer to buffer containing event to write
Returns
S_SUCCESS if successful
S_EVFILE_BADMODE if opened for reading or appending to opposite endian file/buffer.
S_EVFILE_TRUNC if not enough room writing to a user-supplied buffer
S_EVFILE_BADARG if buffer is NULL
S_EVFILE_BADHANDLE if bad handle arg
S_EVFILE_ALLOCFAIL if cannot allocate memory
errno if file/socket write error
stream error if file stream error

Referenced by evwrite_(), and main().