OpenASIP
2.0
|
#include <DataObject.hh>
Public Types | |
enum | OrigType { TYPE_INT, TYPE_STRING, TYPE_DOUBLE, TYPE_FLOAT, TYPE_NULL, TYPE_NOTYPE } |
Public Member Functions | |
DataObject () | |
DataObject (int value) | |
DataObject (SLongWord value) | |
DataObject (double value) | |
DataObject (const std::string value) | |
virtual | ~DataObject () |
virtual int | integerValue () const |
virtual void | setInteger (int value) |
virtual void | setLong (SLongWord value) |
virtual SLongWord | longValue () const |
virtual std::string | stringValue () const |
virtual void | setString (std::string value) |
virtual double | doubleValue () const |
virtual void | setDouble (double value) |
virtual float | floatValue () const |
virtual void | setFloat (float value) |
virtual bool | boolValue () const |
virtual void | setBool (bool value) |
virtual bool | isNull () const |
virtual void | setNull () |
virtual bool | operator!= (const DataObject &object) const |
Protected Member Functions | |
OrigType | type () const |
bool | intFresh () const |
bool | stringFresh () const |
bool | doubleFresh () const |
bool | floatFresh () const |
Private Attributes | |
OrigType | type_ |
The type of value in which DataObject was last assigned. More... | |
bool | intFresh_ |
Flag indicating that the value of integer is up-to-date. More... | |
bool | stringFresh_ |
Flag indicating that the value of string is up-to-date. More... | |
bool | doubleFresh_ |
Flag indicating that the value of double is up-to-date. More... | |
bool | floatFresh_ |
Flag indicating that the value of float is up-to-date. More... | |
SLongWord | intValue_ |
Value as integer. More... | |
std::string | stringValue_ |
Value as string. More... | |
double | doubleValue_ |
Value as double. More... | |
float | floatValue_ |
Value as float. More... | |
Class that represents data in different formats.
Data can be represented as a string, integer, double, or float. The idea behind the data object is to cache the conversion results and to minimize conversions. The DataObject's value can be null, it is indicated with isNull() returning true. This should not be confused with NullDataObject, which is just there to indicate a DataObject reference which is null (a null reference, compares to a null pointer).
Definition at line 50 of file DataObject.hh.
enum DataObject::OrigType |
Models the type with which DataObject was originally initialized.
Enumerator | |
---|---|
TYPE_INT | |
TYPE_STRING | |
TYPE_DOUBLE | |
TYPE_FLOAT | |
TYPE_NULL | |
TYPE_NOTYPE |
Definition at line 56 of file DataObject.hh.
DataObject::DataObject | ( | ) |
Constructor.
Creates an DataObject which represents an empty string.
Definition at line 46 of file DataObject.cc.
|
explicit |
Constructor for integer data.
value | Value as integer. |
Definition at line 57 of file DataObject.cc.
References setInteger().
|
explicit |
Constructor for integer data.
value | Value as integer. |
Definition at line 66 of file DataObject.cc.
References setLong().
|
explicit |
Constructor for double data.
value | Value as double. |
Definition at line 75 of file DataObject.cc.
References setDouble().
|
explicit |
Constructor for string data.
value | Value as string. |
Definition at line 84 of file DataObject.cc.
References setString().
|
virtual |
|
virtual |
Returns the bool value of DataObject.
The conversion is done from the original data type. The NULL value is represented as "false".
NumberFormatException | If conversion fails or if DataObject is not initialized. |
Definition at line 470 of file DataObject.cc.
References integerValue(), StringTools::stringToLower(), stringValue(), type_, TYPE_NULL, and TYPE_STRING.
Referenced by HDB::HDBManager::addOperationPipelinesToFUArchitecture(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), HDB::HDBManager::createImplementationOfRF(), and HDB::HDBManager::rfArchitectureByID().
|
protected |
|
virtual |
Returns the double value of DataObject.
If double value is not available, the conversion is done from the original data type. Note that a NULL DataObject is converted to 0.0.
NumberFormatException | If conversion fails or if DataObject is not initialized. |
Reimplemented in NullDataObject.
Definition at line 386 of file DataObject.cc.
References doubleFresh_, doubleValue_, floatValue_, intValue_, stringValue_, Conversion::toDouble(), type_, TYPE_FLOAT, TYPE_INT, TYPE_NOTYPE, TYPE_NULL, and TYPE_STRING.
Referenced by DSDBManager::applicationCostEstimatesByConf(), CostDatabase::buildBuses(), CostDatabase::buildFunctionUnits(), CostDatabase::buildRegisterFiles(), CostDatabase::buildSockets(), CustomCommand::checkDoubleArgument(), DSDBManager::cycleCount(), DefaultICDecoderEstimator::delayOfBus(), DefaultICDecoderEstimator::delayOfSocket(), DSDBManager::energyEstimate(), StrictMatchRFEstimator::estimateArea(), StrictMatchFUEstimator::estimateArea(), StrictMatchFUEstimator::estimateEnergy(), StrictMatchRFEstimator::estimateEnergy(), DefaultICDecoderEstimator::estimateICArea(), StrictMatchFUEstimator::estimateMaximumComputationDelay(), StrictMatchRFEstimator::estimateMaximumComputationDelay(), StrictMatchFUEstimator::estimatePortReadDelay(), StrictMatchRFEstimator::estimatePortReadDelay(), StrictMatchFUEstimator::estimatePortWriteDelay(), StrictMatchRFEstimator::estimatePortWriteDelay(), and DSDBManager::longestPathDelayEstimate().
|
protected |
|
virtual |
Returns the float value of DataObject.
If float value is not available, the conversion is done from the original data type. Note that a NULL DataObject is converted to 0.0.
NumberFormatException | If conversion fails or if DataObject is not initialized. |
Reimplemented in NullDataObject.
Definition at line 428 of file DataObject.cc.
References doubleValue_, floatFresh_, floatValue_, intValue_, stringValue_, Conversion::toFloat(), type_, TYPE_DOUBLE, TYPE_INT, TYPE_NOTYPE, TYPE_NULL, and TYPE_STRING.
|
virtual |
Returns the integer value of DataObject.
If integer value is not available, the conversion is done from the original value type. Note that a NULL DataObject is converted to 0.
NumberFormatException | If conversion fails or if DataObject is not initialized. |
Reimplemented in NullDataObject.
Definition at line 204 of file DataObject.cc.
References doubleValue_, floatValue_, intFresh_, intValue_, stringValue_, Conversion::toInt(), Conversion::toUnsignedInt(), type_, TYPE_DOUBLE, TYPE_FLOAT, TYPE_NOTYPE, TYPE_NULL, and TYPE_STRING.
Referenced by HDB::HDBManager::addOpcodesToImplementation(), HDB::HDBManager::addOperationPipelinesToFUArchitecture(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), InstructionExecution::address(), DSDBManager::applicationCostEstimatesByConf(), DSDBManager::applicationCount(), DSDBManager::applicationIDs(), DSDBManager::archConfigurationIDs(), DSDBManager::architectureId(), DSDBManager::architectureIDs(), DSDBManager::areaEstimate(), boolValue(), CostDatabase::buildBuses(), CostDatabase::buildSockets(), HDB::HDBManager::busCostEstimationDataIDs(), HDB::HDBManager::busEntryIDs(), CustomCommand::checkIntegerArgument(), CustomCommand::checkPositiveIntegerArgument(), CustomCommand::checkUnsignedIntegerArgument(), DSDBManager::configuration(), DSDBManager::configurationId(), DSDBManager::configurationIDs(), HDB::HDBManager::costEstimationData(), HDB::HDBManager::costEstimationDataIDs(), HDB::HDBManager::costFunctionPluginByID(), HDB::HDBManager::costFunctionPluginDataIDs(), HDB::HDBManager::costFunctionPluginIDs(), HDB::HDBManager::createCostFunctionOfFU(), HDB::HDBManager::createCostFunctionOfRF(), HDB::HDBManager::createImplementationOfFU(), HDB::HDBManager::createImplementationOfRF(), InstructionExecution::cycle(), DefaultICDecoderEstimator::delayOfSocket(), HDB::HDBManager::fuArchitectureID(), HDB::HDBManager::fuArchitectureIDs(), HDB::HDBManager::fuArchitectureIDsByOperationSet(), HDB::HDBManager::fuByEntryID(), HDB::HDBManager::fuCostEstimationDataIDs(), HDB::HDBManager::fuEntriesByArchitecture(), HDB::HDBManager::fuEntryIDOfImplementation(), HDB::HDBManager::fuEntryIDs(), HDB::HDBManager::OperationImplementationByID(), HDB::HDBManager::OperationImplementationIDs(), HDB::HDBManager::OperationImplementationResourceIDs(), DSDBManager::paretoSetConnectivityAndCycles(), HDB::HDBManager::removeBusEntry(), HDB::HDBManager::removeFUEntry(), HDB::HDBManager::removeOperationImplementation(), HDB::HDBManager::removeOperationImplementationResource(), HDB::HDBManager::removeRFEntry(), HDB::HDBManager::removeSocketEntry(), HDB::HDBManager::resolveArchitecturePort(), HDB::HDBManager::rfArchitectureByID(), HDB::HDBManager::rfArchitectureID(), HDB::HDBManager::rfArchitectureIDs(), HDB::HDBManager::rfByEntryID(), HDB::HDBManager::rfCostEstimationDataIDs(), HDB::HDBManager::rfEntriesByArchitecture(), HDB::HDBManager::rfEntryIDOfImplementation(), HDB::HDBManager::rfEntryIDs(), SQLiteConnection::rowCountInTable(), HDB::HDBManager::socketCostEstimationDataIDs(), HDB::HDBManager::socketEntryIDs(), SQLiteConnection::tableExistsInDB(), ScriptInterpreter::variableIntegerValue(), and SQLiteConnection::version().
|
protected |
|
virtual |
Returns true in case the object represents a NULL value.
Reimplemented in NullDataObject.
Definition at line 491 of file DataObject.cc.
References type_, and TYPE_NULL.
Referenced by HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), DSDBManager::configuration(), HDB::HDBManager::costEstimationData(), HDB::HDBManager::createCostFunctionOfFU(), HDB::HDBManager::createCostFunctionOfRF(), HDB::HDBManager::fuArchitectureID(), HDB::HDBManager::fuByEntryID(), HDB::HDBManager::fuEntryHasArchitecture(), HDB::HDBManager::rfArchitectureByID(), HDB::HDBManager::rfArchitectureID(), HDB::HDBManager::rfByEntryID(), and HDB::HDBManager::rfEntryHasArchitecture().
|
virtual |
Returns the (long) integer value of DataObject.
If integer value is not available, the conversion is done from the original value type. Note that a NULL DataObject is converted to 0.
NumberFormatException | If conversion fails or if DataObject is not initialized. |
Reimplemented in NullDataObject.
Definition at line 273 of file DataObject.cc.
References doubleValue_, floatValue_, intFresh_, intValue_, stringValue_, Conversion::toLong(), Conversion::toUnsignedLong(), type_, TYPE_DOUBLE, TYPE_FLOAT, TYPE_NOTYPE, TYPE_NULL, and TYPE_STRING.
|
virtual |
Tests the inequality of two DataObjects.
object | The object this object is compared to. |
NumberFormatException | If conversion fails. |
Definition at line 503 of file DataObject.cc.
References stringValue(), type_, and TYPE_NULL.
|
virtual |
Sets the bool value of DataObject.
value | The bool value of DataObject. |
Definition at line 175 of file DataObject.cc.
References setInteger().
|
virtual |
Sets the double value of DataObject.
value | The double value of DataObject. |
Reimplemented in NullDataObject.
Definition at line 145 of file DataObject.cc.
References doubleFresh_, doubleValue_, floatFresh_, intFresh_, stringFresh_, type_, and TYPE_DOUBLE.
Referenced by DataObject(), and ScriptInterpreter::setResult().
|
virtual |
Sets the float value of DataObject.
value | The float value of DataObject. |
Reimplemented in NullDataObject.
Definition at line 160 of file DataObject.cc.
References doubleFresh_, floatFresh_, floatValue_, intFresh_, stringFresh_, type_, and TYPE_FLOAT.
|
virtual |
Sets the integer value of DataObject.
value | The integer value. |
Reimplemented in NullDataObject.
Definition at line 115 of file DataObject.cc.
References doubleFresh_, floatFresh_, intFresh_, intValue_, stringFresh_, type_, and TYPE_INT.
Referenced by DataObject(), setBool(), ScriptInterpreter::setResult(), and ScriptInterpreter::setVariable().
|
virtual |
Sets the integer value of DataObject.
value | The integer value. |
Reimplemented in NullDataObject.
Definition at line 100 of file DataObject.cc.
References doubleFresh_, floatFresh_, intFresh_, intValue_, stringFresh_, type_, and TYPE_INT.
Referenced by DataObject().
|
virtual |
Sets the DataObject to null.
Reimplemented in NullDataObject.
Definition at line 184 of file DataObject.cc.
References intFresh_, intValue_, stringFresh_, stringValue_, type_, and TYPE_NULL.
Referenced by SQLiteQueryResult::next().
|
virtual |
Sets the string value of DataObject.
value | The string value. |
Reimplemented in NullDataObject.
Definition at line 130 of file DataObject.cc.
References doubleFresh_, floatFresh_, intFresh_, stringFresh_, stringValue_, type_, and TYPE_STRING.
Referenced by CustomCommand::checkArgumentCount(), CustomCommand::checkDoubleArgument(), CustomCommand::checkIntegerArgument(), CustomCommand::checkPositiveIntegerArgument(), SimControlLanguageCommand::checkSimulationEnded(), SimControlLanguageCommand::checkSimulationInitialized(), SimControlLanguageCommand::checkSimulationNotAlreadyRunning(), SimControlLanguageCommand::checkSimulationStopped(), CustomCommand::checkUnsignedIntegerArgument(), DataObject(), HelpCommand::execute(), MachCommand::execute(), ConfCommand::execute(), ProgCommand::execute(), MemDumpCommand::execute(), Script::execute(), SettingCommand::execute(), CmdHelp::execute(), CmdTrigger::execute(), CmdReset::execute(), CmdQuit::execute(), CmdOutput::execute(), CmdRegister::execute(), CmdMem::execute(), CmdAdvanceClock::execute(), SimpleScriptInterpreter::interpret(), SQLiteQueryResult::next(), SimControlLanguageCommand::setErrorMessage(), ScriptInterpreter::setResult(), ScriptInterpreter::setVariable(), TclInterpreter::tclObjToDataObject(), and DefaultICDecoderEstimator::valueFromKeyValuePairString().
|
protected |
|
virtual |
Returns the string value of DataObject.
If string value is not available, the conversion is done from the original data type. Note that a NULL DataObject is converted to an empty string.
NumberFormatException | If conversion fails or if DataObject is not initialized. |
Reimplemented in NullDataObject.
Definition at line 344 of file DataObject.cc.
References doubleValue_, floatValue_, intValue_, stringFresh_, stringValue_, Conversion::toString(), type_, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_NOTYPE, and TYPE_NULL.
Referenced by HDB::HDBManager::addBlockImplementationFiles(), HDB::HDBManager::addCostEstimationData(), HDB::HDBManager::addDataPortsToImplementation(), HDB::HDBManager::addFUExternalPortsToImplementation(), HDB::HDBManager::addFUImplementation(), HDB::HDBManager::addFUParametersToImplementation(), HDB::HDBManager::addOpcodesToImplementation(), HDB::HDBManager::addOperationPipelinesToFUArchitecture(), HDB::HDBManager::addPortsAndBindingsToFUArchitecture(), HDB::HDBManager::addRFExternalPortsToImplementation(), HDB::HDBManager::addRFParametersToImplementation(), DSDBManager::applicationCostEstimatesByConf(), DSDBManager::applicationPath(), DSDBManager::architectureString(), HDB::HDBManager::blockSourceFile(), boolValue(), HDBToHtml::busEntryToHtml(), CustomCommand::checkUnsignedIntegerArgument(), ConditionScript::conditionOk(), HDB::HDBManager::costEstimationData(), HDB::HDBManager::costFunctionPluginByID(), HDBToHtml::costFunctionPluginToHtml(), HDB::HDBManager::createCostFunctionOfFU(), HDB::HDBManager::createCostFunctionOfRF(), HDB::HDBManager::createImplementationOfFU(), HDB::HDBManager::createImplementationOfRF(), DefaultICDecoderEstimator::delayOfBus(), DefaultICDecoderEstimator::delayOfSocket(), DefaultICDecoderEstimator::estimateICArea(), DefaultICDecoderEstimator::estimateICEnergy(), MemDumpCommand::execute(), HDBToHtml::fuEntryToHtml(), HDBToHtml::fuImplToHtml(), HDB::HDBManager::hasColumn(), DSDBManager::implementationString(), HDB::HDBManager::modifyCostEstimationData(), HDB::HDBManager::OperationImplementationByID(), HDB::HDBManager::OperationImplementationResourceByID(), operator!=(), HDB::HDBManager::resolveArchitecturePort(), ScriptInterpreter::result(), HDBToHtml::rfEntryToHtml(), HDBToHtml::rfImplToHtml(), SimpleScriptInterpreter::setVariableToInterpreter(), TclInterpreter::setVariableToInterpreter(), HDBToHtml::socketEntryToHtml(), CostFunctionPluginDialog::TransferDataToWindow(), CostEstimationDataDialog::TransferDataToWindow(), and ScriptInterpreter::variableStringValue().
|
protected |
|
mutableprivate |
Flag indicating that the value of double is up-to-date.
Definition at line 110 of file DataObject.hh.
Referenced by doubleValue(), setDouble(), setFloat(), setInteger(), setLong(), and setString().
|
mutableprivate |
Value as double.
Definition at line 118 of file DataObject.hh.
Referenced by doubleValue(), floatValue(), integerValue(), longValue(), setDouble(), and stringValue().
|
mutableprivate |
Flag indicating that the value of float is up-to-date.
Definition at line 112 of file DataObject.hh.
Referenced by floatValue(), setDouble(), setFloat(), setInteger(), setLong(), and setString().
|
mutableprivate |
Value as float.
Definition at line 120 of file DataObject.hh.
Referenced by doubleValue(), floatValue(), integerValue(), longValue(), setFloat(), and stringValue().
|
mutableprivate |
Flag indicating that the value of integer is up-to-date.
Definition at line 106 of file DataObject.hh.
Referenced by integerValue(), longValue(), setDouble(), setFloat(), setInteger(), setLong(), setNull(), and setString().
|
mutableprivate |
Value as integer.
Definition at line 114 of file DataObject.hh.
Referenced by doubleValue(), floatValue(), integerValue(), longValue(), setInteger(), setLong(), setNull(), and stringValue().
|
mutableprivate |
Flag indicating that the value of string is up-to-date.
Definition at line 108 of file DataObject.hh.
Referenced by setDouble(), setFloat(), setInteger(), setLong(), setNull(), setString(), and stringValue().
|
mutableprivate |
Value as string.
Definition at line 116 of file DataObject.hh.
Referenced by doubleValue(), floatValue(), integerValue(), longValue(), setNull(), setString(), and stringValue().
|
private |
The type of value in which DataObject was last assigned.
Definition at line 104 of file DataObject.hh.
Referenced by boolValue(), doubleValue(), floatValue(), integerValue(), isNull(), longValue(), operator!=(), setDouble(), setFloat(), setInteger(), setLong(), setNull(), setString(), and stringValue().