Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

FileSink Class Reference

#include <FileSink.h>

Inheritance diagram for FileSink:

Inheritance graph
[legend]
Collaboration diagram for FileSink:

Collaboration graph
[legend]
List of all members.

Detailed Description

File data output.

Author:
Author
darkeye
Version:
Revision
1.5

Definition at line 57 of file FileSink.h.

Public Member Functions

 FileSink (const char *name) throw ( Exception )
 Constructor by a file name.
 FileSink (const FileSink &fsink) throw ( Exception )
 Copy constructor.
virtual ~FileSink (void) throw ( Exception )
 Destructor.
virtual FileSinkoperator= (const FileSink &fs) throw ( Exception )
 Assignment operator.
const char * getFileName (void) const throw ()
 Get the file name this FileSink represents.
virtual bool exists (void) const throw ()
 Check for the existence of the file this FileSink represents.
virtual bool create (void) throw ( Exception )
 Create the file.
virtual bool open (void) throw ( Exception )
 Open the file.
virtual bool isOpen (void) const throw ()
 Check if the FileSink is open.
virtual bool canWrite (unsigned int sec, unsigned int usec) throw ( Exception )
 Check if the FileSink is ready to accept data.
virtual unsigned int write (const void *buf, unsigned int len) throw ( Exception )
 Write data to the FileSink.
virtual void flush (void) throw ( Exception )
 This is a no-op in this FileSink.
virtual void close (void) throw ( Exception )
 Close the FileSink.

Protected Member Functions

 FileSink (void) throw ( Exception )
 Default constructor.

Protected Attributes

int fileDescriptor
 Low-level file descriptor for the file represented by this object.


Constructor & Destructor Documentation

FileSink::FileSink void   )  throw ( Exception ) [inline, protected]
 

Default constructor.

Always throws an Exception.

Exceptions:
Exception 

Definition at line 97 of file FileSink.h.

FileSink::FileSink const char *  name  )  throw ( Exception ) [inline]
 

Constructor by a file name.

Parameters:
name name of the file to be represented by the object.
Exceptions:
Exception 

Definition at line 112 of file FileSink.h.

FileSink::FileSink const FileSink fsink  )  throw ( Exception )
 

Copy constructor.

Parameters:
fsink the FileSink to copy.
Exceptions:
Exception 

Definition at line 134 of file FileSink.cpp.

virtual FileSink::~FileSink void   )  throw ( Exception ) [inline, virtual]
 

Destructor.

Exceptions:
Exception 

Definition at line 131 of file FileSink.h.


Member Function Documentation

bool FileSink::canWrite unsigned int  sec,
unsigned int  usec
throw ( Exception ) [virtual]
 

Check if the FileSink is ready to accept data.

Blocks until the specified time for data to be available.

Parameters:
sec the maximum seconds to block.
usec micro seconds to block after the full seconds.
Returns:
true if the Sink is ready to accept data, false otherwise.
Exceptions:
Exception 

Implements Sink.

Definition at line 241 of file FileSink.cpp.

Referenced by FileCast::canWrite().

void FileSink::close void   )  throw ( Exception ) [virtual]
 

Close the FileSink.

Exceptions:
Exception 

Implements Sink.

Definition at line 298 of file FileSink.cpp.

References fileDescriptor, flush(), and isOpen().

Referenced by FileCast::close(), and create().

bool FileSink::create void   )  throw ( Exception ) [virtual]
 

Create the file.

Returns:
true if creation was successful, false otherwise.
Exceptions:
Exception 

Definition at line 200 of file FileSink.cpp.

References close(), isOpen(), and Reporter::reportEvent().

bool FileSink::exists void   )  const throw () [virtual]
 

Check for the existence of the file this FileSink represents.

Returns:
true if the file exists and is a regular file, false otherwise.

Definition at line 184 of file FileSink.cpp.

virtual void FileSink::flush void   )  throw ( Exception ) [inline, virtual]
 

This is a no-op in this FileSink.

Exceptions:
Exception 

Implements Sink.

Definition at line 226 of file FileSink.h.

Referenced by close(), and FileCast::flush().

const char* FileSink::getFileName void   )  const throw () [inline]
 

Get the file name this FileSink represents.

Returns:
the file name this FileSink represents.

Definition at line 152 of file FileSink.h.

virtual bool FileSink::isOpen void   )  const throw () [inline, virtual]
 

Check if the FileSink is open.

Returns:
true if the FileSink is open, false otherwise.

Implements Sink.

Definition at line 190 of file FileSink.h.

References fileDescriptor.

Referenced by close(), create(), FileCast::isOpen(), and open().

bool FileSink::open void   )  throw ( Exception ) [virtual]
 

Open the file.

Truncates the file.

Returns:
true if opening was successful, false otherwise.
Exceptions:
Exception 

Implements Sink.

Definition at line 222 of file FileSink.cpp.

References fileDescriptor, and isOpen().

FileSink & FileSink::operator= const FileSink fs  )  throw ( Exception ) [virtual]
 

Assignment operator.

Parameters:
fs the FileSink to assign to this object.
Returns:
a reference to this object.
Exceptions:
Exception 

Definition at line 154 of file FileSink.cpp.

References Sink::operator=().

unsigned int FileSink::write const void *  buf,
unsigned int  len
throw ( Exception ) [virtual]
 

Write data to the FileSink.

Parameters:
buf the data to write.
len number of bytes to write from buf.
Returns:
the number of bytes written (may be less than len).
Exceptions:
Exception 

Implements Sink.

Definition at line 271 of file FileSink.cpp.

Referenced by FileCast::write().


Member Data Documentation

int FileSink::fileDescriptor [protected]
 

Low-level file descriptor for the file represented by this object.

Definition at line 89 of file FileSink.h.

Referenced by close(), isOpen(), and open().


The documentation for this class was generated from the following files:
Generated on Sat Oct 22 13:17:07 2005 for DarkIce by  doxygen 1.4.4