-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLog.h
77 lines (61 loc) · 1.59 KB
/
Log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef Log_h
#define Log_h
// C Standard libraries
#include <iostream>
#include <vector>
#include <string>
#include "numbers.h"
using namespace std;
/** \brief Logging class
Allows dumping/logging matrices and vectors in a convenient way.
© Copyright 2010 TU Berlin - Christoph Tavan. All Rights Reserved.
\author Christoph Tavan TU Berlin
\author $LastChangedBy$
\date 2010-12-27
\date $LastChangedDate$
\version $Rev$ \sa
**/
class Log: public ostream{
public:
Log(ostream& out, int level);
~Log();
int level; //!< Loglevel of the instance. level must be > 0 for any output to appear.
template <typename T> Log& operator<<(const T& value)
{
if (level > 0) {
(ostream&)*this << value;
}
return *this;
}
/** \brief Dump some string.
\author Christoph Tavan TU Berlin
\date 2010-12-27
\param string Message
\param description of parameter
\return description of return value
\sa
**/
void message(string text);
/** \brief Dump a 1D-vector
\author Christoph Tavan TU Berlin
\date 2010-12-27
\param vector Vector
\param string Name of the vector
\return void
\sa
**/
void vec(vector< my_rational > v, string name);
void vec(vector< unsigned > v, string name);
void vec(vector< string > v, string name);
/** \brief Dump a 2D-matrix
\author Christoph Tavan TU Berlin
\date 2010-12-27
\param vector m x n matrix
\param string Name of the matrix
\param float Optional, whether to convert output to floats
\return description of return value
\sa
**/
void matrix(vector< vector< my_rational > > m, string name, bool tofloat = false);
};
#endif