Drake
LeafEventCollection< EventType > Class Template Reference

A concrete class that holds all simultaneous homogeneous events for a LeafSystem. More...

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

Inheritance diagram for LeafEventCollection< EventType >:
[legend]
Collaboration diagram for LeafEventCollection< EventType >:
[legend]

Public Member Functions

 LeafEventCollection ()=default
 Constructor. More...
 
const std::vector< const EventType * > & get_events () const
 Returns a const reference to the vector of const pointers to all of the events. More...
 
void add_event (std::unique_ptr< EventType > event) override
 Add event to the existing collection. More...
 
bool HasEvents () const override
 Returns true if and only if this collection is nonempty. More...
 
void Clear () override
 Removes all events from this collection. More...
 
Does not allow copy, move, or assignment
 LeafEventCollection (const LeafEventCollection &)=delete
 
LeafEventCollectionoperator= (const LeafEventCollection &)=delete
 
 LeafEventCollection (LeafEventCollection &&)=delete
 
LeafEventCollectionoperator= (LeafEventCollection &&)=delete
 
- Public Member Functions inherited from EventCollection< EventType >
virtual ~EventCollection ()
 
void SetFrom (const EventCollection< EventType > &other)
 Clears all the events maintained by this and adds all the events in other to this. More...
 
void Merge (const EventCollection< EventType > &other)
 Merges all of other's events into this. More...
 
 EventCollection (const EventCollection &)=delete
 
EventCollectionoperator= (const EventCollection &)=delete
 
 EventCollection (EventCollection &&)=delete
 
EventCollectionoperator= (EventCollection &&)=delete
 

Static Public Member Functions

static std::unique_ptr< LeafEventCollection< EventType > > MakeForcedEventCollection ()
 Static method that generates a LeafEventCollection with exactly one event with no optional attribute, data or callback, and trigger type kForced. More...
 

Protected Member Functions

void DoMerge (const EventCollection< EventType > &other_collection) override
 All events in other_collection are concatanated to this. More...
 
- Protected Member Functions inherited from EventCollection< EventType >
 EventCollection ()=default
 Constructor only accessible by derived class. More...
 

Detailed Description

template<typename EventType>
class drake::systems::LeafEventCollection< EventType >

A concrete class that holds all simultaneous homogeneous events for a LeafSystem.

Constructor & Destructor Documentation

LeafEventCollection ( const LeafEventCollection< EventType > &  )
delete
LeafEventCollection ( LeafEventCollection< EventType > &&  )
delete
LeafEventCollection ( )
default

Constructor.

Member Function Documentation

void add_event ( std::unique_ptr< EventType >  event)
inlineoverridevirtual

Add event to the existing collection.

Ownership of event is transferred. Aborts if event is null.

Implements EventCollection< EventType >.

Here is the caller graph for this function:

void Clear ( )
inlineoverridevirtual

Removes all events from this collection.

Implements EventCollection< EventType >.

void DoMerge ( const EventCollection< EventType > &  other_collection)
inlineoverrideprotectedvirtual

All events in other_collection are concatanated to this.

Aborts if other_collection is null.

Here is an example. Suppose this collection stores the following events:

  EventType: {event1, event2, event3}

other_collection has:

  EventType: {event4}

After calling DoMerge(other_collection), this stores:

  EventType: {event1, event2, event3, event4}
Exceptions
std::bad_castif other_collection is not an instance of LeafEventCollection.

Implements EventCollection< EventType >.

Here is the call graph for this function:

const std::vector<const EventType*>& get_events ( ) const
inline

Returns a const reference to the vector of const pointers to all of the events.

Here is the caller graph for this function:

bool HasEvents ( ) const
inlineoverridevirtual

Returns true if and only if this collection is nonempty.

Implements EventCollection< EventType >.

Here is the caller graph for this function:

static std::unique_ptr<LeafEventCollection<EventType> > MakeForcedEventCollection ( )
inlinestatic

Static method that generates a LeafEventCollection with exactly one event with no optional attribute, data or callback, and trigger type kForced.

LeafEventCollection& operator= ( const LeafEventCollection< EventType > &  )
delete
LeafEventCollection& operator= ( LeafEventCollection< EventType > &&  )
delete

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