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

#include <FUGuardEncoding.hh>

Inheritance diagram for FUGuardEncoding:
Inheritance graph
Collaboration diagram for FUGuardEncoding:
Collaboration graph

Public Member Functions

 FUGuardEncoding (const std::string &fu, const std::string &port, bool inverted, unsigned int encoding, GuardField &parent)
 
 FUGuardEncoding (const ObjectState *state, GuardField &parent)
 
virtual ~FUGuardEncoding ()
 
std::string functionUnit () const
 
std::string port () const
 
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_FU_GUARD_ENCODING = "fu_guard_enc"
 ObjectState name for FU guard encoding. More...
 
static const std::string OSKEY_FU_NAME = "fu_name"
 ObjectState attribute key for the name of the function unit. More...
 
static const std::string OSKEY_PORT_NAME = "port_name"
 ObjectState attribute key for the name of the port. 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...
 

Private Attributes

std::string functionUnit_
 Name of the function unit. More...
 
std::string port_
 Name of the port. 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 FUGuardEncoding class maps a guard expression with FU output port term to a control code.

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

Definition at line 47 of file FUGuardEncoding.hh.

Constructor & Destructor Documentation

◆ FUGuardEncoding() [1/2]

FUGuardEncoding::FUGuardEncoding ( const std::string &  fu,
const std::string &  port,
bool  inverted,
unsigned int  encoding,
GuardField parent 
)

The constructor.

Creates a guard encoding and registers it into the given guard field. The guard expression is identified by the name of function unit and port, and the "invert" flag, all given as parameters.

Parameters
fuName of the function unit.
portName of the port.
invertedThe "invert" flag.
encodingThe control code of the guard expression.
parentThe parent guard field.
Exceptions
ObjectAlreadyExistsIf the guard expression is already encoded in the parent field, or if the given control code is already assigned to another guard expression.

Definition at line 62 of file FUGuardEncoding.cc.

65  : GuardEncoding(inverted, encoding), functionUnit_(fu), port_(port) {
66  parent.addGuardEncoding(*this);
67  setParent(&parent);
68 }

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

Here is the call graph for this function:

◆ FUGuardEncoding() [2/2]

FUGuardEncoding::FUGuardEncoding ( 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 expression if already encoded in the parent field, or if the given control code is already assigned to another guard expression.

Definition at line 84 of file FUGuardEncoding.cc.

85  : GuardEncoding(state), functionUnit_(""), port_("") {
86  const string procName = "FUGuardEncoding::FUGuardEncoding";
87 
88  if (state->name() != OSNAME_FU_GUARD_ENCODING) {
89  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
90  }
91 
92  try {
95  } catch (const Exception& exception) {
97  __FILE__, __LINE__, procName, exception.errorMessage());
98  }
99 
100  parent.addGuardEncoding(*this);
101  setParent(&parent);
102 }

References GuardField::addGuardEncoding(), Exception::errorMessage(), functionUnit_, ObjectState::name(), OSKEY_FU_NAME, OSKEY_PORT_NAME, OSNAME_FU_GUARD_ENCODING, GuardEncoding::parent(), port_, GuardEncoding::setParent(), and ObjectState::stringAttribute().

Here is the call graph for this function:

◆ ~FUGuardEncoding()

FUGuardEncoding::~FUGuardEncoding ( )
virtual

The destructor.

Definition at line 107 of file FUGuardEncoding.cc.

107  {
108  GuardField* parent = this->parent();
109  setParent(NULL);
110  parent->removeGuardEncoding(*this);
111 }

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

Here is the call graph for this function:

Member Function Documentation

◆ functionUnit()

std::string FUGuardEncoding::functionUnit ( ) const

Returns the name of the function unit that contains the port of this guard expression.

Returns
The name of the function unit.

Definition at line 121 of file FUGuardEncoding.cc.

121  {
122  return functionUnit_;
123 }

References functionUnit_.

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

◆ port()

std::string FUGuardEncoding::port ( ) const

Returns the name of the FU port of this guard expression.

Returns
The name of the FU port.

Definition at line 132 of file FUGuardEncoding.cc.

132  {
133  return port_;
134 }

References port_.

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

◆ saveState()

ObjectState * FUGuardEncoding::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 143 of file FUGuardEncoding.cc.

143  {
147  state->setAttribute(OSKEY_PORT_NAME, port());
148  return state;
149 }

References functionUnit(), OSKEY_FU_NAME, OSKEY_PORT_NAME, OSNAME_FU_GUARD_ENCODING, port(), GuardEncoding::saveState(), ObjectState::setAttribute(), and ObjectState::setName().

Referenced by GuardField::saveState().

Here is the call graph for this function:

Member Data Documentation

◆ functionUnit_

std::string FUGuardEncoding::functionUnit_
private

Name of the function unit.

Definition at line 69 of file FUGuardEncoding.hh.

Referenced by FUGuardEncoding(), and functionUnit().

◆ OSKEY_FU_NAME

const std::string FUGuardEncoding::OSKEY_FU_NAME = "fu_name"
static

ObjectState attribute key for the name of the function unit.

Definition at line 63 of file FUGuardEncoding.hh.

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

◆ OSKEY_PORT_NAME

const std::string FUGuardEncoding::OSKEY_PORT_NAME = "port_name"
static

ObjectState attribute key for the name of the port.

Definition at line 65 of file FUGuardEncoding.hh.

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

◆ OSNAME_FU_GUARD_ENCODING

const std::string FUGuardEncoding::OSNAME_FU_GUARD_ENCODING = "fu_guard_enc"
static

◆ port_

std::string FUGuardEncoding::port_
private

Name of the port.

Definition at line 71 of file FUGuardEncoding.hh.

Referenced by FUGuardEncoding(), and port().


The documentation for this class was generated from the following files:
FUGuardEncoding::OSKEY_PORT_NAME
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
Definition: FUGuardEncoding.hh:65
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
ObjectStateLoadingException
Definition: Exception.hh:551
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
FUGuardEncoding::functionUnit
std::string functionUnit() const
Definition: FUGuardEncoding.cc:121
GuardEncoding::setParent
void setParent(GuardField *parent)
Definition: GuardEncoding.cc:137
FUGuardEncoding::OSNAME_FU_GUARD_ENCODING
static const std::string OSNAME_FU_GUARD_ENCODING
ObjectState name for FU guard encoding.
Definition: FUGuardEncoding.hh:61
FUGuardEncoding::functionUnit_
std::string functionUnit_
Name of the function unit.
Definition: FUGuardEncoding.hh:69
Exception
Definition: Exception.hh:54
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
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
GuardField::removeGuardEncoding
void removeGuardEncoding(GPRGuardEncoding &encoding)
Definition: GuardField.cc:163
FUGuardEncoding::port
std::string port() const
Definition: FUGuardEncoding.cc:132
FUGuardEncoding::OSKEY_FU_NAME
static const std::string OSKEY_FU_NAME
ObjectState attribute key for the name of the function unit.
Definition: FUGuardEncoding.hh:63
GuardEncoding::saveState
virtual ObjectState * saveState() const
Definition: GuardEncoding.cc:123
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
FUGuardEncoding::port_
std::string port_
Name of the port.
Definition: FUGuardEncoding.hh:71
GuardEncoding::parent
GuardField * parent() const
Definition: GuardEncoding.cc:90