CppADCodeGen  HEAD
A C++ Algorithmic Differentiation Package with Source Code Generation
simple_logger.hpp
1 #ifndef CPPAD_CG_SIMPLE_LOGGER_INCLUDED
2 #define CPPAD_CG_SIMPLE_LOGGER_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2016 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 
18 namespace CppAD {
19 namespace cg {
20 
24 class SimpleLogger {
25 protected:
26  // verbosity level
27  Verbosity verbosity_;
28  // output stream used for logging
29  std::ostream* log_;
30 public:
31 
35  inline SimpleLogger() :
36  verbosity_(Verbosity::None),
37  log_(&std::cout) {
38  }
39 
40  inline virtual ~SimpleLogger() {
41  }
42 
43  inline std::ostream& log() const {
44  return *log_;
45  }
46 
47  inline void setLog(std::ostream& out) {
48  log_ = &out;
49  }
50 
51  inline void setVerbosity(Verbosity verbosity) {
52  verbosity_ = verbosity;
53  }
54 
55  inline Verbosity getVerbosity() const {
56  return verbosity_;
57  }
58 
59 };
60 
61 } // END cg namespace
62 } // END CppAD namespace
63 
64 #endif
65 
STL namespace.