This class handles all the output from OSSolverService, OSAmplClient and other executables derived from them. Every output statement in the code uses methods in this class, passing information about the area that originated the request as well as the print, verbosity or severity level of the message. The message creates output only if the print level matches the user specifications. The main advantage of doing things this way is that multiple output streams can be maintained, each tailored to a specific need and containing only output that the user really wants to see. There can be as many output streams as needed; each one has an identifying name ("stdout" and "stderr" are reserved names) and an array of print levels, one for each area. The class is implemented as a Singleton, which means that two private methods must be defined in the header but must never be implemented: a copy constructor, and an equality operator. More...
#include <OSOutput.h>
Public Member Functions | |
OSOutput () | |
Constructor. More... | |
~OSOutput () | |
Destructor. More... | |
bool | OSPrint (ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level, std::string outStr) |
This is the main method to output a string All output generated by the program should ultimately use this method. More... | |
void | FlushAllBuffers () |
Flush all buffers. More... | |
bool | SetPrintLevel (std::string name, ENUM_OUTPUT_LEVEL *level, int dim) |
Modify all print levels associated with a channel. More... | |
bool | SetPrintLevel (std::string name, ENUM_OUTPUT_LEVEL level) |
set the print level associated with a channel More... | |
int | AddChannel (std::string name) |
Add a channel to the array outputChannel. More... | |
bool | DeleteChannel (std::string name) |
Delete a channel from the array outputChannel. More... | |
int | FindChannel (std::string name) |
Find the position of a channel within the array *outputChannel. More... | |
![]() | |
OSReferencedObject () | |
virtual | ~OSReferencedObject () |
int | ReferenceCount () const |
void | AddRef (const OSReferencer *referencer) const |
void | ReleaseRef (const OSReferencer *referencer) const |
Private Member Functions | |
OSOutput (const OSOutput &) | |
OSOutput & | operator= (const OSOutput &) |
Private Attributes | |
int | nOfOutputs |
The number of output channels that have been defined. More... | |
OSOutputChannel ** | outputChannel |
The array of output channels currently in use. More... | |
This class handles all the output from OSSolverService, OSAmplClient and other executables derived from them. Every output statement in the code uses methods in this class, passing information about the area that originated the request as well as the print, verbosity or severity level of the message. The message creates output only if the print level matches the user specifications. The main advantage of doing things this way is that multiple output streams can be maintained, each tailored to a specific need and containing only output that the user really wants to see. There can be as many output streams as needed; each one has an identifying name ("stdout" and "stderr" are reserved names) and an array of print levels, one for each area. The class is implemented as a Singleton, which means that two private methods must be defined in the header but must never be implemented: a copy constructor, and an equality operator.
Definition at line 146 of file OSOutput.h.
|
private |
OSOutput::OSOutput | ( | ) |
Constructor.
Definition at line 161 of file OSOutput.cpp.
OSOutput::~OSOutput | ( | ) |
Destructor.
Definition at line 169 of file OSOutput.cpp.
bool OSOutput::OSPrint | ( | ENUM_OUTPUT_AREA | area, |
ENUM_OUTPUT_LEVEL | level, | ||
std::string | outStr | ||
) |
This is the main method to output a string All output generated by the program should ultimately use this method.
level,: | the print level associated with the string |
area,: | the area of the code in which the output was generated |
outStr,: | the string to be output |
Definition at line 178 of file OSOutput.cpp.
void OSOutput::FlushAllBuffers | ( | ) |
Flush all buffers.
Definition at line 188 of file OSOutput.cpp.
bool OSOutput::SetPrintLevel | ( | std::string | name, |
ENUM_OUTPUT_LEVEL * | level, | ||
int | dim | ||
) |
Modify all print levels associated with a channel.
name,: | The name of the channel ("stdout" and "stderr" are reserved names) |
level,: | The array of print levels used for the output to this channel |
dim,: | The number of entries in this array |
Definition at line 194 of file OSOutput.cpp.
bool OSOutput::SetPrintLevel | ( | std::string | name, |
ENUM_OUTPUT_LEVEL | level | ||
) |
set the print level associated with a channel
name,: | The name of the channel ("stdout" and "stderr" are reserved names) |
level,: | The print level used for the output to this channel if < ENUM_OUTPUT_LEVEL_NUMBER_OF_LEVELS, set the (same) print level in all areas otherwise set the print level only in one particular area |
Definition at line 209 of file OSOutput.cpp.
int OSOutput::AddChannel | ( | std::string | name | ) |
Add a channel to the array outputChannel.
name,: | The name of the channel ("stdout" and "stderr" are reserved names) |
Definition at line 233 of file OSOutput.cpp.
bool OSOutput::DeleteChannel | ( | std::string | name | ) |
Delete a channel from the array outputChannel.
name,: | The name of the channel |
Definition at line 280 of file OSOutput.cpp.
int OSOutput::FindChannel | ( | std::string | name | ) |
Find the position of a channel within the array *outputChannel.
name,: | The name of the channel |
Definition at line 312 of file OSOutput.cpp.
|
private |
The number of output channels that have been defined.
Definition at line 223 of file OSOutput.h.
|
private |
The array of output channels currently in use.
Definition at line 228 of file OSOutput.h.