University of Sheffield   

    The Simons
    Component Library

Introduction   Class Hierarchy   Class Listing   Index of Classes   Index of Methods   Header Files  

Output Class Reference

#include <Output.h>

Inheritance diagram for Output:

FileStream Stream Object TextOutput WebOutput List of all members.

Detailed Description

Output: the superclass of all output file streams.

The Output class provides the ANSII standard C++ implementation of an output filesystem. It implements the FileStream protocol for opening and closing a filesystem. It implements the Stream protocol for detecting the state of a Stream. Operations that connect to the filesystem may raise a NotFound exception if the filesystem cannot be found and a NoResponse exception if the filesystem fails, or is already in use. The parent of TextOutput and ByteOutput, the Output class defines the abstract protocol for writing values of all the basic types Boolean, Character, Natural, Integer and Decimal. It also defines the protocol for writing Character[] array and String objects.


Public Member Functions

 Output ()
 Construct a standard Output stream.

virtual ~Output ()
 Release an unused Output stream.

 Output (StringID)
 Construct an Output file stream.

virtual Void open ()
 Open this Output stream for writing.

virtual Void close ()
 Close this Output stream.

virtual Void openLog ()
 Open this Output stream for appending.

virtual Boolean exists () const
 Test if this Output stream exists.

virtual Boolean log () const
 Test if this Output stream is a log.

virtual Boolean ready () const
 Test if this Output stream is ready.

virtual Boolean failed () const
 Test if this Output stream has failed.

virtual Boolean sink () const
 Test if this Output is a sink.

virtual OutputID put (Boolean)
 Write out a Boolean value.

virtual OutputID put (Character)
 Write out a Character value.

virtual OutputID put (Natural)
 Write out a Natural value.

virtual OutputID put (Integer)
 Write out an Integer value.

virtual OutputID put (Decimal)
 Write out a Decimal value.

virtual OutputID put (StringID)
 Write out a String.

virtual OutputID put (Character[])
 Write out a literal Character array.

virtual OutputID line ()
 Write a newline Character on the output.

virtual OutputID space ()
 Write a space Character on the output.

virtual OutputID tab ()
 Write a tab Character on the output.


Protected Member Functions

 Output (const Output &)
 Copy another Output stream.


Protected Attributes

std::ostream * filesystem
 The output stream pathname.


Constructor & Destructor Documentation

Output::Output const Output &  output  )  [protected]
 

Copy another Output stream.

Required by C++ to ensure that copying an Output faithfully copies a FileStream. Constructs a shallow copy of the other Output.

Parameters:
output - the Output to copy.
Returns:
the copied Output stream.

Output::Output  ) 
 

Construct a standard Output stream.

Constructs an Output stream onto the standard output (display monitor). By default, the pathname is null.

Returns:
a standard Output stream.

Output::~Output  )  [virtual]
 

Release an unused Output stream.

Performs all closing actions to disconnect from the underlying filesystem.

Output::Output StringID  path  ) 
 

Construct an Output file stream.

Constructs an Output stream onto the given path name. When opened, this Output stream will connect to the named file.

Parameters:
path - a file pathname.
Returns:
a file Output stream.


Member Function Documentation

Void Output::close  )  [virtual]
 

Close this Output stream.

Provided this Output is open, closes the connection to the underlying filesystem. Otherwise, has no effect, since this Output is not connected.

Reimplemented from Stream.

Reimplemented in WebOutput.

Boolean Output::exists  )  const [virtual]
 

Test if this Output stream exists.

Use this method to test if the connection with the underlying filesystem was successfully opened.

Returns:
true if the filesystem connection exists, otherwise false.

Reimplemented from Stream.

Boolean Output::failed  )  const [virtual]
 

Test if this Output stream has failed.

Use this method to test if this Output stream failed to complete the previous output operation.

Returns:
true if this Output stream has failed, otherwise false.

Reimplemented from Stream.

OutputID Output::line  )  [virtual]
 

Write a newline Character on the output.

May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Reimplemented in TextOutput, and WebOutput.

Boolean Output::log  )  const [virtual]
 

Test if this Output stream is a log.

Use this method to test for the bitmask that indicates that this file was opened for appending.

Returns:
true if this Stream is empty, otherwise false.

Reimplemented from FileStream.

Void Output::open  )  [virtual]
 

Open this Output stream for writing.

Provided this Output is not already in use, opens a connection to the underlying filesystem. Otherwise, raises a DeviceBusy exception indicating that the connection was refused. If a successful connection opens an existing file, the previous file contents will be overwritten by the new data. If no file pathname was supplied, opens a connection to standard output.

Reimplemented from Stream.

Reimplemented in WebOutput.

Void Output::openLog  )  [virtual]
 

Open this Output stream for appending.

Provided this Output is not already in use, opens a connection to the underlying filesystem. Otherwise, raises a DeviceBusy exception indicating that the connection was refused. If a successful connection opens an existing file, the previous file contents will be preserved and new data will be appended to the end. If no file pathname was supplied, opens a connection to standard error.

Reimplemented from FileStream.

Reimplemented in WebOutput.

OutputID Output::put Character  array[]  )  [virtual]
 

Write out a literal Character array.

The Character array must be a null-byte terminated string. This method is abstract in Output.

Parameters:
array - the array to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

OutputID Output::put StringID  string  )  [virtual]
 

Write out a String.

May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Parameters:
string - the String to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

OutputID Output::put Decimal  value  )  [virtual]
 

Write out a Decimal value.

Attempts to write the given value to this Output stream. May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Parameters:
value - the value to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

OutputID Output::put Integer  value  )  [virtual]
 

Write out an Integer value.

Attempts to write the given value to this Output stream. May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Parameters:
value - the value to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

OutputID Output::put Natural  value  )  [virtual]
 

Write out a Natural value.

Attempts to write the given value to this Output stream. May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Parameters:
value - the value to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

OutputID Output::put Character  value  )  [virtual]
 

Write out a Character value.

Attempts to write the given value to this Output stream. May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Parameters:
value - the value to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

OutputID Output::put Boolean  value  )  [virtual]
 

Write out a Boolean value.

Attempts to write the given value to this Output stream. May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Parameters:
value - the value to write out.
Returns:
this Output stream.

Reimplemented in TextOutput.

Boolean Output::ready  )  const [virtual]
 

Test if this Output stream is ready.

Use this method to test if the Output stream is ready for the next output operation.

Returns:
true if this Output stream is ready, otherwise false.

Reimplemented from Stream.

Boolean Output::sink  )  const [virtual]
 

Test if this Output is a sink.

Trivially returns true for Output streams.

Returns:
true, since this Output is always a sink.

Reimplemented from Stream.

OutputID Output::space  )  [virtual]
 

Write a space Character on the output.

May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Reimplemented in TextOutput, and WebOutput.

OutputID Output::tab  )  [virtual]
 

Write a tab Character on the output.

May raise a WriteFailure exception if writing fails. This method is abstract in Output.

Reimplemented in TextOutput, and WebOutput.


Member Data Documentation

std::ostream* Output::filesystem [protected]
 

The output stream pathname.


The documentation for this class was generated from the following files:
Generated on Fri May 5 17:17:19 2006 for The Simons Component Library by doxygen1.3