opensurgsim
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SurgSim::Framework::AssertMessage Class Reference

An internal message class used for assertion failures. More...

#include <AssertMessage.h>

Inheritance diagram for SurgSim::Framework::AssertMessage:
SurgSim::Framework::LogMessageBase

Public Types

typedef void(* DeathCallback) (const std::string &message)
 The type used for the callback function that is triggered after an assertion has failed.
 

Public Member Functions

 AssertMessage (Logger *logger)
 Constructor. More...
 
 AssertMessage (const std::unique_ptr< Logger > &logger)
 Constructor. More...
 
 AssertMessage (const std::shared_ptr< Logger > &logger)
 Constructor. More...
 
 ~AssertMessage () noexcept(false)
 Destructor, which may throw an exception if the failure behavior does.
 
- Public Member Functions inherited from SurgSim::Framework::LogMessageBase
 LogMessageBase (Logger *logger, int level)
 Construct a LogMessage. More...
 
 ~LogMessageBase ()
 Destructor.
 
template<typename T >
LogMessageBaseoperator<< (T &&input)
 Add the given input to the current log message. More...
 
LogMessageBaseoperator<< (std::ios_base &(*manipulator)(std::ios_base &))
 
LogMessageBaseoperator<< (std::ostream &(*manipulator)(std::ostream &))
 

Static Public Member Functions

static void setFailureCallback (DeathCallback callback)
 After an assertion has failed, call some arbitrary function. More...
 
static DeathCallback getFailureCallback ()
 Get the callback that will currently be called after an assertion has failed. More...
 
static void setFailureBehaviorToThrow ()
 After an assertion has failed, throw a C++ exception. More...
 
static void setFailureBehaviorToDeath ()
 After an assertion has failed, enter the debugger or kill the application in a system-dependent way. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SurgSim::Framework::LogMessageBase
std::string getMessage ()
 
void flush ()
 write the current message to the logger
 

Detailed Description

An internal message class used for assertion failures.

Dies after logging.

Constructor & Destructor Documentation

§ AssertMessage() [1/3]

SurgSim::Framework::AssertMessage::AssertMessage ( Logger logger)
inlineexplicit

Constructor.

Parameters
loggerLogger used to log this message.

§ AssertMessage() [2/3]

SurgSim::Framework::AssertMessage::AssertMessage ( const std::unique_ptr< Logger > &  logger)
inlineexplicit

Constructor.

Parameters
loggerLogger used to log this message.

§ AssertMessage() [3/3]

SurgSim::Framework::AssertMessage::AssertMessage ( const std::shared_ptr< Logger > &  logger)
inlineexplicit

Constructor.

Parameters
loggerLogger used to log this message.

Member Function Documentation

§ getFailureCallback()

AssertMessage::DeathCallback SurgSim::Framework::AssertMessage::getFailureCallback ( )
static

Get the callback that will currently be called after an assertion has failed.

Thread-unsafe if called concurrently from multiple threads, or concurrently with a failing assertion.

Returns
The callback.

§ setFailureBehaviorToDeath()

static void SurgSim::Framework::AssertMessage::setFailureBehaviorToDeath ( )
inlinestatic

After an assertion has failed, enter the debugger or kill the application in a system-dependent way.

Thread-unsafe if called concurrently from multiple threads, or concurrently with a failing assertion.

§ setFailureBehaviorToThrow()

static void SurgSim::Framework::AssertMessage::setFailureBehaviorToThrow ( )
inlinestatic

After an assertion has failed, throw a C++ exception.

Thread-unsafe if called concurrently from multiple threads, or concurrently with a failing assertion.

§ setFailureCallback()

void SurgSim::Framework::AssertMessage::setFailureCallback ( AssertMessage::DeathCallback  callback)
static

After an assertion has failed, call some arbitrary function.

The callback function should cause the application (or at least the current thread) to terminate.

Thread-unsafe if called concurrently from multiple threads, or concurrently with a failing assertion.


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