blob: 66d785ab352de093c2bc37fb338d5fcc5d3157d1 (
plain)
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
|
//------------------------------------------------------------------------------
// Author: Pavel Karneliuk
// Description: Interface to print out user information
// Copyright (c) 2013 EPAM Systems
//------------------------------------------------------------------------------
/*
This file is part of Nfstrace.
Nfstrace is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 2 of the License.
Nfstrace is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Nfstrace. If not, see <http://www.gnu.org/licenses/>.
*/
//------------------------------------------------------------------------------
#ifndef OUT_H
#define OUT_H
//------------------------------------------------------------------------------
#include <iostream>
//------------------------------------------------------------------------------
namespace NST
{
namespace utils
{
class Out : public std::ostream
{
public:
enum class Level : int // verbosity level
{
Silent = 0,
Info = 1,
All = 2,
};
// helper for creation and destruction global level of verbosity
struct Global
{
explicit Global(const Level verbose_level);
~Global();
Global(const Global&) = delete;
Global& operator=(const Global&) = delete;
static Level get_level(); // return global level of verbosity
static void set_level(Level); // set global level of verbosity
};
explicit Out(Level level = Level::Info); // verbose level of message
~Out();
Out(const Out&) = delete;
Out& operator=(const Out&) = delete;
};
inline bool operator>=(const Out::Level a, const Out::Level b)
{
return (int)a >= (int)b;
}
} // namespace utils
} // namespace NST
//------------------------------------------------------------------------------
#endif // OUT_H
//------------------------------------------------------------------------------
|