Spectra
|
#include <formula.h>
Public Member Functions | |
formula (int id) | |
void | addOperand (int) |
std::string | getContent () |
std::string | getInitContent () |
bool | isFullySet () |
bool | canAddOperands () |
std::string | printOpType () |
void | incrementIds () |
int | getId () |
State | getState () |
const fileLocation & | getStart () const |
const fileLocation & | getEnd () const |
OpType | getOperation () |
std::vector< int > & | getOperands () |
std::string | getPrintText () |
void | setOperation (OpType) |
void | setContent (std::string) |
void | setPrint (std::string) |
void | setStart (const fileLocation &start) |
void | setEnd (const fileLocation &end) |
bool | operator< (const formula &other) const |
bool | operator== (const formula &other) const |
A class representing one ptLTL formula. The formula can be defined either
|
explicit |
A constructor setting this formula's id and initializing it's state and operation to ATOM.
id | The UNIQUE id to be set to this formula. |
Created: 10. 11. 2018 by Petra Sečkařová (xseck). Filename: formula.cpp a02@ stud. fit. vutbr .cz
Description: Implementation of methods of a class representing a single ptLTL formula. A constructor setting this formula's id and initializing it's state and operation to ATOM.
id | The UNIQUE id to be set to this formula. |
void formula::addOperand | ( | int | value | ) |
Adds new subformula id to the list of operands, updates initialization state accordingly.
value | An id of subformula, that is an operand to this one. |
Update initialization state
Add the operand
bool formula::canAddOperands | ( | ) |
Checks if any other operands can be added.
std::string formula::getContent | ( | ) |
Constructs a code for one step of processing of this formula in a created monitor. The returned string is based on recursive expressions for each supported operation introduced in http://www.havelund.com/Publications/sttt-tacas02.pdf
std::string formula::getInitContent | ( | ) |
Constructs a string for initialization of processing of this formula in a created monitor. The returned string is based on recursive expressions for each supported operation introduced in http://www.havelund.com/Publications/sttt-tacas02.pdf
void formula::incrementIds | ( | ) |
A method incrementing all ids by 1. Used when after successfully parsing one formula, another one appears in a specification file, which is not connected to the previous one, so a new root formula is created. The root formula has to have id = 0, so all formulae parsed until now must increment their ids.
bool formula::isFullySet | ( | ) |
Checks, that the number of operands is correct or content not empty if operation == ATOM.
|
inline |
An < operator definition based on id's. Note that a formula is considered to be less if it's id is !GREATER!. This is used for sorting the formulae by id in DESCENDING order.
other | The other formula to be compared. |
|
inline |
An == operator definition based on id's.
other | The other formula to be compared. |
std::string formula::printOpType | ( | ) |
A decoder of OpType enum into a string representation.
void formula::setContent | ( | std::string | c | ) |
A setter of this formula's content. Meant for ATOM formulae, won't have any useful effect for others. The passed name of state variable is given a prefix e used in enum created for generated monitor and wrapped in M.values[...] which denotes a reference to function returning its value computed as defined in specification file.
c | An atomic expression, typically a name of a boolean variable to be set as this formula's content. |