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

#include <History.hh>

Public Types

typedef const DiagnosisDiagPtr
 
typedef pair< ptime, EventObservation
 
typedef map< ptime, Event >::const_iterator ObservationIterator
 
typedef set< ptime >::const_iterator TimeIterator
 
typedef Candidate::StateId StateId
 
typedef vector< unordered_map< StateId, unordered_set< StateId > > > Dict
 

Public Member Functions

 History ()
 
 History (const History &hist, const Dict &dict)
 
void publishObservation (ptime t, const Event &e)
 
void publishDiagnosis (ptime t, const Diagnosis &d)
 
ptime initialTimePoint () const
 
ptime lastTimePoint () const
 
TimeIterator begin (ptime t) const
 
TimeIterator end (ptime t) const
 
const DiagnosisgetDiagnosis (ptime t) const
 
ObservationIterator obsBegin (ptime t) const
 
ObservationIterator obsEnd (ptime t) const
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

ptime _initialTimePoint
 
vector< ptime > _timePoints
 
vector< Diagnosis_diags
 
map< ptime, Event_obs
 
set< ptime > _hist
 
Diagnosis _nullDiagnosis
 

Friends

class boost::serialization::access
 
ostream & operator<< (ostream &os, const History &history)
 

Detailed Description

This class represents an history of diagnosis computations. The basic idea here is to record in such an object the sequence of observations received by a diagnostic algorithm as well as the diagnosis that this algorithm provides through the time. To record into the History, first the History is created, that automatically initialises the starting time of the History with the local time of the computer. To record an observation, it is required to publish it into the History. The same for Diagnosis results coming from the algorithms. It is the responsability of the user to initialise the history at the right time and time-stamped the received observations and the produced Diagnosis objects. The class History does not store the Diagnosis that are published. Some operations are available to compare with different indicators the different porduced Histories. History is serializable so it can be saved in a file and loaded from a file, independently from the environment where the History was created. With this capacity, it is then possible to perform algorithm analyses off-line.

This class has an extensive use of the boost_date_time library.

See also
time_duration and ptime

Definition at line 56 of file History.hh.

Member Typedef Documentation

◆ DiagPtr

History::DiagPtr

The way History is linked with Diagnosis objects

Definition at line 64 of file History.hh.

◆ Dict

typedef vector< unordered_map<StateId,unordered_set<StateId> > > Diades::Automata::History::Dict

Definition at line 102 of file History.hh.

◆ Observation

History::Observation An Observation is a Event that is time-stamped.

Definition at line 70 of file History.hh.

◆ ObservationIterator

typedef map<ptime,Event>::const_iterator Diades::Automata::History::ObservationIterator

History::ObservationIterator iterator on the Observation

Definition at line 75 of file History.hh.

◆ StateId

Definition at line 101 of file History.hh.

◆ TimeIterator

typedef set<ptime>::const_iterator Diades::Automata::History::TimeIterator

History::TimeIterator iterator on the time points

Definition at line 81 of file History.hh.

Constructor & Destructor Documentation

◆ History() [1/2]

Diades::Automata::History::History ( )
inline

Default and unique constructor Once the History constructor is called the initialTimePoint() is set to the time of the creation of the History in microseconds

Definition at line 97 of file History.hh.

◆ History() [2/2]

Diades::Automata::History::History ( const History hist,
const Dict dict 
)

Constructor

Parameters
hista state-abstracted History
dictthe state abstractions

Member Function Documentation

◆ begin()

TimeIterator Diades::Automata::History::begin ( ptime  t) const
inline

Iterator on time points

Parameters
ta time point
Returns
an iterator on the first known time point (known through publications) in the History that is either t or the earliest known time point t' after t.

Definition at line 169 of file History.hh.

Referenced by Diades::Automata::historyCompare().

◆ end()

TimeIterator Diades::Automata::History::end ( ptime  t) const
inline

Iterator on time points

Parameters
ta time point
Returns
an iterator on the element after the known time point (known through publications) in the History that is either t or (if not present) the earliest known time point t' before t.

Definition at line 186 of file History.hh.

Referenced by Diades::Automata::historyCompare().

◆ getDiagnosis()

const Diagnosis& Diades::Automata::History::getDiagnosis ( ptime  t) const

Get the diagnosis at time t

Parameters
ta time point t that does not necessary be a published time point
Returns
the diagnosis that is available at time t. This diagnosis was published either at time t (if such a publication exists) or is the last published Diagnosis before t.

Referenced by Diades::Automata::historyCompare(), and Diades::Automata::historyCompareWithTimeStep().

◆ initialTimePoint()

ptime Diades::Automata::History::initialTimePoint ( ) const
inline
Returns
the initial time point of the History

Definition at line 146 of file History.hh.

Referenced by Diades::Automata::historyCompare(), Diades::Automata::historyCompareWithTimeStep(), main(), makeComparison(), and runDiagnosis().

◆ lastTimePoint()

ptime Diades::Automata::History::lastTimePoint ( ) const
inline
Returns
the (current) last time point of the History

Definition at line 156 of file History.hh.

Referenced by Diades::Automata::historyCompare(), and Diades::Automata::historyCompareWithTimeStep().

◆ obsBegin()

ObservationIterator Diades::Automata::History::obsBegin ( ptime  t) const
inline

Iterator on observations

Parameters
ta time point
Returns
an iterator on the observation published in the History either at time t or (if not present) at the earliest known time point t' before t.

Definition at line 213 of file History.hh.

◆ obsEnd()

ObservationIterator Diades::Automata::History::obsEnd ( ptime  t) const
inline

Iterator on observations

Parameters
ta time point
Returns
an iterator on the element after the observation published in the History either at time t or (if not present) at the earliest known time point t' before t.

Definition at line 231 of file History.hh.

References Diades::Utils::operator<<().

◆ publishDiagnosis()

void Diades::Automata::History::publishDiagnosis ( ptime  t,
const Diagnosis d 
)
inline

Publication of a Diagnosis

Parameters
tthe time-stamp associated with the Event to record
dthe Diagnosis that is produced at time t and handled by the diagnostic algorithm that publishes the Diagnosis

Definition at line 134 of file History.hh.

Referenced by Diades::Automata::Diagnose< ALG >::Diagnose(), main(), and runDiagnosis().

◆ publishObservation()

void Diades::Automata::History::publishObservation ( ptime  t,
const Event e 
)
inline

Publication of an Observation

Parameters
tthe time-stamp associated with the Event to record
ethe event that is observed at time t and handled by the diagnostic algorithm that publishes the observation

Definition at line 121 of file History.hh.

Referenced by runDiagnosis().

◆ serialize()

template<class Archive >
void Diades::Automata::History::serialize ( Archive &  ar,
const unsigned int  version 
)
inlineprivate

Serialisation method

Parameters
arthe Archive to use
versionthe version
See also
http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/index.html

Definition at line 264 of file History.hh.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 253 of file History.hh.

◆ operator<<

ostream& operator<< ( ostream &  os,
const History history 
)
friend

Output stream operator

Parameters
osoutput stream
historythe History to print
Returns
the update output stream

Member Data Documentation

◆ _diags

vector<Diagnosis> Diades::Automata::History::_diags
private

Definition at line 85 of file History.hh.

◆ _hist

set<ptime> Diades::Automata::History::_hist
private

Definition at line 87 of file History.hh.

◆ _initialTimePoint

ptime Diades::Automata::History::_initialTimePoint
private

Definition at line 83 of file History.hh.

◆ _nullDiagnosis

Diagnosis Diades::Automata::History::_nullDiagnosis
private

Definition at line 88 of file History.hh.

◆ _obs

map<ptime,Event> Diades::Automata::History::_obs
private

Definition at line 86 of file History.hh.

◆ _timePoints

vector<ptime> Diades::Automata::History::_timePoints
private

Definition at line 84 of file History.hh.


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