OpenASIP  2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
GuardEncoding Class Reference

#include <GuardEncoding.hh>

Inheritance diagram for GuardEncoding:
Inheritance graph
Collaboration diagram for GuardEncoding:
Collaboration graph

Public Member Functions

virtual ~GuardEncoding ()
 
GuardFieldparent () const
 
bool isGuardInverted () const
 
unsigned int encoding () const
 
virtual ObjectStatesaveState () const
 

Static Public Attributes

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...
 

Protected Member Functions

 GuardEncoding (bool inverted, unsigned int encoding)
 
 GuardEncoding (const ObjectState *state)
 
void setParent (GuardField *parent)
 

Private Attributes

bool inverted_
 The "invert" flag. More...
 
unsigned int encoding_
 The encoding. More...
 
GuardFieldparent_
 The parent guard field. More...
 

Detailed Description

GuardEncoding class captures the properties shared by all types of guard encoding.

Definition at line 45 of file GuardEncoding.hh.

Constructor & Destructor Documentation

◆ ~GuardEncoding()

GuardEncoding::~GuardEncoding ( )
virtual

The destructor

Definition at line 80 of file GuardEncoding.cc.

80  {
81 }

◆ GuardEncoding() [1/2]

GuardEncoding::GuardEncoding ( bool  inverted,
unsigned int  encoding 
)
protected

The constructor.

Parameters
invertedThe "invert" flag.
encodingThe control code.

Definition at line 51 of file GuardEncoding.cc.

51  :
52  inverted_(inverted), encoding_(encoding), parent_(NULL) {
53 }

◆ GuardEncoding() [2/2]

GuardEncoding::GuardEncoding ( const ObjectState state)
protected

The constructor.

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

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.

Definition at line 65 of file GuardEncoding.cc.

66  : inverted_(false), encoding_(0), parent_(NULL) {
67  try {
70  } catch (const Exception& exception) {
71  const string procName = "GuardEncoding::GuardEncoding";
73  __FILE__, __LINE__, procName, exception.errorMessage());
74  }
75 }

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

Here is the call graph for this function:

Member Function Documentation

◆ encoding()

unsigned int GuardEncoding::encoding ( ) const

◆ isGuardInverted()

bool GuardEncoding::isGuardInverted ( ) const

Tells whether the guard expression is inverted.

Returns
True if the guard expression is inverted, otherwise false.

Definition at line 101 of file GuardEncoding.cc.

101  {
102  return inverted_;
103 }

References inverted_.

Referenced by GuardField::addGuardEncoding(), DefaultDecoderGenerator::findGuard(), GuardField::fuGuardEncoding(), GuardField::gprGuardEncoding(), GuardField::hasFUGuardEncoding(), GuardField::hasGPRGuardEncoding(), printGuardFieldEncodings(), GuardField::removeUnconditionalGuardEncoding(), and saveState().

◆ parent()

GuardField * GuardEncoding::parent ( ) const

◆ saveState()

ObjectState * GuardEncoding::saveState ( ) const
virtual

Saves the state of the object to an ObjectState instance.

Returns
The newly created ObjectState instance.

Reimplemented in FUGuardEncoding, GPRGuardEncoding, and UnconditionalGuardEncoding.

Definition at line 123 of file GuardEncoding.cc.

123  {
127  return state;
128 }

References encoding(), isGuardInverted(), OSKEY_ENCODING, OSKEY_INVERTED, OSNAME_GUARD_ENCODING, and ObjectState::setAttribute().

Referenced by UnconditionalGuardEncoding::saveState(), FUGuardEncoding::saveState(), and GPRGuardEncoding::saveState().

Here is the call graph for this function:

◆ setParent()

void GuardEncoding::setParent ( GuardField parent)
protected

Sets the parent pointer.

Parameters
parentThe parent.

Definition at line 137 of file GuardEncoding.cc.

137  {
138  parent_ = parent;
139 }

References parent(), and parent_.

Referenced by FUGuardEncoding::FUGuardEncoding(), GPRGuardEncoding::GPRGuardEncoding(), UnconditionalGuardEncoding::UnconditionalGuardEncoding(), FUGuardEncoding::~FUGuardEncoding(), GPRGuardEncoding::~GPRGuardEncoding(), and UnconditionalGuardEncoding::~UnconditionalGuardEncoding().

Here is the call graph for this function:

Member Data Documentation

◆ encoding_

unsigned int GuardEncoding::encoding_
private

The encoding.

Definition at line 71 of file GuardEncoding.hh.

Referenced by encoding(), and GuardEncoding().

◆ inverted_

bool GuardEncoding::inverted_
private

The "invert" flag.

Definition at line 69 of file GuardEncoding.hh.

Referenced by GuardEncoding(), and isGuardInverted().

◆ OSKEY_ENCODING

const std::string GuardEncoding::OSKEY_ENCODING = "encoding"
static

ObjectState attribute key for encoding.

Definition at line 60 of file GuardEncoding.hh.

Referenced by GuardEncoding(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), and saveState().

◆ OSKEY_INVERTED

const std::string GuardEncoding::OSKEY_INVERTED = "inverted"
static

ObjectState attribute key for invert flag.

Definition at line 58 of file GuardEncoding.hh.

Referenced by GuardEncoding(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), and saveState().

◆ OSNAME_GUARD_ENCODING

const std::string GuardEncoding::OSNAME_GUARD_ENCODING = "guard_encoding"
static

ObjectState name for guard encoding.

Definition at line 56 of file GuardEncoding.hh.

Referenced by saveState().

◆ parent_

GuardField* GuardEncoding::parent_
private

The parent guard field.

Definition at line 73 of file GuardEncoding.hh.

Referenced by parent(), and setParent().


The documentation for this class was generated from the following files:
ObjectStateLoadingException
Definition: Exception.hh:551
GuardEncoding::isGuardInverted
bool isGuardInverted() const
Definition: GuardEncoding.cc:101
ObjectState
Definition: ObjectState.hh:59
GuardEncoding::OSKEY_INVERTED
static const std::string OSKEY_INVERTED
ObjectState attribute key for invert flag.
Definition: GuardEncoding.hh:58
GuardEncoding::encoding_
unsigned int encoding_
The encoding.
Definition: GuardEncoding.hh:71
GuardEncoding::parent_
GuardField * parent_
The parent guard field.
Definition: GuardEncoding.hh:73
Exception
Definition: Exception.hh:54
GuardEncoding::encoding
unsigned int encoding() const
Definition: GuardEncoding.cc:112
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
GuardEncoding::OSNAME_GUARD_ENCODING
static const std::string OSNAME_GUARD_ENCODING
ObjectState name for guard encoding.
Definition: GuardEncoding.hh:56
GuardEncoding::inverted_
bool inverted_
The "invert" flag.
Definition: GuardEncoding.hh:69
ObjectState::boolAttribute
bool boolAttribute(const std::string &name) const
Definition: ObjectState.cc:338
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
GuardEncoding::OSKEY_ENCODING
static const std::string OSKEY_ENCODING
ObjectState attribute key for encoding.
Definition: GuardEncoding.hh:60
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
GuardEncoding::parent
GuardField * parent() const
Definition: GuardEncoding.cc:90