OpenASIP
2.0
|
#include <IDFSerializer.hh>
Public Member Functions | |
IDFSerializer () | |
virtual | ~IDFSerializer () |
virtual ObjectState * | readState () |
virtual void | writeState (const ObjectState *state) |
MachineImplementation * | readMachineImplementation () |
void | writeMachineImplementation (const MachineImplementation &implementation) |
Public Member Functions inherited from XMLSerializer | |
XMLSerializer () | |
virtual | ~XMLSerializer () |
void | setSourceFile (const std::string &fileName) |
void | setSourceString (const std::string &source) |
void | setDestinationFile (const std::string &fileName) |
void | setDestinationString (std::string &destination) |
void | setSchemaFile (const std::string &fileName) |
void | setUseSchema (bool useSchema) |
void | setXMLNamespace (std::string nsUri) |
Public Member Functions inherited from TCETools::Serializer | |
virtual | ~Serializer () |
Static Private Member Functions | |
static ObjectState * | convertToOMFormat (const ObjectState *fileState) |
static ObjectState * | convertToFileFormat (const ObjectState *omState) |
Additional Inherited Members | |
Protected Member Functions inherited from XMLSerializer | |
std::string | sourceFile () const |
Writer and reader for IDF files.
Definition at line 45 of file IDFSerializer.hh.
IDF::IDFSerializer::IDFSerializer | ( | ) |
The constructor.
Definition at line 90 of file IDFSerializer.cc.
References IDF_SCHEMA_FILE, Environment::schemaDirPath(), XMLSerializer::setSchemaFile(), and XMLSerializer::setUseSchema().
|
virtual |
|
staticprivate |
Converts the given ObjectState tree that represents state of a MachineImplementation instance to IDF file format.
omState | ObjectState tree that represents state of a MachineImplementation instance. |
Definition at line 352 of file IDFSerializer.cc.
References ObjectState::addChild(), ADF_IMPLEMENTATION, assert, BUS, BUS_ID, BUS_NAME, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), DECOMPRESSOR_FILE, FU, FU_ID, FU_NAME, ObjectState::hasAttribute(), ObjectState::hasChild(), HDB_FILE, IC_DECODER_PARAMETER, IC_DECODER_PARAMETER_NAME, IC_DECODER_PARAMETER_VALUE, IC_DECODER_PLUGIN, IC_DECODER_PLUGIN_FILE, IC_DECODER_PLUGIN_NAME, IU, IU_NAME, ObjectState::name(), IDF::MachineImplementation::OSKEY_DECOMPRESSOR_FILE, IDF::UnitImplementationLocation::OSKEY_HDB_FILE, IDF::MachineImplementation::OSKEY_IC_DECODER_FILE, IDF::MachineImplementation::OSKEY_IC_DECODER_HDB, IDF::MachineImplementation::OSKEY_IC_DECODER_NAME, IDF::MachineImplementation::OSKEY_IC_DECODER_PARAMETER_NAME, IDF::MachineImplementation::OSKEY_IC_DECODER_PARAMETER_VALUE, IDF::UnitImplementationLocation::OSKEY_ID, IDF::UnitImplementationLocation::OSKEY_UNIT_NAME, IDF::MachineImplementation::OSNAME_BUS_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_FU_GENERATED, IDF::MachineImplementation::OSNAME_FU_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_IC_DECODER_PARAMETER, IDF::MachineImplementation::OSNAME_IC_DECODER_PLUGIN, IDF::MachineImplementation::OSNAME_IU_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_RF_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_SOCKET_IMPLEMENTATIONS, RF, RF_ID, RF_NAME, ObjectState::setAttribute(), ObjectState::setValue(), SOCKET, SOCKET_ID, and ObjectState::stringAttribute().
Referenced by writeState().
|
staticprivate |
Converts the given ObjectState tree that represents an IDF file to format that can be loaded by MachineImplementation instance.
fileState | ObjectState tree that represents an IDF file. |
Definition at line 178 of file IDFSerializer.cc.
References ObjectState::addChild(), assert, BUS, BUS_ID, BUS_NAME, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), DECOMPRESSOR_FILE, FU, FU_GENERATE, FU_ID, FU_NAME, ObjectState::hasChild(), HDB_FILE, IC_DECODER_PARAMETER, IC_DECODER_PARAMETER_NAME, IC_DECODER_PARAMETER_VALUE, IC_DECODER_PLUGIN, IC_DECODER_PLUGIN_FILE, IC_DECODER_PLUGIN_NAME, IU, IU_NAME, ObjectState::name(), IDF::MachineImplementation::OSKEY_DECOMPRESSOR_FILE, IDF::UnitImplementationLocation::OSKEY_HDB_FILE, IDF::MachineImplementation::OSKEY_IC_DECODER_FILE, IDF::MachineImplementation::OSKEY_IC_DECODER_HDB, IDF::MachineImplementation::OSKEY_IC_DECODER_NAME, IDF::MachineImplementation::OSKEY_IC_DECODER_PARAMETER_NAME, IDF::MachineImplementation::OSKEY_IC_DECODER_PARAMETER_VALUE, IDF::UnitImplementationLocation::OSKEY_ID, IDF::UnitImplementationLocation::OSKEY_UNIT_NAME, IDF::MachineImplementation::OSNAME_BUS_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_FU_GENERATED, IDF::MachineImplementation::OSNAME_FU_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_IC_DECODER_PARAMETER, IDF::MachineImplementation::OSNAME_IC_DECODER_PLUGIN, IDF::MachineImplementation::OSNAME_IU_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_MACHINE_IMPLEMENTATION, IDF::MachineImplementation::OSNAME_RF_IMPLEMENTATIONS, IDF::MachineImplementation::OSNAME_SOCKET_IMPLEMENTATIONS, IDF::UnitImplementationLocation::OSNAME_UNIT_IMPLEMENTATION, RF, RF_ID, RF_NAME, ObjectState::setAttribute(), SOCKET, SOCKET_ID, SOCKET_NAME, ObjectState::stringAttribute(), and ObjectState::stringValue().
Referenced by readState().
MachineImplementation * IDF::IDFSerializer::readMachineImplementation | ( | ) |
Reads the source IDF file that is set and creates a MachineImplementation instance from it.
SerializerException | If an error occurs while reading the file. |
ObjectStateLoadingException | If an error occurs while loading the state of MachineImplementation instance. |
Definition at line 148 of file IDFSerializer.cc.
References implementation, and readState().
Referenced by IDF::MachineImplementation::loadFromIDF(), loadInputs(), ProGe::ProGeUI::loadMachineImplementation(), ProGe::ProGeUI::loadProcessorConfiguration(), and readIdf().
|
virtual |
Reads the source file that is set and creates an ObjectState tree that can be loaded by MachineImplementation instance.
SerializerException | If an error occurs while reading the file. |
Reimplemented from XMLSerializer.
Definition at line 111 of file IDFSerializer.cc.
References convertToOMFormat(), IDF::MachineImplementation::OSKEY_SOURCE_IDF, XMLSerializer::readState(), ObjectState::setAttribute(), and XMLSerializer::sourceFile().
Referenced by DSDBManager::implementation(), ProcessorImplementationWindow::onLoadIDF(), readMachineImplementation(), and DSDBManager::writeImplementationToFile().
void IDF::IDFSerializer::writeMachineImplementation | ( | const MachineImplementation & | implementation | ) |
Writes the given machine implementation to the destination IDF file.
implementation | The implementation to be written. |
SerializerException | If an error occurs while writing file. |
Definition at line 163 of file IDFSerializer.cc.
References implementation, IDF::MachineImplementation::saveState(), and writeState().
Referenced by ProcessorImplementationWindow::doSaveIDF().
|
virtual |
Writes the given ObjectState tree created by MachineImplementation::saveState to an IDF file.
state | ObjectState tree that represents the MachineImplementation instance. |
SerializerException | If an error occurs while writing the file. |
Reimplemented from XMLSerializer.
Definition at line 131 of file IDFSerializer.cc.
References convertToFileFormat(), and XMLSerializer::writeState().
Referenced by DSDBManager::addImplementation(), DSDBManager::writeImplementationToFile(), and writeMachineImplementation().