NAG CPP Interface
iomanager::IOManager

 Contents

Settings help

CPP Name Style:


 #include "include/utility/nagcpp_iomanager.hpp"

 class IOManager : IOManagerBase

1 Description

A class for translating between std::istream or std::ostream (referred to as Input channel and Output channel respectively in the rest of this documentation) and the Input/Output unit numbers used in the algorithmic engine.
The Input/Output unit numbers (usually just referred to as unit numbers) are roughly synonymous with Unix file descriptors, with Input channels registered to a particular unit number using IOManager::register_istream and Output channels using IOManager::register_ostream.
The documentation for a number of functions in the NAG CPP Interface refer to error unit or advisory unit (see for example majorprintlevel in e04ucf), which can be thought of as being analogous to standard error, std::cerr and standard output, std::cout, respectively. The convenience methods, IOManager::register_to_error_message_unit and IOManager::register_to_advisory_message_unit, are supplied to associate channels with the error unit and the advisory unit. The error unit and advisory unit can be reset to their default values (std::cerr and std::cout respectively), via IOManager::reset_error_message_unit and IOManager::reset_advisory_message_unit.
Resource management (opening/closing/deleting etc. files) remains the reponsibility of the user. In particular, files used for channels must have been opened before their associated unit numbers are used.
To communicate unit numbers to a function, the value returned either when a channel is registered, or from IOManager::unit_from_istream or IOManager::unit_from_ostream must be used.
The actual writing and reading of information is carried out via IOManager::print_rec and IOManager::read_rec respectively.
When a channel is no longer required it may be deregistered by calling IOManager::deregister_ostream or IOManager::deregister_istream. The special nature of the error unit and the advisory unit means that these must have persistent channel associations; therefore if a channel associated with their unit number is deregistered then they are reset to their default values.
A global variable GLOBAL_IOMANAGER is supplied for convenience and will be used by all functions unless it is specifically overridden in the optional argument class as described in Optional Arguments.

2 Variables

None.

3 Methods

~IOManager()
types::f77_integer  IOManager::register_istream(std::istream is_to_register)
types::f77_integer  IOManager::register_ostream(std::ostream os_to_register)
void function  IOManager::deregister_istream(std::istream is_to_deregister, types::f77_integer unit_number)
void function  IOManager::deregister_istream(std::istream is_to_deregister, types::f77_integer unit_number)
void function  IOManager::deregister_ostream(std::ostream os_to_deregister, types::f77_integer unit_number)
void function  IOManager::deregister_ostream(std::ostream os_to_deregister, types::f77_integer unit_number)
types::f77_integer  IOManager::unit_from_istream(std::istream is_of_interest)
std::istream&  IOManager::istream_from_unit(std::istream is_of_interest)
types::f77_integer  IOManager::unit_from_ostream(std::ostream os_of_interest)
std::ostream&  IOManager::ostream_from_unit(std::istream os_of_interest)
void function  IOManager::register_to_advisory_message_unit(std::ostream os_to_register)
void function  IOManager::register_to_error_message_unit(std::ostream os_to_register)