#include <DLMemoryBasedIO.h>
Inheritance diagram for DLMemoryBasedIO:
Public Member Functions | |
DLMemoryBasedIO (void *ptr, int size, const char *mode) | |
virtual | ~DLMemoryBasedIO (void) |
int | dlRead (void *buff, int size) |
int | dlGets (void *buff, int size) |
string | dlGetLine () |
int | dlGetInt (DLEndian endian) |
short | dlGetShort (DLEndian endian) |
void | dlWriteInt (int intVal, DLEndian endian) |
void | dlWriteShort (short shortVal, DLEndian endian) |
int | dlWrite (void *buff, int size) |
int | dlClose () |
int | dlFlush () |
void * | dlGetMemBlock () |
int | dlGetMemSize () |
DLMemoryBasedIO is derived from DLIOStream object and it implements the memory based I/O system for DOCLIB.
DLMemoryBasedIO handles the byte order (endian) for reading/writing int/short in the memory based system.
It makes use of the MFS (Memory File System mfs_file.c) to read/write to memory.
Definition at line 20 of file DLMemoryBasedIO.h.
DLMemoryBasedIO::DLMemoryBasedIO | ( | void * | ptr, | |
int | size, | |||
const char * | mode | |||
) |
constructor
ptr | pointer to a memory location to be used for the memory based I/O operations. | |
size | buffer size | |
mode | I/O mode to open as. Same as flags for fopen. "r" read, "w" write , "rb" read binary, "wb" write binary. |
virtual DLMemoryBasedIO::~DLMemoryBasedIO | ( | void | ) | [virtual] |
Destructor
int DLMemoryBasedIO::dlRead | ( | void * | buff, | |
int | size | |||
) | [virtual] |
dlRead reads up to a number of (size) bytes from the DOCLIB memory I/O stream into the buffer. dlRead will read up to the max size or reached the end of the memory block. The buffer must be allocated prior calling the dlRead() function. The number of bytes read in is returned.
buff | buffer to store the data | |
size | max buffer size to read. |
Implements DLIOStream.
int DLMemoryBasedIO::dlGets | ( | void * | buff, | |
int | size | |||
) | [virtual] |
dlGets reads up to a number of (size) bytes from the DOCLIB memory I/O stream into the buffer. dlGets will read up to the max size or until line feed or reached the end of the memory block. The buffer must be allocated prior calling the dlRead() function. The number of bytes read in is returned.
buff | buffer to store the data | |
size | max buffer size to read |
Implements DLIOStream.
string DLMemoryBasedIO::dlGetLine | ( | ) | [virtual] |
dlGetLine reads a line from the DOCLIB memory I/O stream. dlGetLine will read up to an end of line or DL_PPM_MAX_LINE_LENGTH (256) or reached the end of the memory block. A string of the read in line will be returned.
Implements DLIOStream.
int DLMemoryBasedIO::dlGetInt | ( | DLEndian | endian | ) | [virtual] |
dlGetInt reads an int "sizeof(int) bytes" from the DOCLIB memory I/O stream. dlGetInt will convert the byte order of the current int value into the indicated byte order. The read in "int" value is returned.
endian | desired byte order
|
Implements DLIOStream.
short DLMemoryBasedIO::dlGetShort | ( | DLEndian | endian | ) | [virtual] |
dlGetShort reads a short "sizeof(short) bytes" from the DOCLIB I/O stream. dlGetShort will convert the byte order of the current short value into the indicated byte order. The read in "short" value is returned.
endian | desired byte order
|
Implements DLIOStream.
void DLMemoryBasedIO::dlWriteInt | ( | int | intVal, | |
DLEndian | endian | |||
) | [virtual] |
dlWriteInt writes an int to the DOCLIB I/O stream. dlWriteInt will convert the int value into the indicated byte order and then writes it out to the DOCLIB I/O stream.
intVal | int value to write | |
endian | desired byte order
|
Implements DLIOStream.
void DLMemoryBasedIO::dlWriteShort | ( | short | shortVal, | |
DLEndian | endian | |||
) | [virtual] |
dlWriteInt writes a short to the DOCLIB I/O stream. dlWriteInt will convert the short value into the indicated byte order and then writes it out to the DOCLIB I/O stream.
shortVal | short value to write | |
endian | desired byte order
|
Implements DLIOStream.
int DLMemoryBasedIO::dlWrite | ( | void * | buff, | |
int | size | |||
) | [virtual] |
dlWrite writes a buffer with size to the DOCLIB memory I/O stream.
buff | buffer to write | |
size | buffer size to write |
Implements DLIOStream.
int DLMemoryBasedIO::dlClose | ( | ) | [virtual] |
int DLMemoryBasedIO::dlFlush | ( | ) | [virtual] |
dlFlush flush the current DOCLIB memory I/O stream.
Implements DLIOStream.
void* DLMemoryBasedIO::dlGetMemBlock | ( | ) |
dlGetMemBlock () returns the memory address location where DLMemoryBasedIO is using for I/O operations.
int DLMemoryBasedIO::dlGetMemSize | ( | ) |
dlGetMemSize returns the size of the memory block