Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

alize::FileWriter Class Reference

#include <FileWriter.h>

Inheritance diagram for alize::FileWriter:
Inheritance graph
[legend]
Collaboration diagram for alize::FileWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FileWriter (const FileName &)
virtual ~FileWriter ()
virtual void close ()
virtual String getClassName () const
virtual String toString () const

Protected Member Functions

void open ()
bool isClosed () const
bool isOpen () const
void writeUInt4 (unsigned long value)
void writeDouble (double value)
void writeFloat (float value)
void writeShort (short value)
void writeChar (char value)
void writeString (const String &string)
void writeAttribute (const String &name, const String &value)
void writeAttribute (const String &name, unsigned long value)
void writeAttribute (const String &name, double value)
void swap2Bytes (void *src, void *dest)
void swap4Bytes (void *src, void *dest)
void swap8Bytes (void *src, void *dest)

Protected Attributes

FILE * _pFileStruct
FileName _fileName
bool _swap

Private Member Functions

 FileWriter (const FileWriter &)
const FileWriteroperator= (const FileWriter &)
bool operator== (const FileWriter &) const
bool operator!= (const FileWriter &) const

Detailed Description

Convenient class used to write data to a file

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2003

Definition at line 81 of file FileWriter.h.


Constructor & Destructor Documentation

FileWriter::FileWriter ( const FileName f ) [explicit]

Definition at line 68 of file FileWriter.cpp.

FileWriter::~FileWriter (  ) [virtual]

Definition at line 220 of file FileWriter.cpp.

References close().

alize::FileWriter::FileWriter ( const FileWriter  ) [private]

Member Function Documentation

void FileWriter::close (  ) [virtual]

Closes the file

Exceptions:
IOExceptionif an I/O error occurs

Reimplemented in alize::FeatureFileWriter.

Definition at line 87 of file FileWriter.cpp.

References _fileName, _pFileStruct, isOpen(), and NULL.

Referenced by alize::FeatureFileWriter::close(), open(), alize::ConfigFileWriter::writeConfig(), and ~FileWriter().

String FileWriter::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Object.

Reimplemented in alize::ConfigFileWriter, alize::FeatureFileWriter, alize::MixtureFileWriter, alize::MixtureServerFileWriter, and alize::SegServerFileWriter.

Definition at line 218 of file FileWriter.cpp.

bool FileWriter::isClosed (  ) const [protected]

Tests whether the file is closed

Definition at line 71 of file FileWriter.cpp.

References _pFileStruct, and NULL.

bool FileWriter::isOpen (  ) const [protected]

Tests whether the file is opened

Definition at line 73 of file FileWriter.cpp.

References _pFileStruct, and NULL.

Referenced by close(), and open().

void FileWriter::open (  ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 75 of file FileWriter.cpp.

References _fileName, _pFileStruct, alize::String::c_str(), close(), alize::String::isEmpty(), isOpen(), and NULL.

Referenced by alize::ConfigFileWriter::writeConfig().

bool alize::FileWriter::operator!= ( const FileWriter  ) const [private]

Not implemented

const FileWriter& alize::FileWriter::operator= ( const FileWriter  ) [private]

Not implemented

bool alize::FileWriter::operator== ( const FileWriter  ) const [private]

Not implemented

void FileWriter::swap2Bytes ( void *  src,
void *  dest 
) [protected]

Definition at line 175 of file FileWriter.cpp.

void FileWriter::swap4Bytes ( void *  src,
void *  dest 
) [protected]

Definition at line 187 of file FileWriter.cpp.

void FileWriter::swap8Bytes ( void *  src,
void *  dest 
) [protected]

Definition at line 202 of file FileWriter.cpp.

String FileWriter::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

Definition at line 169 of file FileWriter.cpp.

References _fileName.

void FileWriter::writeAttribute ( const String name,
double  value 
) [protected]

Definition at line 166 of file FileWriter.cpp.

References alize::String::valueOf(), and writeString().

void FileWriter::writeAttribute ( const String name,
const String value 
) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 157 of file FileWriter.cpp.

References writeString().

Referenced by alize::ConfigFileWriter::writeConfig().

void FileWriter::writeAttribute ( const String name,
unsigned long  value 
) [protected]

Definition at line 163 of file FileWriter.cpp.

References alize::String::valueOf(), and writeString().

void FileWriter::writeChar ( char  value ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 139 of file FileWriter.cpp.

References _fileName, _pFileStruct, and NULL.

void FileWriter::writeDouble ( double  value ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 115 of file FileWriter.cpp.

References _fileName, _pFileStruct, and NULL.

void FileWriter::writeFloat ( float  value ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 123 of file FileWriter.cpp.

References _fileName, _pFileStruct, and NULL.

void FileWriter::writeShort ( short  value ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 131 of file FileWriter.cpp.

References _fileName, _pFileStruct, and NULL.

void FileWriter::writeString ( const String string ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 147 of file FileWriter.cpp.

References _fileName, _pFileStruct, and NULL.

Referenced by writeAttribute(), and alize::ConfigFileWriter::writeConfig().

void FileWriter::writeUInt4 ( unsigned long  value ) [protected]
Exceptions:
IOExceptionif an I/O error occurs

Definition at line 96 of file FileWriter.cpp.

References _fileName, _pFileStruct, and NULL.


Member Data Documentation

bool alize::FileWriter::_swap [protected]

Definition at line 102 of file FileWriter.h.


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