OS  2.10.2
OSOutput.h
Go to the documentation of this file.
1 /* $Id: OSOutput.h 3172 2012-11-12 04:59:24Z Gassmann $ */
15 #ifndef OSOUTPUT_H
16 #define OSOUTPUT_H
17 
18 #include "OSConfig.h"
19 #include "OSParameters.h"
20 #include "OSReferenced.hpp"
21 #include "OSSmartPtr.hpp"
22 
23 #include <string>
24 #include <vector>
25 
26 #ifdef HAVE_CSTDIO
27 # include <cstdio>
28 #else
29 # ifdef HAVE_STDIO_H
30 # include <stdio.h>
31 # else
32 # error "don't have header file for stdio"
33 # endif
34 #endif
35 
36 
42 {
43 private:
47  std::string name;
48 
52  FILE* file;
53 
57  int printLevel[ENUM_OUTPUT_AREA_NUMBER_OF_AREAS];
58 
59 
60 public:
66  OSOutputChannel(std::string name);
67 
72 
76  std::string Name();
77 
85 
91 
97  bool setAllPrintLevels(ENUM_OUTPUT_LEVEL* level, int dim);
98 
103 
114  void OSPrintf(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level, std::string str);
115 
119  void flushBuffer();
120 
125  bool Open();
126 };
127 
147 {
148 private:
149  OSOutput(const OSOutput&);
150  OSOutput& operator =(const OSOutput&);
151 public:
156 
161 
171  bool OSPrint(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level, std::string outStr);
172 
177 
184  bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL* level, int dim);
185 
193  bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL level);
194 
203  int AddChannel(std::string name);
204 
205 
210  bool DeleteChannel(std::string name);
211 
217  int FindChannel(std::string name);
218 
219 private:
223  int nOfOutputs;
224 
228  OSOutputChannel** outputChannel;
229 };
230 
231 
232 // osoutput takes care of all output (see ticket 14)
233 // It is declared here as a global variable
234 // so as to minimize the changes to the API
235 
236 extern const OSSmartPtr<OSOutput> osoutput;
237 
238 #endif
OSConfig.h
OSOutputChannel::OSOutputChannel
OSOutputChannel(std::string name)
Constructor.
OSOutput::AddChannel
int AddChannel(std::string name)
Add a channel to the array outputChannel.
OSOutputChannel::~OSOutputChannel
~OSOutputChannel()
Destructor.
ENUM_OUTPUT_AREA_NUMBER_OF_AREAS
@ ENUM_OUTPUT_AREA_NUMBER_OF_AREAS
Definition: OSParameters.h:148
OSOutput::OSOutput
OSOutput()
Constructor.
OSOutputChannel::setAllPrintLevels
bool setAllPrintLevels(ENUM_OUTPUT_LEVEL level)
Set the print level for all areas.
OSOutputChannel::isAccepted
bool isAccepted(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level)
Test if the device accepts a particular combination of print level and area (i.e.,...
OSOutputChannel::setPrintLevel
bool setPrintLevel(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level)
Set the print level for a particular area.
OSOutputChannel::flushBuffer
void flushBuffer()
Flush output buffer.
OSOutputChannel::setAllPrintLevels
bool setAllPrintLevels(ENUM_OUTPUT_LEVEL *level, int dim)
Set different print levels for all areas.
OSSmartPtr
Template class for Smart Pointers.
Definition: OSSmartPtr.hpp:157
OSOutputChannel::OSPrintf
void OSPrintf(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level, std::string str)
Send one string to the output device provided that the output device "accepts" the output (i....
OSOutput::DeleteChannel
bool DeleteChannel(std::string name)
Delete a channel from the array outputChannel.
OSOutput::FindChannel
int FindChannel(std::string name)
Find the position of a channel within the array *outputChannel.
ENUM_OUTPUT_AREA
ENUM_OUTPUT_AREA
Enumeration for the different areas that can produce output.
Definition: OSParameters.h:129
OSOutputChannel
a class that holds information about one output channel (file, device, stream, peripheral,...
Definition: OSOutput.h:42
OSOutput::OSPrint
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 ...
OSReferenced.hpp
OSReferencedObject
ReferencedObject class.
Definition: OSReferenced.hpp:161
OSOutput::SetPrintLevel
bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL level)
set the print level associated with a channel
OSOutput::SetPrintLevel
bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL *level, int dim)
Modify all print levels associated with a channel.
OSOutputChannel::Name
std::string Name()
Get the name of the output channel.
OSOutput::FlushAllBuffers
void FlushAllBuffers()
Flush all buffers.
OSOutputChannel::Open
bool Open()
OSOutput::~OSOutput
~OSOutput()
Destructor.
OSSmartPtr.hpp
OSOutput
This class handles all the output from OSSolverService, OSAmplClient and other executables derived fr...
Definition: OSOutput.h:147
osoutput
const OSSmartPtr< OSOutput > osoutput
OSParameters.h
ENUM_OUTPUT_LEVEL
ENUM_OUTPUT_LEVEL
Enumeration for the different verbosity levels that can be used in producing output.
Definition: OSParameters.h:108