OPAL (Object Oriented Parallel Accelerator Library)
2024.2
OPAL
optimizer
Util
Trace
CoutSink.h
Go to the documentation of this file.
1
//
2
// Class CoutSink
3
//
4
// Copyright (c) 2010 - 2013, Yves Ineichen, ETH Zürich
5
// All rights reserved
6
//
7
// Implemented as part of the PhD thesis
8
// "Toward massively parallel multi-objective optimization with application to
9
// particle accelerators" (https://doi.org/10.3929/ethz-a-009792359)
10
//
11
// This file is part of OPAL.
12
//
13
// OPAL is free software: you can redistribute it and/or modify
14
// it under the terms of the GNU General Public License as published by
15
// the Free Software Foundation, either version 3 of the License, or
16
// (at your option) any later version.
17
//
18
// You should have received a copy of the GNU General Public License
19
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20
//
21
#ifndef __TRACE_COUT_SINK_H__
22
#define __TRACE_COUT_SINK_H__
23
24
#include <iostream>
25
#include <string>
26
27
#include "
Util/AnsiColors.h
"
28
#include "
Util/Trace/TraceComponent.h
"
29
30
class
CoutSink
:
public
TraceComponent
{
31
32
public
:
33
34
35
CoutSink
(std::string prefix =
""
)
36
:
TraceComponent
(
"CoutSink"
)
37
,
prefix_
(prefix) {
38
39
clear_color_
=
AnsiColors::Reset
;
40
}
41
42
~CoutSink
()
43
{}
44
45
46
void
setColor
(std::string color) {
color_
= color; }
47
void
setClearColor
(std::string color) {
clear_color_
= color; }
48
49
50
void
execute
(std::ostringstream &dump) {
51
std::cout <<
color_
<<
prefix_
52
<< dump.str()
53
<<
clear_color_
<< std::flush;
54
}
55
56
private
:
57
58
std::string
prefix_
;
59
std::string
color_
;
60
std::string
clear_color_
;
61
62
};
63
64
#endif
TraceComponent.h
AnsiColors.h
AnsiColors::Reset
constexpr char Reset[]
Definition
AnsiColors.h:5
CoutSink
Definition
CoutSink.h:30
CoutSink::execute
void execute(std::ostringstream &dump)
Definition
CoutSink.h:50
CoutSink::CoutSink
CoutSink(std::string prefix="")
Definition
CoutSink.h:35
CoutSink::~CoutSink
~CoutSink()
Definition
CoutSink.h:42
CoutSink::clear_color_
std::string clear_color_
Definition
CoutSink.h:60
CoutSink::prefix_
std::string prefix_
Definition
CoutSink.h:58
CoutSink::setClearColor
void setClearColor(std::string color)
Definition
CoutSink.h:47
CoutSink::setColor
void setColor(std::string color)
Definition
CoutSink.h:46
CoutSink::color_
std::string color_
Definition
CoutSink.h:59
TraceComponent
Definition
TraceComponent.h:27
Generated on Wed Sep 30 2026 07:14:50 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.8