OpenASIP  2.0
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ObjectState Class Reference

#include <ObjectState.hh>

Collaboration diagram for ObjectState:
Collaboration graph

Classes

struct  Attribute
 Struct for describing an attribute of the XML element. More...
 

Public Member Functions

 ObjectState (const std::string &name, ObjectState *parent=NULL)
 
 ObjectState (const ObjectState &old)
 
 ~ObjectState ()
 
ObjectStateparent () const
 
std::string name () const
 
void setName (const std::string &name)
 
void setValue (const std::string &value)
 
void setValue (int value)
 
void setValue (double value)
 
void setValue (bool value)
 
void setValue (UIntWord value)
 
std::string stringValue () const
 
int intValue () const
 
unsigned int unsignedIntValue () const
 
double doubleValue () const
 
bool boolValue () const
 
int UIntWordValue () const
 
void setAttribute (const std::string &name, const std::string &value)
 
void setAttribute (const std::string &name, int value)
 
void setAttribute (const std::string &name, unsigned int value)
 
void setAttribute (const std::string &name, double value)
 
void setAttribute (const std::string &name, bool value)
 
void setAttribute (const std::string &name, ULongWord value)
 
int attributeCount () const
 
Attributeattribute (int index) const
 
bool hasAttribute (const std::string &name) const
 
std::string stringAttribute (const std::string &name) const
 
int intAttribute (const std::string &name) const
 
unsigned int unsignedIntAttribute (const std::string &name) const
 
double doubleAttribute (const std::string &name) const
 
bool boolAttribute (const std::string &name) const
 
UIntWord UIntWordAttribute (const std::string &name) const
 
ULongWord uLongAttribute (const std::string &name) const
 
bool hasChild (const std::string &name) const
 
void addChild (ObjectState *child)
 
void removeChild (ObjectState *child)
 
void replaceChild (ObjectState *old, ObjectState *newChild)
 
int childCount () const
 
ObjectStatechildByName (const std::string &name) const
 
ObjectStatechild (int index) const
 
bool operator!= (const ObjectState &object)
 

Static Public Member Functions

static void dumpObjectState (const ObjectState &state, std::ostream &output, const std::string &identation="")
 

Private Types

typedef std::vector< ObjectState * > ChildTable
 Table of child ObjectState. More...
 
typedef std::vector< AttributeAttributeTable
 Table of attributes. More...
 

Private Member Functions

ObjectStateoperator= (const ObjectState &old)
 Assingment forbidden. More...
 
std::string commonErrorMessage () const
 

Private Attributes

std::string name_
 Name of the element. More...
 
std::string value_
 The value of a leaf element. More...
 
ObjectStateparent_
 The parent element. More...
 
ChildTable children_
 The child elements. More...
 
AttributeTable attributes_
 Contains all the attributes of the element. More...
 

Detailed Description

Class ObjectState represents state of an object.

It may contain attribute-value pairs of the object and a main value. It may be used as a node in tree structure or alone. If a class is going to be serialized to a file, it must be able to create an ObjectState object of itself. It must be able to create itself from an ObjectState object too. That is, it must implement the Serializable interface. ObjectState tree is a general structure which can be handled by many different kind of serializers, for example XMLSerializer. Serializers can read a file create an ObjectState tree according to it and they can write a file of a certain format according to a ObjectState tree. ObjectState enables an easy way to serialize an object model to different kinds of file formats.

Definition at line 59 of file ObjectState.hh.

Member Typedef Documentation

◆ AttributeTable

typedef std::vector<Attribute> ObjectState::AttributeTable
private

Table of attributes.

Definition at line 127 of file ObjectState.hh.

◆ ChildTable

typedef std::vector<ObjectState*> ObjectState::ChildTable
private

Table of child ObjectState.

Definition at line 125 of file ObjectState.hh.

Constructor & Destructor Documentation

◆ ObjectState() [1/2]

ObjectState::ObjectState ( const std::string &  name,
ObjectState parent = NULL 
)

Constructor.

Parameters
nameName of the ObjectState.
parentParent of this object. If non-NULL, this object is added to the parent with addChild().

Definition at line 51 of file ObjectState.cc.

51  :
52  name_(name), value_(""), parent_(parent) {
53  if (parent != NULL) {
54  parent->addChild(this);
55  }
56 }

References addChild(), and parent().

Referenced by ObjectState().

Here is the call graph for this function:

◆ ObjectState() [2/2]

ObjectState::ObjectState ( const ObjectState old)

Copy constructor.

Makes a deep copy.

Parameters
oldThe ObjectState tree to copy.

Definition at line 65 of file ObjectState.cc.

65  :
66  name_(old.name_), value_(old.value_), parent_(NULL),
68 
69  for (int i = 0; i < old.childCount(); i++) {
70  ObjectState* newChild = new ObjectState(*old.child(i));
71  addChild(newChild);
72  }
73 }

References addChild(), child(), childCount(), and ObjectState().

Here is the call graph for this function:

◆ ~ObjectState()

ObjectState::~ObjectState ( )

Destructor.

Deletes all the children as well and removes itself from the list of child objects of the parent object. That is, the parent object will stay valid.

Definition at line 81 of file ObjectState.cc.

81  {
82  if (parent_ != NULL) {
84  parent_->children_, this);
85  assert(removed);
86  }
88 }

References assert, children_, SequenceTools::deleteAllItems(), parent_, and ContainerTools::removeValueIfExists().

Here is the call graph for this function:

Member Function Documentation

◆ addChild()

void ObjectState::addChild ( ObjectState child)

Adds a child object.

Parameters
childObjectState object to be added as a child.

Definition at line 376 of file ObjectState.cc.

376  {
377  children_.push_back(child);
378  child->parent_ = this;
379 }

References child(), children_, and parent_.

Referenced by IPXactModel::addAddressSpaceObject(), IPXactModel::addBusInterfaceObject(), IPXactModel::addFileObject(), IPXactModel::addModelParamsObject(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), IPXactModel::addSignalObject(), ADFSerializer::bridgeToMDF(), ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), ADFSerializer::controlUnitToMachine(), ADFSerializer::controlUnitToMDF(), ProDeOptionsSerializer::convertToConfigFileFormat(), GUIOptionsSerializer::convertToConfigFileFormat(), BEMSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToFileFormat(), ADFSerializer::convertToMDFFormat(), BEMSerializer::convertToOMFormat(), IDF::IDFSerializer::convertToOMFormat(), OperationSerializer::convertToOperationFormat(), OperationSerializer::convertToXMLFormat(), XMLSerializer::createState(), OSEdAddOperationCmd::Do(), ADFSerializer::functionUnitToMachine(), ADFSerializer::functionUnitToMDF(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), BEMSerializer::immediateSlotToFile(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMachine(), ADFSerializer::instructionTemplateToMDF(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::mdfFUPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), ADFSerializer::mdfPort(), ADFSerializer::mdfSRPort(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), ObjectState(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), InstructionField::reorderSubfields(), TTAMachine::Machine::saveComponentStates(), TTAMachine::ExecutionPipeline::saveOperandUse(), OperationPropertyDialog::saveOperation(), TTAMachine::ExecutionPipeline::saveResourceUse(), OSEdOptions::saveState(), IDF::FUGenerated::saveState(), OperationTriggeredEncoding::saveState(), TTAMachine::Unit::saveState(), LImmDstRegisterField::saveState(), IPXactModel::saveState(), TTAMachine::OperationTriggeredFormat::saveState(), SourceField::saveState(), InstructionFormat::saveState(), TTAMachine::HWOperation::saveState(), ImmediateControlField::saveState(), GUIOptions::saveState(), SlotField::saveState(), TTAMachine::InstructionTemplate::saveState(), MoveSlot::saveState(), GuardField::saveState(), TTAMachine::Socket::saveState(), TTAMachine::FunctionUnit::saveState(), TTAMachine::Bus::saveState(), OperationPimpl::saveState(), SocketCodeTable::saveState(), BinaryEncoding::saveState(), IDF::MachineImplementation::saveState(), Operand::saveState(), TTAMachine::Machine::saveState(), OperationSerializer::setOperandProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), ADFSerializer::socketToMachine(), ADFSerializer::socketToMDF(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), InputOperandDialog::updateOperand(), and DataDependenceGraph::writeToXMLFile().

Here is the call graph for this function:

◆ attribute()

ObjectState::Attribute * ObjectState::attribute ( int  index) const

Returns an attribute by the given index.

The value of index must be greater or equal to 0 and less than the number of attributes.

Parameters
indexThe index of the requested attribute.
Returns
Attribute by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Definition at line 228 of file ObjectState.cc.

228  {
229  if (index < 0 || index >= attributeCount()) {
230  const string procName = "ObjectState::attribute";
231  string errorMsg = commonErrorMessage();
232  errorMsg += "Requested attribute by index '";
233  errorMsg += Conversion::toString(index);
234  errorMsg += "' which is out of range.";
235  throw OutOfRange(__FILE__, __LINE__, procName, errorMsg);
236  } else {
237  return const_cast<Attribute*>(&attributes_[index]);
238  }
239 }

References attributeCount(), attributes_, commonErrorMessage(), and Conversion::toString().

Referenced by XMLSerializer::createDOM(), XMLSerializer::createDOMDocument(), and dumpObjectState().

Here is the call graph for this function:

◆ attributeCount()

int ObjectState::attributeCount ( ) const

◆ boolAttribute()

bool ObjectState::boolAttribute ( const std::string &  name) const

Returns the value of the requested attribute.

Parameters
nameName of the attribute.
Returns
Value of the requested attribute.
Exceptions
KeyNotFoundIf no attribute called the given name is found.
TypeMismatchIf the value of the requested attribute can't be converted to bool.

Definition at line 338 of file ObjectState.cc.

338  {
339  string value = stringAttribute(name);
340 
341  int intValue;
342  try {
343  intValue = Conversion::toInt(value);
344  } catch (const NumberFormatException&) {
345  const string procName = "ObjectState::boolAttribute";
346  throw TypeMismatch(__FILE__, __LINE__, procName);
347  }
348 
349  return intValue;
350 }

References intValue(), name(), stringAttribute(), and Conversion::toInt().

Referenced by ADFSerializer::addressSpaceToMDF(), ADFSerializer::busToMDF(), ADFSerializer::convertToMDFFormat(), GuardEncoding::GuardEncoding(), BEMSerializer::guardFieldToFile(), TTAMachine::AddressSpace::loadState(), OperationPimpl::loadState(), Operand::loadState(), TTAMachine::Machine::loadState(), TTAMachine::FUPort::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), ADFSerializer::registerFileToMDF(), and OperationSerializer::toXMLFormat().

Here is the call graph for this function:

◆ boolValue()

bool ObjectState::boolValue ( ) const

◆ child()

ObjectState * ObjectState::child ( int  index) const

Returns a child by the given index.

The index must be greater or equal to 0 and less than the number of children.

Parameters
indexThe index.
Returns
Child by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Definition at line 471 of file ObjectState.cc.

471  {
472  if (index < 0 || index >= childCount()) {
473  const string procName = "ObjectState::child";
474  string errorMsg = commonErrorMessage();
475  errorMsg += "Requested child by index '";
476  errorMsg += Conversion::toString(index);
477  errorMsg += "' which is out of range.";
478  throw OutOfRange(__FILE__, __LINE__, procName, errorMsg);
479  } else {
480  return children_[index];
481  }
482 }

References childCount(), children_, commonErrorMessage(), and Conversion::toString().

Referenced by addChild(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), TTAMachine::Bus::adjustSegmentChain(), ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), OSEdTreeView::constructTree(), ADFSerializer::controlUnitToMachine(), ADFSerializer::controlUnitToMDF(), BEMSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToFileFormat(), ADFSerializer::convertToMachineFormat(), ADFSerializer::convertToMDFFormat(), BEMSerializer::convertToOMFormat(), IDF::IDFSerializer::convertToOMFormat(), OperationSerializer::convertToOperationFormat(), GUIOptionsSerializer::convertToOptionsObjectFormat(), OperationSerializer::convertToXMLFormat(), BEMSerializer::convertZeroEncExtraBits(), XMLSerializer::createDOM(), XMLSerializer::createDOMDocument(), OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), dumpObjectState(), OperationIndex::effectiveOperation(), IPXactModel::extractAddressSpaces(), IPXactModel::extractBusInterfaces(), IPXactModel::extractFiles(), IPXactModel::extractModelParams(), IPXactModel::extractPortMappings(), IPXactModel::extractSignals(), ADFSerializer::functionUnitToMachine(), ADFSerializer::functionUnitToMDF(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), ADFSerializer::hasEmptyInstructionTemplate(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMachine(), ADFSerializer::instructionTemplateToMDF(), BlocksModel::LoadModelFromXml(), OperationPropertyLoader::loadModule(), OSEdOptions::loadState(), IDF::FUGenerated::loadState(), OperationTriggeredEncoding::loadState(), TTAMachine::Unit::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), SourceField::loadState(), InstructionFormat::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::HWOperation::loadState(), ImmediateControlField::loadState(), GUIOptions::loadState(), LImmDstRegisterField::loadState(), SlotField::loadState(), TTAMachine::InstructionTemplate::loadState(), MoveSlot::loadState(), GuardField::loadState(), TTAMachine::Socket::loadState(), TTAMachine::Bus::loadState(), OperationPimpl::loadState(), SocketCodeTable::loadState(), BinaryEncoding::loadState(), IDF::MachineImplementation::loadState(), Operand::loadState(), TTAMachine::Machine::loadState(), TTAMachine::Unit::loadStateWithoutReferences(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), OperationIndex::moduleOf(), ADFSerializer::momTemplateSlot(), ObjectState(), OperationContainer::operation(), OperationIndex::operationName(), operator!=(), TTAMachine::Unit::portNames(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), removeChild(), InstructionField::reorderSubfields(), TTAMachine::ExecutionPipeline::saveOperandUse(), TTAMachine::ExecutionPipeline::saveResourceUse(), OperationSerializer::setOperandProperties(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), ADFSerializer::socketToMachine(), ADFSerializer::socketToMDF(), TTAMachine::ExecutionPipeline::sortResourceUsages(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and OperationPropertyDialog::updateSwapLists().

Here is the call graph for this function:

◆ childByName()

ObjectState * ObjectState::childByName ( const std::string &  name) const

Returns the child of the requested name.

If there are many children of that name, returns the first of them.

Parameters
nameName of the child.
Returns
First child of the requested name.
Exceptions
InstanceNotFoundIf the requested child is not found.

Definition at line 443 of file ObjectState.cc.

443  {
444  ChildTable::const_iterator iter = children_.begin();
445  while (iter != children_.end()) {
446  if ((*iter)->name() == name) {
447  return *iter;
448  }
449  iter++;
450  }
451 
452  string procName = "ObjectState::childByName";
453  string errorMsg = commonErrorMessage();
454  errorMsg += "Requested child by name '";
455  errorMsg += name;
456  errorMsg += "' which doesn't exist.";
457  throw InstanceNotFound(__FILE__, __LINE__, procName, errorMsg);
458 }

References children_, commonErrorMessage(), and name().

Referenced by GUIOptionsSerializer::addKeyboardShortcut(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::bridgeToMachine(), ADFSerializer::busToMachine(), ADFSerializer::controlUnitToMachine(), IDF::IDFSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToOMFormat(), ProDeOptionsSerializer::convertToOptionsObjectFormat(), GUIOptionsSerializer::convertToOptionsObjectFormat(), BEMSerializer::convertZeroEncExtraBits(), IPXactModel::extractAddressSpace(), IPXactModel::extractBusInterface(), IPXactModel::extractFiles(), IPXactModel::extractModelParam(), IPXactModel::extractPortMap(), IPXactModel::extractSignals(), IPXactModel::extractVLNV(), ADFSerializer::functionUnitToMachine(), BEMSerializer::guardFieldToOM(), BEMSerializer::immediateSlotToOM(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::instructionTemplateToMachine(), BlocksModel::LoadModelFromXml(), IDF::FUGenerated::loadState(), IPXactModel::loadState(), TTAMachine::HWOperation::loadState(), BinaryEncoding::loadState(), IDF::MachineImplementation::loadState(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineSRPort(), ADFSerializer::mdfOperation(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), BEMSerializer::readRegisterFilePortCode(), ADFSerializer::registerFileToMachine(), ADFSerializer::setIUExtensionMode(), GUIOptionsSerializer::setToolbarProperties(), GUIOptionsSerializer::setWindowProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToOM(), ADFSerializer::socketToMachine(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().

Here is the call graph for this function:

◆ childCount()

int ObjectState::childCount ( ) const

Referenced by ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), TTAMachine::Bus::adjustSegmentChain(), ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), child(), OSEdTreeView::constructTree(), ADFSerializer::controlUnitToMachine(), ADFSerializer::controlUnitToMDF(), BEMSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToFileFormat(), ADFSerializer::convertToMachineFormat(), ADFSerializer::convertToMDFFormat(), BEMSerializer::convertToOMFormat(), IDF::IDFSerializer::convertToOMFormat(), OperationSerializer::convertToOperationFormat(), GUIOptionsSerializer::convertToOptionsObjectFormat(), OperationSerializer::convertToXMLFormat(), BEMSerializer::convertZeroEncExtraBits(), XMLSerializer::createDOM(), XMLSerializer::createDOMDocument(), OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), dumpObjectState(), OperationIndex::effectiveOperation(), IPXactModel::extractAddressSpaces(), IPXactModel::extractBusInterfaces(), IPXactModel::extractFiles(), IPXactModel::extractModelParams(), IPXactModel::extractPortMappings(), IPXactModel::extractSignals(), ADFSerializer::functionUnitToMachine(), ADFSerializer::functionUnitToMDF(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), ADFSerializer::hasEmptyInstructionTemplate(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMachine(), ADFSerializer::instructionTemplateToMDF(), BlocksModel::LoadModelFromXml(), OperationPropertyLoader::loadModule(), OSEdOptions::loadState(), IDF::FUGenerated::loadState(), OperationTriggeredEncoding::loadState(), TTAMachine::Unit::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), SourceField::loadState(), InstructionFormat::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::HWOperation::loadState(), ImmediateControlField::loadState(), GUIOptions::loadState(), LImmDstRegisterField::loadState(), SlotField::loadState(), TTAMachine::InstructionTemplate::loadState(), MoveSlot::loadState(), GuardField::loadState(), TTAMachine::Socket::loadState(), TTAMachine::Bus::loadState(), OperationPimpl::loadState(), SocketCodeTable::loadState(), BinaryEncoding::loadState(), IDF::MachineImplementation::loadState(), Operand::loadState(), TTAMachine::Machine::loadState(), TTAMachine::Unit::loadStateWithoutReferences(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), OperationIndex::moduleOf(), ADFSerializer::momTemplateSlot(), ObjectState(), OperationContainer::operation(), OperationIndex::operationCount(), TTAMachine::Unit::portNames(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), InstructionField::reorderSubfields(), TTAMachine::ExecutionPipeline::saveOperandUse(), TTAMachine::ExecutionPipeline::saveResourceUse(), OperationSerializer::setOperandProperties(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), ADFSerializer::socketToMachine(), ADFSerializer::socketToMDF(), TTAMachine::ExecutionPipeline::sortResourceUsages(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and OperationPropertyDialog::updateSwapLists().

◆ commonErrorMessage()

std::string ObjectState::commonErrorMessage ( ) const
private

Generates a common beginning of error messages.

Returns
The generated error message.

Definition at line 529 of file ObjectState.cc.

529  {
530  string errorMsg = "ObjectState ";
531  errorMsg += name();
532  errorMsg += ": ";
533  return errorMsg;
534 }

References name().

Referenced by attribute(), child(), childByName(), and stringAttribute().

Here is the call graph for this function:

◆ doubleAttribute()

double ObjectState::doubleAttribute ( const std::string &  name) const

Returns the value of the requested attribute.

Parameters
nameName of the attribute.
Returns
Value of the requested attribute.
Exceptions
KeyNotFoundIf no attribute called the given name is found.
NumberFormatExceptionIf the value of the requested attribute can't be converted to double.

Definition at line 323 of file ObjectState.cc.

323  {
324  string value = stringAttribute(name);
325  return Conversion::toDouble(value);
326 }

References name(), stringAttribute(), and Conversion::toDouble().

Referenced by BEMSerializer::readState().

Here is the call graph for this function:

◆ doubleValue()

double ObjectState::doubleValue ( ) const

◆ dumpObjectState()

void ObjectState::dumpObjectState ( const ObjectState state,
std::ostream &  output,
const std::string &  identation = "" 
)
static

Prints object state structure for debug purposes into the stream.

Definition at line 540 of file ObjectState.cc.

543  {
544 
545  using std::cout;
546  using std::endl;
547 
548  cout << identation << "Name: "<< state.name() << " ";
549  if (!state.stringValue().empty()) {
550  cout << "Value: " << state.stringValue() << " ";
551  }
552  cout << endl;
553  for (int i = 0; i < state.attributeCount(); i++) {
554  cout << identation << "Attr: " << state.attribute(i)->name << " = "
555  << state.attribute(i)->value << endl;
556  }
557  for (int i = 0; i < state.childCount(); i++) {
558  dumpObjectState(*state.child(i), output, identation + " ");
559  }
560 }

References attribute(), attributeCount(), child(), childCount(), ObjectState::Attribute::name, name(), stringValue(), and ObjectState::Attribute::value.

Here is the call graph for this function:

◆ hasAttribute()

bool ObjectState::hasAttribute ( const std::string &  name) const

Returns true if the ObjectState has an attribute with the given name.

Parameters
nameName of the attribute.
Returns
True if the ObjectState has an attribute with the given name.

Definition at line 205 of file ObjectState.cc.

205  {
206  AttributeTable::const_iterator iter = attributes_.begin();
207  while (iter != attributes_.end()) {
208  if ((*iter).name == name) {
209  return true;
210  }
211  iter++;
212  }
213  return false;
214 }

References attributes_, and name().

Referenced by ADFSerializer::addressSpaceToMDF(), TTAMachine::Bus::adjustSegmentChain(), ADFSerializer::busToMDF(), ADFSerializer::controlUnitToMDF(), GUIOptionsSerializer::convertToConfigFileFormat(), IDF::IDFSerializer::convertToFileFormat(), ADFSerializer::convertToMDFFormat(), BEMSerializer::convertZeroEncExtraBits(), IPXactModel::extractModelParam(), IPXactModel::extractVlnvFromAttr(), ADFSerializer::functionUnitToMDF(), FUPortCode::FUPortCode(), TTAMachine::Port::loadState(), TTAMachine::AddressSpace::loadState(), KeyboardShortcut::loadState(), TTAMachine::FunctionUnit::loadState(), IDF::MachineImplementation::loadState(), Operand::loadState(), TTAMachine::Machine::loadState(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), ADFSerializer::machineFUPort(), ADFSerializer::mdfPort(), ADFSerializer::mdfSRPort(), operator!=(), PortCode::PortCode(), BEMSerializer::readState(), ADFSerializer::registerFileToMDF(), InstructionField::reorderSubfields(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), SocketEncoding::SocketEncoding(), ADFSerializer::socketToMDF(), OperationSerializer::toOperation(), and OperationSerializer::toXMLFormat().

Here is the call graph for this function:

◆ hasChild()

bool ObjectState::hasChild ( const std::string &  name) const

Returns true if there is a child element called the given name.

Returns
True if there is a child element called the given name.

Definition at line 358 of file ObjectState.cc.

358  {
359  ChildTable::const_iterator iter = children_.begin();
360  while (iter != children_.end()) {
361  if ((*iter)->name() == name) {
362  return true;
363  }
364  iter++;
365  }
366  return false;
367 }

References children_, and name().

Referenced by GUIOptionsSerializer::addKeyboardShortcut(), ADFSerializer::addressSpaceToMachine(), TTAMachine::Bus::adjustSegmentChain(), IDF::IDFSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToOMFormat(), ProDeOptionsSerializer::convertToOptionsObjectFormat(), GUIOptionsSerializer::convertToOptionsObjectFormat(), BEMSerializer::convertZeroEncExtraBits(), IPXactModel::extractAddressSpace(), IPXactModel::extractAddressSpaces(), IPXactModel::extractBusInterface(), IPXactModel::extractBusInterfaces(), IPXactModel::extractBusMode(), IPXactModel::extractFiles(), IPXactModel::extractModelParam(), IPXactModel::extractPortMap(), IPXactModel::extractPortMappings(), IPXactModel::extractSignals(), IPXactModel::extractVLNV(), ADFSerializer::immediateUnitToMachine(), IDF::FUGenerated::loadState(), IPXactModel::loadState(), IDF::MachineImplementation::loadState(), ADFSerializer::machineFUPort(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), BEMSerializer::readRegisterFilePortCode(), ADFSerializer::registerFileToMachine(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), ADFSerializer::socketToMachine(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().

Here is the call graph for this function:

◆ intAttribute()

int ObjectState::intAttribute ( const std::string &  name) const

Returns the value of the requested attribute.

Parameters
nameName of the attribute.
Returns
Value of the requested attribute.
Exceptions
KeyNotFoundIf no attribute called the given name is found.
NumberFormatExceptionIf the value of the requested attribute can't be converted to int.

Definition at line 276 of file ObjectState.cc.

276  {
277  string value = stringAttribute(name);
278  return Conversion::toInt(value);
279 }

References name(), stringAttribute(), and Conversion::toInt().

Referenced by GUIOptionsSerializer::addKeyboardShortcut(), TTAMachine::ExecutionPipeline::addResourceUsage(), ADFSerializer::busToMDF(), GUIOptionsSerializer::convertToConfigFileFormat(), BEMSerializer::convertZeroEncExtraBits(), Encoding::Encoding(), GPRGuardEncoding::GPRGuardEncoding(), GuardEncoding::GuardEncoding(), BEMSerializer::guardFieldToOM(), ImmediateEncoding::ImmediateEncoding(), ADFSerializer::immediateUnitToMDF(), ProDeOptions::loadState(), OperationTriggeredField::loadState(), ImmediateSlotField::loadState(), ToolbarButton::loadState(), IDF::UnitImplementationLocation::loadState(), InstructionField::loadState(), TTAMachine::Guard::loadState(), InstructionFormat::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::HWOperation::loadState(), ImmediateControlField::loadState(), GUIOptions::loadState(), LImmDstRegisterField::loadState(), SlotField::loadState(), TTAMachine::InstructionTemplate::loadState(), KeyboardShortcut::loadState(), TTAMachine::ExecutionPipeline::loadState(), OperationPimpl::loadState(), SocketCodeTable::loadState(), Operand::loadState(), TTAMachine::RegisterGuard::loadState(), TTAMachine::BaseFUPort::loadStateWithoutReferences(), TTAMachine::BaseRegisterFile::loadStateWithoutReferences(), TTAMachine::ImmediateUnit::loadStateWithoutReferences(), TTAMachine::FUPort::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), ADFSerializer::mdfFUPort(), PortCode::PortCode(), ADFSerializer::registerFileToMDF(), InstructionField::reorderSubfields(), TTAMachine::ExecutionPipeline::saveOperandUse(), TTAMachine::ExecutionPipeline::saveResourceUse(), BEMSerializer::slotFieldToFile(), BEMSerializer::socketCodeTableToFile(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), and OperationPropertyDialog::updateSwapLists().

Here is the call graph for this function:

◆ intValue()

int ObjectState::intValue ( ) const

◆ name()

std::string ObjectState::name ( ) const

Referenced by ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), TTAMachine::Bus::adjustSegmentChain(), boolAttribute(), BridgeEncoding::BridgeEncoding(), ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), childByName(), commonErrorMessage(), ADFSerializer::controlUnitToMachine(), ADFSerializer::controlUnitToMDF(), GUIOptionsSerializer::convertToConfigFileFormat(), BEMSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToFileFormat(), ADFSerializer::convertToMachineFormat(), ADFSerializer::convertToMDFFormat(), BEMSerializer::convertToOMFormat(), IDF::IDFSerializer::convertToOMFormat(), GUIOptionsSerializer::convertToOptionsObjectFormat(), BEMSerializer::convertZeroEncExtraBits(), XMLSerializer::createDOM(), XMLSerializer::createDOMDocument(), DestinationField::DestinationField(), PasteComponentCmd::Do(), doubleAttribute(), dumpObjectState(), IPXactModel::extractAddressSpace(), IPXactModel::extractAddressSpaces(), IPXactModel::extractBusInterface(), IPXactModel::extractBusInterfaces(), IPXactModel::extractBusMode(), IPXactModel::extractFiles(), IPXactModel::extractModelParam(), IPXactModel::extractModelParams(), IPXactModel::extractPortMap(), IPXactModel::extractPortMappings(), IPXactModel::extractSignals(), IPXactModel::extractVLNV(), IPXactModel::extractVlnvFromAttr(), FUGuardEncoding::FUGuardEncoding(), ADFSerializer::functionUnitToMachine(), ADFSerializer::functionUnitToMDF(), FUPortCode::FUPortCode(), GPRGuardEncoding::GPRGuardEncoding(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), hasAttribute(), hasChild(), ADFSerializer::hasEmptyInstructionTemplate(), ImmediateEncoding::ImmediateEncoding(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMachine(), ADFSerializer::instructionTemplateToMDF(), intAttribute(), IUPortCode::IUPortCode(), OSEdOptions::loadState(), TTAMachine::RFPort::loadState(), TTAMachine::ImmediateSlot::loadState(), TTAMachine::SpecialRegisterPort::loadState(), IDF::FUGenerated::loadState(), ImmediateSlotField::loadState(), TTAMachine::FUPort::loadState(), ToolbarButton::loadState(), OperationTriggeredEncoding::loadState(), TTAMachine::Unit::loadState(), TTAMachine::Bridge::loadState(), IDF::UnitImplementationLocation::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), SourceField::loadState(), InstructionFormat::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::HWOperation::loadState(), ImmediateControlField::loadState(), GUIOptions::loadState(), LImmDstRegisterField::loadState(), TTAMachine::Segment::loadState(), SlotField::loadState(), TTAMachine::InstructionTemplate::loadState(), KeyboardShortcut::loadState(), MoveSlot::loadState(), TTAMachine::ExecutionPipeline::loadState(), GuardField::loadState(), TTAMachine::Socket::loadState(), TTAMachine::Bus::loadState(), TTAMachine::PortGuard::loadState(), OperationPimpl::loadState(), SocketCodeTable::loadState(), BinaryEncoding::loadState(), IDF::MachineImplementation::loadState(), Operand::loadState(), TTAMachine::Machine::loadState(), TTAMachine::RegisterGuard::loadState(), TTAMachine::UnconditionalGuard::loadState(), TTAMachine::ImmediateUnit::loadStateWithoutReferences(), TTAMachine::Unit::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::Segment::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineSRPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), ADFSerializer::mdfSRPort(), NOPEncoding::NOPEncoding(), operator!=(), BEMSerializer::readRegisterFilePortCode(), ADFSerializer::registerFileToMachine(), RFPortCode::RFPortCode(), TTAMachine::ExecutionPipeline::saveOperandUse(), TTAMachine::ExecutionPipeline::saveResourceUse(), setAttribute(), OperationSerializer::setOperandProperties(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), stringAttribute(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), uLongAttribute(), UnconditionalGuardEncoding::UnconditionalGuardEncoding(), unsignedIntAttribute(), and OperationPropertyDialog::updateSwapLists().

◆ operator!=()

bool ObjectState::operator!= ( const ObjectState object)

Inequality comparison operator.

Parameters
objectObject in which this object is compared to.
Returns
True if objects are inequal, false otherwise.

Definition at line 491 of file ObjectState.cc.

491  {
492 
493  if (name_ != object.name() ||
494  value_ != object.stringValue() ||
495  children_.size() != static_cast<unsigned int>(object.childCount()) ||
496  static_cast<int>(attributes_.size()) != object.attributeCount()) {
497 
498  return true;
499  }
500 
501  for (size_t i = 0; i < attributes_.size(); i++) {
502  Attribute attr = attributes_[i];
503  if (!object.hasAttribute(attr.name)) {
504  return true;
505  } else {
506  if (attr.value != object.stringAttribute(attr.name)) {
507  return true;
508  }
509  }
510  }
511 
512  for (size_t i = 0; i < children_.size(); i++) {
513  ObjectState& child = *children_[i];
514  ObjectState& compare = *object.child(i);
515  if (child != compare) {
516  return true;
517  }
518  }
519 
520  return false;
521 }

References attributes_, child(), children_, hasAttribute(), ObjectState::Attribute::name, name(), name_, stringValue(), ObjectState::Attribute::value, and value_.

Here is the call graph for this function:

◆ operator=()

ObjectState& ObjectState::operator= ( const ObjectState old)
private

Assingment forbidden.

◆ parent()

ObjectState* ObjectState::parent ( ) const

Referenced by ObjectState(), and replaceChild().

◆ removeChild()

void ObjectState::removeChild ( ObjectState child)

Removes the given child object.

Parameters
childThe child object to be removed.
Exceptions
InstanceNotFoundIf the object does not have the given child object.

Definition at line 389 of file ObjectState.cc.

389  {
391  if (removed) {
392  child->parent_ = NULL;
393  } else {
394  const string procName = "ObjectState::removeChild";
395  throw InstanceNotFound(__FILE__, __LINE__, procName);
396  }
397 }

References child(), children_, parent_, and ContainerTools::removeValueIfExists().

Referenced by InstructionField::reorderSubfields(), and BEMSerializer::sourceFieldToFile().

Here is the call graph for this function:

◆ replaceChild()

void ObjectState::replaceChild ( ObjectState old,
ObjectState newChild 
)

Replaces a child with a new child.

Parameters
oldChild to be replaced.
newChildChild to be added in the place of the old child.
Exceptions
InvalidDataIf the new child given already has a parent object.

Definition at line 408 of file ObjectState.cc.

408  {
409  if (newChild->parent() != NULL) {
410  const string procName = "ObjectState::replaceChild";
411  throw InvalidData(__FILE__, __LINE__, procName);
412  }
413 
414  ChildTable::iterator it = children_.begin();
415  while (it != children_.end()) {
416  if (*it == old) {
417  ObjectState* toBeRemoved = *it;
418  ChildTable::iterator pt = it;
419  pt++;
420  if (pt == children_.end()) {
421  children_.push_back(newChild);
422  } else {
423  children_.insert(pt, newChild);
424  }
425  newChild->parent_ = this;
426  delete toBeRemoved;
427  break;
428  }
429  it++;
430  }
431 }

References children_, parent(), and parent_.

Referenced by OSEdPropertiesCmd::Do().

Here is the call graph for this function:

◆ setAttribute() [1/6]

void ObjectState::setAttribute ( const std::string &  name,
bool  value 
)

Sets an attribute.

If there is an attribute called the given name, its value is changed according to the given value. Otherwise a new attribute is created.

Parameters
nameName of the attribute.
valueValue of the attribute.

Definition at line 192 of file ObjectState.cc.

192  {
193  string valueAsString = Conversion::toString(value);
194  setAttribute(name, valueAsString);
195 }

References name(), setAttribute(), and Conversion::toString().

Here is the call graph for this function:

◆ setAttribute() [2/6]

void ObjectState::setAttribute ( const std::string &  name,
const std::string &  value 
)

Sets an attribute.

If there is an attribute called the given name, its value is changed according to the given value. Otherwise a new attribute is created.

Parameters
nameName of the attribute.
valueValue of the attribute.

Definition at line 100 of file ObjectState.cc.

102  {
103 
104  AttributeTable::iterator iter = attributes_.begin();
105  while (iter != attributes_.end()) {
106  if ((*iter).name == name) {
107  (*iter).value = value;
108  return;
109  }
110  iter++;
111  }
112  Attribute newAttribute;
113  newAttribute.name = name;
114  newAttribute.value = value;
115  attributes_.push_back(newAttribute);
116 }

References attributes_, ObjectState::Attribute::name, name(), and ObjectState::Attribute::value.

Referenced by IPXactModel::addBusInterfaceObject(), GUIOptionsSerializer::addKeyboardShortcut(), IPXactModel::addModelParamsObject(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), ADFSerializer::bridgeToMachine(), ADFSerializer::bridgeToMDF(), ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), ADFSerializer::controlUnitToMachine(), ADFSerializer::controlUnitToMDF(), ProDeOptionsSerializer::convertToConfigFileFormat(), GUIOptionsSerializer::convertToConfigFileFormat(), BEMSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToFileFormat(), ADFSerializer::convertToMDFFormat(), IDF::IDFSerializer::convertToOMFormat(), OperationSerializer::convertToXMLFormat(), BEMSerializer::convertZeroEncExtraBits(), XMLSerializer::createState(), PasteComponentCmd::Do(), ADFSerializer::functionUnitToMachine(), ADFSerializer::functionUnitToMDF(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), BEMSerializer::immediateSlotToFile(), ADFSerializer::immediateSlotToMachine(), ADFSerializer::immediateSlotToMDF(), BEMSerializer::immediateSlotToOM(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMachine(), ADFSerializer::instructionTemplateToMDF(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), ADFSerializer::mdfPort(), ADFSerializer::mdfSRPort(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), OutputOperandDialog::onOk(), BEMSerializer::readRegisterFilePortCode(), IDF::IDFSerializer::readState(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), TTAMachine::ExecutionPipeline::saveOperandUse(), OperationPropertyDialog::saveOperation(), TTAMachine::ExecutionPipeline::saveResourceUse(), GuardEncoding::saveState(), TTAMachine::Connection::saveState(), TTAMachine::BaseFUPort::saveState(), ProDeOptions::saveState(), GPRGuardEncoding::saveState(), FUGuardEncoding::saveState(), TTAMachine::FUPort::saveState(), BridgeEncoding::saveState(), ImmediateSlotField::saveState(), OperationTriggeredField::saveState(), ImmediateEncoding::saveState(), IDF::FUGenerated::saveState(), Encoding::saveState(), TTAMachine::BaseRegisterFile::saveState(), FUPortCode::saveState(), PortCode::saveState(), ToolbarButton::saveState(), OperationTriggeredEncoding::saveState(), TTAMachine::Bridge::saveState(), TTAMachine::OperationTriggeredOperand::saveState(), LImmDstRegisterField::saveState(), IDF::UnitImplementationLocation::saveState(), InstructionField::saveState(), TTAMachine::Guard::saveState(), TTAMachine::ImmediateUnit::saveState(), TTAMachine::Port::saveState(), TTAMachine::TemplateSlot::saveState(), InstructionFormat::saveState(), SocketEncoding::saveState(), TTAMachine::AddressSpace::saveState(), TTAMachine::HWOperation::saveState(), TTAMachine::ControlUnit::saveState(), ImmediateControlField::saveState(), GUIOptions::saveState(), TTAMachine::Segment::saveState(), TTAMachine::RegisterFile::saveState(), SlotField::saveState(), KeyboardShortcut::saveState(), MoveSlot::saveState(), TTAMachine::Socket::saveState(), TTAMachine::FunctionUnit::saveState(), TTAMachine::Bus::saveState(), TTAMachine::PortGuard::saveState(), TTAMachine::Component::saveState(), OperationPimpl::saveState(), SocketCodeTable::saveState(), IDF::MachineImplementation::saveState(), Operand::saveState(), TTAMachine::Machine::saveState(), TTAMachine::RegisterGuard::saveState(), setAttribute(), ADFSerializer::setIUExtensionMode(), OperationSerializer::setOperandProperties(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), ADFSerializer::socketToMachine(), ADFSerializer::socketToMDF(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), InputOperandDialog::updateOperand(), and OperationPropertyDialog::updateSwapLists().

Here is the call graph for this function:

◆ setAttribute() [3/6]

void ObjectState::setAttribute ( const std::string &  name,
double  value 
)

Sets an attribute.

If there is an attribute called the given name, its value is changed according to the given value. Otherwise a new attribute is created.

Parameters
nameName of the attribute.
valueValue of the attribute.

Definition at line 176 of file ObjectState.cc.

176  {
177  string valueAsString = Conversion::toString(value);
178  setAttribute(name, valueAsString);
179 }

References name(), setAttribute(), and Conversion::toString().

Here is the call graph for this function:

◆ setAttribute() [4/6]

void ObjectState::setAttribute ( const std::string &  name,
int  value 
)

Sets an attribute.

If there is an attribute called the given name, its value is changed according to the given value. Otherwise a new attribute is created.

Parameters
nameName of the attribute.
valueValue of the attribute.

Definition at line 129 of file ObjectState.cc.

129  {
130  string valueAsString = Conversion::toString(value);
131  setAttribute(name, valueAsString);
132 }

References name(), setAttribute(), and Conversion::toString().

Here is the call graph for this function:

◆ setAttribute() [5/6]

void ObjectState::setAttribute ( const std::string &  name,
ULongWord  value 
)

Sets an attribute.

If there is an attribute called the given name, its value is changed according to the given value. Otherwise a new attribute is created.

Parameters
nameName of the attribute.
valueValue of the attribute.

Definition at line 160 of file ObjectState.cc.

160  {
161  string valueAsString = Conversion::toString(value);
162  setAttribute(name, valueAsString);
163 }

References name(), setAttribute(), and Conversion::toString().

Here is the call graph for this function:

◆ setAttribute() [6/6]

void ObjectState::setAttribute ( const std::string &  name,
unsigned int  value 
)

Sets an attribute.

If there is an attribute called the given name, its value is changed according to the given value. Otherwise a new attribute is created.

Parameters
nameName of the attribute.
valueValue of the attribute.

Definition at line 145 of file ObjectState.cc.

145  {
146  string valueAsString = Conversion::toString(value);
147  setAttribute(name, valueAsString);
148 }

References name(), setAttribute(), and Conversion::toString().

Here is the call graph for this function:

◆ setName()

void ObjectState::setName ( const std::string &  name)

Referenced by ADFSerializer::controlUnitToMDF(), BEMSerializer::destinationFieldToFile(), BEMSerializer::destinationFieldToOM(), OperationPropertyDialog::saveOperation(), DestinationField::saveState(), IUPortCode::saveState(), TTAMachine::RFPort::saveState(), RFPortCode::saveState(), UnconditionalGuardEncoding::saveState(), NOPEncoding::saveState(), TTAMachine::ImmediateSlot::saveState(), GPRGuardEncoding::saveState(), TTAMachine::SpecialRegisterPort::saveState(), FUGuardEncoding::saveState(), BridgeEncoding::saveState(), ImmediateSlotField::saveState(), TTAMachine::FUPort::saveState(), ImmediateEncoding::saveState(), TTAMachine::BaseRegisterFile::saveState(), FUPortCode::saveState(), TTAMachine::Unit::saveState(), TTAMachine::Bridge::saveState(), LImmDstRegisterField::saveState(), TTAMachine::OperationTriggeredFormat::saveState(), SourceField::saveState(), TTAMachine::ImmediateUnit::saveState(), SocketEncoding::saveState(), TTAMachine::ControlUnit::saveState(), ImmediateControlField::saveState(), TTAMachine::RegisterFile::saveState(), DataDependenceEdge::saveState(), SlotField::saveState(), TTAMachine::InstructionTemplate::saveState(), MoveSlot::saveState(), GuardField::saveState(), TTAMachine::Socket::saveState(), TTAMachine::FunctionUnit::saveState(), TTAMachine::Bus::saveState(), TTAMachine::PortGuard::saveState(), TTAMachine::RegisterGuard::saveState(), TTAMachine::UnconditionalGuard::saveState(), BEMSerializer::sourceFieldToFile(), and BEMSerializer::sourceFieldToOM().

◆ setValue() [1/5]

void ObjectState::setValue ( bool  value)

◆ setValue() [2/5]

void ObjectState::setValue ( const std::string &  value)

Referenced by IPXactModel::addAddressSpaceObject(), IPXactModel::addBusInterfaceObject(), IPXactModel::addFileObject(), IPXactModel::addModelParamsObject(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), IPXactModel::addSignalObject(), ADFSerializer::bridgeToMDF(), ADFSerializer::busToMDF(), ADFSerializer::controlUnitToMDF(), GUIOptionsSerializer::convertToConfigFileFormat(), IDF::IDFSerializer::convertToFileFormat(), BEMSerializer::convertZeroEncExtraBits(), XMLSerializer::createState(), ADFSerializer::functionUnitToMDF(), BEMSerializer::guardFieldToFile(), BEMSerializer::immediateSlotToFile(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMDF(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), ADFSerializer::mdfFUPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), ADFSerializer::mdfPort(), ADFSerializer::mdfSRPort(), BEMSerializer::moveSlotToFile(), ADFSerializer::registerFileToMDF(), OperationPropertyDialog::saveOperation(), IDF::FUGenerated::saveState(), IPXactModel::saveState(), TTAMachine::OperationTriggeredFormat::saveState(), TTAMachine::AddressSpace::saveState(), DataDependenceEdge::saveState(), OperationPimpl::saveState(), BinaryEncoding::saveState(), BEMSerializer::slotFieldToFile(), BEMSerializer::socketCodeTableToFile(), ADFSerializer::socketToMDF(), BEMSerializer::sourceFieldToFile(), OperationSerializer::toXMLFormat(), and DataDependenceGraph::writeToXMLFile().

◆ setValue() [3/5]

void ObjectState::setValue ( double  value)

◆ setValue() [4/5]

void ObjectState::setValue ( int  value)

◆ setValue() [5/5]

void ObjectState::setValue ( UIntWord  value)

◆ stringAttribute()

std::string ObjectState::stringAttribute ( const std::string &  name) const

Returns the value of the requested attribute.

Parameters
nameName of the attribute.
Returns
Value of the requested attribute.
Exceptions
KeyNotFoundIf no attribute called the given name is found.

Definition at line 249 of file ObjectState.cc.

249  {
250  AttributeTable::const_iterator iter = attributes_.begin();
251  while (iter != attributes_.end()) {
252  if ((*iter).name == name) {
253  return (*iter).value;
254  }
255  iter++;
256  }
257 
258  string procName = "ObjectState::stringAttribute";
259  string errorMsg = commonErrorMessage();
260  errorMsg += "Requested attribute by name '";
261  errorMsg += name;
262  errorMsg += "' which doesn't exist.";
263  throw KeyNotFound(__FILE__, __LINE__, procName, errorMsg);
264 }

References attributes_, commonErrorMessage(), and name().

Referenced by GUIOptionsSerializer::addKeyboardShortcut(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::addressSpaceToMDF(), TTAMachine::Bus::adjustSegmentChain(), boolAttribute(), BridgeEncoding::BridgeEncoding(), ADFSerializer::bridgeToMachine(), ADFSerializer::bridgeToMDF(), ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), TTAMachine::Component::Component(), ADFSerializer::controlUnitToMachine(), ADFSerializer::controlUnitToMDF(), GUIOptionsSerializer::convertToConfigFileFormat(), IDF::IDFSerializer::convertToFileFormat(), IDF::IDFSerializer::convertToOMFormat(), ProDeOptionsSerializer::convertToOptionsObjectFormat(), OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), doubleAttribute(), OperationIndex::effectiveOperation(), IPXactModel::extractModelParam(), IPXactModel::extractVlnvFromAttr(), FUGuardEncoding::FUGuardEncoding(), ADFSerializer::functionUnitToMachine(), ADFSerializer::functionUnitToMDF(), FUPortCode::FUPortCode(), GPRGuardEncoding::GPRGuardEncoding(), BEMSerializer::guardFieldToFile(), BEMSerializer::guardFieldToOM(), TTAMachine::HWOperation::HWOperation(), BEMSerializer::immediateSlotToFile(), ADFSerializer::immediateSlotToMachine(), ADFSerializer::immediateSlotToMDF(), BEMSerializer::immediateSlotToOM(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::immediateUnitToMDF(), ADFSerializer::instructionTemplateToMachine(), ADFSerializer::instructionTemplateToMDF(), intAttribute(), BlocksModel::LoadModelFromXml(), IDF::FUGenerated::loadState(), ImmediateSlotField::loadState(), OperationTriggeredEncoding::loadState(), TTAMachine::OperationTriggeredOperand::loadState(), ToolbarButton::loadState(), TTAMachine::Unit::loadState(), TTAMachine::Bridge::loadState(), IDF::UnitImplementationLocation::loadState(), InstructionField::loadState(), InstructionFormat::loadState(), TTAMachine::Port::loadState(), TTAMachine::HWOperation::loadState(), ImmediateControlField::loadState(), GUIOptions::loadState(), LImmDstRegisterField::loadState(), TTAMachine::InstructionTemplate::loadState(), KeyboardShortcut::loadState(), MoveSlot::loadState(), TTAMachine::ExecutionPipeline::loadState(), TTAMachine::Socket::loadState(), TTAMachine::FunctionUnit::loadState(), TTAMachine::Bus::loadState(), TTAMachine::PortGuard::loadState(), OperationPimpl::loadState(), TTAMachine::Component::loadState(), SocketCodeTable::loadState(), IDF::MachineImplementation::loadState(), Operand::loadState(), TTAMachine::Machine::loadState(), TTAMachine::RegisterGuard::loadState(), TTAMachine::ImmediateUnit::loadStateWithoutReferences(), TTAMachine::Unit::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::Segment::loadStateWithoutReferences(), TTAMachine::Port::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmDstRegisterFieldToFile(), BEMSerializer::longImmTagToFile(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), ADFSerializer::mdfFUPort(), ADFSerializer::mdfOperation(), ADFSerializer::mdfPipeline(), ADFSerializer::mdfPort(), ADFSerializer::mdfSRPort(), OperationIndex::moduleOf(), ADFSerializer::momTemplateSlot(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), OperationContainer::operation(), OperationIndex::operationName(), TTAMachine::OperationTriggeredOperand::OperationTriggeredOperand(), PortCode::PortCode(), TTAMachine::Unit::portNames(), BEMSerializer::readRegisterFilePortCode(), BEMSerializer::readState(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), TTAMachine::ExecutionPipeline::saveResourceUse(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToFile(), BEMSerializer::socketCodeTableToOM(), SocketEncoding::SocketEncoding(), ADFSerializer::socketToMachine(), ADFSerializer::socketToMDF(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), OperationSerializer::toOperation(), OperationSerializer::toXMLFormat(), uLongAttribute(), and unsignedIntAttribute().

Here is the call graph for this function:

◆ stringValue()

std::string ObjectState::stringValue ( ) const

Referenced by GUIOptionsSerializer::addKeyboardShortcut(), ADFSerializer::addressSpaceToMachine(), ADFSerializer::bridgeToMachine(), ADFSerializer::busToMachine(), ADFSerializer::controlUnitToMachine(), IDF::IDFSerializer::convertToOMFormat(), XMLSerializer::createDOM(), XMLSerializer::createDOMDocument(), dumpObjectState(), IPXactModel::extractAddressSpace(), IPXactModel::extractBusInterface(), IPXactModel::extractFiles(), IPXactModel::extractModelParam(), IPXactModel::extractPortMap(), IPXactModel::extractSignals(), IPXactModel::extractVLNV(), ADFSerializer::functionUnitToMachine(), BEMSerializer::guardFieldToOM(), BEMSerializer::immediateSlotToOM(), ADFSerializer::immediateUnitToMachine(), ADFSerializer::instructionTemplateToMachine(), OSEdOptions::loadState(), IDF::FUGenerated::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), OperationPimpl::loadState(), BinaryEncoding::loadState(), BEMSerializer::longImmDstRegFieldToOM(), BEMSerializer::longImmTagToOM(), ADFSerializer::machineFUPort(), ADFSerializer::machineOperation(), ADFSerializer::machinePipeline(), ADFSerializer::machineRFPort(), ADFSerializer::machineSRPort(), BEMSerializer::moveSlotToOM(), operator!=(), BEMSerializer::readRegisterFilePortCode(), ADFSerializer::registerFileToMachine(), ADFSerializer::setIUExtensionMode(), GUIOptionsSerializer::setToolbarProperties(), GUIOptionsSerializer::setWindowProperties(), BEMSerializer::slotFieldToOM(), BEMSerializer::socketCodeTableToOM(), ADFSerializer::socketToMachine(), BEMSerializer::sourceFieldToOM(), and OperationSerializer::toOperation().

◆ UIntWordAttribute()

UIntWord ObjectState::UIntWordAttribute ( const std::string &  name) const

◆ UIntWordValue()

int ObjectState::UIntWordValue ( ) const

◆ uLongAttribute()

ULongWord ObjectState::uLongAttribute ( const std::string &  name) const

Returns the value of the requested attribute.

Parameters
nameName of the attribute.
Returns
Value of the requested attribute.
Exceptions
KeyNotFoundIf no attribute called the given name is found.
NumberFormatExceptionIf the value of the requested attribute can't be converted to int.

Definition at line 291 of file ObjectState.cc.

291  {
292 
293  string value = stringAttribute(name);
294  return Conversion::toUnsignedLong(value);
295 }

References name(), stringAttribute(), and Conversion::toUnsignedLong().

Referenced by TTAMachine::AddressSpace::loadState().

Here is the call graph for this function:

◆ unsignedIntAttribute()

unsigned int ObjectState::unsignedIntAttribute ( const std::string &  name) const

Returns the value of the requested attribute.

Parameters
nameName of the attribute.
Returns
Value of the requested attribute.
Exceptions
KeyNotFoundIf no attribute called the given name is found.
NumberFormatExceptionIf the value of the requested attribute can't be converted to unsigned int.

Definition at line 308 of file ObjectState.cc.

308  {
309  string value = stringAttribute(name);
310  return Conversion::toUnsignedInt(value);
311 }

References name(), stringAttribute(), and Conversion::toUnsignedInt().

Here is the call graph for this function:

◆ unsignedIntValue()

unsigned int ObjectState::unsignedIntValue ( ) const

Member Data Documentation

◆ attributes_

AttributeTable ObjectState::attributes_
private

Contains all the attributes of the element.

Definition at line 146 of file ObjectState.hh.

Referenced by attribute(), hasAttribute(), operator!=(), setAttribute(), and stringAttribute().

◆ children_

ChildTable ObjectState::children_
private

The child elements.

Definition at line 143 of file ObjectState.hh.

Referenced by addChild(), child(), childByName(), hasChild(), operator!=(), removeChild(), replaceChild(), and ~ObjectState().

◆ name_

std::string ObjectState::name_
private

Name of the element.

Definition at line 134 of file ObjectState.hh.

Referenced by operator!=().

◆ parent_

ObjectState* ObjectState::parent_
private

The parent element.

Definition at line 140 of file ObjectState.hh.

Referenced by addChild(), removeChild(), replaceChild(), and ~ObjectState().

◆ value_

std::string ObjectState::value_
private

The value of a leaf element.

Definition at line 137 of file ObjectState.hh.

Referenced by operator!=().


The documentation for this class was generated from the following files:
ObjectState::attributes_
AttributeTable attributes_
Contains all the attributes of the element.
Definition: ObjectState.hh:146
ObjectState::hasAttribute
bool hasAttribute(const std::string &name) const
Definition: ObjectState.cc:205
ObjectState::attribute
Attribute * attribute(int index) const
Definition: ObjectState.cc:228
NumberFormatException
Definition: Exception.hh:421
ObjectState::stringAttribute
std::string stringAttribute(const std::string &name) const
Definition: ObjectState.cc:249
ObjectState::Attribute::name
std::string name
Name of the attribute.
Definition: ObjectState.hh:63
ObjectState::Attribute::value
std::string value
Value of the attribute.
Definition: ObjectState.hh:64
ObjectState::intValue
int intValue() const
OutOfRange
Definition: Exception.hh:320
ObjectState
Definition: ObjectState.hh:59
ObjectState::value_
std::string value_
The value of a leaf element.
Definition: ObjectState.hh:137
ObjectState::children_
ChildTable children_
The child elements.
Definition: ObjectState.hh:143
Conversion::toString
static std::string toString(const T &source)
assert
#define assert(condition)
Definition: Application.hh:86
Conversion::toDouble
static double toDouble(const T &source)
ObjectState::dumpObjectState
static void dumpObjectState(const ObjectState &state, std::ostream &output, const std::string &identation="")
Definition: ObjectState.cc:540
SequenceTools::deleteAllItems
static void deleteAllItems(SequenceType &aSequence)
InvalidData
Definition: Exception.hh:149
TypeMismatch
Definition: Exception.hh:803
ObjectState::ObjectState
ObjectState(const std::string &name, ObjectState *parent=NULL)
Definition: ObjectState.cc:51
ContainerTools::removeValueIfExists
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
ObjectState::commonErrorMessage
std::string commonErrorMessage() const
Definition: ObjectState.cc:529
ObjectState::child
ObjectState * child(int index) const
Definition: ObjectState.cc:471
ObjectState::addChild
void addChild(ObjectState *child)
Definition: ObjectState.cc:376
ObjectState::childCount
int childCount() const
ObjectState::name
std::string name() const
Conversion::toUnsignedInt
static unsigned int toUnsignedInt(const T &source)
ObjectState::parent
ObjectState * parent() const
ObjectState::parent_
ObjectState * parent_
The parent element.
Definition: ObjectState.hh:140
ObjectState::stringValue
std::string stringValue() const
KeyNotFound
Definition: Exception.hh:285
Conversion::toInt
static int toInt(const T &source)
Conversion::toUnsignedLong
static ULongWord toUnsignedLong(const T &source)
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100
InstanceNotFound
Definition: Exception.hh:304
ObjectState::name_
std::string name_
Name of the element.
Definition: ObjectState.hh:134
ObjectState::attributeCount
int attributeCount() const