Main Page | Class Hierarchy | Compound List | File List | Compound Members

BxBinaryFileWriter Class Reference

Class implementing byte-order-sensitive write operations on binary files. More...

#include <BxBinaryFileWriter.h>

Inheritance diagram for BxBinaryFileWriter:

BxBinaryFile BxObject List of all members.

Public Member Functions

 BxBinaryFileWriter ()
 BxBinaryFileWriter (char *filename)
bool writeDataObject (BxDataObject &pdo)

Detailed Description

This class was originally developed to implement byte-order-sensitive write operations over primitive BinX application data types. BxBinaryFileWriter is derived from the class BxBinaryFile and inherits numerous methods from that class.
Since initial development of the BinX Library, all write() methods defined by this class have been deprecated. Within this class only primitive BinX application data types are supported and although byte order checking is performed, the flags indicating when byte reversal is required may not be properly managed under all circumstances. To write values to a binary file, use the method toStreamBinary defined and implemented by the class BxDataObject and reimplemented by some its derived classes, including BxInteger and BxFloat and their derived classes BxLong64, BxDouble64, etc.
Since: BinX version 1.0.


Constructor & Destructor Documentation

BxBinaryFileWriter::BxBinaryFileWriter  ) 
 

Default constructor.

Constructs an instance of the class BxBinaryFileWriter. Default attribute values are assigned as follows:

     readonly_ = false;  
   
No external binary file is associated with this object. A filename must be explicitly associated with this instance and the external file must be explicitly created and opened using other methods defined by BxBinaryFileWriter or by its base class BxBinaryFile.

BxBinaryFileWriter::BxBinaryFileWriter char *  filename  ) 
 

Construct a binary file writer instance; create and open a specified external file for writing.

The input parameter provides the full path filename of an external file to be associated with the newly constructed instance of BxBinaryFileWriter. The specified file is created and opened for writing in binary mode.
The filename is not remembered by this object. Only the file pointer is maintained by the newly constructed BxBinaryFileWriter object.
Invocation Example:
BxBinaryFileWriter writer("file.dat");


Member Function Documentation

bool BxBinaryFileWriter::writeDataObject BxDataObject pdo  ) 
 

Write an instance of BxDataObject to a binary file, converting byte order if necessary.

An input data object is written to the current write position in a binary file. The file must be open for writing in binary mode. The number of bytes written is determined by the type of the BxDataObject instance. Only primitive BinX application data types are supported by this method.
If the byte order of the binary file differs from the memory byte order of the executing host machine, then the byte order is reversed before writing the value to the binary file.

Parameters:
pdo A reference to the data ojbect instance to be written.
Returns:
true If all bytes of the input object were successfully written to the binary file,
false If unable to write all of the bytes to the binary file.


The documentation for this class was generated from the following files:
Generated on Fri May 6 13:36:18 2005 for edikt::BinX by doxygen 1.3.3