tcl::obj_reader Class Reference

Inheritance diagram for tcl::obj_reader:

Inheritance graph
[legend]
Collaboration diagram for tcl::obj_reader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 obj_reader (tcl::obj x)
 Construct with a tcl::obj to read from.
virtual ~obj_reader () throw ()
 Virtual destructor allows correct destruction of subclasses.
virtual io::version_id input_version_id ()
virtual char read_char (const rutz::fstring &name)
 Read the char attribute associated with the tag name.
virtual int read_int (const rutz::fstring &name)
 Read the int attribute associated with the tag name.
virtual bool read_bool (const rutz::fstring &name)
 Read the bool attribute associated with the tag name.
virtual double read_double (const rutz::fstring &name)
 Read the double attribute associated with the tag name.
virtual void read_value_obj (const rutz::fstring &name, rutz::value &v)
 Read the rutz::value attribute associated with the tag name.
virtual void read_byte_array (const rutz::fstring &name, rutz::byte_array &data)
 Read the raw data array associated with the tag name.
virtual nub::ref< io::serializableread_object (const rutz::fstring &name)
virtual nub::soft_ref< io::serializableread_weak_object (const rutz::fstring &name)
virtual void read_owned_object (const rutz::fstring &name, nub::ref< io::serializable > obj)
virtual void read_base_class (const rutz::fstring &base_class_name, nub::ref< io::serializable > base_part)
virtual nub::ref< io::serializableread_root (io::serializable *root=0)
int ensure_version_id (const char *name, io::version_id lowest_supported_version, const char *msg, const rutz::file_pos &pos)
Overloaded read functions
These functions offer a set of overloads to provide compile-time polymorphism so that any supported type (any basic type, or rutz::value, a string type) or can be read with the same source code.

void read_value (const rutz::fstring &name, char &ret)
void read_value (const rutz::fstring &name, int &ret)
void read_value (const rutz::fstring &name, unsigned int &ret)
void read_value (const rutz::fstring &name, unsigned long &ret)
void read_value (const rutz::fstring &name, bool &ret)
void read_value (const rutz::fstring &name, double &ret)
void read_value (const rutz::fstring &name, rutz::fstring &ret)
void read_value (const rutz::fstring &name, rutz::value &ret)

Protected Member Functions

virtual rutz::fstring read_string_impl (const rutz::fstring &name)
 Read the string attribute associated with the tag name.
void default_read_byte_array (const rutz::fstring &name, rutz::byte_array &data)
 Base64 implementation of read_byte_array() for use by subclasses.

Detailed Description

Definition at line 44 of file objreader.h.


Member Function Documentation

io::version_id tcl::obj_reader::input_version_id (  )  [virtual]

Returns the serialization version id that was stored with the object currently being read.

Implements io::reader.

Definition at line 57 of file objreader.cc.

References error, and SRC_POS.

nub::ref< io::serializable > tcl::obj_reader::read_object ( const rutz::fstring name  )  [virtual]

Get a nub::ref associated with the tag name. A new object of the appropriate type will be created and inserted into the nub::objectdb, if necessary.

Implements io::reader.

Definition at line 95 of file objreader.cc.

References error, and SRC_POS.

nub::soft_ref< io::serializable > tcl::obj_reader::read_weak_object ( const rutz::fstring name  )  [virtual]

Get a soft_ref associated with the tag name. If no such object exists, a null object is returned; otherwise, a new object of the appropriate type will be created and inserted into the nub::objectdb, if necessary.

Implements io::reader.

Definition at line 101 of file objreader.cc.

References error, and SRC_POS.

void tcl::obj_reader::read_owned_object ( const rutz::fstring name,
nub::ref< io::serializable obj 
) [virtual]

Restore the state of the io object obj, associated with the tag name. The io::reader will not create a new object, but will use the io* provided here.

Implements io::reader.

Definition at line 106 of file objreader.cc.

References error, and SRC_POS.

void tcl::obj_reader::read_base_class ( const rutz::fstring base_class_name,
nub::ref< io::serializable base_part 
) [virtual]

Read the named base class into the io object obj, which should be arranged to point or refer to the appropriate base class part of the object. In particular, obj's virtual functions must NOT call the fully derived versions. This effect can be best accomplished with an io::proxy.

Implements io::reader.

Definition at line 112 of file objreader.cc.

References error, and SRC_POS.

nub::ref< io::serializable > tcl::obj_reader::read_root ( io::serializable root = 0  )  [virtual]

Restore an entire object hierarchy, starting with the root object. If root is non-null, the function will use root as the root object. Otherwise the function will create a new root object. In either case, the function returns the object that was actually used as the root object.

Implements io::reader.

Definition at line 119 of file objreader.cc.

References error, and SRC_POS.

int io::reader::ensure_version_id ( const char *  name,
io::version_id  lowest_supported_version,
const char *  msg,
const rutz::file_pos pos 
) [inherited]

A convenience function to ensure that the current serial version is no less than the lowest_supported_version. Returns the actual version. If this test fails, an exception will be thrown.

Definition at line 83 of file reader.cc.

References GVX_ASSERT, GVX_TRACE, and io::reader::input_version_id().

Referenced by Trial::read_from(), TimingHdlr::read_from(), TimingHandler::read_from(), MorphyFace::read_from(), MaskHatch::read_from(), Jitter::read_from(), House::read_from(), Gabor::read_from(), FixPt::read_from(), Fish::read_from(), Face::read_from(), ExptDriver::read_from(), EventResponseHdlr::read_from(), Block::read_from(), GxTransform::read_from(), GxText::read_from(), GxShapeKit::read_from(), GxPixmap::read_from(), GxDrawStyle::read_from(), GxColor::read_from(), and GxCache::read_from().


The documentation for this class was generated from the following files:
The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Mon Feb 11 05:09:32 2008 by Doxygen version 1.5.2.