Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Log Class Reference

Implementation of a thread-safe log. More...

#include <log.hpp>

List of all members.

Public Member Functions

 Log ()
 Standard constructor.
 Log (bool)
 Constructor.
 ~Log ()
 Standard destructor.
bool getSilent ()
 Set silence.
void setSilent (bool)
 Set silence.
Logoperator<< (const string &)
 Left shift operator.
Logoperator<< (const char *)
 Left shift operator.
Logoperator<< (const int &)
 Left shift operator.
Logoperator<< (const float &)
 Left shift operator.
Logoperator<< (const double &)
 Left shift operator.
Logoperator<< (const timespec &)
 Left shift operator.
void saveToFile (const char *)
 Saves the log in a file.

Protected Attributes

Mutex mutex
 Mutex.
stringstream sstream
 string stream as storage
bool silent
 flag: if true content will also writen on the screen


Detailed Description

Implementation of a thread-safe log.

Definition at line 37 of file log.hpp.


Constructor & Destructor Documentation

Log::Log  ) 
 

Standard constructor.

Definition at line 31 of file log.cpp.

References silent.

Log::Log bool  in  ) 
 

Constructor.

Parameters:
in Should each added content also be printed on the screen?
Definition at line 39 of file log.cpp.

References silent.

Log::~Log  ) 
 

Standard destructor.

Definition at line 46 of file log.cpp.


Member Function Documentation

bool Log::getSilent  ) 
 

Set silence.

Returns:
Should each added content also be printed on the screen?
Definition at line 54 of file log.cpp.

References silent.

Log & Log::operator<< const timespec &  in  ) 
 

Left shift operator.

Inserts an item into the log.

Parameters:
in item which will be inserted
Definition at line 130 of file log.cpp.

References mutex, silent, and sstream.

Log & Log::operator<< const double &  in  ) 
 

Left shift operator.

Inserts an item into the log.

Parameters:
in item which will be inserted
Definition at line 94 of file log.cpp.

References mutex, silent, and sstream.

Log & Log::operator<< const float &  in  ) 
 

Left shift operator.

Inserts an item into the log.

Parameters:
in item which will be inserted
Definition at line 106 of file log.cpp.

References mutex, silent, and sstream.

Log & Log::operator<< const int &  in  ) 
 

Left shift operator.

Inserts an item into the log.

Parameters:
in item which will be inserted
Definition at line 118 of file log.cpp.

References mutex, silent, and sstream.

Log & Log::operator<< const char *  in  ) 
 

Left shift operator.

Inserts an item into the log.

Parameters:
in item which will be inserted
Definition at line 82 of file log.cpp.

References mutex, silent, and sstream.

Log & Log::operator<< const string &  in  ) 
 

Left shift operator.

Inserts an item into the log.

Parameters:
in item which will be inserted
Definition at line 70 of file log.cpp.

References mutex, silent, and sstream.

void Log::saveToFile const char *  fname  ) 
 

Saves the log in a file.

If the file already exist, the log content gets appended.

Parameters:
fname file name of file which will be saved to
Definition at line 143 of file log.cpp.

References mutex, and sstream.

Referenced by PtfCore::run().

void Log::setSilent bool  in  ) 
 

Set silence.

Parameters:
in Should each added content also be printed on the screen?
Definition at line 62 of file log.cpp.

References silent.

Referenced by PtfCore::run().


Member Data Documentation

Mutex Log::mutex [protected]
 

Mutex.

Definition at line 52 of file log.hpp.

Referenced by operator<<(), and saveToFile().

bool Log::silent [protected]
 

flag: if true content will also writen on the screen

Definition at line 54 of file log.hpp.

Referenced by getSilent(), Log(), operator<<(), and setSilent().

stringstream Log::sstream [protected]
 

string stream as storage

Definition at line 53 of file log.hpp.

Referenced by operator<<(), and saveToFile().


The documentation for this class was generated from the following files:
Generated on Fri Dec 17 14:54:29 2004 for Psychological Test Framework by doxygen 1.3.8