maliput
DiscreteUpdateEvent< T > Class Template Referencefinal

Detailed Description

template<typename T>
class maliput::drake::systems::DiscreteUpdateEvent< T >

This class represents a discrete update event.

It has an optional callback function (two forms are supported) to do custom handling of this event, and that can write updates to a mutable, non-null DiscreteValues object.

See also
LeafSystem for more convenient interfaces to discrete update events via the Declare*DiscreteUpdateEvent() methods.

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

Inheritance diagram for DiscreteUpdateEvent< T >:
[legend]

Public Types

Discrete Update Callbacks

Two callback signatures are supported.

See Event Callbacks for a complete discussion. Both callback types receive a const reference to the context and this discrete update event, and a writable non-null pointer to discrete state which the callback may write to. They differ in whether a const reference to the owning system is also provided.

typedef std::function< void(const Context< T > &, const DiscreteUpdateEvent< T > &, DiscreteValues< T > *)> DiscreteUpdateCallback
 Callback without system reference. More...
 
typedef std::function< void(const System< T > &, const Context< T > &, const DiscreteUpdateEvent< T > &, DiscreteValues< T > *)> SystemCallback
 Callback with const system reference. More...
 
- Public Types inherited from Event< T >
using TriggerType = systems::TriggerType
 

Public Member Functions

 DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (DiscreteUpdateEvent)
 
bool is_discrete_update () const override
 Returns true if this is a DiscreteUpdateEvent. More...
 
 DiscreteUpdateEvent ()
 Makes a DiscreteUpdateEvent with no trigger type, no event data, and no specified callback function. More...
 
 DiscreteUpdateEvent (const DiscreteUpdateCallback &callback)
 Makes a DiscreteUpdateEvent with no trigger type, no event data, and the specified callback function. More...
 
 DiscreteUpdateEvent (const SystemCallback &system_callback)
 Makes a DiscreteUpdateEvent with no trigger type, no event data, and the specified system callback function. More...
 
 DiscreteUpdateEvent (const TriggerType &trigger_type, const DiscreteUpdateCallback &callback)
 
 DiscreteUpdateEvent (const TriggerType &trigger_type, const SystemCallback &system_callback)
 
 DiscreteUpdateEvent (const TriggerType &trigger_type)
 
void handle (const System< T > &system, const Context< T > &context, DiscreteValues< T > *discrete_state) const
 Calls the optional callback function, if one exists, with system, context, this and discrete_state. More...
 
- Public Member Functions inherited from Event< T >
 Event ()
 
virtual ~Event ()
 
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 set_trigger_type (const TriggerType trigger_type)
 
void set_event_data (std::unique_ptr< EventData > 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. More...
 
void AddToComposite (CompositeEventCollection< T > *events) const
 Provides an alternate signature for adding an Event that already has the correct trigger type set. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Event< T >
 DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (Event)
 
 Event (const TriggerType &trigger)
 

Member Typedef Documentation

◆ DiscreteUpdateCallback

typedef std::function<void(const Context<T>&, const DiscreteUpdateEvent<T>&, DiscreteValues<T>*)> DiscreteUpdateCallback

Callback without system reference.

◆ SystemCallback

typedef std::function<void(const System<T>&, const Context<T>&, const DiscreteUpdateEvent<T>&, DiscreteValues<T>*)> SystemCallback

Callback with const system reference.

Constructor & Destructor Documentation

◆ DiscreteUpdateEvent() [1/6]

Makes a DiscreteUpdateEvent with no trigger type, no event data, and no specified callback function.

◆ DiscreteUpdateEvent() [2/6]

DiscreteUpdateEvent ( const DiscreteUpdateCallback callback)
explicit

Makes a DiscreteUpdateEvent with no trigger type, no event data, and the specified callback function.

◆ DiscreteUpdateEvent() [3/6]

DiscreteUpdateEvent ( const SystemCallback system_callback)
explicit

Makes a DiscreteUpdateEvent with no trigger type, no event data, and the specified system callback function.

◆ DiscreteUpdateEvent() [4/6]

DiscreteUpdateEvent ( const TriggerType trigger_type,
const DiscreteUpdateCallback callback 
)

◆ DiscreteUpdateEvent() [5/6]

DiscreteUpdateEvent ( const TriggerType trigger_type,
const SystemCallback system_callback 
)

◆ DiscreteUpdateEvent() [6/6]

DiscreteUpdateEvent ( const TriggerType trigger_type)
explicit

Member Function Documentation

◆ DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

DRAKE_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( DiscreteUpdateEvent< T >  )

◆ handle()

void handle ( const System< T > &  system,
const Context< T > &  context,
DiscreteValues< T > *  discrete_state 
) const

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

◆ is_discrete_update()

bool is_discrete_update ( ) const
overridevirtual

Returns true if this is a DiscreteUpdateEvent.

Implements Event< T >.


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