Drake
Event< T > Class Template Referenceabstract

Abstract base class that represents an event. More...

#include <drake/systems/framework/event.h>

Public Types

using TriggerType = systems::TriggerType
 

Public Member Functions

 Event ()
 Constructs an Event with no trigger type and no event data. More...
 
void operator= (const Event &)=delete
 
 Event (Event &&)=delete
 
void operator= (Event &&)=delete
 
virtual bool is_discrete_update () const =0
 Returns true if this is a DiscreteUpdateEvent. More...
 
virtual ~Event ()
 An object passed. More...
 
std::unique_ptr< EventClone () const
 Clones this instance. More...
 
TriggerType get_trigger_type () const
 Returns the trigger type. More...
 
bool has_event_data () const
 Returns true if this event has associated data. More...
 
const EventDataget_event_data () const
 Returns a const pointer to the event data. More...
 
EventDataget_mutable_event_data ()
 Returns a mutable pointer to the event data. More...
 
void AddToComposite (TriggerType trigger_type, CompositeEventCollection< T > *events) const
 Adds a clone of this event to the event collection events, with the given trigger type. More...
 
void AddToComposite (CompositeEventCollection< T > *events) const
 Provides an alternate signature for adding an Event that already has the correct trigger type set. More...
 

Protected Member Functions

 Event (const Event &other)
 
virtual void DoAddToComposite (TriggerType trigger_type, CompositeEventCollection< T > *events) const =0
 Derived classes must implement this to add a clone of this Event to the event collection and unconditionally set its trigger type. More...
 
virtual EventDoClone () const =0
 Derived classes must implement this method to clone themselves. More...
 

Detailed Description

template<typename T>
class drake::systems::Event< T >

Abstract base class that represents an event.

The base event contains two main pieces of information: an enum trigger type and an optional attribute of AbstractValue that can be used to explain why the event is triggered. Derived classes should contain a function pointer to an optional callback function that handles the event. No-op is the default handling behavior. Currently, the System framework only supports three concrete event types: PublishEvent, DiscreteUpdateEvent, and UnrestrictedUpdateEvent distinguished by their callback functions' access level to the context.

Event handling occurs during a simulation of a system. The logic that describes when particular event types are handled is described in the class documentation for Simulator.

Member Typedef Documentation

◆ TriggerType

Constructor & Destructor Documentation

◆ Event() [1/3]

Event ( )
inline

Constructs an Event with no trigger type and no event data.

◆ Event() [2/3]

Event ( Event< T > &&  )
delete

◆ ~Event()

virtual ~Event ( )
inlinevirtual

An object passed.

◆ Event() [3/3]

Event ( const Event< T > &  other)
inlineprotected

Member Function Documentation

◆ AddToComposite() [1/2]

void AddToComposite ( TriggerType  trigger_type,
CompositeEventCollection< T > *  events 
) const
inline

Adds a clone of this event to the event collection events, with the given trigger type.

If this event has an unknown trigger type, then any trigger type is acceptable. Otherwise the given trigger type must match match the trigger type stored in this event.

Precondition
trigger_type must match the current trigger type unless that is unknown.
events must not be null.

◆ AddToComposite() [2/2]

void AddToComposite ( CompositeEventCollection< T > *  events) const
inline

Provides an alternate signature for adding an Event that already has the correct trigger type set.

Must not have an unknown trigger type.

◆ Clone()

std::unique_ptr<Event> Clone ( ) const
inline

Clones this instance.

◆ DoAddToComposite()

virtual void DoAddToComposite ( TriggerType  trigger_type,
CompositeEventCollection< T > *  events 
) const
protectedpure virtual

Derived classes must implement this to add a clone of this Event to the event collection and unconditionally set its trigger type.

◆ DoClone()

virtual Event* DoClone ( ) const
protectedpure virtual

Derived classes must implement this method to clone themselves.

Any Event-specific data is cloned using the Clone() method. Data specific to the class derived from Event must be cloned by the implementation.

◆ get_event_data()

const EventData* get_event_data ( ) const
inline

Returns a const pointer to the event data.

The returned value can be nullptr, which means this event does not have any associated data.

◆ get_mutable_event_data()

EventData* get_mutable_event_data ( )
inline

Returns a mutable pointer to the event data.

The returned value can be nullptr, which means this event does not have any associated data.

◆ get_trigger_type()

TriggerType get_trigger_type ( ) const
inline

Returns the trigger type.

◆ has_event_data()

bool has_event_data ( ) const
inline

Returns true if this event has associated data.

◆ is_discrete_update()

virtual bool is_discrete_update ( ) const
pure virtual

◆ operator=() [1/2]

void operator= ( const Event< T > &  )
delete

◆ operator=() [2/2]

void operator= ( Event< T > &&  )
delete

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