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::Candidate Class Reference

#include <Candidate.hh>

Public Types

typedef Diades::Graph::Node::NodeId StateId
 
typedef set< Event >::const_iterator FaultIterator
 
typedef set< Event >::size_type FaultSize
 

Public Member Functions

 Candidate ()
 
 Candidate (StateId stateId, const set< Event > &faults)
 
 Candidate (const vector< StateId > &stateId, const vector< set< Event > > &faults)
 
 Candidate (const Candidate &candidate)
 
Candidateoperator= (const Candidate &candidate)
 
const vector< StateId > & stateId () const
 
const vector< set< Event > > & faults () const
 
FaultIterator begin (unsigned i) const
 
FaultIterator end (unsigned i) const
 
FaultSize numberOfFaults () const
 
bool isNormal () const
 
bool isAbnormal () const
 
bool operator== (const Candidate &candidate) const
 
bool operator!= (const Candidate &candidate) const
 
bool operator< (const Candidate &candidate) const
 
string toString () const
 

Private Member Functions

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

Private Attributes

vector< StateId_stateId
 
vector< set< Event > > _faults
 

Friends

class boost::serialization::access
 
ostream & operator<< (ostream &os, const Candidate &candidate)
 

Detailed Description

Representation of a diagnosis candidate

A diagnosis candidate is the association of a Candidate::StateId and a set of faults (Event)

Definition at line 38 of file Candidate.hh.

Member Typedef Documentation

◆ FaultIterator

typedef set<Event>::const_iterator Diades::Automata::Candidate::FaultIterator

Candidate::FaultIterator iterator on the faults of this candidate

Definition at line 49 of file Candidate.hh.

◆ FaultSize

Candidate::FaultSize type of integer in which the number of faults is encoded

Definition at line 54 of file Candidate.hh.

◆ StateId

Candidate::StateId the id of a State.

Definition at line 44 of file Candidate.hh.

Constructor & Destructor Documentation

◆ Candidate() [1/4]

Diades::Automata::Candidate::Candidate ( )
inline

Default constructor

Definition at line 64 of file Candidate.hh.

◆ Candidate() [2/4]

Diades::Automata::Candidate::Candidate ( StateId  stateId,
const set< Event > &  faults 
)
inline

Parametrised constructor (singleton constructor)

Parameters
stateIdid of the State
faultsset of faults of the Candidate

Definition at line 72 of file Candidate.hh.

References faults(), and stateId().

◆ Candidate() [3/4]

Diades::Automata::Candidate::Candidate ( const vector< StateId > &  stateId,
const vector< set< Event > > &  faults 
)
inline

Parametrised constructor (vector constructor)

Parameters
stateIdvectoriezed ids of the State
faultsvectorized set of faults of the Candidate

Definition at line 85 of file Candidate.hh.

◆ Candidate() [4/4]

Diades::Automata::Candidate::Candidate ( const Candidate candidate)
inline

Copy constructor (linear in the size of the faults)

Parameters
candidatethe Candidate to copy

Definition at line 94 of file Candidate.hh.

Member Function Documentation

◆ begin()

FaultIterator Diades::Automata::Candidate::begin ( unsigned  i) const
inline

Fault iterator

Returns
a FaultIterator on the first fault of the Candidate

Definition at line 138 of file Candidate.hh.

◆ end()

FaultIterator Diades::Automata::Candidate::end ( unsigned  i) const
inline

Fault iterator

Returns
a FaultIterator on the element after the last fault of the Candidate

Definition at line 146 of file Candidate.hh.

◆ faults()

const vector< set<Event> >& Diades::Automata::Candidate::faults ( ) const
inline

Faults of the Candidate

Returns
the set of faults of the Candidate

Definition at line 130 of file Candidate.hh.

References _faults.

Referenced by Candidate(), and numberOfFaults().

◆ isAbnormal()

bool Diades::Automata::Candidate::isAbnormal ( ) const
inline
Returns
true if the Candidate has at least one fault

Definition at line 178 of file Candidate.hh.

References isNormal().

◆ isNormal()

bool Diades::Automata::Candidate::isNormal ( ) const
inline
Returns
true if the Candidate has no fault

Definition at line 169 of file Candidate.hh.

References numberOfFaults().

Referenced by isAbnormal().

◆ numberOfFaults()

FaultSize Diades::Automata::Candidate::numberOfFaults ( ) const
inline
Returns
the number of faults in the Candidate

Definition at line 154 of file Candidate.hh.

References faults().

Referenced by isNormal().

◆ operator!=()

bool Diades::Automata::Candidate::operator!= ( const Candidate candidate) const
inline

Inquality operator (attention, inequality by value, linear in the size of faults())

Parameters
candidateCandidate to compare
Returns
true both candidates are different

Definition at line 202 of file Candidate.hh.

References operator<().

◆ operator<()

bool Diades::Automata::Candidate::operator< ( const Candidate candidate) const

comparison operator to be used with set<Candidate>. the comparison operator works as follows. The smaller size of fault candidates first.

Parameters
candidatethe Candidate to compare
Returns
true if the current Candidate is smaller than 'candidate'

Referenced by operator!=().

◆ operator=()

Candidate& Diades::Automata::Candidate::operator= ( const Candidate candidate)
inline

Assignation operator

Parameters
candidatethe Candidate to assign
Returns
the assigned Candidate

Definition at line 105 of file Candidate.hh.

References _faults, and _stateId.

◆ operator==()

bool Diades::Automata::Candidate::operator== ( const Candidate candidate) const
inline

Equality operator (attention, equality by value, linear in the size of faults())

Parameters
candidateCandidate to compare
Returns
true both candidates are equal

Definition at line 188 of file Candidate.hh.

References _faults, and stateId().

◆ serialize()

template<class Archive >
void Diades::Automata::Candidate::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 263 of file Candidate.hh.

References _faults, and _stateId.

◆ stateId()

const vector<StateId>& Diades::Automata::Candidate::stateId ( ) const
inline

The state id of the Candidate

Returns
the state id of the Candidate

Definition at line 122 of file Candidate.hh.

References _stateId.

Referenced by Candidate(), and operator==().

◆ toString()

string Diades::Automata::Candidate::toString ( ) const
inline
Returns
a pretty string about the Candidate

Definition at line 222 of file Candidate.hh.

Referenced by std::hash< Diades::Automata::Candidate >::operator()().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 252 of file Candidate.hh.

◆ operator<<

ostream& operator<< ( ostream &  os,
const Candidate candidate 
)
friend

output stream operator

Parameters
osoutput stream
candidatethe Candidate to print
Returns
the update output stream

Definition at line 237 of file Candidate.hh.

Member Data Documentation

◆ _faults

vector< set<Event> > Diades::Automata::Candidate::_faults
private

Definition at line 59 of file Candidate.hh.

Referenced by faults(), operator=(), operator==(), and serialize().

◆ _stateId

vector< StateId > Diades::Automata::Candidate::_stateId
private

Definition at line 58 of file Candidate.hh.

Referenced by operator=(), serialize(), and stateId().


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