Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Verbose_ostream.h
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // Copyright (c) 1997 The CGAL Consortium
4 
5 // This software and related documentation is part of the Computational
6 // Geometry Algorithms Library (CGAL).
7 // This software and documentation is provided "as-is" and without warranty
8 // of any kind. In no event shall the CGAL Consortium be liable for any
9 // damage of any kind.
10 //
11 // Every use of CGAL requires a license.
12 //
13 // Academic research and teaching license
14 // - For academic research and teaching purposes, permission to use and copy
15 // the software and its documentation is hereby granted free of charge,
16 // provided that it is not a component of a commercial product, and this
17 // notice appears in all copies of the software and related documentation.
18 //
19 // Commercial licenses
20 // - A commercial license is available through Algorithmic Solutions, who also
21 // markets LEDA (http://www.algorithmic-solutions.de).
22 // - Commercial users may apply for an evaluation license by writing to
23 // Algorithmic Solutions (contact@algorithmic-solutions.com).
24 //
25 // The CGAL Consortium consists of Utrecht University (The Netherlands),
26 // ETH Zurich (Switzerland), Free University of Berlin (Germany),
27 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
28 // (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria),
29 // and Tel-Aviv University (Israel).
30 //
31 // ----------------------------------------------------------------------
32 //
33 // release : CGAL-2.2
34 // release_date : 2000, September 30
35 //
36 // file : include/CGAL/IO/Verbose_ostream.h
37 // package : Stream_support (2.9)
38 // chapter : $CGAL_Chapter: Stream Support $
39 // source : support.fw
40 // revision : $Revision: 1.1.1.1 $
41 // revision_date : $Date: 2001/07/05 22:17:48 $
42 // author(s) : Lutz Kettner
43 //
44 // coordinator : INRIA, Sophia Antipolis
45 //
46 // A stream like output class for verbose output.
47 // email : contact@cgal.org
48 // www : http://www.cgal.org
49 //
50 // ======================================================================
51 
52 #ifndef CGAL_IO_VERBOSE_OSTREAM_H
53 #define CGAL_IO_VERBOSE_OSTREAM_H 1
54 #ifndef CGAL_PROTECT_IOSTREAM
55 #include <iostream>
56 #define CGAL_PROTECT_IOSTREAM
57 #endif
58 
60 
61 #define CGAL__VERB(x) if (b) *o << x; return *this
62 
64  bool b;
65  std::ostream* o;
66 public:
67  Verbose_ostream( bool active = false, std::ostream& out = std::cerr)
68  : b(active), o(&out){}
69 
70  bool verbose() const { return b; }
71  void set_verbose( bool active) { b = active; }
72  std::ostream& out() { return *o; }
73 
74 #ifndef CGAL_CFG_NO_MEMBER_TEMPLATES
75  template < class T >
76  Verbose_ostream& operator<<( const T& t) { CGAL__VERB(t);}
77 #endif // CGAL_CFG_NO_MEMBER_TEMPLATES //
78  // The following specialisations avoid the & for their small args.
80  Verbose_ostream& operator<<( const char* s) { CGAL__VERB(s);}
85  Verbose_ostream& operator<<( unsigned int a) { CGAL__VERB(a);}
86  Verbose_ostream& operator<<( unsigned long l) { CGAL__VERB(l);}
87 #ifdef _LONGLONG
88  Verbose_ostream& operator<<( long long l) { CGAL__VERB(l);}
89  Verbose_ostream& operator<<( unsigned long long l) { CGAL__VERB(l);}
90 #endif /* _LONGLONG */
93  Verbose_ostream& operator<<( unsigned short i) { CGAL__VERB(i);}
94 
95  Verbose_ostream& operator<<( std::ostream& (*f)(std::ostream&))
96  { CGAL__VERB(f);}
97  Verbose_ostream& operator<<( std::ios& (*f)(std::ios&))
98  { CGAL__VERB(f);}
100  if (b)
101  o->flush();
102  return *this;
103  }
104  Verbose_ostream& put(char c) {
105  if (b)
106  o->put(c);
107  return *this;
108  }
109  Verbose_ostream& write(const char* s,int n) {
110  if (b)
111  o->write( s, n);
112  return *this;
113  }
114 };
115 #undef CGAL__VERB
116 
118 #endif // CGAL_IO_VERBOSE_OSTREAM_H //
119 // EOF //
Verbose_ostream & flush()
Verbose_ostream & operator<<(long l)
void set_verbose(bool active)
Verbose_ostream & put(char c)
Verbose_ostream & operator<<(const char *s)
Verbose_ostream & operator<<(unsigned short i)
const NT & d
double s
Definition: blastest.C:80
Verbose_ostream & write(const char *s, int n)
Verbose_ostream & operator<<(std::ostream &(*f)(std::ostream &))
Verbose_ostream & operator<<(void *p)
Verbose_ostream & operator<<(short i)
Verbose_ostream(bool active=false, std::ostream &out=std::cerr)
Verbose_ostream & operator<<(int a)
std::ostream & out()
blockLoc i
Definition: read.cpp:79
Verbose_ostream & operator<<(unsigned int a)
Verbose_ostream & operator<<(float f)
Verbose_ostream & operator<<(char c)
Verbose_ostream & operator<<(const T &t)
const NT & n
bool verbose() const
std::ostream * o
Verbose_ostream & operator<<(double d)
Verbose_ostream & operator<<(unsigned long l)
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
#define CGAL__VERB(x)
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
Verbose_ostream & operator<<(std::ios &(*f)(std::ios &))