ConicBundle
CBout.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CBOUT_HXX
4 #define CBOUT_HXX
5 
6 
14 #include <iostream>
15 #include <cstdlib>
16 
17 namespace ConicBundle {
18 
23 
24 
25 
26 
30 class CBout
31 {
33  std::ostream *out;
34 
35 
38 
39 public:
49  virtual void set_out(std::ostream* out=0,int print_level=1);
50 
59  virtual void set_cbout(const CBout* cb,int incr=-1);
60 
62  virtual ~CBout(); //implemented in CBout.cxx
63 
65  void clear_cbout(){out=0;print_level=1;}
66 
68  CBout(const CBout* cb=0,int incr=-1){set_cbout(cb,incr);}
69 
71  CBout(std::ostream* outp,int pl=1){set_out(outp,pl);}
72 
74  CBout(const CBout& cb,int incr=0){set_out(cb.out,cb.print_level+incr);}
75 
78  virtual bool cb_out(int pl=-1) const
79  {if ((out)&&(pl<print_level)) return true; return false;}
80 
83  std::ostream& get_out() const
84  {if (out==0) std::abort(); return *out;}
85 
88  std::ostream* get_out_ptr() const
89  {return out;}
90 
93  int get_print_level() const
94  {return print_level;}
95 
98  virtual int mfile_data(std::ostream& out) const
99  { out<<"\n%\n% here something is missing, because mfile_data is not yet implemented\n%\n\n"; return 0;}
100 
101 
102 };
103 
104 
106 
107 }
108 
109 #endif
110 
virtual bool cb_out(int pl=-1) const
Returns true if out!=0 and (pl<print_level), pl<0 should be used for WARNINGS and ERRORS only...
Definition: CBout.hxx:78
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
CBout(std::ostream *outp, int pl=1)
initialize correspondingly
Definition: CBout.hxx:71
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
CBout(const CBout &cb, int incr=0)
copy constructor
Definition: CBout.hxx:74
std::ostream & get_out() const
If cb_out() returned true, this returns the output stream, but it will abort if called with out==0...
Definition: CBout.hxx:83
virtual void set_out(std::ostream *out=0, int print_level=1)
Specifies the output level (out==NULL: no output at all, out!=NULL and level=0: errors and warnings...
void clear_cbout()
reset to default settings (out=0,print_level=1)
Definition: CBout.hxx:65
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
int print_level
nonnegative level of output, 0 should mean WARNINGS and ERRORS only, 1 should represent normal output...
Definition: CBout.hxx:37
int get_print_level() const
returns the print_level
Definition: CBout.hxx:93
std::ostream * get_out_ptr() const
returns the pointer to the output stream
Definition: CBout.hxx:88
CBout(const CBout *cb=0, int incr=-1)
calls set_cbout
Definition: CBout.hxx:68
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.
virtual int mfile_data(std::ostream &out) const
writes problem data to the given outstream
Definition: CBout.hxx:98