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

#include <OperationTriggeredField.hh>

Inheritance diagram for OperationTriggeredField:
Inheritance graph
Collaboration diagram for OperationTriggeredField:
Collaboration graph

Public Member Functions

 OperationTriggeredField (const ObjectState *state, OperationTriggeredEncoding &parent)
 
 OperationTriggeredField (OperationTriggeredEncoding &parent, int piece, int start, int width)
 
int piece () const
 
void setPiece (int piece)
 
int start () const
 
void setStart (int start)
 
virtual void loadState (const ObjectState *state)
 
virtual ObjectStatesaveState () const
 
virtual int childFieldCount () const
 
virtual int width () const
 
void setWidth (int width)
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_FIELD = "ota-field"
 
static const std::string OSKEY_PIECE_NAME = "piece"
 
static const std::string OSKEY_START_NAME = "start"
 
static const std::string OSKEY_WIDTH_NAME = "width"
 

Private Attributes

int piece_
 
int start_
 
int width_
 

Detailed Description

Definition at line 43 of file OperationTriggeredField.hh.

Constructor & Destructor Documentation

◆ OperationTriggeredField() [1/2]

OperationTriggeredField::OperationTriggeredField ( const ObjectState state,
OperationTriggeredEncoding parent 
)

The constructor

Loads the state of the field encoding from the given ObjectState tree

Parameters
stateThe ObjectState tree
parentThe parent operation triggered encoding
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.

Definition at line 69 of file OperationTriggeredField.cc.

70  {
71  parent.addField(*this);
72  loadState(state);
73 }

References OperationTriggeredEncoding::addField(), and loadState().

Here is the call graph for this function:

◆ OperationTriggeredField() [2/2]

OperationTriggeredField::OperationTriggeredField ( OperationTriggeredEncoding parent,
int  piece,
int  start,
int  width 
)

The constructor.

Registers the field encoding to the parent binary encoding automatically.

Parameters
parentThe parent binaryEncoding.

Definition at line 51 of file OperationTriggeredField.cc.

54  parent.addField(*this);
55 }

References OperationTriggeredEncoding::addField().

Here is the call graph for this function:

Member Function Documentation

◆ childFieldCount()

int OperationTriggeredField::childFieldCount ( ) const
virtual

Always returns 0 because field encoding does not have any child fields.

Returns
0

Definition at line 115 of file OperationTriggeredField.cc.

115  {
116  return 0;
117 }

◆ loadState()

void OperationTriggeredField::loadState ( const ObjectState state)
virtual

Loads the state of the field encoding from the given ObjectState tree.

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

Implements Serializable.

Definition at line 145 of file OperationTriggeredField.cc.

145  {
146  ObjectState* newState = new ObjectState(*state);
147 
148  try {
149  piece_ = newState->intAttribute(OSKEY_PIECE_NAME);
150  start_ = newState->intAttribute(OSKEY_START_NAME);
151  width_ = newState->intAttribute(OSKEY_WIDTH_NAME);
152 
153  } catch (const Exception& exception) {
154  const std::string procName = "OperationTriggeredField::loadState";
156  __FILE__, __LINE__, procName, exception.errorMessage());
157  }
158 
159  delete newState;
160 }

References Exception::errorMessage(), ObjectState::intAttribute(), OSKEY_PIECE_NAME, OSKEY_START_NAME, OSKEY_WIDTH_NAME, piece_, start_, and width_.

Referenced by OperationTriggeredField().

Here is the call graph for this function:

◆ piece()

int OperationTriggeredField::piece ( ) const

Returns the piece index that indicates the index of the encoding piece.

Returns
The encoding piece index.

Definition at line 82 of file OperationTriggeredField.cc.

82  {
83  return piece_;
84 }

References piece_.

Referenced by setPiece().

◆ saveState()

ObjectState * OperationTriggeredField::saveState ( ) const
virtual

Saves the state of the field encoding to an ObjectState tree.

Returns
The newly created ObjectState tree.

Implements Serializable.

Definition at line 170 of file OperationTriggeredField.cc.

170  {
171  ObjectState* state = new ObjectState(OSNAME_FIELD);
175 
176  return state;
177 }

References OSKEY_PIECE_NAME, OSKEY_START_NAME, OSKEY_WIDTH_NAME, OSNAME_FIELD, piece_, ObjectState::setAttribute(), start_, and width_.

Referenced by OperationTriggeredEncoding::saveState().

Here is the call graph for this function:

◆ setPiece()

void OperationTriggeredField::setPiece ( int  piece)

Definition at line 87 of file OperationTriggeredField.cc.

87  {
88  piece_ = piece;
89 }

References piece(), and piece_.

Here is the call graph for this function:

◆ setStart()

void OperationTriggeredField::setStart ( int  start)

Definition at line 103 of file OperationTriggeredField.cc.

103  {
104  start_ = start;
105 }

References start(), and start_.

Here is the call graph for this function:

◆ setWidth()

void OperationTriggeredField::setWidth ( int  width)

Definition at line 131 of file OperationTriggeredField.cc.

131  {
132  width_ = width;
133 }

References width(), and width_.

Here is the call graph for this function:

◆ start()

int OperationTriggeredField::start ( ) const

Returns the piece index that indicates the index of the encoding piece.

Returns
The encoding piece index.

Definition at line 98 of file OperationTriggeredField.cc.

98  {
99  return start_;
100 }

References start_.

Referenced by setStart().

◆ width()

int OperationTriggeredField::width ( ) const
virtual

Returns the bit width of the field encoding

Returns
The bit width of the field encoding.

Definition at line 126 of file OperationTriggeredField.cc.

126  {
127  return width_;
128 }

References width_.

Referenced by setWidth(), and OperationTriggeredEncoding::width().

Member Data Documentation

◆ OSKEY_PIECE_NAME

const std::string OperationTriggeredField::OSKEY_PIECE_NAME = "piece"
static

Definition at line 66 of file OperationTriggeredField.hh.

Referenced by loadState(), and saveState().

◆ OSKEY_START_NAME

const std::string OperationTriggeredField::OSKEY_START_NAME = "start"
static

Definition at line 67 of file OperationTriggeredField.hh.

Referenced by loadState(), and saveState().

◆ OSKEY_WIDTH_NAME

const std::string OperationTriggeredField::OSKEY_WIDTH_NAME = "width"
static

Definition at line 68 of file OperationTriggeredField.hh.

Referenced by loadState(), and saveState().

◆ OSNAME_FIELD

const std::string OperationTriggeredField::OSNAME_FIELD = "ota-field"
static

Definition at line 65 of file OperationTriggeredField.hh.

Referenced by OperationTriggeredEncoding::loadState(), and saveState().

◆ piece_

int OperationTriggeredField::piece_
private

Definition at line 71 of file OperationTriggeredField.hh.

Referenced by loadState(), piece(), saveState(), and setPiece().

◆ start_

int OperationTriggeredField::start_
private

Definition at line 72 of file OperationTriggeredField.hh.

Referenced by loadState(), saveState(), setStart(), and start().

◆ width_

int OperationTriggeredField::width_
private

Definition at line 73 of file OperationTriggeredField.hh.

Referenced by loadState(), saveState(), setWidth(), and width().


The documentation for this class was generated from the following files:
OperationTriggeredField::OSKEY_PIECE_NAME
static const std::string OSKEY_PIECE_NAME
Definition: OperationTriggeredField.hh:66
OperationTriggeredField::start
int start() const
Definition: OperationTriggeredField.cc:98
ObjectStateLoadingException
Definition: Exception.hh:551
OperationTriggeredField::OSNAME_FIELD
static const std::string OSNAME_FIELD
Definition: OperationTriggeredField.hh:65
ObjectState
Definition: ObjectState.hh:59
OperationTriggeredField::loadState
virtual void loadState(const ObjectState *state)
Definition: OperationTriggeredField.cc:145
OperationTriggeredEncoding::addField
void addField(OperationTriggeredField &field)
Definition: OperationTriggeredEncoding.cc:138
OperationTriggeredField::piece
int piece() const
Definition: OperationTriggeredField.cc:82
OperationTriggeredField::OSKEY_WIDTH_NAME
static const std::string OSKEY_WIDTH_NAME
Definition: OperationTriggeredField.hh:68
Exception
Definition: Exception.hh:54
OperationTriggeredField::start_
int start_
Definition: OperationTriggeredField.hh:72
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
OperationTriggeredField::width_
int width_
Definition: OperationTriggeredField.hh:73
OperationTriggeredField::width
virtual int width() const
Definition: OperationTriggeredField.cc:126
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
OperationTriggeredField::OSKEY_START_NAME
static const std::string OSKEY_START_NAME
Definition: OperationTriggeredField.hh:67
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
OperationTriggeredField::piece_
int piece_
Definition: OperationTriggeredField.hh:71