DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Diades::Automata::Event Class Reference

#include <Event.hh>

Public Types

typedef Diades::Utils::Exception< EventException
 
typedef unsigned Id
 
typedef string Label
 
typedef EventDataEventDataPointer
 

Public Member Functions

 Event ()
 
 Event (const Event &e)
 
bool isValid () const
 
const Labellabel () const
 
const Labelnickname () const
 
void setNickname (const Label &nick)
 
Id id () const
 
Eventoperator= (const Event &e)
 
bool operator< (const Event &e) const
 
bool operator== (const Event &e) const
 
bool operator!= (const Event &e) const
 
bool operator> (const Event &e) const
 
int memoryUsage () const
 
int dataMemoryUsage () const
 
ostream & save (ostream &os) const
 
istream & load (istream &is)
 

Static Public Member Functions

static string typeName ()
 
static Event nullEvent ()
 
static const Event::LabelnullEventLabel ()
 
static Event getEvent (const Label &evtLabel)
 
static Event getEvent (const Id &evtId)
 
static void allocateEvents (size_t capacity)
 
static void destroyEvents ()
 

Private Member Functions

 Event (EventDataPointer data)
 

Private Attributes

EventDataPointer _ptr
 

Friends

class EventFactory
 
ostream & operator<< (ostream &os, const Event &e)
 
istream & operator>> (istream &is, Event &e)
 

Detailed Description

Event associated to a transition An Event is a structure which indicates a "id" (EventId) and a "label" (EventLabel) The default Event has a label 'nullEventLabel'. This structure can be used in a set (operator < ) provided and in a hash table (hash<Event> is defined)

Definition at line 53 of file Event.hh.

Member Typedef Documentation

◆ EventDataPointer

typedef EventData* Diades::Automata::Event::EventDataPointer

Definition at line 114 of file Event.hh.

◆ Exception

typedef Diades::Utils::Exception<Event> Diades::Automata::Event::Exception

Definition at line 57 of file Event.hh.

◆ Id

EventId an Event Diades::Automata::Event::Id

Definition at line 62 of file Event.hh.

◆ Label

typedef string Diades::Automata::Event::Label

Definition at line 71 of file Event.hh.

Constructor & Destructor Documentation

◆ Event() [1/3]

Diades::Automata::Event::Event ( EventDataPointer  data)
inlineprivate

Private contructor (only used by the EventFactory)

Parameters
dataan EventData
Returns
the event associated to the data 'data'

Definition at line 124 of file Event.hh.

◆ Event() [2/3]

Diades::Automata::Event::Event ( )
inline

Default constructor

Returns
an invalid event (this is not the nullevent)

Definition at line 159 of file Event.hh.

◆ Event() [3/3]

Diades::Automata::Event::Event ( const Event e)
inline
Parameters
e
Returns
a copy of the event e

Definition at line 166 of file Event.hh.

Member Function Documentation

◆ allocateEvents()

static void Diades::Automata::Event::allocateEvents ( size_t  capacity)
static

allocate memory to store future events

Parameters
capacitythe storage capacity If more events are allocated there is a dynamic resize

◆ dataMemoryUsage()

int Diades::Automata::Event::dataMemoryUsage ( ) const
inline
Returns
the memory size of the Event (full size)

Definition at line 283 of file Event.hh.

References Diades::Automata::EventData::_id, Diades::Automata::EventData::_label, and Diades::Automata::EventData::_nickname.

◆ destroyEvents()

static void Diades::Automata::Event::destroyEvents ( )
static

Destroy any used events (all references become invalid, do not use it)

Referenced by main().

◆ getEvent() [1/2]

static Event Diades::Automata::Event::getEvent ( const Label evtLabel)
static
Parameters
evtLabelthe label of the event
Returns
the unique Event of this label

Referenced by generateSharedEvents(), main(), MealyEncoding(), MealyEncodingV1(), and MooreEncoding().

◆ getEvent() [2/2]

static Event Diades::Automata::Event::getEvent ( const Id evtId)
static
Parameters
evtIdthe id of the event
Returns
the unique Event of this id

◆ id()

Id Diades::Automata::Event::id ( ) const
inline
Returns
the id of the event
Precondition
valid()

Definition at line 207 of file Event.hh.

References Diades::Automata::EventData::_id, and require.

Referenced by Diades::Automata::Component::beginOfSourceStateOfEvent(), Diades::Automata::ObservableComponent::beginOfSourceStateOfObservableEvent(), Diades::Automata::Component::beginOfTargetStateOfEvent(), Diades::Automata::ObservableComponent::beginOfTargetStateOfObservableEvent(), Diades::Automata::Component::endOfSourceStateOfEvent(), Diades::Automata::ObservableComponent::endOfSourceStateOfObservableEvent(), Diades::Automata::Component::endOfTargetStateOfEvent(), Diades::Automata::ObservableComponent::endOfTargetStateOfObservableEvent(), Diades::Automata::Component::eventTransitionBegin(), Diades::Automata::Component::eventTransitionEnd(), Diades::Automata::ComposableModel::inputEventTransitionBegin(), Diades::Automata::Component::inputEventTransitionBegin(), Diades::Automata::ComposableModel::inputEventTransitionEnd(), Diades::Automata::Component::inputEventTransitionEnd(), Diades::Automata::ObservableComponent::inputObservableTransitionBegin(), Diades::Automata::ObservableComponent::inputObservableTransitionEnd(), Diades::Automata::ObservableMask::isDetectable(), Diades::Automata::ObservableMask::isIdentifiable(), Diades::Automata::ObservableComponent::observableTransitionBegin(), Diades::Automata::ObservableComponent::observableTransitionEnd(), std::hash< Diades::Automata::Event >::operator()(), operator<(), operator==(), Diades::Automata::ComposableModel::outputEventTransitionBegin(), Diades::Automata::Component::outputEventTransitionBegin(), Diades::Automata::ComposableModel::outputEventTransitionEnd(), Diades::Automata::Component::outputEventTransitionEnd(), Diades::Automata::ObservableComponent::outputObservableTransitionBegin(), Diades::Automata::ObservableComponent::outputObservableTransitionEnd(), Diades::Automata::ObservableComponent::unobservableTransitionBegin(), and Diades::Automata::ObservableComponent::unobservableTransitionEnd().

◆ isValid()

bool Diades::Automata::Event::isValid ( ) const
inline

◆ label()

const Label& Diades::Automata::Event::label ( ) const
Returns
the label of the event. The label of the event identifies the event (two events with the same label are identical)
Precondition
isValid()

Referenced by Diades::Automata::FaultDiagnosis::componentDiagnose(), Diades::Automata::FaultDiagnosis::globalModelDiagnose(), main(), and Diades::Automata::tinyXmlText().

◆ load()

istream& Diades::Automata::Event::load ( istream &  is)

Load an event from a stream (dual of save)

Parameters
isinput stream
Returns
the new inputstream without the content of the event that is load

◆ memoryUsage()

int Diades::Automata::Event::memoryUsage ( ) const
inline
Returns
the memory size of the Event (pointer size)

Definition at line 277 of file Event.hh.

◆ nickname()

const Label& Diades::Automata::Event::nickname ( ) const
inline
Returns
the nickname of the event. The nickname of the event is the short name of the event (coming from file description) Two different events may have the same nickname so be careful. See the label() method.
Precondition
valid()

Definition at line 190 of file Event.hh.

References Diades::Automata::EventData::_nickname, and require.

Referenced by exportBackwardToDot(), exportToDesComp(), exportToDot(), and main().

◆ nullEvent()

static Event Diades::Automata::Event::nullEvent ( )
static
Returns
the null Event

◆ nullEventLabel()

static const Event::Label& Diades::Automata::Event::nullEventLabel ( )
static
Returns
the label of the null Event

◆ operator!=()

bool Diades::Automata::Event::operator!= ( const Event e) const
inline
Parameters
ean Event
Returns
true if both events are different

Definition at line 258 of file Event.hh.

◆ operator<()

bool Diades::Automata::Event::operator< ( const Event e) const
inline
Parameters
ean Event
Returns
true if the current event is 'strictly lower' than the event e (for set ordering)

Definition at line 224 of file Event.hh.

References id(), and isValid().

◆ operator=()

Event& Diades::Automata::Event::operator= ( const Event e)
inline
Parameters
ean Event
Returns
a copy of the event e (assignation)

Definition at line 217 of file Event.hh.

References _ptr.

◆ operator==()

bool Diades::Automata::Event::operator== ( const Event e) const
inline
Parameters
ean Event
Returns
true if both events are the same

Definition at line 245 of file Event.hh.

References id(), and isValid().

◆ operator>()

bool Diades::Automata::Event::operator> ( const Event e) const
inline
Parameters
ean Event
Returns
true if the current event is 'strictly greater' than the event e (for set ordering)

Definition at line 269 of file Event.hh.

◆ save()

ostream& Diades::Automata::Event::save ( ostream &  os) const
inline
Parameters
osoutput stream
Returns
the new output stream including the event e (format: id label)
Precondition
the event is valid

Definition at line 311 of file Event.hh.

References boost::serialization::load(), and require.

◆ setNickname()

void Diades::Automata::Event::setNickname ( const Label nick)
inline

Definition at line 197 of file Event.hh.

References Diades::Automata::EventData::_nickname.

Referenced by generateSharedEvents(), and main().

◆ typeName()

static string Diades::Automata::Event::typeName ( )
inlinestatic

Definition at line 55 of file Event.hh.

Friends And Related Function Documentation

◆ EventFactory

friend class EventFactory
friend

Definition at line 324 of file Event.hh.

◆ operator<<

ostream& operator<< ( ostream &  os,
const Event e 
)
friend
Parameters
osoutput stream
ean Event
Returns
the new output stream including the event e

Definition at line 291 of file Event.hh.

◆ operator>>

istream& operator>> ( istream &  is,
Event e 
)
friend
Parameters
isoutput stream
ean Event
Returns
the new output stream including the event e

Member Data Documentation

◆ _ptr

EventDataPointer Diades::Automata::Event::_ptr
private

Definition at line 117 of file Event.hh.

Referenced by operator=().


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