maliput
EventStatus Class Reference

Detailed Description

Holds the return status from execution of an event handler function, or the effective status after a series of handler executions due to dispatching of simultaneous events.

Drake API users will typically use only the four factory methods below to return status, and optionally a human-readable message, from their event handlers.

#include <src/maliput/drake/systems/framework/event_status.h>

Public Types

enum  Severity { kDidNothing = 0, kSucceeded = 1, kReachedTermination = 2, kFailed = 3 }
 The numerical values are ordered, with did_nothing < success < terminate < fatal. More...
 

Public Member Functions

Severity severity () const
 Returns the severity of the current status. More...
 
const SystemBasesystem () const
 Returns the optionally-provided subsystem that generated a status return that can include a message (reached termination or failed). More...
 
const std::string & message () const
 Returns the optionally-provided human-readable message supplied by the event handler that produced the current status. More...
 
EventStatusKeepMoreSevere (EventStatus candidate)
 (Advanced) Replaces the contents of this with the more-severe status if candidate is a more severe status than this one. More...
 

Static Public Member Functions

static EventStatus DidNothing ()
 Returns "did nothing" status, with no message. More...
 
static EventStatus Succeeded ()
 Returns "succeeded" status, with no message. More...
 
static EventStatus ReachedTermination (const SystemBase *system, std::string message)
 Returns "reached termination" status, with a message explaining why. More...
 
static EventStatus Failed (const SystemBase *system, std::string message)
 Returns "failed" status, with a message explaining why. More...
 

Member Enumeration Documentation

◆ Severity

enum Severity

The numerical values are ordered, with did_nothing < success < terminate < fatal.

Enumerator
kDidNothing 

Successful, but nothing happened; no state update needed.

kSucceeded 

Handler executed successfully; state may have been updated.

kReachedTermination 

Handler succeeded but detected a termination condition (has message).

kFailed 

Handler was unable to perform its job (has message).

Member Function Documentation

◆ DidNothing()

static EventStatus DidNothing ( )
static

Returns "did nothing" status, with no message.

◆ Failed()

static EventStatus Failed ( const SystemBase system,
std::string  message 
)
static

Returns "failed" status, with a message explaining why.

◆ KeepMoreSevere()

EventStatus& KeepMoreSevere ( EventStatus  candidate)

(Advanced) Replaces the contents of this with the more-severe status if candidate is a more severe status than this one.

Does nothing if candidate severity is less than or equal to this severity. This method is for use in event dispatchers for accumulating status returns from a series of event handlers for a set of simultaneous events.

◆ message()

const std::string& message ( ) const

Returns the optionally-provided human-readable message supplied by the event handler that produced the current status.

Returns an empty string if no message was provided.

◆ ReachedTermination()

static EventStatus ReachedTermination ( const SystemBase system,
std::string  message 
)
static

Returns "reached termination" status, with a message explaining why.

◆ severity()

Severity severity ( ) const

Returns the severity of the current status.

◆ Succeeded()

static EventStatus Succeeded ( )
static

Returns "succeeded" status, with no message.

◆ system()

const SystemBase* system ( ) const

Returns the optionally-provided subsystem that generated a status return that can include a message (reached termination or failed).

Returns nullptr if no subsystem was provided.


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