Drake
DiscreteUpdateEvent< T > Class Template Referencefinal

This class represents a discrete update event. More...

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

Inheritance diagram for DiscreteUpdateEvent< T >:
[legend]
Collaboration diagram for DiscreteUpdateEvent< T >:
[legend]

Public Types

typedef std::function< void(const Context< T > &, const DiscreteUpdateEvent< T > &, DiscreteValues< T > *)> DiscreteUpdateCallback
 Callback function that processes a discrete update event. More...
 
- Public Types inherited from Event< T >
enum  TriggerType {
  kUnknown, kInitialization, kForced, kTimed,
  kPeriodic, kPerStep, kWitness
}
 Predefined types of triggers. More...
 

Public Member Functions

void operator= (const DiscreteUpdateEvent &)=delete
 
 DiscreteUpdateEvent (DiscreteUpdateEvent &&)=delete
 
void operator= (DiscreteUpdateEvent &&)=delete
 
bool is_discrete_update () const override
 Returns true if this is a DiscreteUpdateEvent. More...
 
 DiscreteUpdateEvent (const typename Event< T >::TriggerType &trigger_type, DiscreteUpdateCallback callback)
 Makes a DiscreteUpdateEvent with trigger_type with no optional data and the callback function callback. More...
 
 DiscreteUpdateEvent (const typename Event< T >::TriggerType &trigger_type)
 Makes a DiscreteUpdateEvent with trigger_type with no optional data and no specified callback function. More...
 
void add_to_composite (CompositeEventCollection< T > *events) const override
 Assuming that events is not null, this function makes a deep copy of this event and adds the deep copy to events's collection of discrete update events. More...
 
void handle (const Context< T > &context, DiscreteValues< T > *discrete_state) const
 Calls the optional callback function, if one exists, with context, 'this' and discrete_state. More...
 
- Public Member Functions inherited from Event< T >
void operator= (const Event &)=delete
 
 Event (Event &&)=delete
 
void operator= (Event &&)=delete
 
virtual ~Event ()
 
std::unique_ptr< EventClone () const
 Clones this instance. More...
 
TriggerType get_trigger_type () const
 Returns the trigger type. More...
 
bool has_attribute () const
 Returns true if this event has an associated attribute. More...
 
const AbstractValueget_attribute () const
 Returns a const pointer to the AbstractValue attribute. More...
 
template<typename DataType >
const DataType & get_attribute () const
 Returns a const reference to the underlying attribute. More...
 
void set_attribute (std::unique_ptr< AbstractValue > attribute)
 Sets and transfers the ownership of attribute. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Event< T >
 Event (const Event &other)
 
 Event (const TriggerType &trigger)
 Constructs an Event with the specified trigger. More...
 

Detailed Description

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

This class represents a discrete update event.

It has an optional callback function to do custom handling of this event given const Context and const DiscreteUpdateEvent references, and writes the updates to a mutable, non-null DiscreteValues object.

Member Typedef Documentation

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

Callback function that processes a discrete update event.

Constructor & Destructor Documentation

DiscreteUpdateEvent ( const typename Event< T >::TriggerType trigger_type,
DiscreteUpdateCallback  callback 
)
inline

Makes a DiscreteUpdateEvent with trigger_type with no optional data and the callback function callback.

callback can be null.

DiscreteUpdateEvent ( const typename Event< T >::TriggerType trigger_type)
inlineexplicit

Makes a DiscreteUpdateEvent with trigger_type with no optional data and no specified callback function.

Member Function Documentation

void add_to_composite ( CompositeEventCollection< T > *  events) const
inlineoverridevirtual

Assuming that events is not null, this function makes a deep copy of this event and adds the deep copy to events's collection of discrete update events.

Implements Event< T >.

Here is the call graph for this function:

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

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

Here is the call graph for this function:

bool is_discrete_update ( ) const
inlineoverridevirtual

Returns true if this is a DiscreteUpdateEvent.

Implements Event< T >.

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

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