OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
typedef std::vector< AttributeAttributeTable
 Table of attributes.
 

Private Member Functions

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

Private Attributes

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

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 :
53 if (parent != NULL) {
54 parent->addChild(this);
55 }
56}
std::string name_
Name of the element.
void addChild(ObjectState *child)
std::string value_
The value of a leaf element.
ObjectState * parent() const
ObjectState * parent_
The parent element.
std::string name() const

References addChild(), and parent().

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}
ObjectState * child(int index) const
AttributeTable attributes_
Contains all the attributes of the element.
int childCount() const

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

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}
#define assert(condition)
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
ChildTable children_
The child elements.
static void deleteAllItems(SequenceType &aSequence)

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(), GUIOptionsSerializer::convertToConfigFileFormat(), ProDeOptionsSerializer::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(), ObjectState(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), InstructionField::reorderSubfields(), TTAMachine::Machine::saveComponentStates(), TTAMachine::ExecutionPipeline::saveOperandUse(), OperationPropertyDialog::saveOperation(), TTAMachine::ExecutionPipeline::saveResourceUse(), IPXactModel::saveState(), GUIOptions::saveState(), BinaryEncoding::saveState(), GuardField::saveState(), ImmediateControlField::saveState(), InstructionFormat::saveState(), LImmDstRegisterField::saveState(), MoveSlot::saveState(), OperationTriggeredEncoding::saveState(), SlotField::saveState(), SocketCodeTable::saveState(), SourceField::saveState(), IDF::MachineImplementation::saveState(), TTAMachine::Bus::saveState(), TTAMachine::FunctionUnit::saveState(), TTAMachine::HWOperation::saveState(), TTAMachine::InstructionTemplate::saveState(), TTAMachine::Machine::saveState(), TTAMachine::OperationTriggeredFormat::saveState(), TTAMachine::Socket::saveState(), TTAMachine::Unit::saveState(), Operand::saveState(), OperationPimpl::saveState(), OSEdOptions::saveState(), IDF::FUGenerated::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}
static std::string toString(const T &source)
int attributeCount() const
std::string commonErrorMessage() const

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 {
344 } catch (const NumberFormatException&) {
345 const string procName = "ObjectState::boolAttribute";
346 throw TypeMismatch(__FILE__, __LINE__, procName);
347 }
348
349 return intValue;
350}
static int toInt(const T &source)
int intValue() const
std::string stringAttribute(const std::string &name) const

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

Referenced by ADFSerializer::addressSpaceToMDF(), ADFSerializer::busToMDF(), ADFSerializer::convertToMDFFormat(), GuardEncoding::GuardEncoding(), BEMSerializer::guardFieldToFile(), TTAMachine::AddressSpace::loadState(), TTAMachine::Machine::loadState(), Operand::loadState(), OperationPimpl::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(), GUIOptions::loadState(), BinaryEncoding::loadState(), GuardField::loadState(), ImmediateControlField::loadState(), InstructionFormat::loadState(), LImmDstRegisterField::loadState(), MoveSlot::loadState(), OperationTriggeredEncoding::loadState(), SlotField::loadState(), SocketCodeTable::loadState(), SourceField::loadState(), IDF::MachineImplementation::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::Bus::loadState(), TTAMachine::HWOperation::loadState(), TTAMachine::InstructionTemplate::loadState(), TTAMachine::Machine::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), TTAMachine::Socket::loadState(), TTAMachine::Unit::loadState(), Operand::loadState(), OperationPimpl::loadState(), OSEdOptions::loadState(), IDF::FUGenerated::loadState(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), TTAMachine::Unit::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(), GUIOptionsSerializer::convertToOptionsObjectFormat(), ProDeOptionsSerializer::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(), IPXactModel::loadState(), BinaryEncoding::loadState(), IDF::MachineImplementation::loadState(), TTAMachine::HWOperation::loadState(), IDF::FUGenerated::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(), GUIOptions::loadState(), BinaryEncoding::loadState(), GuardField::loadState(), ImmediateControlField::loadState(), InstructionFormat::loadState(), LImmDstRegisterField::loadState(), MoveSlot::loadState(), OperationTriggeredEncoding::loadState(), SlotField::loadState(), SocketCodeTable::loadState(), SourceField::loadState(), IDF::MachineImplementation::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::Bus::loadState(), TTAMachine::HWOperation::loadState(), TTAMachine::InstructionTemplate::loadState(), TTAMachine::Machine::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), TTAMachine::Socket::loadState(), TTAMachine::Unit::loadState(), Operand::loadState(), OperationPimpl::loadState(), OSEdOptions::loadState(), IDF::FUGenerated::loadState(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), TTAMachine::Unit::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}
static double toDouble(const T &source)

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}
Attribute * attribute(int index) const
static void dumpObjectState(const ObjectState &state, std::ostream &output, const std::string &identation="")
std::string stringValue() const
std::string value
Value of the attribute.
std::string name
Name of the attribute.

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

Referenced by dumpObjectState().

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(), KeyboardShortcut::loadState(), IDF::MachineImplementation::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::FunctionUnit::loadState(), TTAMachine::Machine::loadState(), TTAMachine::Port::loadState(), Operand::loadState(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::RegisterFile::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(), GUIOptionsSerializer::convertToOptionsObjectFormat(), ProDeOptionsSerializer::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(), IPXactModel::loadState(), IDF::MachineImplementation::loadState(), IDF::FUGenerated::loadState(), ADFSerializer::machineFUPort(), BEMSerializer::moveSlotToFile(), BEMSerializer::moveSlotToOM(), BEMSerializer::readRegisterFilePortCode(), ADFSerializer::registerFileToMachine(), GUIOptionsSerializer::setToolbarProperties(), BEMSerializer::slotFieldToFile(), BEMSerializer::slotFieldToOM(), ADFSerializer::socketToMachine(), BEMSerializer::sourceFieldToFile(), BEMSerializer::sourceFieldToOM(), and BlocksModel::VerifyXmlStructure().

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(), GUIOptions::loadState(), KeyboardShortcut::loadState(), ToolbarButton::loadState(), ImmediateControlField::loadState(), ImmediateSlotField::loadState(), InstructionField::loadState(), InstructionFormat::loadState(), LImmDstRegisterField::loadState(), OperationTriggeredField::loadState(), SlotField::loadState(), SocketCodeTable::loadState(), IDF::UnitImplementationLocation::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::ExecutionPipeline::loadState(), TTAMachine::Guard::loadState(), TTAMachine::RegisterGuard::loadState(), TTAMachine::HWOperation::loadState(), TTAMachine::InstructionTemplate::loadState(), Operand::loadState(), OperationPimpl::loadState(), ProDeOptions::loadState(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::BaseFUPort::loadStateWithoutReferences(), TTAMachine::BaseRegisterFile::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::FUPort::loadStateWithoutReferences(), TTAMachine::ImmediateUnit::loadStateWithoutReferences(), TTAMachine::RegisterFile::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(), GUIOptions::loadState(), KeyboardShortcut::loadState(), ToolbarButton::loadState(), BinaryEncoding::loadState(), GuardField::loadState(), ImmediateControlField::loadState(), ImmediateSlotField::loadState(), InstructionFormat::loadState(), LImmDstRegisterField::loadState(), MoveSlot::loadState(), OperationTriggeredEncoding::loadState(), SlotField::loadState(), SocketCodeTable::loadState(), SourceField::loadState(), IDF::MachineImplementation::loadState(), IDF::UnitImplementationLocation::loadState(), TTAMachine::AddressSpace::loadState(), TTAMachine::Bridge::loadState(), TTAMachine::Bus::loadState(), TTAMachine::ExecutionPipeline::loadState(), TTAMachine::FUPort::loadState(), TTAMachine::PortGuard::loadState(), TTAMachine::RegisterGuard::loadState(), TTAMachine::UnconditionalGuard::loadState(), TTAMachine::HWOperation::loadState(), TTAMachine::ImmediateSlot::loadState(), TTAMachine::InstructionTemplate::loadState(), TTAMachine::Machine::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), TTAMachine::RFPort::loadState(), TTAMachine::Segment::loadState(), TTAMachine::Socket::loadState(), TTAMachine::SpecialRegisterPort::loadState(), TTAMachine::Unit::loadState(), Operand::loadState(), OperationPimpl::loadState(), OSEdOptions::loadState(), IDF::FUGenerated::loadState(), TTAMachine::FunctionUnit::loadStateWithoutReferences(), TTAMachine::Bus::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::ImmediateUnit::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), TTAMachine::Segment::loadStateWithoutReferences(), TTAMachine::Unit::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(), setAttribute(), setAttribute(), setAttribute(), setAttribute(), 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++) {
514 ObjectState& compare = *object.child(i);
515 if (child != compare) {
516 return true;
517 }
518 }
519
520 return false;
521}
bool hasAttribute(const std::string &name) const

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}
void setAttribute(const std::string &name, const std::string &value)

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(), GUIOptionsSerializer::convertToConfigFileFormat(), ProDeOptionsSerializer::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(), GUIOptions::saveState(), KeyboardShortcut::saveState(), ToolbarButton::saveState(), BridgeEncoding::saveState(), Encoding::saveState(), FUGuardEncoding::saveState(), FUPortCode::saveState(), GPRGuardEncoding::saveState(), GuardEncoding::saveState(), ImmediateControlField::saveState(), ImmediateEncoding::saveState(), ImmediateSlotField::saveState(), InstructionField::saveState(), InstructionFormat::saveState(), LImmDstRegisterField::saveState(), MoveSlot::saveState(), OperationTriggeredEncoding::saveState(), OperationTriggeredField::saveState(), PortCode::saveState(), SlotField::saveState(), SocketCodeTable::saveState(), SocketEncoding::saveState(), IDF::MachineImplementation::saveState(), IDF::UnitImplementationLocation::saveState(), TTAMachine::AddressSpace::saveState(), TTAMachine::BaseFUPort::saveState(), TTAMachine::BaseRegisterFile::saveState(), TTAMachine::Bridge::saveState(), TTAMachine::Bus::saveState(), TTAMachine::Connection::saveState(), TTAMachine::ControlUnit::saveState(), TTAMachine::FunctionUnit::saveState(), TTAMachine::FUPort::saveState(), TTAMachine::Guard::saveState(), TTAMachine::PortGuard::saveState(), TTAMachine::RegisterGuard::saveState(), TTAMachine::HWOperation::saveState(), TTAMachine::ImmediateUnit::saveState(), TTAMachine::Machine::saveState(), TTAMachine::Component::saveState(), TTAMachine::OperationTriggeredOperand::saveState(), TTAMachine::Port::saveState(), TTAMachine::RegisterFile::saveState(), TTAMachine::Segment::saveState(), TTAMachine::Socket::saveState(), TTAMachine::TemplateSlot::saveState(), Operand::saveState(), OperationPimpl::saveState(), ProDeOptions::saveState(), IDF::FUGenerated::saveState(), setAttribute(), setAttribute(), setAttribute(), setAttribute(), 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(), BridgeEncoding::saveState(), DestinationField::saveState(), FUGuardEncoding::saveState(), FUPortCode::saveState(), GPRGuardEncoding::saveState(), GuardField::saveState(), ImmediateControlField::saveState(), ImmediateEncoding::saveState(), ImmediateSlotField::saveState(), IUPortCode::saveState(), LImmDstRegisterField::saveState(), MoveSlot::saveState(), NOPEncoding::saveState(), RFPortCode::saveState(), SlotField::saveState(), SocketEncoding::saveState(), SourceField::saveState(), UnconditionalGuardEncoding::saveState(), TTAMachine::BaseRegisterFile::saveState(), TTAMachine::Bridge::saveState(), TTAMachine::Bus::saveState(), TTAMachine::ControlUnit::saveState(), TTAMachine::FunctionUnit::saveState(), TTAMachine::FUPort::saveState(), TTAMachine::PortGuard::saveState(), TTAMachine::RegisterGuard::saveState(), TTAMachine::UnconditionalGuard::saveState(), TTAMachine::ImmediateSlot::saveState(), TTAMachine::ImmediateUnit::saveState(), TTAMachine::InstructionTemplate::saveState(), TTAMachine::OperationTriggeredFormat::saveState(), TTAMachine::RegisterFile::saveState(), TTAMachine::RFPort::saveState(), TTAMachine::Socket::saveState(), TTAMachine::SpecialRegisterPort::saveState(), TTAMachine::Unit::saveState(), DataDependenceEdge::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(), IPXactModel::saveState(), BinaryEncoding::saveState(), TTAMachine::AddressSpace::saveState(), TTAMachine::OperationTriggeredFormat::saveState(), OperationPimpl::saveState(), IDF::FUGenerated::saveState(), DataDependenceEdge::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(), name(), and ObjectState::Attribute::value.

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(), GUIOptions::loadState(), KeyboardShortcut::loadState(), ToolbarButton::loadState(), ImmediateControlField::loadState(), ImmediateSlotField::loadState(), InstructionField::loadState(), InstructionFormat::loadState(), LImmDstRegisterField::loadState(), MoveSlot::loadState(), OperationTriggeredEncoding::loadState(), SocketCodeTable::loadState(), IDF::MachineImplementation::loadState(), IDF::UnitImplementationLocation::loadState(), TTAMachine::Bridge::loadState(), TTAMachine::Bus::loadState(), TTAMachine::ExecutionPipeline::loadState(), TTAMachine::FunctionUnit::loadState(), TTAMachine::PortGuard::loadState(), TTAMachine::RegisterGuard::loadState(), TTAMachine::HWOperation::loadState(), TTAMachine::InstructionTemplate::loadState(), TTAMachine::Machine::loadState(), TTAMachine::Component::loadState(), TTAMachine::OperationTriggeredOperand::loadState(), TTAMachine::Port::loadState(), TTAMachine::Socket::loadState(), TTAMachine::Unit::loadState(), Operand::loadState(), OperationPimpl::loadState(), IDF::FUGenerated::loadState(), TTAMachine::Bus::loadStateWithoutReferences(), TTAMachine::ControlUnit::loadStateWithoutReferences(), TTAMachine::ImmediateUnit::loadStateWithoutReferences(), TTAMachine::Port::loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), TTAMachine::Segment::loadStateWithoutReferences(), TTAMachine::Unit::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(), BinaryEncoding::loadState(), TTAMachine::OperationTriggeredFormat::loadState(), OperationPimpl::loadState(), OSEdOptions::loadState(), IDF::FUGenerated::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}
static ULongWord toUnsignedLong(const T &source)

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}
static unsigned int toUnsignedInt(const T &source)

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: