OS 2.10.2
Loading...
Searching...
No Matches
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{
43private:
47 std::string name;
48
52 FILE* file;
53
58
59
60public:
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
120
125 bool Open();
126};
127
147{
148private:
149 OSOutput(const OSOutput&);
150 OSOutput& operator =(const OSOutput&);
151public:
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
219private:
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
236extern const OSSmartPtr<OSOutput> osoutput;
237
238#endif
const OSSmartPtr< OSOutput > osoutput
ENUM_OUTPUT_LEVEL
Enumeration for the different verbosity levels that can be used in producing output.
Definition: OSParameters.h:108
ENUM_OUTPUT_AREA
Enumeration for the different areas that can produce output.
Definition: OSParameters.h:129
@ ENUM_OUTPUT_AREA_NUMBER_OF_AREAS
Definition: OSParameters.h:148
a class that holds information about one output channel (file, device, stream, peripheral,...
Definition: OSOutput.h:42
bool setAllPrintLevels(ENUM_OUTPUT_LEVEL level)
Set the print level for all areas.
~OSOutputChannel()
Destructor.
bool setAllPrintLevels(ENUM_OUTPUT_LEVEL *level, int dim)
Set different print levels for all areas.
void flushBuffer()
Flush output buffer.
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....
std::string Name()
Get the name of the output channel.
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.,...
bool setPrintLevel(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level)
Set the print level for a particular area.
OSOutputChannel(std::string name)
Constructor.
This class handles all the output from OSSolverService, OSAmplClient and other executables derived fr...
Definition: OSOutput.h:147
~OSOutput()
Destructor.
int FindChannel(std::string name)
Find the position of a channel within the array *outputChannel.
int AddChannel(std::string name)
Add a channel to the array outputChannel.
bool DeleteChannel(std::string name)
Delete a channel from the array outputChannel.
OSOutput()
Constructor.
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 ...
bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL level)
set the print level associated with a channel
void FlushAllBuffers()
Flush all buffers.
bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL *level, int dim)
Modify all print levels associated with a channel.
ReferencedObject class.
Template class for Smart Pointers.
Definition: OSSmartPtr.hpp:157