COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Types | Public Member Functions | Private Attributes | List of all members
LogStampFilter Class Reference

Prepends a stamp to the log messages. More...

#include <LogStampFilter.hpp>

Public Types

typedef char char_type
 
typedef boost::iostreams::multichar_output_filter_tag category
 

Public Member Functions

 LogStampFilter (const std::string &streamName, const std::string &stamp=std::string())
 Constructor. More...
 
void setStamp (const std::string &stamp)
 Sets stamp. More...
 
std::string getStamp () const
 Gives the stamps. More...
 
void setPlace (const CodeLocation &place)
 Sets the code location. More...
 
void endMessage ()
 Ends message. More...
 
template<typename Sink >
std::streamsize write (Sink &sink, const char_type *data, std::streamsize size)
 Writes data to a sink. More...
 

Private Attributes

CodeLocation m_place
 The current code location. More...
 
std::string m_stamp
 The current stamp. More...
 
std::string m_streamName
 The stream name. More...
 
bool m_newMessage
 Indicates whether it is a new message or not. More...
 

Detailed Description

Prepends a stamp to the log messages.

This class is written to act as a Boost.Iostreams filter. It defines char_type and category types and a write method for that purpose.
The stamp can be personalized with setStamp(). Four tags are regonized:

Author
Quentin Gasper

Definition at line 42 of file LogStampFilter.hpp.

Member Typedef Documentation

typedef boost::iostreams::multichar_output_filter_tag category

Definition at line 47 of file LogStampFilter.hpp.

typedef char char_type

Definition at line 46 of file LogStampFilter.hpp.

Constructor & Destructor Documentation

LogStampFilter ( const std::string &  streamName,
const std::string &  stamp = std::string() 
)

Constructor.

Parameters
streamNameThe stream name.
stampThe stamp. Can be empty.

Definition at line 11 of file LogStampFilter.cpp.

Member Function Documentation

void endMessage ( )

Ends message.

After calling this method, the stamp will be prepended again on the next call to write.

Definition at line 40 of file LogStampFilter.cpp.

std::string getStamp ( ) const

Gives the stamps.

Returns
Returns the stamp.

Definition at line 32 of file LogStampFilter.cpp.

void setPlace ( const CodeLocation place)

Sets the code location.

Parameters
placeThe code location

Definition at line 48 of file LogStampFilter.cpp.

void setStamp ( const std::string &  stamp)

Sets stamp.

Parameters
stampThe stamp. Can be empty.

Definition at line 24 of file LogStampFilter.cpp.

std::streamsize write ( Sink &  sink,
const char_type data,
std::streamsize  size 
)
inline

Writes data to a sink.

If it is a new message, the stamp is prepended.

Returns
Returns size or (size + the size of the stamp) if the stamp has been prepended.

Definition at line 84 of file LogStampFilter.hpp.

Member Data Documentation

bool m_newMessage
private

Indicates whether it is a new message or not.

If true, the stamp will be prepended on the next call of write. It can be set back to true by calling endMessage()

Definition at line 125 of file LogStampFilter.hpp.

CodeLocation m_place
private

The current code location.

Definition at line 113 of file LogStampFilter.hpp.

std::string m_stamp
private

The current stamp.

Definition at line 116 of file LogStampFilter.hpp.

std::string m_streamName
private

The stream name.

Definition at line 119 of file LogStampFilter.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin