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

logger Struct Reference

#include <log.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Private Attributes

ostream & os
set< log_typelog_types
bool logger_valid

Friends

ostream & operator<< (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 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 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 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<< ostream &(*)(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

ostream& operator<< 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

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?)

ostream& logger::os [private]
 

The ostream associated with this logger.


The documentation for this struct was generated from the following files:
Generated on Wed Feb 16 20:54:27 2005 for Fixpoint Engine by  doxygen 1.3.9.1