faudes::TimeConstraint Class Reference
[Timed Automata PlugIn]

A TimeConstraint is a set of elementary clock constraints. More...

#include <tp_timeconstraint.h>

List of all members.

Public Types

typedef std::set
< ElemConstraint >
::const_iterator 
Iterator
 Iterator to access ElemConstraints.
typedef std::set
< ElemConstraint >
::const_reverse_iterator 
RIterator
 Reverse iterator to access ElemConstraints.
typedef ElemConstraint::Operator Operator
 Convenience typedef for operators.

Public Member Functions

 TimeConstraint (void)
 Construct an empty TimeConstraint (allways satisfied).
 TimeConstraint (const TimeConstraint &rOtherTimeConstraint)
 Copy constructor.
 TimeConstraint (const std::string &rFilename, const std::string &rLabel="TimeConstraint")
 Constructor from file.
 ~TimeConstraint (void)
 Destructor.
SymbolTableClockSymbolTablep (void) const
 Get Pointer to mpClockSymbolTable.
void ClockSymbolTablep (SymbolTable *pSymTab)
 Set Pointer to mpClockSymbolTable.
void Write (void) const
 Write to console.
void Write (const std::string &rFileName, const std::string &rLabel="TimeConstraint", std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write to file with label (default: "TimeConstraint") and openmode (default: truncate file).
void Write (TokenWriter &tw) const
 Write to TokenWriter.
void Write (TokenWriter &tw, const std::string &rLabel) const
 Write to TokenWriter with a given label.
std::string ToString (void) const
 Write to a std::string.
void DWrite (void) const
 Write NameSet to console, debug version.
void DWrite (TokenWriter &tw) const
 Write to TokenWriter, debug version.
void Read (const std::string &rFileName, const std::string &rLabel="TimeConstraint")
 Read from file.
void Read (TokenReader &tr, const std::string &rLabel="TimeConstraint")
 Read from tokenreader.
std::string Name (void) const
 Return name of Constraint.
void Name (const std::string &rName)
 Set name of Constraint.
bool Empty (void) const
 Checks if TimeConstraint containts no ElemConstraints.
Idx Size (void) const
 Returns number of ElemConstraint s.
Iterator Insert (const ElemConstraint &rElemConstr)
 Adds an elementary clock constraint to the time constraint.
Iterator Insert (const std::string clockname, Operator op, const tpTime::Type timeconst)
 Adds an elementary clock constraint to the time constraint.
Iterator Insert (Idx clockindex, Operator op, const tpTime::Type timeconst)
 Adds an elementary clock constraint to the time constraint.
void Insert (const std::list< ElemConstraint > &rNewConstraints)
 Adds a list of elementary clock constraints to the time constraint.
void Insert (const TimeConstraint &rOtherTimeConstraint)
 Adds elementary clock constraints from other TimeConstant to the time constraint.
TimeConstraintoperator<< (const TimeConstraint &rOtherTimeConstraint)
 Convenience operator to combine a TimeConstraint with another TimeConstraint.
TimeConstraintoperator<< (const ElemConstraint &rElemConstr)
 Convenience operator to combines a TimeConstraint with an elementary TimeConstraint.
std::set< ElemConstraintClockConstraints (void) const
 Returns copy of ClockConstraints.
Idx InsClock (const std::string &rClockName) const
 Advertise clock to ClockSymbolTable and retrive index.
std::string ClockName (Idx clockindex) const
 Lookup clock name.
Idx ClockIndex (const std::string &rClockName) const
 Lookup clock index.
std::string EStr (const ElemConstraint &rElemConstr) const
 Pretty printable string of elem.
bool EraseByClock (Idx clock)
 Removes all elementary clock constraints refering to a specified clock.
Iterator Erase (Iterator it)
 Calls std::set::erase(iterator).
bool Erase (const ElemConstraint &rElemConstr)
 Removes elementary clock constraint.
bool Erase (const std::string &rClockName, Operator op, const tpTime::Type timeconst)
 Removes elementary clock constraint.
bool Erase (Idx clockindex, Operator op, const tpTime::Type timeconst)
 Removes elementary clock constraint.
void Clear (void)
 Clear all.
bool Exists (const ElemConstraint &rElemConstr) const
 Checks if elementary clock constraint is contained in constraint.
Iterator Begin (void) const
 Iterator to begin of set.
Iterator End (void) const
 Iterator to end of set.
RIterator RBegin (void) const
 Reverse iterator that yields the ElemConstraints in reverse order starting at the last element and ending after the first.
RIterator REnd (void) const
 Reverse iterator that yields the ElemConstraints in reverse order starting at the last element and ending after the first.
Iterator Begin (Idx clock) const
 Iterator to first constraint with specified clock.
Iterator End (Idx clock) const
 Iterator to first constraint just behind specified clock.
ClockSet ActiveClocks (void) const
 Returns a Clockset containing all clocks used by the TimeConstraint.
TimeInterval Interval (Idx clockindex) const
 Given a clock, compute the timeinterval in which the constraint is satisfied.
TimeInterval Interval (const std::string &clockname) const
 Given a clock, compute the timeinterval in which the constraint is satisfied.
void Interval (Idx clockindex, const TimeInterval &rInterval)
 Given a clock and an interval, set up the constraint such that it is valid in the given interval.
void Interval (const std::string &rClockName, const TimeInterval &rInterval)
 Given a clock and an interval, set up the constraint such that it is valid in the given interval.
void Minimize (void)
 Minimize by eliminating redundant elementary constraints.
bool operator== (const TimeConstraint &rOther) const
 Test for equality.
bool operator!= (const TimeConstraint &rOther) const
 Test for equality.

Protected Types

typedef std::set
< ElemConstraint >::iterator 
iterator
 nonconst iterator to access ElemConstraints

Protected Attributes

std::string mName
 My name.
std::set< ElemConstraintmClockConstraints
 Set of elementary clock constraints.
SymbolTablempClockSymbolTable
 SymbolTable for clock names.

Detailed Description

A TimeConstraint is a set of elementary clock constraints.

Semantically, the elementary constraints are combibed by conjunction, ie the TimeConstraint is satisfied if all ElemConstraint s are satisfied. This implementation also maintains the clock symboltable to may cloc indices to symbolic names.

Parameters:
ClockConstraints Set of elementary clock constraints

Definition at line 279 of file tp_timeconstraint.h.


Member Typedef Documentation

nonconst iterator to access ElemConstraints

Definition at line 810 of file tp_timeconstraint.h.

typedef std::set<ElemConstraint>::const_iterator faudes::TimeConstraint::Iterator

Iterator to access ElemConstraints.

Definition at line 284 of file tp_timeconstraint.h.

Convenience typedef for operators.

Definition at line 290 of file tp_timeconstraint.h.

typedef std::set<ElemConstraint>::const_reverse_iterator faudes::TimeConstraint::RIterator

Reverse iterator to access ElemConstraints.

Definition at line 287 of file tp_timeconstraint.h.


Constructor & Destructor Documentation

faudes::TimeConstraint::TimeConstraint ( void   ) 

Construct an empty TimeConstraint (allways satisfied).

Definition at line 196 of file tp_timeconstraint.cpp.

faudes::TimeConstraint::TimeConstraint ( const TimeConstraint rOtherTimeConstraint  ) 

Copy constructor.

Parameters:
rOtherTimeConstraint Time constraint to copy

Definition at line 210 of file tp_timeconstraint.cpp.

faudes::TimeConstraint::TimeConstraint ( const std::string &  rFilename,
const std::string &  rLabel = "TimeConstraint" 
)

Constructor from file.

Uses Read() to scan a file for specified label to read the constraint.

Parameters:
rFilename File to read
rLabel Section label for the set in the file.

Definition at line 203 of file tp_timeconstraint.cpp.

faudes::TimeConstraint::~TimeConstraint ( void   ) 

Destructor.

Definition at line 219 of file tp_timeconstraint.cpp.


Member Function Documentation

ClockSet faudes::TimeConstraint::ActiveClocks ( void   )  const

Returns a Clockset containing all clocks used by the TimeConstraint.

Returns:
Clockset containing all clocks used by the TimeConstraint.

Definition at line 450 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::Begin ( Idx  clock  )  const

Iterator to first constraint with specified clock.

Returns:
TimeConstraint::iterator

Definition at line 440 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::Begin ( void   )  const

Iterator to begin of set.

Returns:
TimeConstraint::Iterator

Definition at line 419 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Clear ( void   ) 

Clear all.

Definition at line 411 of file tp_timeconstraint.cpp.

std::set< ElemConstraint > faudes::TimeConstraint::ClockConstraints ( void   )  const

Returns copy of ClockConstraints.

Definition at line 335 of file tp_timeconstraint.cpp.

Idx faudes::TimeConstraint::ClockIndex ( const std::string &  rClockName  )  const

Lookup clock index.

Parameters:
rClockName Symbolic name of clock
Returns:
Index of clock

Definition at line 260 of file tp_timeconstraint.cpp.

std::string faudes::TimeConstraint::ClockName ( Idx  clockindex  )  const

Lookup clock name.

Parameters:
clockindex index of clock
Returns:
name of clock

Definition at line 255 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::ClockSymbolTablep ( SymbolTable pSymTab  ) 

Set Pointer to mpClockSymbolTable.

Definition at line 228 of file tp_timeconstraint.cpp.

SymbolTable * faudes::TimeConstraint::ClockSymbolTablep ( void   )  const

Get Pointer to mpClockSymbolTable.

Returns:
Pointer to mpClockSymbolTable

Definition at line 223 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::DWrite ( TokenWriter tw  )  const

Write to TokenWriter, debug version.

Parameters:
tw Reference to TokenWriter
Exceptions:
std::ios::failure Thrown on i/o error.

Definition at line 630 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::DWrite ( void   )  const

Write NameSet to console, debug version.

Definition at line 624 of file tp_timeconstraint.cpp.

bool faudes::TimeConstraint::Empty ( void   )  const

Checks if TimeConstraint containts no ElemConstraints.

Returns:
True if TimeConstraint is empty. Else false.

Definition at line 240 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::End ( Idx  clock  )  const

Iterator to first constraint just behind specified clock.

Returns:
TimeConstraint::Iterator

Definition at line 445 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::End ( void   )  const

Iterator to end of set.

Returns:
TimeConstraint::Iterator

Definition at line 425 of file tp_timeconstraint.cpp.

bool faudes::TimeConstraint::Erase ( Idx  clockindex,
Operator  op,
const tpTime::Type  timeconst 
)

Removes elementary clock constraint.

Parameters:
clockindex Clock
op Operator
timeconst Time constant
Returns:
True, if constraint has been removed

Definition at line 382 of file tp_timeconstraint.cpp.

bool faudes::TimeConstraint::Erase ( const std::string &  rClockName,
Operator  op,
const tpTime::Type  timeconst 
)

Removes elementary clock constraint.

Parameters:
rClockName Clock
op Operator
timeconst Time constant
Returns:
True, if constraint has been removed

Definition at line 391 of file tp_timeconstraint.cpp.

bool faudes::TimeConstraint::Erase ( const ElemConstraint rElemConstr  ) 

Removes elementary clock constraint.

Parameters:
rElemConstr Constraint to be removed.
Returns:
True, if constraint has been removed

Definition at line 370 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::Erase ( Iterator  it  ) 

Calls std::set::erase(iterator).

ElemConstraint refered by it is removed from constraint.

Parameters:
it TimeConstraint::Iterator pointing to ElemConstraint that is removed.
Returns:
Iterator pointing to next ElemConstraint.

Definition at line 359 of file tp_timeconstraint.cpp.

bool faudes::TimeConstraint::EraseByClock ( Idx  clock  ) 

Removes all elementary clock constraints refering to a specified clock.

Parameters:
clock Clock whos constraints are to be removed.
Returns:
True, if constraints(s) have been erased

Definition at line 341 of file tp_timeconstraint.cpp.

std::string faudes::TimeConstraint::EStr ( const ElemConstraint rElemConstr  )  const

Pretty printable string of elem.

constraint

Parameters:
rElemConstr ref to elem constraint
Returns:
output string

Definition at line 266 of file tp_timeconstraint.cpp.

bool faudes::TimeConstraint::Exists ( const ElemConstraint rElemConstr  )  const

Checks if elementary clock constraint is contained in constraint.

Parameters:
rElemConstr elementary constraint

Definition at line 400 of file tp_timeconstraint.cpp.

Idx faudes::TimeConstraint::InsClock ( const std::string &  rClockName  )  const

Advertise clock to ClockSymbolTable and retrive index.

Parameters:
rClockName symbolic name of clock
Returns:
index of clock

Definition at line 250 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Insert ( const TimeConstraint rOtherTimeConstraint  ) 

Adds elementary clock constraints from other TimeConstant to the time constraint.

Parameters:
rOtherTimeConstraint Time constraint whos clock constraints are to be added to time constraint.

Definition at line 319 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Insert ( const std::list< ElemConstraint > &  rNewConstraints  ) 

Adds a list of elementary clock constraints to the time constraint.

Parameters:
rNewConstraints Set of elementary clock constraints that is to be added to time constraint.

Definition at line 308 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::Insert ( Idx  clockindex,
Operator  op,
const tpTime::Type  timeconst 
)

Adds an elementary clock constraint to the time constraint.

Parameters:
clockindex Clock for new ElemConstraint
op Operator for new ElemConstraint
timeconst Time constant for new ElemConstraint
Returns:
iterator to new constraint

Definition at line 287 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::Insert ( const std::string  clockname,
Operator  op,
const tpTime::Type  timeconst 
)

Adds an elementary clock constraint to the time constraint.

Parameters:
clockname Clock for new ElemConstraint
op Operator for new ElemConstraint
timeconst Time constant for new ElemConstraint
Returns:
iterator to new constraint

Definition at line 296 of file tp_timeconstraint.cpp.

TimeConstraint::Iterator faudes::TimeConstraint::Insert ( const ElemConstraint rElemConstr  ) 

Adds an elementary clock constraint to the time constraint.

Parameters:
rElemConstr Elementary clock constraint that is to be added to time constraint
Returns:
iterator to new constraint

Definition at line 276 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Interval ( const std::string &  rClockName,
const TimeInterval rInterval 
)

Given a clock and an interval, set up the constraint such that it is valid in the given interval.

Parameters:
rClockName specifies the clock
rInterval reference to time interval

Definition at line 501 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Interval ( Idx  clockindex,
const TimeInterval rInterval 
)

Given a clock and an interval, set up the constraint such that it is valid in the given interval.

Parameters:
clockindex specifies the clock
rInterval reference to time interval

Definition at line 507 of file tp_timeconstraint.cpp.

TimeInterval faudes::TimeConstraint::Interval ( const std::string &  clockname  )  const

Given a clock, compute the timeinterval in which the constraint is satisfied.

Returns:
TimeInterval

Definition at line 463 of file tp_timeconstraint.cpp.

TimeInterval faudes::TimeConstraint::Interval ( Idx  clockindex  )  const

Given a clock, compute the timeinterval in which the constraint is satisfied.

Returns:
TimeInterval

Definition at line 469 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Minimize ( void   ) 

Minimize by eliminating redundant elementary constraints.

The current implemantation retrieves the time constraints as intervals per clock and then converts back to a time constraint.

Definition at line 534 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Name ( const std::string &  rName  )  [inline]

Set name of Constraint.

Parameters:
rName BaseSet name

Definition at line 453 of file tp_timeconstraint.h.

std::string faudes::TimeConstraint::Name ( void   )  const [inline]

Return name of Constraint.

Returns:
Name

Definition at line 445 of file tp_timeconstraint.h.

bool faudes::TimeConstraint::operator!= ( const TimeConstraint rOther  )  const

Test for equality.

Parameters:
rOther Constraint to compare with.
Returns:
True if not equal; see operator==.

Definition at line 556 of file tp_timeconstraint.cpp.

TimeConstraint& faudes::TimeConstraint::operator<< ( const ElemConstraint rElemConstr  )  [inline]

Convenience operator to combines a TimeConstraint with an elementary TimeConstraint.

Parameters:
rElemConstr extra elemtary constraint
Returns:
TimeConstraint object containing all ElemConstraints of both TimeConstraints.

Definition at line 544 of file tp_timeconstraint.h.

TimeConstraint& faudes::TimeConstraint::operator<< ( const TimeConstraint rOtherTimeConstraint  )  [inline]

Convenience operator to combine a TimeConstraint with another TimeConstraint.

Parameters:
rOtherTimeConstraint other TimeConstraint
Returns:
TimeConstraint object containing all ElemConstraints of both TimeConstraints.

Definition at line 533 of file tp_timeconstraint.h.

bool faudes::TimeConstraint::operator== ( const TimeConstraint rOther  )  const

Test for equality.

The implementation converts both constraints to intervals and then performs the comparison.

Parameters:
rOther Constraint to compare with.
Returns:
True if constraints are semantically identical.

Definition at line 544 of file tp_timeconstraint.cpp.

TimeConstraint::RIterator faudes::TimeConstraint::RBegin ( void   )  const

Reverse iterator that yields the ElemConstraints in reverse order starting at the last element and ending after the first.

See set<...>rbegin(void). Returns the "End".

Returns:
TimeConstraint::RIterator

Definition at line 430 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Read ( TokenReader tr,
const std::string &  rLabel = "TimeConstraint" 
)

Read from tokenreader.

Clears before. It is an error if the file contains an index

Parameters:
tr Reference to tokenreader
rLabel Label to read
Exceptions:
std::ios::failure Thrown on i/o error.

Definition at line 647 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Read ( const std::string &  rFileName,
const std::string &  rLabel = "TimeConstraint" 
)

Read from file.

Reads specified label by creating a tokenreader and calling read(tr)

Parameters:
rFileName Filename
rLabel token label to read from file
Exceptions:
Exception If opening/reading fails an Exception object is thrown (id 1, 50, 51, 56)

Definition at line 641 of file tp_timeconstraint.cpp.

TimeConstraint::RIterator faudes::TimeConstraint::REnd ( void   )  const

Reverse iterator that yields the ElemConstraints in reverse order starting at the last element and ending after the first.

See set<...>rend(void). Returns the "Begin".

Returns:
TimeConstraint::RIterator

Definition at line 435 of file tp_timeconstraint.cpp.

Idx faudes::TimeConstraint::Size ( void   )  const

Returns number of ElemConstraint s.

Returns:
Number of ElemConstraint s.

Definition at line 245 of file tp_timeconstraint.cpp.

std::string faudes::TimeConstraint::ToString ( void   )  const

Write to a std::string.

Returns:
String containing all elements

Definition at line 616 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Write ( TokenWriter tw,
const std::string &  rLabel 
) const

Write to TokenWriter with a given label.

Parameters:
tw Reference to TokenWriter
rLabel Label for set in file
Exceptions:
std::ios::failure Thrown on i/o error.

Definition at line 588 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Write ( TokenWriter tw  )  const

Write to TokenWriter.

The name of the constraint is used as the label in the file.

Parameters:
tw Reference to TokenWriter
Exceptions:
std::ios::failure Thrown on i/o error.

Definition at line 582 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Write ( const std::string &  rFileName,
const std::string &  rLabel = "TimeConstraint",
std::ios::openmode  openmode = std::ios::out|std::ios::trunc 
) const

Write to file with label (default: "TimeConstraint") and openmode (default: truncate file).

Parameters:
rFileName Filename
rLabel Label for set in file
openmode std::ios::openmode
Exceptions:
Exception If opening/writing fails an Exception object is thrown (id 2)

Definition at line 568 of file tp_timeconstraint.cpp.

void faudes::TimeConstraint::Write ( void   )  const

Write to console.

Definition at line 562 of file tp_timeconstraint.cpp.


Member Data Documentation

Set of elementary clock constraints.

Definition at line 804 of file tp_timeconstraint.h.

std::string faudes::TimeConstraint::mName [protected]

My name.

Definition at line 801 of file tp_timeconstraint.h.

SymbolTable for clock names.

Definition at line 807 of file tp_timeconstraint.h.


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

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen