FairRoot/PandaRoot
Functions | Variables
chigen::ostreams Namespace Reference

Functions

void initialize_streams ()
 

Variables

bool suppress_all_cout = false
 
bool write_log_file = false
 
bool suppress_pandaroot = false
 
bool suppress_pandaroot_cout = false
 
bool verbose_mode = true
 
std::ostreamlog_file = 0
 
std::ostreamterminal = 0
 
std::ostreamtee_stream = 0
 
std::ostreamchigen_cout = 0
 

Function Documentation

void chigen::ostreams::initialize_streams ( )

Definition at line 56 of file ChiGenContext.cxx.

References chigen_cout, CHIGEN_LOG_FILE, log_file, suppress_all_cout, suppress_pandaroot, suppress_pandaroot_cout, tee_stream, terminal, and write_log_file.

Referenced by chigen::initialize().

56  {
57  remove(CHIGEN_LOG_FILE);
58  std::ofstream* __temp_logFile__ = new std::ofstream();
59  if (write_log_file)
60  __temp_logFile__->open(CHIGEN_LOG_FILE);
61  ostreams::log_file = new std::ostream(__temp_logFile__->rdbuf());
62  ostreams::terminal = new std::ostream(std::cout.rdbuf());
63  TeeDevice __temp_tee_device(*ostreams::terminal, *__temp_logFile__);
64  ostreams::tee_stream = new TeeStream(__temp_tee_device);
65 
67  //write all to log.file
68  std::cout.rdbuf(__temp_logFile__->rdbuf());
69  ostreams::chigen_cout = &std::cout;
70  } else if (suppress_all_cout && !write_log_file) {
71  //no any cout at all
72  std::cout.rdbuf(0);
73  ostreams::chigen_cout = &std::cout;
74  } else if (write_log_file) {
75  //writing log file
76  if (suppress_pandaroot) {
77  //suppress panda root in log file
78  std::cout.rdbuf(0);
80  } else if (suppress_pandaroot_cout) {
81  //suppress pandaroot in terminal but not in log
82  std::cout.rdbuf(__temp_logFile__->rdbuf());
84  } else {
85  //both pandaroot & chigen goes to log and terminal
86  std::cout.rdbuf(ostreams::tee_stream->rdbuf());
88  }
89  } else {
90  //no log file will be created
92  //suppress pandaroot in terminal
93  std::cout.rdbuf(0);
94  }
96  }
97  }
#define CHIGEN_LOG_FILE
Definition: ChiGenContext.h:15
std::ostream * terminal
std::ostream * chigen_cout
basic_ostream< char, char_traits< char > > ostream
std::ostream * tee_stream
std::ostream * log_file

Variable Documentation

std::ostream * chigen::ostreams::chigen_cout = 0

Default output stream used by ChiGen

Definition at line 54 of file ChiGenContext.cxx.

Referenced by initialize_streams(), chigen::ChiGen::next(), and chigen::PndChiGenExclusive::ReadEvent().

std::ostream * chigen::ostreams::log_file = 0

Log file

Definition at line 51 of file ChiGenContext.cxx.

Referenced by initialize_streams().

bool chigen::ostreams::suppress_all_cout = false

Suppress all output to terminal

Definition at line 44 of file ChiGenContext.cxx.

Referenced by initialize_streams().

bool chigen::ostreams::suppress_pandaroot = false

Suppress all pandaroot output (to terminal and to log)

Definition at line 46 of file ChiGenContext.cxx.

Referenced by initialize_streams().

bool chigen::ostreams::suppress_pandaroot_cout = false

Suppress pandaroot output to terminal

Definition at line 47 of file ChiGenContext.cxx.

Referenced by initialize_streams().

std::ostream * chigen::ostreams::tee_stream = 0

Tee stream, which duplicate stdout to log file

Definition at line 53 of file ChiGenContext.cxx.

Referenced by initialize_streams().

std::ostream * chigen::ostreams::terminal = 0

Console (stdout)

Definition at line 52 of file ChiGenContext.cxx.

Referenced by initialize_streams().

bool chigen::ostreams::verbose_mode = true

Print events

Definition at line 48 of file ChiGenContext.cxx.

Referenced by chigen::ChiGen::next(), and chigen::PndChiGenExclusive::ReadEvent().

bool chigen::ostreams::write_log_file = false

Write log file

Definition at line 45 of file ChiGenContext.cxx.

Referenced by initialize_streams().