A concrete class that holds all simultaneous homogeneous events for a LeafSystem.
End users should never need to use or know about this class. It is for internal use only.
#include <drake/systems/framework/event_collection.h>
Public Member Functions | |
LeafEventCollection () | |
Constructor. More... | |
void | Reserve (int capacity) |
Reserve storage for at least capacity events. 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 | AddEvent (EventType event) final |
Add event to the existing collection. More... | |
bool | HasEvents () const final |
Returns true if and only if this collection is nonempty. More... | |
void | Clear () final |
Removes all events from this collection. More... | |
Does not allow copy, move, or assignment | |
LeafEventCollection (const LeafEventCollection &)=delete | |
LeafEventCollection & | operator= (const LeafEventCollection &)=delete |
LeafEventCollection (LeafEventCollection &&)=delete | |
LeafEventCollection & | operator= (LeafEventCollection &&)=delete |
Public Member Functions inherited from EventCollection< EventType > | |
virtual | ~EventCollection () |
void | SetFrom (const EventCollection< EventType > &other) |
Clears all the events maintained by this then adds all of the events in other to this. More... | |
void | AddToEnd (const EventCollection< EventType > &other) |
Adds all of other 's events to the end of this . More... | |
EventCollection (const EventCollection &)=delete | |
EventCollection & | operator= (const EventCollection &)=delete |
EventCollection (EventCollection &&)=delete | |
EventCollection & | operator= (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... | |
Static Public Attributes | |
static constexpr int | kDefaultCapacity = 32 |
The default capacity of event storage allocation, expressed as a number of events. More... | |
Protected Member Functions | |
void | DoAddToEnd (const EventCollection< EventType > &other_collection) final |
All events in other_collection are concatenated to this. More... | |
Protected Member Functions inherited from EventCollection< EventType > | |
EventCollection ()=default | |
Constructor only accessible by derived class. More... | |
|
delete |
|
delete |
Constructor.
|
finalvirtual |
Add event
to the existing collection.
Implements EventCollection< EventType >.
|
finalvirtual |
Removes all events from this collection.
Implements EventCollection< EventType >.
|
finalprotectedvirtual |
All events in other_collection
are concatenated to this.
Here is an example. Suppose this collection stores the following events:
EventType: {event1, event2, event3}
other_collection
has:
EventType: {event4}
After calling DoAddToEnd(other_collection), this
stores:
EventType: {event1, event2, event3, event4}
std::exception | if other_collection is not an instance of LeafEventCollection. |
Implements EventCollection< EventType >.
const std::vector<const EventType*>& get_events | ( | ) | const |
Returns a const reference to the vector of const pointers to all of the events.
|
finalvirtual |
Returns true
if and only if this collection is nonempty.
Implements EventCollection< EventType >.
|
static |
Static method that generates a LeafEventCollection with exactly one event with no optional attribute, data or callback, and trigger type kForced.
|
delete |
|
delete |
void Reserve | ( | int | capacity | ) |
Reserve storage for at least capacity
events.
At construction, there will be at least kDefaultCapacity
; use this method to reserve more.
|
static |
The default capacity of event storage allocation, expressed as a number of events.
Chosen to be large enough that most systems won't need to allocate during simulation advance steps.