maliput
|
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 <src/maliput/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 | add_event (std::unique_ptr< EventType > event) final |
Add event to the existing collection. 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... | |
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... | |
Constructor.
|
final |
Add event
to the existing collection.
Ownership of event
is transferred. Aborts if event is null.
|
final |
Add event
to the existing collection.
|
final |
Removes all events from this collection.
|
finalprotected |
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. |
const std::vector<const EventType*>& get_events | ( | ) | const |
Returns a const reference to the vector of const pointers to all of the events.
|
final |
Returns true
if and only if this collection is nonempty.
|
static |
Static method that generates a LeafEventCollection with exactly one event with no optional attribute, data or callback, and trigger type kForced.
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.
|
staticconstexpr |
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.