Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
PublishEvent< T > Class Template Referencefinal

Detailed Description

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

This class represents a publish event.

It has an optional callback function to do custom handling of this event.

See also
System::Publish for more details.
LeafSystem for more convenient interfaces to publish events via the Declare*PublishEvent() methods.

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

Public Member Functions

bool is_discrete_update () const override
 Returns true if this is a DiscreteUpdateEvent.
 PublishEvent ()=default
 Constructs an empty PublishEvent.
 PublishEvent (const std::function< EventStatus(const System< T > &, const Context< T > &, const PublishEvent< T > &)> &callback)
 Constructs a PublishEvent with the given callback function.
EventStatus handle (const System< T > &system, const Context< T > &context) const
 Calls the optional callback or system callback function, if one exists, with system, context, and this.
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 PublishEvent (const PublishEvent &)=default
PublishEventoperator= (const PublishEvent &)=default
 PublishEvent (PublishEvent &&)=default
PublishEventoperator= (PublishEvent &&)=default
Public Member Functions inherited from Event< T >
virtual ~Event ()
std::unique_ptr< EventClone () const
 Clones this instance.
TriggerType get_trigger_type () const
 Returns the trigger type.
template<typename EventDataType>
bool has_event_data () const
 Returns true if this event has associated data of the given EventDataType.
template<typename EventDataType>
const EventDataType * get_event_data () const
 Returns a const pointer to the event data.
template<typename EventDataType>
EventDataType * get_mutable_event_data ()
 Returns a mutable pointer to the event data.
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.
void AddToComposite (CompositeEventCollection< T > *events) const
 Provides an alternate signature for adding an Event that already has the correct trigger type set.

Additional Inherited Members

Public Types inherited from Event< T >
using TriggerType = systems::TriggerType
Protected Member Functions inherited from Event< T >
 Event ()=default
 Constructs an empty Event.
 Event (const Event &)=default
Eventoperator= (const Event &)=default
 Event (Event &&)=default
Eventoperator= (Event &&)=default

Constructor & Destructor Documentation

◆ PublishEvent() [1/4]

template<typename T>
PublishEvent ( const PublishEvent< T > & )
default

◆ PublishEvent() [2/4]

template<typename T>
PublishEvent ( PublishEvent< T > && )
default

◆ PublishEvent() [3/4]

template<typename T>
PublishEvent ( )
default

Constructs an empty PublishEvent.

◆ PublishEvent() [4/4]

template<typename T>
PublishEvent ( const std::function< EventStatus(const System< T > &, const Context< T > &, const PublishEvent< T > &)> & callback)
explicit

Constructs a PublishEvent with the given callback function.

Member Function Documentation

◆ handle()

template<typename T>
EventStatus handle ( const System< T > & system,
const Context< T > & context ) const

Calls the optional callback or system callback function, if one exists, with system, context, and this.

◆ is_discrete_update()

template<typename T>
bool is_discrete_update ( ) const
overridevirtual

Returns true if this is a DiscreteUpdateEvent.

Implements Event< T >.

◆ operator=() [1/2]

template<typename T>
PublishEvent & operator= ( const PublishEvent< T > & )
default

◆ operator=() [2/2]

template<typename T>
PublishEvent & operator= ( PublishEvent< T > && )
default

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