DOLFIN
DOLFIN C++ interface
LogStream.h
1// Copyright (C) 2003-2009 Anders Logg
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// Modified by Garth N. Wells 2005.
19
20#ifndef __LOG_STREAM_H
21#define __LOG_STREAM_H
22
23#include <complex>
24#include <string>
25#include <sstream>
26
27namespace dolfin
28{
29
30 class Variable;
31 class MeshEntity;
32 class MeshEntityIterator;
33 class Point;
34
38
40 {
41 public:
42
44 enum class Type {COUT, ENDL};
45
47 LogStream(Type type);
48
50 ~LogStream();
51
53 LogStream& operator<< (const LogStream& stream);
54
56 LogStream& operator<< (const std::string& s);
57
59 LogStream& operator<< (int a);
60
62 LogStream& operator<< (unsigned int a);
63
65 LogStream& operator<< (long int a);
66
68 LogStream& operator<< (long unsigned int a);
69
71 LogStream& operator<< (double a);
72
74 LogStream& operator<< (std::complex<double> z);
75
77 LogStream& operator<< (const Variable& variable);
78
81 LogStream& operator<< (const MeshEntity& entity);
82
84 LogStream& operator<< (const Point& point);
85
87 void setprecision(std::streamsize n);
88
89 private:
90
91 // Type of stream
92 Type _type;
93
94 // Buffer
95 std::stringstream buffer;
96
97 };
98
100 extern LogStream cout;
101
103 extern LogStream endl;
104
105}
106
107#endif
Definition: LogStream.h:40
~LogStream()
Destructor.
Definition: LogStream.cpp:41
Type
Stream types.
Definition: LogStream.h:44
LogStream & operator<<(const LogStream &stream)
Output for log stream.
Definition: LogStream.cpp:46
void setprecision(std::streamsize n)
Set precision.
Definition: LogStream.cpp:122
LogStream(Type type)
Create log stream of given type.
Definition: LogStream.cpp:36
Definition: MeshEntity.h:43
Definition: Point.h:41
Common base class for DOLFIN variables.
Definition: Variable.h:36
Definition: adapt.h:30
LogStream cout
dolfin::cout
LogStream endl
dolfin::endl;