maliput
LeafEventCollection< EventType > Class Template Reference

Detailed Description

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

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 & Destructor Documentation

◆ LeafEventCollection()

Constructor.

Member Function Documentation

◆ add_event()

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

Add event to the existing collection.

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

◆ AddEvent()

void AddEvent ( EventType  event)
final

Add event to the existing collection.

◆ Clear()

void Clear ( )
final

Removes all events from this collection.

◆ DoAddToEnd()

void DoAddToEnd ( const EventCollection< EventType > &  other_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}
Exceptions
std::exceptionif other_collection is not an instance of LeafEventCollection.

◆ get_events()

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

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

◆ HasEvents()

bool HasEvents ( ) const
final

Returns true if and only if this collection is nonempty.

◆ MakeForcedEventCollection()

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

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

◆ Reserve()

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.

Member Data Documentation

◆ kDefaultCapacity

constexpr int kDefaultCapacity = 32
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.


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