#include <DLFileBasedIO.h>
Inheritance diagram for DLFileBasedIO:
Public Member Functions | |
DLFileBasedIO (const char *filename, const char *mode) | |
~DLFileBasedIO (void) | |
int | dlRead (void *buff, int size) |
int | dlGets (void *buff, int size) |
string | dlGetLine () |
int | dlWrite (void *buff, int size) |
int | dlGetInt (DLEndian endian) |
short | dlGetShort (DLEndian endian) |
void | dlWriteInt (int intVal, DLEndian endian) |
void | dlWriteShort (short shortVal, DLEndian endian) |
int | dlClose () |
int | dlFlush () |
DLFileBasedIO is derived from DLIOStream and it implements the file based I/O system for DOCLIB. This object is used by the image format classes such as DLBMPImage, DLJPGImage, and so on.
DLFileBasedIO handles the byte order (endianness) for reading/writing multi-byte-width variables in the file-based system.
Definition at line 19 of file DLFileBasedIO.h.
DLFileBasedIO::DLFileBasedIO | ( | const char * | filename, | |
const char * | mode | |||
) |
constructor
filename | file name to open | |
mode | file mode to open as. Same as flags for fopen();
|
DLFileBasedIO::~DLFileBasedIO | ( | void | ) |
Destructor
int DLFileBasedIO::dlRead | ( | void * | buff, | |
int | size | |||
) | [virtual] |
dlRead reads up to a number of (size) bytes from the DOCLIB File I/O stream into the buffer. dlRead will read up to the maximum buffer size or end of file, whichever comes first. 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 DLFileBasedIO::dlGets | ( | void * | buff, | |
int | size | |||
) | [virtual] |
dlGets reads up to a number of (size) bytes from the DOCLIB File I/O stream into the buffer. dlGets will read up to the max size or until line feed or end of file. 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 DLFileBasedIO::dlGetLine | ( | ) | [virtual] |
dlGetLine reads a line from the DOCLIB File I/O stream. dlGetLine will read up to an end of line or DL_PPM_MAX_LINE_LENGTH (256) or end of file. A string of the read in line will be returned.
Implements DLIOStream.
int DLFileBasedIO::dlWrite | ( | void * | buff, | |
int | size | |||
) | [virtual] |
dlWrite writes a buffer of a given size to the DOCLIB File I/O stream.
buff | buffer to write | |
size | buffer size to write |
Implements DLIOStream.
int DLFileBasedIO::dlGetInt | ( | DLEndian | endian | ) | [virtual] |
dlGetInt reads an int "sizeof(int) bytes" from the DOCLIB File 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 DLFileBasedIO::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 DLFileBasedIO::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 DLFileBasedIO::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 DLFileBasedIO::dlClose | ( | ) | [virtual] |
dlClose closes the current DOCLIB File I/O stream.
Implements DLIOStream.
int DLFileBasedIO::dlFlush | ( | ) | [virtual] |
dlFlush flushes the current DOCLIB File I/O stream.
Implements DLIOStream.