dmlite  0.6
Public Types | Public Member Functions
dmlite::IOHandler Class Reference

IO interface. More...

#include <io.h>

List of all members.

Public Types

enum  Whence { kSet = SEEK_SET, kCur = SEEK_CUR, kEnd = SEEK_END }

Public Member Functions

virtual ~IOHandler ()
 Virtual destructor.
virtual void close (void) throw (DmException)
 Close.
virtual struct stat fstat (void) throw (DmException)
virtual size_t read (char *buffer, size_t count) throw (DmException)
virtual size_t write (const char *buffer, size_t count) throw (DmException)
virtual size_t readv (const struct iovec *vector, size_t count) throw (DmException)
virtual size_t writev (const struct iovec *vector, size_t count) throw (DmException)
virtual size_t pread (void *buffer, size_t count, off_t offset) throw (DmException)
virtual size_t pwrite (const void *buffer, size_t count, off_t offset) throw (DmException)
virtual void seek (off_t offset, Whence whence) throw (DmException)
virtual off_t tell (void) throw (DmException)
 Return the cursor position.
virtual void flush (void) throw (DmException)
 Flush the buffer.
virtual bool eof (void) throw (DmException)
 Return true if end of file.

Detailed Description

IO interface.


Member Enumeration Documentation

Enumerator:
kSet 

Beginning of the file.

kCur 

Current position.

kEnd 

End of file.


Constructor & Destructor Documentation

virtual dmlite::IOHandler::~IOHandler ( )
virtual

Virtual destructor.


Member Function Documentation

virtual void dmlite::IOHandler::close ( void  ) throw (DmException)
virtual

Close.

virtual bool dmlite::IOHandler::eof ( void  ) throw (DmException)
virtual

Return true if end of file.

virtual void dmlite::IOHandler::flush ( void  ) throw (DmException)
virtual

Flush the buffer.

virtual struct stat dmlite::IOHandler::fstat ( void  ) throw (DmException)
readvirtual

Gets information about a file descriptor.

Note:
Not all plug-ins will fill all the fields, but st_size is a reasonable expectation.
Default implementation combining seek/tell is provided.
virtual size_t dmlite::IOHandler::pread ( void *  buffer,
size_t  count,
off_t  offset 
) throw (DmException)
virtual

Read from the given offset without changing the file offset.

Parameters:
bufferWhere to put the data.
countNumber of bytes to read.
offsetThe operation offset.
Note:
A default implementation using read/seek/tell is provided.
virtual size_t dmlite::IOHandler::pwrite ( const void *  buffer,
size_t  count,
off_t  offset 
) throw (DmException)
virtual

Write from the given offset without changing the file offset.

Parameters:
bufferData to write.
countNumber of bytes to read.
offsetThe operation offset.
Note:
A default implementation using read/seek/tell is provided.
virtual size_t dmlite::IOHandler::read ( char *  buffer,
size_t  count 
) throw (DmException)
virtual

Read.

Parameters:
bufferWhere to store the data.
countNumber of bytes to read.
Returns:
Number of bytes actually read.
virtual size_t dmlite::IOHandler::readv ( const struct iovec *  vector,
size_t  count 
) throw (DmException)
virtual

Read into multiple buffers.

Parameters:
vectorAn array with 'count' iovec structs.
countNumber of elements in vector.
Returns:
The total size read.
Note:
See man readv.
A default implementation using read is provided.
virtual void dmlite::IOHandler::seek ( off_t  offset,
Whence  whence 
) throw (DmException)
virtual

Move the cursor.

Parameters:
offsetThe offset.
whenceReference.
virtual off_t dmlite::IOHandler::tell ( void  ) throw (DmException)
virtual

Return the cursor position.

virtual size_t dmlite::IOHandler::write ( const char *  buffer,
size_t  count 
) throw (DmException)
virtual

Write.

Parameters:
bufferData to write.
countNumber of bytes to write.
Returns:
Number of bytes actually written.
virtual size_t dmlite::IOHandler::writev ( const struct iovec *  vector,
size_t  count 
) throw (DmException)
virtual

Write from multiple buffers.

Parameters:
vectorAn array with 'count' iovec structs.
countNumber of elements in vector.
Returns:
The total size written.
Note:
See man writev.
A default implementation using write is provided.

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