GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSPrint.cc
Go to the documentation of this file.
1 // ************************************************************************
2 // * This file is part of GGEMS. *
3 // * *
4 // * GGEMS is free software: you can redistribute it and/or modify *
5 // * it under the terms of the GNU General Public License as published by *
6 // * the Free Software Foundation, either version 3 of the License, or *
7 // * (at your option) any later version. *
8 // * *
9 // * GGEMS is distributed in the hope that it will be useful, *
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 // * GNU General Public License for more details. *
13 // * *
14 // * You should have received a copy of the GNU General Public License *
15 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
16 // * *
17 // ************************************************************************
18 
32 
33 // Initializations
34 GGEMSStream GGcout = GGEMSStream(std::cout, GGEMSConsoleColor::green);
35 GGEMSStream GGcerr = GGEMSStream(std::cerr, GGEMSConsoleColor::red);
36 GGEMSStream GGwarn = GGEMSStream(std::cout, GGEMSConsoleColor::yellow);
37 
41 
42 GGEMSStream::GGEMSStream(std::ostream& stream, GGEMSConsoleColor const& color)
43 : class_name_(""),
44  method_name_(""),
45  verbosity_limit_(0),
46  verbosity_level_(0),
47  stream_counter_(0),
48  stream_(stream),
49  color_index_(color)
50 {
51  ;
52 }
53 
57 
58 void GGEMSStream::SetVerbosity(GGint const& verbosity_limit)
59 {
60  verbosity_limit_ = verbosity_limit;
61 }
62 
66 
67 GGEMSStream& GGEMSStream::operator()(std::string const& class_name,
68  std::string const& method_name, GGint const& verbosity_level)
69 {
70  class_name_ = class_name;
71  method_name_ = method_name;
72  verbosity_level_ = verbosity_level;
73  stream_counter_ = 0;
74  return *this;
75 }
76 
80 
81 void set_ggems_verbose(GGint verbosity)
82 {
83  GGcout.SetVerbosity(verbosity);
84  GGcerr.SetVerbosity(verbosity);
85  GGwarn.SetVerbosity(verbosity);
86 }
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGEMSStream::SetVerbosity
void SetVerbosity(GGint const &verbosity_limit)
Set the global verbosity.
Definition: GGEMSPrint.cc:58
set_ggems_verbose
void set_ggems_verbose(GGint verbosity)
Set the verbosity of output stream.
Definition: GGEMSPrint.cc:81
GGEMSStream::verbosity_limit_
GGint verbosity_limit_
Definition: GGEMSPrint.hh:172
GGwarn
GGEMSStream GGwarn
Definition: GGEMSPrint.cc:36
GGEMSStream::verbosity_level_
GGint verbosity_level_
Definition: GGEMSPrint.hh:173
GGEMSStream::GGEMSStream
GGEMSStream(std::ostream &stream, GGEMSConsoleColor const &color)
GGEMSStream constructor.
Definition: GGEMSPrint.cc:42
GGint
#define GGint
Definition: GGEMSTypes.hh:224
GGEMSConsoleColor
GGEMSConsoleColor
define a color for the console terminal
Definition: GGEMSPrint.hh:77
GGEMSStream::class_name_
std::string class_name_
Definition: GGEMSPrint.hh:170
GGEMSStream
Generic class redefining standard output.
Definition: GGEMSPrint.hh:127
GGEMSPrint.hh
Print a custom std::cout end std::cerr handling verbosity.
GGEMSStream::method_name_
std::string method_name_
Definition: GGEMSPrint.hh:171
GGcerr
GGEMSStream GGcerr
Definition: GGEMSPrint.cc:35
GGEMSStream::stream_counter_
GGint stream_counter_
Definition: GGEMSPrint.hh:174
GGEMSStream::operator()
GGEMSStream & operator()(std::string const &class_name, std::string const &method_name, GGint const &verbosity_level)
setting private members to display them to standart output
Definition: GGEMSPrint.hh:139