CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::Log Class Reference

#include <Log.hh>

+ Inheritance diagram for CASM::Log:

Detailed Description

Definition at line 9 of file Log.hh.

Public Member Functions

 Log (std::ostream &_ostream=std::cout, int _verbosity=standard, bool _show_clock=false)
 Construct a Log. More...
 
template<int _required_verbosity = standard>
void calculate (const std::string &what)
 
template<int _required_verbosity = standard>
void construct (const std::string &what)
 
template<int _required_verbosity = standard>
void generate (const std::string &what)
 
template<int _required_verbosity = standard>
void set (const std::string &what)
 
template<int _required_verbosity = standard>
void check (const std::string &what)
 
template<int _required_verbosity = standard>
void results (const std::string &what)
 
template<int _required_verbosity = standard>
void read (const std::string &what)
 
template<int _required_verbosity = standard>
void write (const std::string &what)
 
template<int _required_verbosity = standard>
void begin (const std::string &what)
 
template<int _required_verbosity = standard>
void end (const std::string &what)
 
template<int _required_verbosity = standard>
void warning (const std::string &what)
 
template<int _required_verbosity = standard>
void error (const std::string &what)
 
template<int _required_verbosity = standard>
void compiling (const std::string &what)
 
template<int _required_verbosity = standard>
void custom (const std::string &what)
 
template<int _required_verbosity = standard>
void custom (const std::string &type, const std::string &what)
 
void restart_clock ()
 
void show_clock ()
 
void hide_clock ()
 
double time_s () const
 
void begin_lap ()
 
double lap_time () const
 
int verbosity () const
 
void set_verbosity (int _verbosity)
 
template<int _required_verbosity>
Logrequire ()
 
void reset (std::ostream &_ostream=std::cout, int _verbosity=standard, bool _show_clock=false)
 
 operator std::ostream & ()
 
 operator bool ()
 

Static Public Member Functions

static std::pair< bool, int > verbosity_level (std::string s)
 Read verbosity level from a string. More...
 

Static Public Attributes

static const int none = 0
 
static const int quiet = 5
 
static const int standard = 10
 
static const int verbose = 20
 
static const int debug = 100
 

Private Member Functions

template<int _required_verbosity = standard>
void _add (const std::string &type, const std::string &what)
 
void _add_time ()
 
bool _print () const
 

Private Attributes

int m_verbosity
 If m_verbosity >= required verbosity, then print. More...
 
bool m_print
 Whether to print. More...
 
bool m_show_clock
 
boost::chrono::steady_clock::time_point m_start_time
 
boost::chrono::steady_clock::time_point m_lap_start_time
 
std::ostream * m_stream
 

Friends

template<typename T >
Logoperator<< (Log &log, const T &msg_details)
 
Logoperator<< (Log &log, std::ostream &(*fptr)(std::ostream &))
 

Constructor & Destructor Documentation

CASM::Log::Log ( std::ostream &  _ostream = std::cout,
int  _verbosity = standard,
bool  _show_clock = false 
)

Construct a Log.

Parameters
ostreamThe stream to print to
verbosityThe amount to be printed

For verbosity:

  • 0: print nothing
  • 10: print all standard output
  • 100: print all possible output

Definition at line 5 of file Log.cc.

Member Function Documentation

template<int _required_verbosity = standard>
void CASM::Log::_add ( const std::string &  type,
const std::string &  what 
)
inlineprivate

Definition at line 159 of file Log.hh.

void CASM::Log::_add_time ( )
private

Definition at line 104 of file Log.cc.

bool CASM::Log::_print ( ) const
private

Definition at line 110 of file Log.cc.

template<int _required_verbosity = standard>
void CASM::Log::begin ( const std::string &  what)
inline

Definition at line 71 of file Log.hh.

void CASM::Log::begin_lap ( )

Definition at line 28 of file Log.cc.

template<int _required_verbosity = standard>
void CASM::Log::calculate ( const std::string &  what)
inline

Definition at line 31 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::check ( const std::string &  what)
inline

Definition at line 51 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::compiling ( const std::string &  what)
inline

Definition at line 91 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::construct ( const std::string &  what)
inline

Definition at line 36 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::custom ( const std::string &  what)
inline

Definition at line 96 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::custom ( const std::string &  type,
const std::string &  what 
)
inline

Definition at line 107 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::end ( const std::string &  what)
inline

Definition at line 76 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::error ( const std::string &  what)
inline

Definition at line 86 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::generate ( const std::string &  what)
inline

Definition at line 41 of file Log.hh.

void CASM::Log::hide_clock ( )

Definition at line 17 of file Log.cc.

double CASM::Log::lap_time ( ) const

Definition at line 32 of file Log.cc.

CASM::Log::operator bool ( )
inlineexplicit

Definition at line 148 of file Log.hh.

CASM::Log::operator std::ostream & ( )

Definition at line 56 of file Log.cc.

template<int _required_verbosity = standard>
void CASM::Log::read ( const std::string &  what)
inline

Definition at line 61 of file Log.hh.

template<int _required_verbosity>
Log& CASM::Log::require ( )
inline

Definition at line 131 of file Log.hh.

void CASM::Log::reset ( std::ostream &  _ostream = std::cout,
int  _verbosity = standard,
bool  _show_clock = false 
)

Definition at line 47 of file Log.cc.

void CASM::Log::restart_clock ( )

Definition at line 9 of file Log.cc.

template<int _required_verbosity = standard>
void CASM::Log::results ( const std::string &  what)
inline

Definition at line 56 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::set ( const std::string &  what)
inline

Definition at line 46 of file Log.hh.

void CASM::Log::set_verbosity ( int  _verbosity)

Definition at line 42 of file Log.cc.

void CASM::Log::show_clock ( )

Definition at line 13 of file Log.cc.

double CASM::Log::time_s ( ) const

Definition at line 21 of file Log.cc.

int CASM::Log::verbosity ( ) const

Definition at line 38 of file Log.cc.

std::pair< bool, int > CASM::Log::verbosity_level ( std::string  s)
static

Read verbosity level from a string.

Returns
result, a pair of bool,int result.first == true if successfully read, and result.second is the verbosity level

Definition at line 66 of file Log.cc.

template<int _required_verbosity = standard>
void CASM::Log::warning ( const std::string &  what)
inline

Definition at line 81 of file Log.hh.

template<int _required_verbosity = standard>
void CASM::Log::write ( const std::string &  what)
inline

Definition at line 66 of file Log.hh.

Friends And Related Function Documentation

template<typename T >
Log& operator<< ( Log log,
const T &  msg_details 
)
friend

Definition at line 191 of file Log.hh.

Log& operator<< ( Log log,
std::ostream &(*)(std::ostream &)  fptr 
)
friend

Definition at line 115 of file Log.cc.

Member Data Documentation

const int CASM::Log::debug = 100
static

Definition at line 17 of file Log.hh.

boost::chrono::steady_clock::time_point CASM::Log::m_lap_start_time
private

Definition at line 184 of file Log.hh.

bool CASM::Log::m_print
private

Whether to print.

Definition at line 178 of file Log.hh.

bool CASM::Log::m_show_clock
private

Definition at line 180 of file Log.hh.

boost::chrono::steady_clock::time_point CASM::Log::m_start_time
private

Definition at line 182 of file Log.hh.

std::ostream* CASM::Log::m_stream
private

Definition at line 186 of file Log.hh.

int CASM::Log::m_verbosity
private

If m_verbosity >= required verbosity, then print.

Definition at line 175 of file Log.hh.

const int CASM::Log::none = 0
static

Definition at line 13 of file Log.hh.

const int CASM::Log::quiet = 5
static

Definition at line 14 of file Log.hh.

const int CASM::Log::standard = 10
static

Definition at line 15 of file Log.hh.

const int CASM::Log::verbose = 20
static

Definition at line 16 of file Log.hh.


The documentation for this class was generated from the following files: