OpenASIP  2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
TTAMachine::Guard Class Referenceabstract

#include <Guard.hh>

Inheritance diagram for TTAMachine::Guard:
Inheritance graph
Collaboration diagram for TTAMachine::Guard:
Collaboration graph

Public Member Functions

virtual ~Guard ()
 
virtual BusparentBus () const
 
virtual void setParentBus (Bus *parentBus)
 
virtual bool isEqual (const Guard &guard) const =0
 
virtual bool isInverted () const
 
virtual bool isMoreRestrictive (const Guard &guard) const
 
virtual bool isLessRestrictive (const Guard &guard) const
 
virtual bool isOpposite (const Guard &guard) const =0
 
virtual bool isDisjoint (const Guard &guard) const
 
virtual void copyTo (Bus &parentBus) const =0
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_GUARD = "guard"
 ObjectState name for guard. More...
 
static const std::string OSKEY_INVERTED = "inverted"
 ObjectState attribute key for inverted feature. More...
 

Protected Member Functions

 Guard (bool inverted, Bus *parentBus)
 
 Guard (const ObjectState *state, Bus &parentBus)
 
- Protected Member Functions inherited from TTAMachine::SubComponent
 SubComponent ()
 
virtual ~SubComponent ()
 
- Protected Member Functions inherited from TTAMachine::MachinePart
 MachinePart ()
 
virtual ~MachinePart ()
 

Private Attributes

bool inverted_
 Indicated whether the condition term is inverted. More...
 
Busparent_
 The parent bus of the guard. More...
 

Detailed Description

Guard expression representing an execution predicate.

Evaluates to true (execute) or false (don't execute). This is a base class for real Guards.

Definition at line 55 of file Guard.hh.

Constructor & Destructor Documentation

◆ ~Guard()

TTAMachine::Guard::~Guard ( )
virtual

Destructor.

Definition at line 90 of file Guard.cc.

90  {
91  Bus* parent = parent_;
92  parent_ = NULL;
93  if (parent) {
94  parent->removeGuard(*this);
95  }
96 }

References parent_, and TTAMachine::Bus::removeGuard().

Here is the call graph for this function:

◆ Guard() [1/2]

TTAMachine::Guard::Guard ( bool  inverted,
Bus parentBus 
)
protected

Constructor.

Parameters
invertedIndicates whether the condition term is inverted.
parentBusParent bus component of the guard.

Definition at line 64 of file Guard.cc.

64  :
65  inverted_(inverted), parent_(parentBus) {
66 
67  // parentBus.addGuard() cannot be called here because isEqual method
68  // does not work until the whole
69  // (RegisterGuard/PortGuard/UnconditionalGuard) is instantiated
70 }

◆ Guard() [2/2]

TTAMachine::Guard::Guard ( const ObjectState state,
Bus parentBus 
)
protected

Constructor.

Loads its state from the given ObjectState instance.

Parameters
stateThe ObjectState instance from which the state is loaded.
parentBusParent bus of the guard.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 83 of file Guard.cc.

83  : parent_(&parentBus) {
84  loadState(state);
85 }

References loadState().

Here is the call graph for this function:

Member Function Documentation

◆ copyTo()

virtual void TTAMachine::Guard::copyTo ( Bus parentBus) const
pure virtual

◆ isDisjoint()

bool TTAMachine::Guard::isDisjoint ( const Guard guard) const
virtual

Checks whether this guard and given one are disjoint.

The guards are disjoint if neither is the exact subset of the other.

Parameters
guardThe guard to compare.
Returns
True if the guards are disjoint, otherwise false.

Definition at line 138 of file Guard.cc.

138  {
139  return !isEqual(guard);
140 }

References isEqual().

Here is the call graph for this function:

◆ isEqual()

virtual bool TTAMachine::Guard::isEqual ( const Guard guard) const
pure virtual

◆ isInverted()

virtual bool TTAMachine::Guard::isInverted ( ) const
virtual

◆ isLessRestrictive()

bool TTAMachine::Guard::isLessRestrictive ( const Guard guard) const
virtual

Checks whether this guard is less restrictive than the given one.

This method is meant for complex (two-term) guards but they are not supported yet, so returns always false.

Parameters
guardThe guard to compare.
Returns
False.

Definition at line 124 of file Guard.cc.

124  {
125  return false;
126 }

◆ isMoreRestrictive()

bool TTAMachine::Guard::isMoreRestrictive ( const Guard guard) const
virtual

Checks whether this guard is more restrictive than the given one.

This method is meant for complex (two-term) guards but they are not supported yet, so returns always false.

Parameters
guardThe guard to compare.
Returns
False.

Definition at line 109 of file Guard.cc.

109  {
110  return false;
111 }

◆ isOpposite()

virtual bool TTAMachine::Guard::isOpposite ( const Guard guard) const
pure virtual

◆ loadState()

void TTAMachine::Guard::loadState ( const ObjectState state)
virtual

Loads its state from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState is invalid.

Implements Serializable.

Reimplemented in TTAMachine::UnconditionalGuard, TTAMachine::RegisterGuard, and TTAMachine::PortGuard.

Definition at line 164 of file Guard.cc.

164  {
165  try {
167  } catch (Exception& e) {
168  string procName = "Guard::loadState";
170  __FILE__, __LINE__, procName,
171  e.errorMessage());
172  }
173 }

References Exception::errorMessage(), ObjectState::intAttribute(), inverted_, and OSKEY_INVERTED.

Referenced by Guard(), TTAMachine::PortGuard::loadState(), TTAMachine::RegisterGuard::loadState(), and TTAMachine::UnconditionalGuard::loadState().

Here is the call graph for this function:

◆ parentBus()

virtual Bus* TTAMachine::Guard::parentBus ( ) const
virtual

◆ saveState()

ObjectState * TTAMachine::Guard::saveState ( ) const
virtual

Saves the state of the object to an ObjectState object.

Returns
The newly created ObjectState object.

Implements Serializable.

Reimplemented in TTAMachine::UnconditionalGuard, TTAMachine::RegisterGuard, and TTAMachine::PortGuard.

Definition at line 149 of file Guard.cc.

149  {
150  ObjectState* state = new ObjectState(OSNAME_GUARD);
152  return state;
153 }

References inverted_, OSKEY_INVERTED, OSNAME_GUARD, and ObjectState::setAttribute().

Referenced by TTAMachine::Bus::saveState(), TTAMachine::PortGuard::saveState(), TTAMachine::RegisterGuard::saveState(), and TTAMachine::UnconditionalGuard::saveState().

Here is the call graph for this function:

◆ setParentBus()

virtual void TTAMachine::Guard::setParentBus ( Bus parentBus)
inlinevirtual

Definition at line 60 of file Guard.hh.

60  {
62  }

References parent_, and parentBus().

Here is the call graph for this function:

Member Data Documentation

◆ inverted_

bool TTAMachine::Guard::inverted_
private

Indicated whether the condition term is inverted.

Definition at line 85 of file Guard.hh.

Referenced by loadState(), and saveState().

◆ OSKEY_INVERTED

const string TTAMachine::Guard::OSKEY_INVERTED = "inverted"
static

ObjectState attribute key for inverted feature.

Definition at line 77 of file Guard.hh.

Referenced by loadState(), and saveState().

◆ OSNAME_GUARD

const string TTAMachine::Guard::OSNAME_GUARD = "guard"
static

ObjectState name for guard.

Definition at line 75 of file Guard.hh.

Referenced by saveState().

◆ parent_

Bus* TTAMachine::Guard::parent_
private

The parent bus of the guard.

Definition at line 87 of file Guard.hh.

Referenced by setParentBus(), and ~Guard().


The documentation for this class was generated from the following files:
TTAMachine::Guard::OSNAME_GUARD
static const std::string OSNAME_GUARD
ObjectState name for guard.
Definition: Guard.hh:75
ObjectStateLoadingException
Definition: Exception.hh:551
TTAMachine::Guard::isEqual
virtual bool isEqual(const Guard &guard) const =0
ObjectState
Definition: ObjectState.hh:59
TTAMachine::Guard::inverted_
bool inverted_
Indicated whether the condition term is inverted.
Definition: Guard.hh:85
TTAMachine::Guard::OSKEY_INVERTED
static const std::string OSKEY_INVERTED
ObjectState attribute key for inverted feature.
Definition: Guard.hh:77
TTAMachine::Guard::parent_
Bus * parent_
The parent bus of the guard.
Definition: Guard.hh:87
Exception
Definition: Exception.hh:54
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAMachine::Guard::parentBus
virtual Bus * parentBus() const
TTAMachine::Bus::removeGuard
virtual void removeGuard(Guard &guard)
Definition: Bus.cc:428
TTAMachine::Guard::loadState
virtual void loadState(const ObjectState *state)
Definition: Guard.cc:164
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100