Alphabetic Class Index   |   Class Inheritance Tree Index   |   Tool Index

Class: Writer

Parent class: Interpreter

Description:
This class wraps around an ostream and provides a machine-independant framework for writing various binary encoded data types. Sub-classes may be optimized for individual platforms.

Data Fields
privateostream*out

Constructors / Destructor
public Writer(ostream& out)
Constructor from ostream passed by reference.
public Writer(ostream* out)
Constructor from ostream passed as a pointer .
public ~Writer()
Destructor. This method flushes the ostream, but does not close or delete it.

Methods
public virtual ostream* getStream()
Return a pointer to the underlying ostream.
public virtual void writeByte(unsigned char value)
Write a single byte .
Throws: Exception
public virtual void writeBytes(unsigned char* buffer, int n)
Write a given number of bytes .
Throws: Exception
public virtual void writeInt(int value, int bytes)
Write an twos complement, big-endian integer a given number of bytes in length .
Throws: Exception
public virtual void writeUnsignedInt(unsigned int value, int bytes)
Write an unsigned big-endian integer a given number of bytes in length .
Throws: Exception
public virtual void writeUnsignedBits(unsigned int value, int n)
Write a given unsigned integer represented by a given number of bits.
Throws: Exception
public virtual void writeSignedBits(int value, int n)
Write a given twos compliment signed integer represented by a given number of bits .
Throws: Exception
public virtual void writeFloat(float value)
Write a 4 byte IEEE format floating point number.
Throws: Exception
public virtual void writeDouble(double value)
Write a 8 byte IEEE format floating point number.
Throws: Exception
public static void checkMachine()
Test whether the machine running this code stores variables in a way consistent with the assumptions made when writing this class. This particular makes no assumptions so this method does nothing.
Throws: HardwareException
public virtual void writeTestPattern()
Write a fixed set of values. These can then be read back with the readTestPattern method to check a reader and writer for self-consistency.
Throws: Exception

Operators


Alphabetic Class Index   |   Class Inheritance Tree Index   |   Tool Index