OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CoutSink.h
Go to the documentation of this file.
1 #ifndef __TRACE_COUT_SINK_H__
2 #define __TRACE_COUT_SINK_H__
3 
4 #include <iostream>
5 #include <string>
6 
8 
9 class CoutSink : public TraceComponent {
10 
11 public:
12 
13 
14  CoutSink(std::string prefix = "")
15  : TraceComponent("CoutSink")
16  , prefix_(prefix) {
17 
18  clear_color_ = "\e[0m";
19  }
20 
22  {}
23 
24 
25  void setColor(std::string color) { color_ = color; }
26  void setClearColor(std::string color) { clear_color_ = color; }
27 
28 
29  void execute(std::ostringstream &dump) {
30  std::cout << color_ << prefix_
31  << dump.str()
32  << clear_color_ << std::flush;
33  }
34 
35 private:
36 
37  std::string prefix_;
38  std::string color_;
39  std::string clear_color_;
40 
41 };
42 
43 #endif
std::string prefix_
Definition: CoutSink.h:37
void execute(std::ostringstream &dump)
Definition: CoutSink.h:29
void setClearColor(std::string color)
Definition: CoutSink.h:26
void setColor(std::string color)
Definition: CoutSink.h:25
~CoutSink()
Definition: CoutSink.h:21
CoutSink(std::string prefix="")
Definition: CoutSink.h:14
std::string clear_color_
Definition: CoutSink.h:39
std::string color_
Definition: CoutSink.h:38