OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
static const std::string OSKEY_FU_NAME = "fu_name"
 ObjectState attribute key for the name of the function unit.
 
static const std::string OSKEY_PORT_NAME = "port_name"
 ObjectState attribute key for the name of the port.
 
- Static Public Attributes inherited from GuardEncoding
static const std::string OSNAME_GUARD_ENCODING = "guard_encoding"
 ObjectState name for guard encoding.
 
static const std::string OSKEY_INVERTED = "inverted"
 ObjectState attribute key for invert flag.
 
static const std::string OSKEY_ENCODING = "encoding"
 ObjectState attribute key for encoding.
 

Private Attributes

std::string functionUnit_
 Name of the function unit.
 
std::string port_
 Name of the port.
 

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) {
68}
std::string functionUnit_
Name of the function unit.
std::string port() const
std::string port_
Name of the port.
GuardField * parent() const
unsigned int encoding() const
void setParent(GuardField *parent)
void addGuardEncoding(GPRGuardEncoding &encoding)

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
102}
std::string errorMessage() const
Definition Exception.cc:123
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
static const std::string OSNAME_FU_GUARD_ENCODING
ObjectState name for FU guard encoding.
static const std::string OSKEY_FU_NAME
ObjectState attribute key for the name of the function unit.
std::string stringAttribute(const std::string &name) const
std::string name() const

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);
111}
void removeGuardEncoding(GPRGuardEncoding &encoding)

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 {
148 return state;
149}
std::string functionUnit() const
virtual ObjectState * saveState() const
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)

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: