OpenASIP  2.0
Public Member Functions | Static Public Attributes | List of all members
UnconditionalGuardEncoding Class Reference

#include <UnconditionalGuardEncoding.hh>

Inheritance diagram for UnconditionalGuardEncoding:
Inheritance graph
Collaboration diagram for UnconditionalGuardEncoding:
Collaboration graph

Public Member Functions

 UnconditionalGuardEncoding (bool inverted, unsigned int encoding, GuardField &parent)
 
 UnconditionalGuardEncoding (const ObjectState *state, GuardField &parent)
 
virtual ~UnconditionalGuardEncoding ()
 
virtual ObjectStatesaveState () const
 
- Public Member Functions inherited from GuardEncoding
virtual ~GuardEncoding ()
 
GuardFieldparent () const
 
bool isGuardInverted () const
 
unsigned int encoding () const
 

Static Public Attributes

static const std::string OSNAME_UNCONDITIONAL_GUARD_ENCODING = "uc_guard_encoding"
 ObjectState name for unconditional guard encoding. More...
 
- Static Public Attributes inherited from GuardEncoding
static const std::string OSNAME_GUARD_ENCODING = "guard_encoding"
 ObjectState name for guard encoding. More...
 
static const std::string OSKEY_INVERTED = "inverted"
 ObjectState attribute key for invert flag. More...
 
static const std::string OSKEY_ENCODING = "encoding"
 ObjectState attribute key for encoding. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GuardEncoding
 GuardEncoding (bool inverted, unsigned int encoding)
 
 GuardEncoding (const ObjectState *state)
 
void setParent (GuardField *parent)
 

Detailed Description

The UnconditionalGuardEncoding class maps always true guard term to a control code.

Instances of this class are always registered to a guard field.

Definition at line 47 of file UnconditionalGuardEncoding.hh.

Constructor & Destructor Documentation

◆ UnconditionalGuardEncoding() [1/2]

UnconditionalGuardEncoding::UnconditionalGuardEncoding ( bool  inverted,
unsigned int  encoding,
GuardField parent 
)

The constructor.

Registers the encoding to the given guard field automatically.

Parameters
invertedIndicates whether the encoding is for always-true or always-false guard expression.
encodingThe encoding for unconditional guard.
parentThe parent guard field.
Exceptions
ObjectAlreadyExistsIf the guard field has an encoding for the same unconditional guard expression already, or if the given encoding is already assigned.

Definition at line 58 of file UnconditionalGuardEncoding.cc.

60  : GuardEncoding(inverted, encoding) {
61  parent.addGuardEncoding(*this);
62  setParent(&parent);
63 }

References GuardField::addGuardEncoding(), GuardEncoding::parent(), and GuardEncoding::setParent().

Here is the call graph for this function:

◆ UnconditionalGuardEncoding() [2/2]

UnconditionalGuardEncoding::UnconditionalGuardEncoding ( const ObjectState state,
GuardField parent 
)

The constructor.

Loads the state of the object from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
parentThe parent guard field.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.
ObjectAlreadyExistsIf the guard field has an encoding for the same unconditional guard expression already, of if the encoding in the ObjectState instance is already assigned.

Definition at line 79 of file UnconditionalGuardEncoding.cc.

81  : GuardEncoding(state) {
82  if (state->name() != OSNAME_UNCONDITIONAL_GUARD_ENCODING) {
83  const string procName =
84  "UnconditionalGuardEncoding::UnconditionalGuardEncoding";
85  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
86  }
87 
88  parent.addGuardEncoding(*this);
89  setParent(&parent);
90 }

References GuardField::addGuardEncoding(), ObjectState::name(), OSNAME_UNCONDITIONAL_GUARD_ENCODING, GuardEncoding::parent(), and GuardEncoding::setParent().

Here is the call graph for this function:

◆ ~UnconditionalGuardEncoding()

UnconditionalGuardEncoding::~UnconditionalGuardEncoding ( )
virtual

The destructor.

Definition at line 95 of file UnconditionalGuardEncoding.cc.

95  {
96  GuardField* oldParent = parent();
97  setParent(NULL);
98  oldParent->removeUnconditionalGuardEncoding(*this);
99 }

References GuardEncoding::parent(), GuardField::removeUnconditionalGuardEncoding(), and GuardEncoding::setParent().

Here is the call graph for this function:

Member Function Documentation

◆ saveState()

ObjectState * UnconditionalGuardEncoding::saveState ( ) const
virtual

Saves the state of the object to an ObjectState instance.

Returns
The newly created ObjectState instance.

Reimplemented from GuardEncoding.

Definition at line 108 of file UnconditionalGuardEncoding.cc.

108  {
111  return state;
112 }

References OSNAME_UNCONDITIONAL_GUARD_ENCODING, GuardEncoding::saveState(), and ObjectState::setName().

Here is the call graph for this function:

Member Data Documentation

◆ OSNAME_UNCONDITIONAL_GUARD_ENCODING

const std::string UnconditionalGuardEncoding::OSNAME_UNCONDITIONAL_GUARD_ENCODING = "uc_guard_encoding"
static

ObjectState name for unconditional guard encoding.

Definition at line 57 of file UnconditionalGuardEncoding.hh.

Referenced by BEMSerializer::guardFieldToFile(), saveState(), and UnconditionalGuardEncoding().


The documentation for this class was generated from the following files:
ObjectStateLoadingException
Definition: Exception.hh:551
GuardField::removeUnconditionalGuardEncoding
void removeUnconditionalGuardEncoding(UnconditionalGuardEncoding &encoding)
Definition: GuardField.cc:252
ObjectState
Definition: ObjectState.hh:59
GuardField
Definition: GuardField.hh:55
ObjectState::setName
void setName(const std::string &name)
GuardField::addGuardEncoding
void addGuardEncoding(GPRGuardEncoding &encoding)
Definition: GuardField.cc:141
GuardEncoding::setParent
void setParent(GuardField *parent)
Definition: GuardEncoding.cc:137
GuardEncoding::encoding
unsigned int encoding() const
Definition: GuardEncoding.cc:112
ObjectState::name
std::string name() const
GuardEncoding::GuardEncoding
GuardEncoding(bool inverted, unsigned int encoding)
Definition: GuardEncoding.cc:51
UnconditionalGuardEncoding::OSNAME_UNCONDITIONAL_GUARD_ENCODING
static const std::string OSNAME_UNCONDITIONAL_GUARD_ENCODING
ObjectState name for unconditional guard encoding.
Definition: UnconditionalGuardEncoding.hh:57
GuardEncoding::saveState
virtual ObjectState * saveState() const
Definition: GuardEncoding.cc:123
GuardEncoding::parent
GuardField * parent() const
Definition: GuardEncoding.cc:90