evio  5.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
evio::evioFileChannel Class Reference

Implements evioChannel functionality for I/O to and from files. More...

#include <evioFileChannel.hxx>

Inheritance diagram for evio::evioFileChannel:
evio::evioChannel

Public Member Functions

 evioFileChannel (const string &fileName, const string &mode="r", int size=1000000) throw (evioException)
 Constructor opens channel for reading or writing. More...
 
 evioFileChannel (const string &fileName, evioDictionary *dict, const string &mode="r", int size=1000000) throw (evioException)
 Constructor opens channel for reading or writing, dictionary specified. More...
 
 evioFileChannel (const string &fileName, evioDictionary *dict, const uint32_t *firstEvent, const string &mode="w", int size=1000000) throw (evioException)
 Constructor opens channel for reading or writing to file with dictionary specified, If writing, the first event (an event which gets written once in each split file) may also be specified. More...
 
virtual ~evioFileChannel (void)
 Destructor closes file, deletes internal buffer, deletes dictionary one created from file. More...
 
void open (void) throw (evioException)
 Opens channel for reading or writing. More...
 
bool read (void) throw (evioException)
 Reads from file into internal buffer. More...
 
bool read (uint32_t *myEventBuf, int length) throw (evioException)
 Reads from file into user-supplied buffer. More...
 
bool readAlloc (uint32_t **buffer, uint32_t *bufLen) throw (evioException)
 Reads from file and allocates buffer as needed. More...
 
bool readNoCopy (void) throw (evioException)
 Reads from file using no copy mechanism. More...
 
bool readRandom (uint32_t bufferNumber) throw (evioException)
 Reads buffer from file given buffer number. More...
 
void write (void) throw (evioException)
 Writes to file from internal buffer. More...
 
void write (const uint32_t *myEventBuf) throw (evioException)
 Writes to file from user-supplied buffer. More...
 
void write (const evioChannel &channel) throw (evioException)
 Writes to file from internal buffer of another evioChannel object. More...
 
void write (const evioChannel *channel) throw (evioException)
 Writes from internal buffer of another evioChannel object. More...
 
void write (const evioChannelBufferizable &o) throw (evioException)
 Writes from contents of evioChannelBufferizable object. More...
 
void write (const evioChannelBufferizable *o) throw (evioException)
 Writes from contents of evioChannelBufferizable object. More...
 
void close (void) throw (evioException)
 Closes channel. More...
 
int ioctl (const string &request, void *argp) throw (evioException)
 For getting and setting evIoctl parameters. More...
 
const uint32_t * getBuffer (void) const throw (evioException)
 Returns pointer to internal channel buffer. More...
 
int getBufSize (void) const
 Returns internal channel buffer size. More...
 
const uint32_t * getNoCopyBuffer (void) const throw (evioException)
 Returns pointer to no copy buffer. More...
 
const uint32_t * getRandomBuffer (void) const throw (evioException)
 Returns pointer to random buffer. More...
 
void getRandomAccessTable (uint32_t ***const table, uint32_t *len) const throw (evioException)
 Returns random access table. More...
 
string getFileName (void) const
 Returns channel file name. More...
 
string getMode (void) const
 Returns channel I/O mode. More...
 
string getFileXMLDictionary (void) const
 Returns XML dictionary read in from file. More...
 
- Public Member Functions inherited from evio::evioChannel
 evioChannel (void)
 
 evioChannel (evioDictionary *dict)
 
virtual ~evioChannel (void)
 
virtual const evioDictionarygetDictionary (void) const
 

Additional Inherited Members

- Protected Attributes inherited from evio::evioChannel
evioDictionarydictionary
 

Detailed Description

Implements evioChannel functionality for I/O to and from files.

Basically a wrapper around the original evio C library.

Constructor & Destructor Documentation

evioFileChannel::evioFileChannel ( const string &  f,
const string &  m = "r",
int  size = 1000000 
)
throw (evioException
)

Constructor opens channel for reading or writing.

Parameters
fFile name
mI/O mode, "r", "ra", "w", "a", or "s"
sizeInternal buffer size
evioFileChannel::evioFileChannel ( const string &  f,
evioDictionary dict,
const string &  m = "r",
int  size = 1000000 
)
throw (evioException
)

Constructor opens channel for reading or writing, dictionary specified.

Parameters
fFile name
dictDictionary
mI/O mode, "r", "ra", "w", "a", or "s"
sizeInternal buffer size
evioFileChannel::evioFileChannel ( const string &  f,
evioDictionary dict,
const uint32_t *  firstEvent,
const string &  m = "w",
int  size = 1000000 
)
throw (evioException
)

Constructor opens channel for reading or writing to file with dictionary specified, If writing, the first event (an event which gets written once in each split file) may also be specified.

Parameters
fFile name
dictDictionary
firstEventbuffer containing first event
mI/O mode, "r", "ra", "w", "a", or "s"
sizeInternal buffer size
evioFileChannel::~evioFileChannel ( void  )
virtual

Destructor closes file, deletes internal buffer, deletes dictionary one created from file.

Member Function Documentation

void evioFileChannel::close ( void  )
throw (evioException
)
virtual

Closes channel.

Implements evio::evioChannel.

const uint32_t * evioFileChannel::getBuffer ( void  ) const
throw (evioException
)
virtual

Returns pointer to internal channel buffer.

Returns
Pointer to internal buffer

Implements evio::evioChannel.

int evioFileChannel::getBufSize ( void  ) const
virtual

Returns internal channel buffer size.

Returns
Internal buffer size in 4-byte words

Implements evio::evioChannel.

string evioFileChannel::getFileName ( void  ) const

Returns channel file name.

Returns
String containing file name
string evioFileChannel::getFileXMLDictionary ( void  ) const

Returns XML dictionary read in from file.

Returns
XML dictionary read in from file
string evioFileChannel::getMode ( void  ) const

Returns channel I/O mode.

Returns
String containing I/O mode
const uint32_t * evioFileChannel::getNoCopyBuffer ( void  ) const
throw (evioException
)
virtual

Returns pointer to no copy buffer.

Returns
Pointer to no copy buffer

Implements evio::evioChannel.

void evioFileChannel::getRandomAccessTable ( uint32_t ***const  table,
uint32_t *  len 
) const
throw (evioException
)
virtual

Returns random access table.

Parameters
tablePointer to table
lenLength of table

Reimplemented from evio::evioChannel.

const uint32_t * evioFileChannel::getRandomBuffer ( void  ) const
throw (evioException
)
virtual

Returns pointer to random buffer.

Returns
Pointer to random buffer

Reimplemented from evio::evioChannel.

int evioFileChannel::ioctl ( const string &  request,
void *  argp 
)
throw (evioException
)
virtual

For getting and setting evIoctl parameters.

Parameters
requestString containing evIoctl parameters
argpAdditional evIoctl parameter

Implements evio::evioChannel.

void evioFileChannel::open ( void  )
throw (evioException
)
virtual

Opens channel for reading or writing.

For read, user-supplied dictionary overrides one found in file.

Implements evio::evioChannel.

bool evioFileChannel::read ( void  )
throw (evioException
)
virtual

Reads from file into internal buffer.

Returns
true if successful, false on EOF or other evRead error condition

Implements evio::evioChannel.

bool evioFileChannel::read ( uint32_t *  myBuf,
int  length 
)
throw (evioException
)
virtual

Reads from file into user-supplied buffer.

Parameters
myBufUser-supplied buffer. length Length of buffer in 4-byte words.
Returns
true if successful, false on EOF or other evRead error condition

Implements evio::evioChannel.

bool evioFileChannel::readAlloc ( uint32_t **  buffer,
uint32_t *  bufLen 
)
throw (evioException
)
virtual

Reads from file and allocates buffer as needed.

Parameters
bufferPointer to pointer to allocated buffer.
lenLength of allocated buffer in 4-byte words.
Returns
true if successful, false on EOF, throws exception for other error.

Note: user MUST free the allocated buffer!

Implements evio::evioChannel.

bool evioFileChannel::readNoCopy ( void  )
throw (evioException
)
virtual

Reads from file using no copy mechanism.

Returns
true if successful, false on EOF, throws exception for other error.

Implements evio::evioChannel.

bool evioFileChannel::readRandom ( uint32_t  bufferNumber)
throw (evioException
)
virtual

Reads buffer from file given buffer number.

Parameters
bufferNumberBuffer to return
Returns
true if successful, false on EOF, throws exception for other error.

Reimplemented from evio::evioChannel.

void evioFileChannel::write ( void  )
throw (evioException
)
virtual

Writes to file from internal buffer.

Implements evio::evioChannel.

void evioFileChannel::write ( const uint32_t *  myBuf)
throw (evioException
)
virtual

Writes to file from user-supplied buffer.

Parameters
myBufBuffer containing event

Implements evio::evioChannel.

void evioFileChannel::write ( const evioChannel channel)
throw (evioException
)
virtual

Writes to file from internal buffer of another evioChannel object.

Parameters
channelChannel object

Implements evio::evioChannel.

void evioFileChannel::write ( const evioChannel channel)
throw (evioException
)
virtual

Writes from internal buffer of another evioChannel object.

Parameters
channelPointer to channel object

Implements evio::evioChannel.

void evioFileChannel::write ( const evioChannelBufferizable o)
throw (evioException
)
virtual

Writes from contents of evioChannelBufferizable object.

Parameters
oevioChannelBufferizable object that can serialze to buffer

Implements evio::evioChannel.

void evioFileChannel::write ( const evioChannelBufferizable o)
throw (evioException
)
virtual

Writes from contents of evioChannelBufferizable object.

Parameters
oPointer to evioChannelBufferizable object that can serialize to buffer

Implements evio::evioChannel.


The documentation for this class was generated from the following files: