orca-sim
Public Member Functions | Public Attributes | List of all members
orcasim::base::Event Class Reference

This class models a discrete event. More...

#include <Event.hpp>

Public Member Functions

 Event (SimulationTime, TimedModel *)
 Default constructor. More...
 
 Event ()
 Alternative constructor, required for creating arrays of Event elements. More...
 
bool operator< (const Event &e) const
 Comparing operator. More...
 

Public Attributes

SimulationTime time
 Point in time when the event will trigger. More...
 
TimedModeltimedModel
 Model whose activation function will be called once the event triggers. More...
 

Detailed Description

This class models a discrete event.

In orca-sim, events have a reference (a pointer) to the <cycle> funcion of the associated hardware model, which will be executed at time <time> by the simulation engine. Events occur once.

Definition at line 39 of file Event.hpp.

Constructor & Destructor Documentation

§ Event() [1/2]

Event::Event ( SimulationTime  t,
TimedModel p 
)

Default constructor.

Parameters
tpoint in time to execute the event
pa pointer to the associated hardware module

Definition at line 45 of file Event.cpp.

45  {
46  this->time = t;
47  this->timedModel = p;
48 }
SimulationTime time
Point in time when the event will trigger.
Definition: Event.hpp:44
TimedModel * timedModel
Model whose activation function will be called once the event triggers.
Definition: Event.hpp:50

§ Event() [2/2]

Event::Event ( )

Alternative constructor, required for creating arrays of Event elements.

Do not use this constructor.

Definition at line 54 of file Event.cpp.

54  {
55  // Fields are left unintialized intentionally.
56 }

Member Function Documentation

§ operator<()

bool Event::operator< ( const Event e) const

Comparing operator.

Operator overload for '<'.

An event occurs first in time if its time is less than the compared event (required by the priority queue, see <std::priority_queue>).

Use by the internal queue for sorting events by time.

Parameters
eEvent to be compared with the instance
Returns
true if the instance happens later in time than event <e>.

Definition at line 36 of file Event.cpp.

36  {
37  return (this->time > e.time);
38 }
SimulationTime time
Point in time when the event will trigger.
Definition: Event.hpp:44

Member Data Documentation

§ time

SimulationTime orcasim::base::Event::time

Point in time when the event will trigger.

Definition at line 44 of file Event.hpp.

§ timedModel

TimedModel* orcasim::base::Event::timedModel

Model whose activation function will be called once the event triggers.

Definition at line 50 of file Event.hpp.


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