Drake
DiagramEventCollection< EventType > Class Template Referencefinal

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

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

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

Public Member Functions

 DiagramEventCollection (int num_subsystems)
 Note that this constructor only resizes the containers; it does not allocate any derived EventCollection instances. More...
 
void add_event (std::unique_ptr< EventType >) override
 Aborts if called, because no events should be added at the Diagram level. More...
 
int num_subsystems () const
 Returns the number of constituent EventCollection objects that correspond to each subsystem in the Diagram. More...
 
void set_and_own_subevent_collection (int index, std::unique_ptr< EventCollection< EventType >> subevent_collection)
 Transfers subevent_collection ownership to this and associates it with the subsystem identified by index. More...
 
void set_subevent_collection (int index, EventCollection< EventType > *subevent_collection)
 Associate subevent_collection with subsystem identified by index. More...
 
const EventCollection< EventType > & get_subevent_collection (int index) const
 Returns a const pointer to subsystem's EventCollection at index. More...
 
EventCollection< EventType > & get_mutable_subevent_collection (int index)
 Returns a mutable pointer to subsystem's EventCollection at index. More...
 
void Clear () override
 Clears all subevent collections. More...
 
bool HasEvents () const override
 Returns true if and only if any of the subevent collections have any events. More...
 
Does not allow copy, move, or assignment
 DiagramEventCollection (const DiagramEventCollection &)=delete
 
DiagramEventCollectionoperator= (const DiagramEventCollection &)=delete
 
 DiagramEventCollection (DiagramEventCollection &&)=delete
 
DiagramEventCollectionoperator= (DiagramEventCollection &&)=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
 

Protected Member Functions

void DoMerge (const EventCollection< EventType > &other_collection) override
 Goes through each subevent collection and merges in the corresponding one in other_collection. 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::DiagramEventCollection< EventType >

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

For each subsystem in the corresponding Diagram, a derived EventCollection instance is maintained internally, thus effectively holding the same recursive tree structure as the corresponding Diagram.

Constructor & Destructor Documentation

DiagramEventCollection ( const DiagramEventCollection< EventType > &  )
delete
DiagramEventCollection ( DiagramEventCollection< EventType > &&  )
delete
DiagramEventCollection ( int  num_subsystems)
inlineexplicit

Note that this constructor only resizes the containers; it does not allocate any derived EventCollection instances.

Parameters
num_subsystemsNumber of subsystems in the corresponding Diagram.

Member Function Documentation

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

Aborts if called, because no events should be added at the Diagram level.

Implements EventCollection< EventType >.

void Clear ( )
inlineoverridevirtual

Clears all subevent collections.

Implements EventCollection< EventType >.

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

Goes through each subevent collection and merges in the corresponding one in other_collection.

Aborts if this does not have the same number of subevent collections as other_collection. In addition, this method assumes that this and other_collection have the exact same topology (i.e. both are created for the same Diagram.)

Exceptions
std::bad_castif other_collection is not an instance of DiagramEventCollection.

Implements EventCollection< EventType >.

Here is the call graph for this function:

EventCollection<EventType>& get_mutable_subevent_collection ( int  index)
inline

Returns a mutable pointer to subsystem's EventCollection at index.

const EventCollection<EventType>& get_subevent_collection ( int  index) const
inline

Returns a const pointer to subsystem's EventCollection at index.

Aborts if the 0-indexed index is greater than or equal to the number of subsystems specified in this object's construction (see DiagramEventCollection(int)) or if index is not in the range [0, num_subsystems() - 1].

Here is the caller graph for this function:

bool HasEvents ( ) const
inlineoverridevirtual

Returns true if and only if any of the subevent collections have any events.

Implements EventCollection< EventType >.

int num_subsystems ( ) const
inline

Returns the number of constituent EventCollection objects that correspond to each subsystem in the Diagram.

Here is the caller graph for this function:

DiagramEventCollection& operator= ( const DiagramEventCollection< EventType > &  )
delete
DiagramEventCollection& operator= ( DiagramEventCollection< EventType > &&  )
delete
void set_and_own_subevent_collection ( int  index,
std::unique_ptr< EventCollection< EventType >>  subevent_collection 
)
inline

Transfers subevent_collection ownership to this and associates it with the subsystem identified by index.

Aborts if index is not in the range [0, num_subsystems() - 1] or if subevent_collection is null.

void set_subevent_collection ( int  index,
EventCollection< EventType > *  subevent_collection 
)
inline

Associate subevent_collection with subsystem identified by index.

Ownership of the object that subevent_collection is maintained elsewhere, and its life span must be longer than this. Aborts if index is not in the range [0, num_subsystems() - 1] or if subevent_collection is null.

Here is the caller graph for this function:


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