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.
std::string getImplId (void) const throw ()
 String ID of the implementation.
virtual void close (void) throw (DmException)
 Close.
virtual int fileno (void) throw (DmException)
 Return internal file descriptor, if any.
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 int dmlite::IOHandler::fileno ( void   )  throw (DmException) [virtual]

Return internal file descriptor, if any.

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

Flush the buffer.

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

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.
std::string dmlite::IOHandler::getImplId ( void   )  const throw () [inline]

String ID of the implementation.

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:
buffer Where to put the data.
count Number of bytes to read.
offset The 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:
buffer Data to write.
count Number of bytes to read.
offset The 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:
buffer Where to store the data.
count Number 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:
vector An array with 'count' iovec structs.
count Number 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:
offset The offset.
whence Reference.
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:
buffer Data to write.
count Number 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:
vector An array with 'count' iovec structs.
count Number 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:

Generated on 4 May 2016 for dmlite by  doxygen 1.6.1