ESyS-Particle  2.3.2
console.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef _CONSOLE_H_
14 #define _CONSOLE_H_
15 
16 //--STL includes--
17 #include <string>
18 #include <sstream>
19 
20 using std::string;
21 using std::stringstream;
22 
27 class Console
28 {
29 protected:
30  int m_verb ;
31  bool m_mute;
32  bool m_buffered;
35 
36  unsigned int m_bufflen;
37 
38  stringstream m_buffer;
39  string m_filename;
40 
41  double m_time_offs;
42 
43  void flush();
44 
45 public:
46  Console();
47  virtual ~Console() ;
48 
49  void Initialize();
50  void Initialize(const string&);
51  void SetBuffered(unsigned int);
52  void SetFilename(const string&);
53  void SetVerbose(int vl=7) ;
54  inline int GetVerbose() { return m_verb; } ;
55 
56  Console & Message() ;
57  Console & Error() ;
58  Console & Warning() ;
59  Console & Critical() ;
60  Console & Info() ;
61  Console & Debug() ;
62  Console & XDebug() ;
63 
64  template <class T> Console & operator<<(T);
65 
66 } ;
67 
68 #include "console.hpp"
69 
70 extern Console console;
71 
72 #endif // _CONSOLE_H_