DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Diades::Automata::Experimental::EventSetManager< EventLabel, EventId > Class Template Reference

#include <EventSet.hh>

Public Types

typedef size_t EventCode
 EventCode the code of an Event in the EventSetManager. More...
 
typedef std::unordered_map< EventId, size_t > Map
 Map data structure that contains the encoding of the involved Events. More...
 
typedef boost::dynamic_bitset EventSet
 EventSet a simple dynamic bitset represents a set of Events. More...
 
typedef Diades::Utils::Exception< EventSetManagerException
 

Public Member Functions

 EventSetManager ()
 
 EventSetManager (const EventSetManager &mgr)
 
 EventSetManager (EventSetManager &&mgr)
 
EventSetManageroperator= (const EventSetManager &mgr)
 
 ~EventSetManager ()
 
const Mapmap () const
 
bool hasEvent (EventId e) const
 
bool hasCode (EventCode c) const
 
template<typename EventIterator >
EventSetManagerinitialise (EventIterator first, EventIterator last)
 
template<typename EventIterator >
EventSetManagerencodeRange (EventIterator first, EventIterator last)
 
EventCode encode (EventId e)
 
EventCode encodeNoCheck (EventId e)
 
EventCode code (EventId e) const
 
EventId event (EventCode c) const
 
size_t numberOfEncodedEvents () const
 
template<typename EventIterator >
EventSet eventSet (EventIterator first, EventIterator last) const
 
std::vector< EventId > decodeEventSet (const EventSet &eventSet) const
 
EventSet projectEventSet (const EventSetManager &mgr, const EventSet &es)
 
EventSet eventSet (EventId e) const
 
EventSet emptySet () const
 
bool contains (const EventSet &eSet, EventId e) const
 
EventSetManagersortCodes ()
 

Static Public Member Functions

static string typeName ()
 mapping Id->Event More...
 

Private Attributes

Map _idOfEvent
 
std::unordered_map< size_t, EventId > _eventOfId
 mapping Event->Id More...
 

Detailed Description

template<typename EventLabel, typename EventId>
class Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >

This class implements Event enconding to define EventSet. Indeed, an EventSet can be interpreted as a set of Event only with the help of an EventSetManager. Note that for efficiency purpose, an EventSet is not directly associated with its EventSetManager. It is the responsability of the user to manage this assoaciation if it is necessery to do so.

Definition at line 90 of file EventSet.hh.

Member Typedef Documentation

◆ EventCode

template<typename EventLabel, typename EventId>
typedef size_t Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::EventCode

EventCode the code of an Event in the EventSetManager.

Definition at line 95 of file EventSet.hh.

◆ EventSet

template<typename EventLabel, typename EventId>
typedef boost::dynamic_bitset Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::EventSet

EventSet a simple dynamic bitset represents a set of Events.

Definition at line 100 of file EventSet.hh.

◆ Exception

template<typename EventLabel, typename EventId>
typedef Diades::Utils::Exception<EventSetManager> Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::Exception

Definition at line 112 of file EventSet.hh.

◆ Map

template<typename EventLabel, typename EventId>
typedef std::unordered_map<EventId, size_t> Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::Map

Map data structure that contains the encoding of the involved Events.

Definition at line 97 of file EventSet.hh.

Constructor & Destructor Documentation

◆ EventSetManager() [1/3]

template<typename EventLabel, typename EventId>
Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::EventSetManager ( )
inline

Default constructor: empty set of Events

Definition at line 119 of file EventSet.hh.

◆ EventSetManager() [2/3]

template<typename EventLabel, typename EventId>
Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::EventSetManager ( const EventSetManager< EventLabel, EventId > &  mgr)
inline

Copy constructor

Definition at line 126 of file EventSet.hh.

◆ EventSetManager() [3/3]

template<typename EventLabel, typename EventId>
Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::EventSetManager ( EventSetManager< EventLabel, EventId > &&  mgr)
inline

Move constructor

Definition at line 134 of file EventSet.hh.

◆ ~EventSetManager()

template<typename EventLabel, typename EventId>
Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::~EventSetManager ( )
inline

Destructor

Definition at line 155 of file EventSet.hh.

Member Function Documentation

◆ code()

template<typename EventLabel, typename EventId>
EventCode Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::code ( EventId  e) const
inline
Parameters
ean Event
Returns
the code of the Event
Precondition
hasEvent(e)

Definition at line 260 of file EventSet.hh.

◆ contains()

template<typename EventLabel, typename EventId>
bool Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::contains ( const EventSet eSet,
EventId  e 
) const
inline
Parameters
eSetan EventSet
ean Event
Returns
true if e is in the EventSet according to the EventSetManager

Definition at line 403 of file EventSet.hh.

◆ decodeEventSet()

template<typename EventLabel, typename EventId>
std::vector<EventId> Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::decodeEventSet ( const EventSet eventSet) const
inline

decode an eventSet with his manager

Parameters
eventSetthe eventSet to decode
Returns
the vector of Event associated with this eventSet. ignore unknown codes, be aware if this eventSet is not encoded with this manager.

Definition at line 319 of file EventSet.hh.

Referenced by printSolution().

◆ emptySet()

template<typename EventLabel, typename EventId>
EventSet Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::emptySet ( ) const
inline
Returns
the empty set

Definition at line 389 of file EventSet.hh.

◆ encode()

template<typename EventLabel, typename EventId>
EventCode Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::encode ( EventId  e)
inline
Parameters
ean Event
Returns
the code of the Event (doublons are checked, one Event = one code)

Definition at line 232 of file EventSet.hh.

◆ encodeNoCheck()

template<typename EventLabel, typename EventId>
EventCode Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::encodeNoCheck ( EventId  e)
inline
Parameters
ean Event
Returns
the code of the Event (doublons are NOT checked, one Event = maybe several code)

Definition at line 247 of file EventSet.hh.

◆ encodeRange()

template<typename EventLabel, typename EventId>
template<typename EventIterator >
EventSetManager& Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::encodeRange ( EventIterator  first,
EventIterator  last 
)
inline
Parameters
firstfirst iterator of an Event range
lastiterator after the last Event of the range
Returns
the current EventManager

encoding the Event Range and append to the rest (unsorted, first in, first encoded, doublons are checked, one Event = one code)

Definition at line 212 of file EventSet.hh.

◆ event()

template<typename EventLabel, typename EventId>
EventId Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::event ( EventCode  c) const
inline

◆ eventSet() [1/2]

template<typename EventLabel, typename EventId>
template<typename EventIterator >
EventSet Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::eventSet ( EventIterator  first,
EventIterator  last 
) const
inline
Parameters
firstfirst iterator of an Event range
lastiterator after the last Event of the range
Returns
the EventSet encoding this range based on the current EventSetManager
Precondition
any Event of the range must be encoded in the EventSetManager

Definition at line 299 of file EventSet.hh.

◆ eventSet() [2/2]

template<typename EventLabel, typename EventId>
EventSet Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::eventSet ( EventId  e) const
inline
Parameters
eEvent
Returns
the EventSet encoding the singleton set containing the Event e
Precondition
the Event e must be encoded in the EventSetManager

Definition at line 373 of file EventSet.hh.

◆ hasCode()

template<typename EventLabel, typename EventId>
bool Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::hasCode ( EventCode  c) const
inline
Parameters
can EventCode
Returns
true if the code exists in the EventSetManager

Definition at line 180 of file EventSet.hh.

◆ hasEvent()

template<typename EventLabel, typename EventId>
bool Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::hasEvent ( EventId  e) const
inline
Parameters
ean Event
Returns
true if e belongs the EventSetManager

Definition at line 171 of file EventSet.hh.

◆ initialise()

template<typename EventLabel, typename EventId>
template<typename EventIterator >
EventSetManager& Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::initialise ( EventIterator  first,
EventIterator  last 
)
inline
Parameters
firstfirst iterator of an Event range
lastiterator after the last Event of the range
Returns
the current EventManager

Initialise an encoding for the Event Range (unsorted, first in, first encoded)

Definition at line 194 of file EventSet.hh.

◆ map()

template<typename EventLabel, typename EventId>
const Map& Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::map ( ) const
inline
Returns
the Event encoding (Event->Id)

Definition at line 162 of file EventSet.hh.

◆ numberOfEncodedEvents()

template<typename EventLabel, typename EventId>
size_t Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::numberOfEncodedEvents ( ) const
inline
Returns
the number of encoded events

Definition at line 284 of file EventSet.hh.

◆ operator=()

template<typename EventLabel, typename EventId>
EventSetManager& Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::operator= ( const EventSetManager< EventLabel, EventId > &  mgr)
inline

Assignment operator

Definition at line 142 of file EventSet.hh.

◆ projectEventSet()

template<typename EventLabel, typename EventId>
EventSet Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::projectEventSet ( const EventSetManager< EventLabel, EventId > &  mgr,
const EventSet es 
)
inline
Parameters
mgran EventSetManager
esan EventSet encoded in mgr
Returns
the EventSet encoded in the current EventManager that contains the Events of es that are encoded in the current EventSetManager

Definition at line 346 of file EventSet.hh.

◆ sortCodes()

template<typename EventLabel, typename EventId>
EventSetManager& Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::sortCodes ( )
inline
Returns
the current sorted EventSetManager

This method sorts the encoding of the events so that enc(e1) end(e2) iff e1 e2. This is a way to ensure that for a given set of events the encoding is unique. Note that the encoding functions do not sort the encoding. This method should be explicity called once the set of events is encoded and before any creation of an EventSet.

Definition at line 422 of file EventSet.hh.

◆ typeName()

template<typename EventLabel, typename EventId>
static string Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::typeName ( )
inlinestatic

mapping Id->Event

Definition at line 108 of file EventSet.hh.

Member Data Documentation

◆ _eventOfId

template<typename EventLabel, typename EventId>
std::unordered_map<size_t, EventId> Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::_eventOfId
private

mapping Event->Id

Definition at line 104 of file EventSet.hh.

Referenced by Diades::Automata::Experimental::EventSetManager< EventInfo, EventId >::operator=().

◆ _idOfEvent

template<typename EventLabel, typename EventId>
Map Diades::Automata::Experimental::EventSetManager< EventLabel, EventId >::_idOfEvent
private

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