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) |
| Close.
|
virtual int | fileno (void) |
| Return internal file descriptor, if any.
|
virtual struct::stat | fstat (void) |
virtual size_t | read (char *buffer, size_t count) |
virtual size_t | write (const char *buffer, size_t count) |
virtual size_t | readv (const struct iovec *vector, size_t count) |
virtual size_t | writev (const struct iovec *vector, size_t count) |
virtual size_t | pread (void *buffer, size_t count, off_t offset) |
virtual size_t | pwrite (const void *buffer, size_t count, off_t offset) |
virtual void | seek (off_t offset, Whence whence) |
virtual off_t | tell (void) |
| Return the cursor position.
|
virtual void | flush (void) |
| Flush the buffer.
|
virtual bool | eof (void) |
| 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] |
Member Function Documentation
virtual void dmlite::IOHandler::close |
( |
void |
|
) |
[virtual] |
virtual bool dmlite::IOHandler::eof |
( |
void |
|
) |
[virtual] |
Return true if end of file.
virtual int dmlite::IOHandler::fileno |
( |
void |
|
) |
[virtual] |
Return internal file descriptor, if any.
virtual void dmlite::IOHandler::flush |
( |
void |
|
) |
[virtual] |
virtual struct ::stat dmlite::IOHandler::fstat |
( |
void |
|
) |
[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 | |
|
) |
| | [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 | |
|
) |
| | [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 | |
|
) |
| | [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 | |
|
) |
| | [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 | |
|
) |
| | [virtual] |
Move the cursor.
- Parameters:
-
| offset | The offset. |
| whence | Reference. |
virtual off_t dmlite::IOHandler::tell |
( |
void |
|
) |
[virtual] |
Return the cursor position.
virtual size_t dmlite::IOHandler::write |
( |
const char * |
buffer, |
|
|
size_t |
count | |
|
) |
| | [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 | |
|
) |
| | [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: