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

#include <DestinationField.hh>

Inheritance diagram for DestinationField:
Inheritance graph
Collaboration diagram for DestinationField:
Collaboration graph

Public Member Functions

 DestinationField (BinaryEncoding::Position socketIDPos, MoveSlot &parent)
 
 DestinationField (const ObjectState *state, MoveSlot &parent)
 
virtual ~DestinationField ()
 
virtual ObjectStatesaveState () const
 
- Public Member Functions inherited from SlotField
virtual ~SlotField ()
 
MoveSlotparent () const
 
void addSocketEncoding (SocketEncoding &encoding)
 
void removeSocketEncoding (SocketEncoding &encoding)
 
int socketEncodingCount () const
 
SocketEncodingsocketEncoding (int index) const
 
bool hasSocketEncoding (const std::string &socket) const
 
SocketEncodingsocketEncoding (const std::string &socket) const
 
void setNoOperationEncoding (NOPEncoding &encoding)
 
void unsetNoOperationEncoding ()
 
bool hasNoOperationEncoding () const
 
NOPEncodingnoOperationEncoding () const
 
BinaryEncoding::Position componentIDPosition () const
 
virtual int width () const
 
virtual int childFieldCount () const
 
virtual InstructionFieldchildField (int position) const
 
virtual void loadState (const ObjectState *state)
 
- Public Member Functions inherited from InstructionField
virtual ~InstructionField ()
 
InstructionFieldparent () const
 
int bitPosition () const
 
int relativePosition () const
 
virtual void setRelativePosition (int position)
 
void setExtraBits (int bits)
 
int extraBits () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_DESTINATION_FIELD = "dest_field"
 ObjectState name for destination field. More...
 
- Static Public Attributes inherited from SlotField
static const std::string OSNAME_SLOT_FIELD = "slot_field"
 ObjectState name for slot field. More...
 
static const std::string OSKEY_COMPONENT_ID_POSITION = "comp_id_pos"
 ObjectState attribute key for component ID position. More...
 
- Static Public Attributes inherited from InstructionField
static const std::string OSNAME_INSTRUCTION_FIELD = "instr_field"
 ObjectState name for instruction field. More...
 
static const std::string OSKEY_EXTRA_BITS = "extra_bits"
 ObjectState attribute key for the number of extra bits. More...
 
static const std::string OSKEY_POSITION = "position"
 ObjectState attribute key for the relative position of the field. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SlotField
 SlotField (BinaryEncoding::Position componentIDPos, MoveSlot &parent)
 
 SlotField (const ObjectState *state, MoveSlot &parent)
 
- Protected Member Functions inherited from InstructionField
 InstructionField (InstructionField *parent)
 
 InstructionField (const ObjectState *state, InstructionField *parent)
 
void setParent (InstructionField *parent)
 
- Static Protected Member Functions inherited from InstructionField
static void reorderSubfields (ObjectState *state)
 

Detailed Description

The DestinationField class represents the destination field of a move slot.

The destination field contains only socket encodings and so it is just a realization of SlotField class. It does not provide any additional methods.

Definition at line 44 of file DestinationField.hh.

Constructor & Destructor Documentation

◆ DestinationField() [1/2]

DestinationField::DestinationField ( BinaryEncoding::Position  socketIDPos,
MoveSlot parent 
)

The constructor.

Registers the destination field to the given move slot automatically.

Parameters
socketIDPosPosition of the socket ID within the destination field.
parentThe parent move slot.
Exceptions
ObjectAlreadyExistsIf the parent move slot already has a destination field.
IllegalParametersIf the given socket ID position is not the same with other destination fields.

Definition at line 56 of file DestinationField.cc.

58  : SlotField(socketIDPos, parent) {
59  BinaryEncoding* bem = parent.parent();
60  for (int i = 0; i < bem->moveSlotCount(); i++) {
61  MoveSlot& slot = bem->moveSlot(i);
62  if (slot.hasDestinationField() &&
63  slot.destinationField().componentIDPosition() != socketIDPos) {
64  const string procName = "SourceField::SourceField";
65  throw IllegalParameters(__FILE__, __LINE__, procName);
66  } else {
67  break;
68  }
69  }
70 
71  setParent(NULL);
73  setParent(&parent);
74 }

References SlotField::componentIDPosition(), MoveSlot::destinationField(), MoveSlot::hasDestinationField(), BinaryEncoding::moveSlot(), BinaryEncoding::moveSlotCount(), SlotField::parent(), MoveSlot::parent(), MoveSlot::setDestinationField(), and InstructionField::setParent().

Here is the call graph for this function:

◆ DestinationField() [2/2]

DestinationField::DestinationField ( const ObjectState state,
MoveSlot parent 
)

The constructor.

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

Parameters
stateThe ObjectState tree.
parentThe parent move slot.
Exceptions
ObjectStateLoadingExceptionIf an error occurs while loading the state.
ObjectAlreadyExistsIf the parent move slot already has a destination field.

Definition at line 88 of file DestinationField.cc.

89  : SlotField(state, parent) {
90  if (state->name() != OSNAME_DESTINATION_FIELD) {
91  const string procName = "DestinationField::DestinationField";
92  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
93  }
94 
95  setParent(NULL);
97  setParent(&parent);
98 }

References ObjectState::name(), OSNAME_DESTINATION_FIELD, SlotField::parent(), MoveSlot::setDestinationField(), and InstructionField::setParent().

Here is the call graph for this function:

◆ ~DestinationField()

DestinationField::~DestinationField ( )
virtual

The destructor.

Definition at line 103 of file DestinationField.cc.

103  {
104  MoveSlot* parent = this->parent();
105  assert(parent != NULL);
106  setParent(NULL);
108 }

References assert, SlotField::parent(), InstructionField::setParent(), and MoveSlot::unsetDestinationField().

Here is the call graph for this function:

Member Function Documentation

◆ saveState()

ObjectState * DestinationField::saveState ( ) const
virtual

Saves the state of the object to an ObjectState tree.

Returns
The newly created ObjectState tree.

Reimplemented from SlotField.

Definition at line 117 of file DestinationField.cc.

117  {
120  return state;
121 }

References OSNAME_DESTINATION_FIELD, SlotField::saveState(), and ObjectState::setName().

Here is the call graph for this function:

Member Data Documentation

◆ OSNAME_DESTINATION_FIELD

const std::string DestinationField::OSNAME_DESTINATION_FIELD = "dest_field"
static

The documentation for this class was generated from the following files:
BinaryEncoding
Definition: BinaryEncoding.hh:61
MoveSlot
Definition: MoveSlot.hh:60
ObjectStateLoadingException
Definition: Exception.hh:551
SlotField::saveState
virtual ObjectState * saveState() const
Definition: SlotField.cc:388
ObjectState
Definition: ObjectState.hh:59
MoveSlot::unsetDestinationField
void unsetDestinationField()
Definition: MoveSlot.cc:314
ObjectState::setName
void setName(const std::string &name)
assert
#define assert(condition)
Definition: Application.hh:86
IllegalParameters
Definition: Exception.hh:113
MoveSlot::hasDestinationField
bool hasDestinationField() const
Definition: MoveSlot.cc:327
InstructionField::setParent
void setParent(InstructionField *parent)
Definition: InstructionField.cc:282
DestinationField::OSNAME_DESTINATION_FIELD
static const std::string OSNAME_DESTINATION_FIELD
ObjectState name for destination field.
Definition: DestinationField.hh:54
SlotField::componentIDPosition
BinaryEncoding::Position componentIDPosition() const
Definition: SlotField.cc:296
ObjectState::name
std::string name() const
MoveSlot::parent
BinaryEncoding * parent() const
Definition: MoveSlot.cc:118
MoveSlot::setDestinationField
void setDestinationField(DestinationField &field)
Definition: MoveSlot.cc:296
BinaryEncoding::moveSlot
MoveSlot & moveSlot(int index) const
Definition: BinaryEncoding.cc:121
MoveSlot::destinationField
DestinationField & destinationField() const
Definition: MoveSlot.cc:341
SlotField::SlotField
SlotField(BinaryEncoding::Position componentIDPos, MoveSlot &parent)
Definition: SlotField.cc:60
BinaryEncoding::moveSlotCount
int moveSlotCount() const
Definition: BinaryEncoding.cc:104
SlotField::parent
MoveSlot * parent() const
Definition: SlotField.cc:98