OpenASIP  2.0
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
TTAMachine::OperationTriggeredOperand Class Reference

#include <OperationTriggeredOperand.hh>

Inheritance diagram for TTAMachine::OperationTriggeredOperand:
Inheritance graph
Collaboration diagram for TTAMachine::OperationTriggeredOperand:
Collaboration graph

Public Member Functions

 OperationTriggeredOperand (const std::string &name, OperationTriggeredFormat &parent)
 
 OperationTriggeredOperand (const ObjectState *state, OperationTriggeredFormat &parent)
 
virtual ~OperationTriggeredOperand ()
 
const std::string & name () const
 
virtual void setName (const std::string &name)
 
std::string type () const
 
void setType (const std::string &type)
 
std::string direction () const
 
void setDirection (const std::string &direction)
 
virtual void loadState (const ObjectState *state)
 
virtual ObjectStatesaveState () const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 

Static Public Attributes

static const std::string OSNAME_OPERAND = "operand"
 
static const std::string OSKEY_TYPE = "type"
 
static const std::string OSKEY_DIRECTION = "direction"
 
static const std::string OSKEY_NAME = "name"
 

Private Attributes

std::string name_
 
std::string type_
 
std::string direction_
 

Additional Inherited Members

- Protected Member Functions inherited from TTAMachine::SubComponent
 SubComponent ()
 
virtual ~SubComponent ()
 
- Protected Member Functions inherited from TTAMachine::MachinePart
 MachinePart ()
 
virtual ~MachinePart ()
 

Detailed Description

Definition at line 44 of file OperationTriggeredOperand.hh.

Constructor & Destructor Documentation

◆ OperationTriggeredOperand() [1/2]

TTAMachine::OperationTriggeredOperand::OperationTriggeredOperand ( const std::string &  name,
OperationTriggeredFormat parent 
)

The constructor.

Registers the operation code encoding to the parent binary encoding automatically.

Parameters
parentThe parent OperationTriggeredFormat.

Definition at line 54 of file OperationTriggeredOperand.cc.

56  : SubComponent(), name_(name), type_(""), direction_("") {
58  parent.addOperand(*this);
59 }

References TTAMachine::OperationTriggeredFormat::addOperand(), name(), name_, and StringTools::stringToLower().

Here is the call graph for this function:

◆ OperationTriggeredOperand() [2/2]

TTAMachine::OperationTriggeredOperand::OperationTriggeredOperand ( const ObjectState state,
OperationTriggeredFormat parent 
)

The constructor

Loads the state of the operation code encoding from the given ObjectState tree

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

Definition at line 73 of file OperationTriggeredOperand.cc.

75  : SubComponent(), name_(""), type_(""), direction_("") {
76  const std::string procName =
77  "OperationTriggeredOperand::OperationTriggeredOperand";
78  // set name
79  try {
81  } catch (const Exception& exception) {
83  __FILE__, __LINE__, procName, exception.errorMessage());
84  }
85  parent.addOperand(*this);
86  loadState(state);
87 }

References TTAMachine::OperationTriggeredFormat::addOperand(), Exception::errorMessage(), loadState(), OSKEY_NAME, setName(), and ObjectState::stringAttribute().

Here is the call graph for this function:

◆ ~OperationTriggeredOperand()

TTAMachine::OperationTriggeredOperand::~OperationTriggeredOperand ( )
virtual

Destructor.

Definition at line 92 of file OperationTriggeredOperand.cc.

92  {
93  // TODO
94 }

Member Function Documentation

◆ direction()

std::string TTAMachine::OperationTriggeredOperand::direction ( ) const

Definition at line 132 of file OperationTriggeredOperand.cc.

132  {
133  return direction_;
134 }

References direction_.

Referenced by setDirection().

◆ loadState()

void TTAMachine::OperationTriggeredOperand::loadState ( const ObjectState state)
virtual

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

Parameters
stateObjectState object from which (and the children of which) the state is loaded.

Implements Serializable.

Definition at line 142 of file OperationTriggeredOperand.cc.

142  {
143  ObjectState* newState = new ObjectState(*state);
144  try {
145  type_ = state->stringAttribute(OSKEY_TYPE);
147  } catch (const Exception& exception) {
148  const std::string procName = "OperationTriggeredOperand::loadState";
150  __FILE__, __LINE__, procName, exception.errorMessage());
151  }
152 
153  delete newState;
154 }

References direction_, Exception::errorMessage(), OSKEY_DIRECTION, OSKEY_TYPE, ObjectState::stringAttribute(), and type_.

Referenced by OperationTriggeredOperand().

Here is the call graph for this function:

◆ name()

const std::string & TTAMachine::OperationTriggeredOperand::name ( ) const

Returns the name of the operation.

Returns
The name of the operation.

Definition at line 102 of file OperationTriggeredOperand.cc.

102  {
103  return name_;
104 }

References name_.

Referenced by OperationTriggeredOperand(), and setName().

◆ saveState()

ObjectState * TTAMachine::OperationTriggeredOperand::saveState ( ) const
virtual

Saves the state of the operation code encoding to an ObjectState tree.

Returns
The newly created ObjectState tree.

Implements Serializable.

Definition at line 164 of file OperationTriggeredOperand.cc.

164  {
165  ObjectState* state = new ObjectState(OSNAME_OPERAND);
166  state->setAttribute(OSKEY_NAME, name_);
167  state->setAttribute(OSKEY_TYPE, type_);
169 
170  return state;
171 }

References direction_, name_, OSKEY_DIRECTION, OSKEY_NAME, OSKEY_TYPE, OSNAME_OPERAND, ObjectState::setAttribute(), and type_.

Here is the call graph for this function:

◆ setDirection()

void TTAMachine::OperationTriggeredOperand::setDirection ( const std::string &  direction)

Definition at line 137 of file OperationTriggeredOperand.cc.

137  {
138  type_ = direction;
139 }

References direction(), and type_.

Here is the call graph for this function:

◆ setName()

void TTAMachine::OperationTriggeredOperand::setName ( const std::string &  name)
virtual

Sets the name of the operand.

Parameters
nameThe new name.

Definition at line 112 of file OperationTriggeredOperand.cc.

112  {
113  std::string lowerName = StringTools::stringToLower(name);
114 
115  if (lowerName == this->name()) {
116  return;
117  }
118  name_ = lowerName;
119 }

References name(), name_, and StringTools::stringToLower().

Referenced by OperationTriggeredOperand().

Here is the call graph for this function:

◆ setType()

void TTAMachine::OperationTriggeredOperand::setType ( const std::string &  type)

Definition at line 127 of file OperationTriggeredOperand.cc.

127  {
128  type_ = type;
129 }

References type(), and type_.

Here is the call graph for this function:

◆ type()

std::string TTAMachine::OperationTriggeredOperand::type ( ) const

Definition at line 122 of file OperationTriggeredOperand.cc.

122  {
123  return type_;
124 }

References type_.

Referenced by setType().

Member Data Documentation

◆ direction_

std::string TTAMachine::OperationTriggeredOperand::direction_
private

Definition at line 77 of file OperationTriggeredOperand.hh.

Referenced by direction(), loadState(), and saveState().

◆ name_

std::string TTAMachine::OperationTriggeredOperand::name_
private

Definition at line 75 of file OperationTriggeredOperand.hh.

Referenced by name(), OperationTriggeredOperand(), saveState(), and setName().

◆ OSKEY_DIRECTION

const std::string TTAMachine::OperationTriggeredOperand::OSKEY_DIRECTION = "direction"
static

Definition at line 70 of file OperationTriggeredOperand.hh.

Referenced by loadState(), and saveState().

◆ OSKEY_NAME

const std::string TTAMachine::OperationTriggeredOperand::OSKEY_NAME = "name"
static

Definition at line 71 of file OperationTriggeredOperand.hh.

Referenced by OperationTriggeredOperand(), and saveState().

◆ OSKEY_TYPE

const std::string TTAMachine::OperationTriggeredOperand::OSKEY_TYPE = "type"
static

Definition at line 69 of file OperationTriggeredOperand.hh.

Referenced by loadState(), and saveState().

◆ OSNAME_OPERAND

const std::string TTAMachine::OperationTriggeredOperand::OSNAME_OPERAND = "operand"
static

◆ type_

std::string TTAMachine::OperationTriggeredOperand::type_
private

Definition at line 76 of file OperationTriggeredOperand.hh.

Referenced by loadState(), saveState(), setDirection(), setType(), and type().


The documentation for this class was generated from the following files:
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
ObjectStateLoadingException
Definition: Exception.hh:551
TTAMachine::OperationTriggeredOperand::direction_
std::string direction_
Definition: OperationTriggeredOperand.hh:77
TTAMachine::OperationTriggeredOperand::OSKEY_TYPE
static const std::string OSKEY_TYPE
Definition: OperationTriggeredOperand.hh:69
TTAMachine::SubComponent::SubComponent
SubComponent()
Definition: MachinePart.cc:237
TTAMachine::OperationTriggeredOperand::type
std::string type() const
Definition: OperationTriggeredOperand.cc:122
TTAMachine::OperationTriggeredOperand::OSKEY_NAME
static const std::string OSKEY_NAME
Definition: OperationTriggeredOperand.hh:71
ObjectState
Definition: ObjectState.hh:59
TTAMachine::OperationTriggeredOperand::OSKEY_DIRECTION
static const std::string OSKEY_DIRECTION
Definition: OperationTriggeredOperand.hh:70
TTAMachine::OperationTriggeredOperand::OSNAME_OPERAND
static const std::string OSNAME_OPERAND
Definition: OperationTriggeredOperand.hh:68
TTAMachine::OperationTriggeredOperand::name
const std::string & name() const
Definition: OperationTriggeredOperand.cc:102
TTAMachine::OperationTriggeredOperand::name_
std::string name_
Definition: OperationTriggeredOperand.hh:75
TTAMachine::OperationTriggeredOperand::loadState
virtual void loadState(const ObjectState *state)
Definition: OperationTriggeredOperand.cc:142
TTAMachine::OperationTriggeredOperand::direction
std::string direction() const
Definition: OperationTriggeredOperand.cc:132
Exception
Definition: Exception.hh:54
TTAMachine::OperationTriggeredOperand::setName
virtual void setName(const std::string &name)
Definition: OperationTriggeredOperand.cc:112
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
TTAMachine::OperationTriggeredOperand::type_
std::string type_
Definition: OperationTriggeredOperand.hh:76
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100