Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

logger Class Reference

#include <log.hpp>

List of all members.

Public Member Functions

 logger (std::ostream &os)
loggeroperator() (log_type type)
template<class T>
loggeroperator<< (const T &arg)
loggeroperator<< (std::ostream &(*pf)(std::ostream &))
void add_log_type (log_type type)
template<class Con>
void log_all (const Con &con, const std::string &delim)

Static Public Member Functions

log_type get_log_type (const std::string &name)
std::string get_log_name (const log_type &type)

Private Attributes

std::ostream & os
std::set< log_typelog_types
bool logger_valid

Friends

std::ostream & operator<< (std::ostream &os, const logger &l)


Detailed Description

This class acts as a logger. It is assigned a set of log types and an ostream to log to.


Constructor & Destructor Documentation

logger::logger std::ostream &  os  ) 
 

Constructor taking the ostream to log to.

Parameters:
os the ostream.


Member Function Documentation

void logger::add_log_type log_type  type  ) 
 

Adds a log type to be recognised by this logger.

Parameters:
type the log type to be added.

string logger::get_log_name const log_type type  )  [static]
 

Gets the name associated with the given log type.

Parameters:
type the log type.
Returns:
The log name.

log_type logger::get_log_type const std::string &  name  )  [static]
 

Gets the log type associated with the given name.

Parameters:
name the log name.
Returns:
The log type.

template<class Con>
void logger::log_all const Con &  con,
const std::string &  delim
 

Log all members of the given container (if the currently set log type is valid) or discard them (if the currently set log type is invalid).

Parameters:
con the container whose members to log or discard.
delim the delimiter to log between each logged element.

logger & logger::operator() log_type  type  ) 
 

Sets the log state of the logger (valid if the log type is recognised, invalid otherwise) and returns the logger. This method should be called before every logging.

Parameters:
type the log type to use for the next logging.

logger & logger::operator<< std::ostream &(*)(std::ostream &)  pf  ) 
 

Log an ostream manipulator to the specified ostream (if the currently set log type is valid) or discard the element (if the currently set log type is invalid).

Parameters:
pf the manipulator to log or discard.

template<class T>
logger & logger::operator<< const T &  arg  ) 
 

Log an element to the specified ostream (if the currently set log type is valid) or discard the element (if the currently set log type is invalid).

Parameters:
arg the element to log or discard.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  os,
const logger l
[friend]
 

Write a text representation of this logger to an ostream.

Parameters:
os the ostream to write to.
l the logger to write.


Member Data Documentation

std::set<log_type> logger::log_types [private]
 

The set of log types recognised by this logger.

bool logger::logger_valid [private]
 

Is the logger valid? (Is a recognised log type set?)

std::ostream& logger::os [private]
 

The ostream associated with this logger.


The documentation for this class was generated from the following files:
Generated on Mon Mar 21 00:08:23 2005 for Fixpoint Engine by  doxygen 1.3.9.1