OpenASIP  2.0
Public Member Functions | Static Public Attributes | List of all members
TTAMachine::UnconditionalGuard Class Reference

#include <Guard.hh>

Inheritance diagram for TTAMachine::UnconditionalGuard:
Inheritance graph
Collaboration diagram for TTAMachine::UnconditionalGuard:
Collaboration graph

Public Member Functions

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

Static Public Attributes

static const std::string OSNAME_UNCONDITIONAL_GUARD = "unconditional"
 ObjectState name for UnconditionalGuard. More...
 
- Static Public Attributes inherited from TTAMachine::Guard
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...
 

Additional Inherited Members

- Protected Member Functions inherited from TTAMachine::Guard
 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 ()
 

Detailed Description

Always true guard term. Always false if inverted.

Definition at line 180 of file Guard.hh.

Constructor & Destructor Documentation

◆ UnconditionalGuard() [1/2]

TTAMachine::UnconditionalGuard::UnconditionalGuard ( bool  inverted,
Bus parentBus 
)

Constructor.

Parameters
invertedIf true, the guard condition is always false and vice versa.
parentBusParent bus component of the guard.
Exceptions
ComponentAlreadyExistsIf the parent bus already has an equal guard.

Definition at line 615 of file Guard.cc.

616  : Guard(inverted, &parentBus) {
617  parentBus.addGuard(*this);
618 }

References TTAMachine::Bus::addGuard(), and TTAMachine::Guard::parentBus().

Referenced by copyTo().

Here is the call graph for this function:

◆ UnconditionalGuard() [2/2]

TTAMachine::UnconditionalGuard::UnconditionalGuard ( const ObjectState state,
Bus parentBus 
)

Constructor.

Loads its state from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
parentBusThe parent bus of the guard.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 630 of file Guard.cc.

631  : Guard(state, parentBus) {
632  loadState(state);
633  try {
634  parentBus.addGuard(*this);
635  } catch (const ComponentAlreadyExists&) {
636  const string procName = "UnconditionalGuard::UnconditionalGuard";
637  MOMTextGenerator textGen;
638  format errorMsg = textGen.text(
640  errorMsg % parentBus.name();
642  __FILE__, __LINE__, procName, errorMsg.str());
643  }
644 }

References TTAMachine::Bus::addGuard(), loadState(), TTAMachine::Component::name(), TTAMachine::Guard::parentBus(), Texts::TextGenerator::text(), and MOMTextGenerator::TXT_EQUAL_UNCONDITIONAL_GUARDS.

Here is the call graph for this function:

◆ ~UnconditionalGuard()

TTAMachine::UnconditionalGuard::~UnconditionalGuard ( )
virtual

Destructor.

Definition at line 649 of file Guard.cc.

649  {
650 }

Member Function Documentation

◆ copyTo()

virtual void TTAMachine::UnconditionalGuard::copyTo ( Bus parentBus) const
inlinevirtual

Implements TTAMachine::Guard.

Definition at line 190 of file Guard.hh.

190  {
192  }

References TTAMachine::Guard::isInverted(), TTAMachine::Guard::parentBus(), and UnconditionalGuard().

Here is the call graph for this function:

◆ isEqual()

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

Returns true if the guard is equal with the given guard.

Parameters
guardThe other guard.
Returns
True if the guard is equal with the given guard.

Implements TTAMachine::Guard.

Definition at line 660 of file Guard.cc.

660  {
661  const UnconditionalGuard* ucGuard =
662  dynamic_cast<const UnconditionalGuard*>(&guard);
663  if (ucGuard == NULL) {
664  return false;
665  } else {
666  if (isInverted() == ucGuard->isInverted()) {
667  return true;
668  } else {
669  return false;
670  }
671  }
672 }

References TTAMachine::Guard::isInverted().

Here is the call graph for this function:

◆ isOpposite()

bool TTAMachine::UnconditionalGuard::isOpposite ( const Guard ) const
inlinevirtual

Implements TTAMachine::Guard.

Definition at line 186 of file Guard.hh.

186 { return false; }

◆ loadState()

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

Loads its state from the given ObjectState instance.

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

Reimplemented from TTAMachine::Guard.

Definition at line 696 of file Guard.cc.

696  {
697  string procName = "UnconditionalGuard::loadState";
698 
699  if (state->name() != OSNAME_UNCONDITIONAL_GUARD) {
700  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
701  }
702 
703  Guard::loadState(state);
704 }

References TTAMachine::Guard::loadState(), ObjectState::name(), and OSNAME_UNCONDITIONAL_GUARD.

Referenced by UnconditionalGuard().

Here is the call graph for this function:

◆ saveState()

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

Saves the contents to an ObjectState object.

Returns
The created ObjectState object.

Reimplemented from TTAMachine::Guard.

Definition at line 681 of file Guard.cc.

681  {
682  ObjectState* guardState = Guard::saveState();
683  guardState->setName(OSNAME_UNCONDITIONAL_GUARD);
684  return guardState;
685 }

References OSNAME_UNCONDITIONAL_GUARD, TTAMachine::Guard::saveState(), and ObjectState::setName().

Here is the call graph for this function:

Member Data Documentation

◆ OSNAME_UNCONDITIONAL_GUARD

const string TTAMachine::UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD = "unconditional"
static

ObjectState name for UnconditionalGuard.

Definition at line 195 of file Guard.hh.

Referenced by TTAMachine::Bus::loadState(), loadState(), and saveState().


The documentation for this class was generated from the following files:
TTAMachine::Guard::saveState
virtual ObjectState * saveState() const
Definition: Guard.cc:149
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ObjectStateLoadingException
Definition: Exception.hh:551
ObjectState
Definition: ObjectState.hh:59
TTAMachine::Bus::addGuard
void addGuard(Guard &guard)
Definition: Bus.cc:410
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
ObjectState::setName
void setName(const std::string &name)
TTAMachine::Guard::Guard
Guard(bool inverted, Bus *parentBus)
Definition: Guard.cc:64
MOMTextGenerator::TXT_EQUAL_UNCONDITIONAL_GUARDS
@ TXT_EQUAL_UNCONDITIONAL_GUARDS
Definition: MOMTextGenerator.hh:54
ObjectState::name
std::string name() const
TTAMachine::UnconditionalGuard::UnconditionalGuard
UnconditionalGuard(bool inverted, Bus &parentBus)
Definition: Guard.cc:615
TTAMachine::Guard::parentBus
virtual Bus * parentBus() const
TTAMachine::Guard::isInverted
virtual bool isInverted() const
MOMTextGenerator
Definition: MOMTextGenerator.hh:40
TTAMachine::Guard::loadState
virtual void loadState(const ObjectState *state)
Definition: Guard.cc:164
ComponentAlreadyExists
Definition: Exception.hh:510
TTAMachine::UnconditionalGuard::loadState
void loadState(const ObjectState *state)
Definition: Guard.cc:696
TTAMachine::UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD
static const std::string OSNAME_UNCONDITIONAL_GUARD
ObjectState name for UnconditionalGuard.
Definition: Guard.hh:195