The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::log::MessageSource::LogObject Class Reference

Temporary object for constructing a log message with a ostream-like interface. Emits a message to the message source upon destruction. More...

#include <MessageSource.hpp>

Public Member Functions

 LogObject ()=delete
 Not default-constructable.
 
 LogObject (LogObject &&rhp)
 Move constructor.
 
 LogObject (const LogObject &rhp)=delete
 Not Copy-constructable.
 
 LogObject (const MessageSource &src)
 Construct with message source.
 
template<class T >
 LogObject (const MessageSource &src, const T &init)
 Construct with an initial value.
 
 LogObject (const MessageSource &src, std::ostream &(*f)(std::ostream &))
 Construct with a function operating on ostreams (e.g. std::setw)
 
 ~LogObject ()
 Destructor.
 
void cancel ()
 Cancel the LogObject by.
 
template<class T >
LogObjectoperator<< (const T &t)
 Insertion operator on this LogObject.
 
LogObjectoperator<< (std::ostream &(*f)(std::ostream &))
 Handler for stream modifiers (e.g. endl)
 

Detailed Description

Temporary object for constructing a log message with a ostream-like interface. Emits a message to the message source upon destruction.

Note
std::endl and some other function operations are not supported in insertion operators.

This allows MessageSource::operator<< to string multiple insertions together just like cout waiting until the LogObject is destroyed to actually send the message to its destination

Definition at line 131 of file MessageSource.hpp.

Constructor & Destructor Documentation

◆ LogObject() [1/4]

sparta::log::MessageSource::LogObject::LogObject ( LogObject &&  rhp)
inline

Move constructor.

Definition at line 150 of file MessageSource.hpp.

◆ LogObject() [2/4]

sparta::log::MessageSource::LogObject::LogObject ( const MessageSource src)
inline

Construct with message source.

Definition at line 161 of file MessageSource.hpp.

◆ LogObject() [3/4]

template<class T >
sparta::log::MessageSource::LogObject::LogObject ( const MessageSource src,
const T &  init 
)
inline

Construct with an initial value.

Definition at line 169 of file MessageSource.hpp.

◆ LogObject() [4/4]

sparta::log::MessageSource::LogObject::LogObject ( const MessageSource src,
std::ostream &(*)(std::ostream &)  f 
)
inline

Construct with a function operating on ostreams (e.g. std::setw)

Definition at line 179 of file MessageSource.hpp.

◆ ~LogObject()

sparta::log::MessageSource::LogObject::~LogObject ( )
inline

Destructor.

Sends the message constructed within this object through MessageSource::emit_

Definition at line 191 of file MessageSource.hpp.

Member Function Documentation

◆ cancel()

void sparta::log::MessageSource::LogObject::cancel ( )
inline

Cancel the LogObject by.

Definition at line 200 of file MessageSource.hpp.

◆ operator<<() [1/2]

template<class T >
LogObject & sparta::log::MessageSource::LogObject::operator<< ( const T &  t)
inline

Insertion operator on this LogObject.

Returns
This LogObject

Appends object to internal ostringstream

Definition at line 211 of file MessageSource.hpp.

◆ operator<<() [2/2]

LogObject & sparta::log::MessageSource::LogObject::operator<< ( std::ostream &(*)(std::ostream &)  f)
inline

Handler for stream modifiers (e.g. endl)

Definition at line 219 of file MessageSource.hpp.


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