DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
Diades::Petri::EventFactory Class Reference

#include <Event.hh>

Public Member Functions

const EventgetEvent (const string &type)
 
const EventgetEvent (size_t id) const
 
 ~EventFactory ()
 
size_t numberOfCurrentEvents () const
 

Static Public Member Functions

static EventFactoryInstance ()
 

Protected Member Functions

 EventFactory ()
 

Private Attributes

vector< Event_events
 
unordered_map< string, Event_mapping
 

Static Private Attributes

static EventFactory_instance
 

Detailed Description

This class is in charge of creating Event objects. The main idea is to avoid the creation of two objects containing the same data (EventData). When it is required to create an event, it is necessary to use the EventFactory.

Definition at line 201 of file Event.hh.

Constructor & Destructor Documentation

Diades::Petri::EventFactory::EventFactory ( )
inlineprotected

Default constructor

Returns
an empty EventFactory

Definition at line 216 of file Event.hh.

Diades::Petri::EventFactory::~EventFactory ( )

Destructor (memory management) Once the EventFactory is destroyed, any Event objects created by this factory is invalid. The EventFactory should only be destroyed after any other data structure that contains Event objects.

Member Function Documentation

const Event& Diades::Petri::EventFactory::getEvent ( const string &  type)
inline
Parameters
typea type of Event
Returns
the event whose type is 'type'
Postcondition
getEvent(type).type == type

Definition at line 225 of file Event.hh.

References _events, and _mapping.

const Event& Diades::Petri::EventFactory::getEvent ( size_t  id) const
inline

Return the event whose id() is id

Parameters
idthe identifier of an Event
Returns
the associated Event
Precondition
the Event must exist

Definition at line 244 of file Event.hh.

References _events, and require.

static EventFactory* Diades::Petri::EventFactory::Instance ( )
static
Returns
the unique EventFactory object (singleton pattern)
size_t Diades::Petri::EventFactory::numberOfCurrentEvents ( ) const
inline
Returns
the number of allocated events

Definition at line 262 of file Event.hh.

References _events.

Member Data Documentation

vector<Event> Diades::Petri::EventFactory::_events
private

Definition at line 265 of file Event.hh.

Referenced by getEvent(), and numberOfCurrentEvents().

EventFactory* Diades::Petri::EventFactory::_instance
staticprivate

Definition at line 267 of file Event.hh.

unordered_map<string,Event> Diades::Petri::EventFactory::_mapping
private

Definition at line 266 of file Event.hh.

Referenced by getEvent().


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