Public Member Functions | Protected Types | Protected Attributes
vsl_b_ifstream Class Reference

An adapter for a vcl_ifstream to make it suitable for binary IO. More...

#include <vsl_binary_io.h>

Inheritance diagram for vsl_b_ifstream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vsl_b_ifstream (const vcl_string &filename, vcl_ios_openmode mode=vcl_ios_in)
 Create this adaptor from a file.
 vsl_b_ifstream (const char *filename, vcl_ios_openmode mode=vcl_ios_in)
 Create this adaptor from a file.
virtual ~vsl_b_ifstream ()
 Virtual destructor.so that it can be overloaded.
void close ()
 Close the stream.
vcl_istream & is () const
 A reference to the adaptor's stream.
bool operator! () const
 Returns true if the underlying stream has its fail bit set.
virtual void clear_serialisation_records ()
 Clear the stream's record of any serialisation operations.
virtual void add_serialisation_record (unsigned long serial_number, void *pointer, int other_data=0)
 Adds record of object's unique serial number, and location in memory.
virtual void * get_serialisation_pointer (unsigned long serial_number) const
 Returns the pointer to the object identified by the unique serial number.
virtual int get_serialisation_other_data (unsigned long serial_number) const
 Returns the user defined data associated with the unique serial number.
virtual int set_serialisation_other_data (unsigned long serial_number, int other_data)
 Modify the user-defined data associated with the unique serial number.
unsigned short version_no () const
 Return the version number of the IO format of the file being read.

Protected Types

typedef vcl_map< unsigned long,
vcl_pair< void *, int >
, vcl_less< unsigned long > > 
serialisation_records_type
 The type of the serialisation records.

Protected Attributes

vcl_istream * is_
 The member stream.
serialisation_records_type serialisation_records_
 The serialisation records,.
unsigned short version_no_

Detailed Description

An adapter for a vcl_ifstream to make it suitable for binary IO.

Definition at line 232 of file vsl_binary_io.h.


Member Typedef Documentation

typedef vcl_map<unsigned long, vcl_pair<void *, int>, vcl_less<unsigned long> > vsl_b_istream::serialisation_records_type [protected, inherited]

The type of the serialisation records.

Definition at line 218 of file vsl_binary_io.h.


Constructor & Destructor Documentation

vsl_b_ifstream::vsl_b_ifstream ( const vcl_string &  filename,
vcl_ios_openmode  mode = vcl_ios_in 
) [inline]

Create this adaptor from a file.

The adapter will delete the stream automatically on destruction.

Definition at line 237 of file vsl_binary_io.h.

vsl_b_ifstream::vsl_b_ifstream ( const char *  filename,
vcl_ios_openmode  mode = vcl_ios_in 
) [inline]

Create this adaptor from a file.

The adapter will delete the stream automatically on destruction.

Definition at line 243 of file vsl_binary_io.h.

vsl_b_ifstream::~vsl_b_ifstream ( ) [virtual]

Virtual destructor.so that it can be overloaded.

destructor.so that it can be overloaded.

Definition at line 693 of file vsl_binary_io.cxx.


Member Function Documentation

void vsl_b_istream::add_serialisation_record ( unsigned long  serial_number,
void *  pointer,
int  other_data = 0 
) [virtual, inherited]

Adds record of object's unique serial number, and location in memory.

pointer must be non-null, so you should handle null pointers separately.

Adding a null pointer or one that already exists will cause the function to abort(), if debugging is turned on;

You can also store a single integer as other data. Interpretation of this data is entirely up to the client code.

Definition at line 634 of file vsl_binary_io.cxx.

void vsl_b_istream::clear_serialisation_records ( ) [virtual, inherited]

Clear the stream's record of any serialisation operations.

Calling this function while inputting serialisable things from a stream, could cause errors during loading unless the records were cleared at a similar point during output.

Definition at line 621 of file vsl_binary_io.cxx.

void vsl_b_ifstream::close ( )

Close the stream.

Definition at line 699 of file vsl_binary_io.cxx.

int vsl_b_istream::get_serialisation_other_data ( unsigned long  serial_number) const [virtual, inherited]

Returns the user defined data associated with the unique serial number.

Returns 0 if no record has been added.

Definition at line 661 of file vsl_binary_io.cxx.

void * vsl_b_istream::get_serialisation_pointer ( unsigned long  serial_number) const [virtual, inherited]

Returns the pointer to the object identified by the unique serial number.

Returns 0 if no record has been added.

Definition at line 644 of file vsl_binary_io.cxx.

vcl_istream & vsl_b_istream::is ( ) const [inherited]

A reference to the adaptor's stream.

Definition at line 598 of file vsl_binary_io.cxx.

bool vsl_b_istream::operator! ( ) const [inherited]

Returns true if the underlying stream has its fail bit set.

Definition at line 612 of file vsl_binary_io.cxx.

int vsl_b_istream::set_serialisation_other_data ( unsigned long  serial_number,
int  other_data 
) [virtual, inherited]

Modify the user-defined data associated with the unique serial number.

If there is no record of the object, this function will abort.

Definition at line 678 of file vsl_binary_io.cxx.

unsigned short vsl_b_istream::version_no ( ) const [inherited]

Return the version number of the IO format of the file being read.

Definition at line 606 of file vsl_binary_io.cxx.


Member Data Documentation

vcl_istream* vsl_b_istream::is_ [protected, inherited]

The member stream.

Definition at line 214 of file vsl_binary_io.h.

The serialisation records,.

The record takes a unique identifier of the object (which would be stored on the stream) and returns the pointer to the object, and an other_data integer.

Definition at line 224 of file vsl_binary_io.h.

unsigned short vsl_b_istream::version_no_ [protected, inherited]

Definition at line 227 of file vsl_binary_io.h.


The documentation for this class was generated from the following files: