Drake
CompositeEventCollection< T > Class Template Reference

This class bundles an instance of each EventCollection<EventType> into one object that stores the heterogeneous collection. More...

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

Public Member Functions

virtual ~CompositeEventCollection ()
 
void Clear ()
 Clears all the events. More...
 
bool HasEvents () const
 Returns true if and only if this collection contains any events. More...
 
bool HasPublishEvents () const
 Returns true if and only if this collection contains one or more publish events. More...
 
bool HasDiscreteUpdateEvents () const
 Returns true if and only if this collection contains one or more discrete update events. More...
 
bool HasUnrestrictedUpdateEvents () const
 Returns true if and only if this collection contains one or more unrestricted update events. More...
 
void add_publish_event (std::unique_ptr< PublishEvent< T >> event)
 Assuming the internal publish event collection is an instance of LeafEventCollection, adds the publish event event (ownership is also transferred) to it. More...
 
void add_discrete_update_event (std::unique_ptr< DiscreteUpdateEvent< T >> event)
 Assuming the internal discrete update event collection is an instance of LeafEventCollection, adds the discrete update event event (ownership is also transferred) to it. More...
 
void add_unrestricted_update_event (std::unique_ptr< UnrestrictedUpdateEvent< T >> event)
 Assuming the internal unrestricted update event collection is an instance of LeafEventCollection, adds the unrestricted update event event (ownership is also transferred) to it. More...
 
void Merge (const CompositeEventCollection< T > &other)
 Merges the contained homogeneous event collections (e.g., EventCollection<PublishEvent<T>>, EventCollection<DiscreteUpdateEvent<T>>, etc.) from this and other, storing the results in this. More...
 
void SetFrom (const CompositeEventCollection< T > &other)
 Copies the collections of homogeneous events from other to this. More...
 
const EventCollection< PublishEvent< T > > & get_publish_events () const
 Returns a const reference to the collection of publish events. More...
 
const EventCollection< DiscreteUpdateEvent< T > > & get_discrete_update_events () const
 Returns a const reference to the collection of discrete update events. More...
 
const EventCollection< UnrestrictedUpdateEvent< T > > & get_unrestricted_update_events () const
 Returns a const reference to the collection of unrestricted update events. More...
 
EventCollection< PublishEvent< T > > & get_mutable_publish_events () const
 Returns a mutable reference to the collection of publish events. More...
 
EventCollection< DiscreteUpdateEvent< T > > & get_mutable_discrete_update_events () const
 Returns a mutable reference to the collection of discrete update events. More...
 
EventCollection< UnrestrictedUpdateEvent< T > > & get_mutable_unrestricted_update_events () const
 Returns a mutable reference to the collection of unrestricted update events. More...
 
Does not allow copy, move, or assignment
 CompositeEventCollection (const CompositeEventCollection &)=delete
 
CompositeEventCollectionoperator= (const CompositeEventCollection &)=delete
 
 CompositeEventCollection (CompositeEventCollection &&)=delete
 
CompositeEventCollectionoperator= (CompositeEventCollection &&)=delete
 

Protected Member Functions

 CompositeEventCollection (std::unique_ptr< EventCollection< PublishEvent< T >>> pub, std::unique_ptr< EventCollection< DiscreteUpdateEvent< T >>> discrete, std::unique_ptr< EventCollection< UnrestrictedUpdateEvent< T >>> unrestricted)
 Takes ownership of pub, discrete and unrestricted. More...
 

Detailed Description

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

This class bundles an instance of each EventCollection<EventType> into one object that stores the heterogeneous collection.

This is intended to hold heterogeneous events returned by methods like System::CalcNextUpdateTime.

CompositeEventCollection<T> = {
  EventCollection<PublishEvent<T>>,
  EventCollection<DiscreteUpdateEvent<T>>,
  EventCollection<UnrestrictedUpdate<T>>}

There are two concrete derived classes: LeafCompositeEventCollection and DiagramCompositeEventCollection. Adding new events to the collection is only allowed for LeafCompositeEventCollection.

Template Parameters
Tneeds to be compatible with Eigen Scalar type.

Constructor & Destructor Documentation

◆ CompositeEventCollection() [1/3]

◆ CompositeEventCollection() [2/3]

◆ ~CompositeEventCollection()

virtual ~CompositeEventCollection ( )
virtual

◆ CompositeEventCollection() [3/3]

CompositeEventCollection ( std::unique_ptr< EventCollection< PublishEvent< T >>>  pub,
std::unique_ptr< EventCollection< DiscreteUpdateEvent< T >>>  discrete,
std::unique_ptr< EventCollection< UnrestrictedUpdateEvent< T >>>  unrestricted 
)
protected

Takes ownership of pub, discrete and unrestricted.

Aborts if any of these are null.

Member Function Documentation

◆ add_discrete_update_event()

void add_discrete_update_event ( std::unique_ptr< DiscreteUpdateEvent< T >>  event)

Assuming the internal discrete update event collection is an instance of LeafEventCollection, adds the discrete update event event (ownership is also transferred) to it.

Exceptions
std::bad_castif the assumption is incorrect.

◆ add_publish_event()

void add_publish_event ( std::unique_ptr< PublishEvent< T >>  event)

Assuming the internal publish event collection is an instance of LeafEventCollection, adds the publish event event (ownership is also transferred) to it.

Exceptions
std::bad_castif the assumption is incorrect.

◆ add_unrestricted_update_event()

void add_unrestricted_update_event ( std::unique_ptr< UnrestrictedUpdateEvent< T >>  event)

Assuming the internal unrestricted update event collection is an instance of LeafEventCollection, adds the unrestricted update event event (ownership is also transferred) to it.

Exceptions
std::bad_castif the assumption is incorrect.

◆ Clear()

void Clear ( )

Clears all the events.

◆ get_discrete_update_events()

const EventCollection<DiscreteUpdateEvent<T> >& get_discrete_update_events ( ) const

Returns a const reference to the collection of discrete update events.

◆ get_mutable_discrete_update_events()

EventCollection<DiscreteUpdateEvent<T> >& get_mutable_discrete_update_events ( ) const

Returns a mutable reference to the collection of discrete update events.

◆ get_mutable_publish_events()

EventCollection<PublishEvent<T> >& get_mutable_publish_events ( ) const

Returns a mutable reference to the collection of publish events.

◆ get_mutable_unrestricted_update_events()

EventCollection<UnrestrictedUpdateEvent<T> >& get_mutable_unrestricted_update_events ( ) const

Returns a mutable reference to the collection of unrestricted update events.

◆ get_publish_events()

const EventCollection<PublishEvent<T> >& get_publish_events ( ) const

Returns a const reference to the collection of publish events.

◆ get_unrestricted_update_events()

const EventCollection<UnrestrictedUpdateEvent<T> >& get_unrestricted_update_events ( ) const

Returns a const reference to the collection of unrestricted update events.

◆ HasDiscreteUpdateEvents()

bool HasDiscreteUpdateEvents ( ) const

Returns true if and only if this collection contains one or more discrete update events.

◆ HasEvents()

bool HasEvents ( ) const

Returns true if and only if this collection contains any events.

◆ HasPublishEvents()

bool HasPublishEvents ( ) const

Returns true if and only if this collection contains one or more publish events.

◆ HasUnrestrictedUpdateEvents()

bool HasUnrestrictedUpdateEvents ( ) const

Returns true if and only if this collection contains one or more unrestricted update events.

◆ Merge()

void Merge ( const CompositeEventCollection< T > &  other)

Merges the contained homogeneous event collections (e.g., EventCollection<PublishEvent<T>>, EventCollection<DiscreteUpdateEvent<T>>, etc.) from this and other, storing the results in this.

◆ operator=() [1/2]

CompositeEventCollection& operator= ( const CompositeEventCollection< T > &  )
delete

◆ operator=() [2/2]

CompositeEventCollection& operator= ( CompositeEventCollection< T > &&  )
delete

◆ SetFrom()

void SetFrom ( const CompositeEventCollection< T > &  other)

Copies the collections of homogeneous events from other to this.


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