Go to the previous, next section.
#include <nihcl/OIOfd.h>
Class
OIOifd
implements object input for the
readFrom()
function from UNIX file descriptors via the
read()
system call. It provides member functions for reading the fundamental data types, arrays of fundamental data types, and C-style (null-terminated) character strings.
This
file descriptor
object input is more efficient than the
stream
object input that class
OIOin
provides because these are non-virtual, inline member functions that call
read()
directly, and do no parsing--the object format expected is that produced by class
OIOofd
.
OIOifd(int
filedesc, unsigned
capacity
=1024)
OIOifd
for the UNIX file descriptor
filedesc
and with an initial object capacity of
capacity
objects (see class
ReadFromTbl
).
OIOifd& operator>>(char&)
OIOifd& operator>>(unsigned char&)
OIOifd& operator>>(short&)
OIOifd& operator>>(unsigned short&)
OIOifd& operator>>(int&)
OIOifd& operator>>(unsigned int&)
OIOifd& operator>>(long&)
OIOifd& operator>>(unsigned long&)
OIOifd& operator>>(float&)
OIOifd& operator>>(double&)
OIOifd
via the UNIX
read()
system call. The
sizeof
operator is used to determine the number of bytes to read. Raises an
NIHCL_READBINERR
exception if the call to
read()
returns an error. Raises an
NIHCL_RDEOF
exception if the call to
read()
returns End Of File (EOF). Raises an
NIHCL_READBINUNDFL
exception if the call the
read()
returns fewer bytes than the
sizeof
the right operand. Returns a reference to this
OIOifd
if successful.
int get()
get(char&)
of a single
char
from the UNIX file descriptor associated with this
OIOifd
and returns it as the result.
OIOifd& get(char&
c)
OIOifd& get(unsigned char&
c)
get(char*,unsigned)
from the UNIX file descriptor associated with this
OIOifd
into the argument
c
and returns a reference to this
OIOifd
if successful.
OIOifd& get(char*
val, unsigned
size)
OIOifd& get(unsigned char*
val, unsigned
size)
OIOifd& get(short*
val, unsigned
size)
OIOifd& get(unsigned short*
val, unsigned
size)
OIOifd& get(int*
val, unsigned
size)
OIOifd& get(unsigned int*
val, unsigned
size)
OIOifd& get(long*
val, unsigned
size)
OIOifd& get(unsigned long*
val, unsigned
size)
OIOifd& get(float*
val, unsigned
size)
OIOifd& get(double*
val, unsigned
size)
OIOifd
via the UNIX
read()
system call. The
sizeof
operator is used to determine the array element size. Raises an
NIHCL_READBINERR
exception if the call to
read()
returns an error. Raises an
NIHCL_RDEOF
exception if the call to
read()
returns End Of File (EOF). Raises an
NIHCL_READBINUNDFL
exception if the call to
read()
returns fewer bytes than the size of the specified array. Returns a reference to this
OIOifd
if successful.
OIOifd& getCString(char*
s, unsigned
maxlen)
OIOofd::putCString()
into the memory pointed to by
s
from the UNIX file descriptor associated with this
OIOifd
. Raises an
NIHCL_STROV
exception if the string length, including the null terminator, would exceed
maxlen. Returns a reference to this
OIOifd
if successful.
operator int()
OIOifd
.
virtual Object* readObject(const Class&
expected)
OIOofd::storeObject()
from the UNIX file descriptor associated with this
OIOifd
.
Raises an
NIHCL_RDUNKCLASS
exception if the class descriptor of the object to be read has not been linked with the program.
Raises an
NIHCL_RDWRONGCLASS
exception if the class of the object read is not an instance of class
expected
or an instance of a derived class of
expected.
Raises an
NIHCL_RDBADSIG
exception if the signature of the class of the object read does not match the signature of the class descriptor of the same name that has been linked with the program. This is to detect an attempt to read an object stored by an outdated version of the class.
Raises an
NIHCL_RDBADTYP
exception if the value of the next byte read from the associated UNIX file descriptor is not a valid record type: an object reference, a class reference and object, or a class name, signature, and object.
Returns a pointer to the object read if successful.
NIHCL_RDBADSIG
,
NIHCL_RDBADTYP
,
NIHCL_RDEOF
,
NIHCL_RDUNKCLASS
,
NIHCL_RDWRONGCLASS
,
NIHCL_READBINERR
,
NIHCL_READBINUNDFL
,
NIHCL_STROV
Go to the previous, next section.