|
OpenASIP 2.2
|
#include <MDFDocument.hh>


Public Member Functions | |
| MDFDocument () | |
| virtual | ~MDFDocument () |
| virtual bool | OnOpenDocument (const wxString &filename) |
| virtual bool | OnSaveDocument (const wxString &filename) |
| virtual bool | OnNewDocument () |
| Model * | getModel () |
| virtual void | update () |
Private Member Functions | |
| bool | openCFG (const std::string &filename) |
| bool | openADF (const std::string &filename) |
Private Member Functions inherited from ModelObserver | |
| virtual | ~ModelObserver () |
Private Attributes | |
| Model * | model_ |
| Machine Object Model which the document represents. | |
An instance of MDFDocument represents one machine object model for the editor.
Part of the wxWindows document/view framework. Opening and saving of documents is passed through this class to the xml reader/writer components. When a new document is created or opened, this class initializes a new model. Document's model can be accessed with the getModel() method.
Definition at line 51 of file MDFDocument.hh.
| MDFDocument::MDFDocument | ( | ) |
The constructor.
Definition at line 54 of file MDFDocument.cc.
|
virtual |
| Model * MDFDocument::getModel | ( | ) |
Returns document's model.
Definition at line 229 of file MDFDocument.cc.
References model_.
Referenced by PasteComponentCmd::Do(), and MDFView::OnUpdate().
|
virtual |
Creates a new document.
Definition at line 75 of file MDFDocument.cc.
References Model::addObserver(), and model_.

|
virtual |
Opens an .adf or .cfg file. If the opened file extension is .cfg, the architecture file name is read from the configuration.
| fileName | Name of the file to read. |
Definition at line 90 of file MDFDocument.cc.
References assert, FileSystem::fileExtension(), openADF(), openCFG(), ProDeConstants::PROCESSOR_CONFIG_FILE_EXTENSION, and WxConversion::toString().

|
virtual |
Writes the machine object model to an mdf file using the mdf writer component and sets the model unmodified.
| filename | Name of the file into which the Model will be saved. |
Definition at line 205 of file MDFDocument.cc.
References Exception::errorMessage(), Model::getMachine(), model_, XMLSerializer::setDestinationFile(), WxConversion::toString(), WxConversion::toWxString(), and ADFSerializer::writeMachine().

|
private |
Opens an architecture definition file, and creates model of the architecture.
| filename | Architecture file to open. |
Definition at line 169 of file MDFDocument.cc.
References Model::addObserver(), Exception::errorMessage(), FileSystem::fileOfPath(), ProDeTextGenerator::instance(), model_, ProDeTextGenerator::MSG_ERROR_LOADING_FILE, Texts::TextGenerator::text(), and WxConversion::toWxString().
Referenced by OnOpenDocument(), and openCFG().

|
private |
Reads architectrue definition file name from a processor configuration file, and opens the .adf file.
| filename | Configuration file to read. |
Definition at line 117 of file MDFDocument.cc.
References ProcessorConfigurationFile::architectureName(), FileSystem::directoryOfPath(), ProcessorConfigurationFile::errorCount(), Exception::errorMessage(), ProcessorConfigurationFile::errors(), ProcessorConfigurationFile::errorString(), openADF(), ProcessorConfigurationFile::setPCFDirectory(), and WxConversion::toWxString().
Referenced by OnOpenDocument().

|
virtual |
Updates the document when the Model changes.
Implements ModelObserver.
Definition at line 238 of file MDFDocument.cc.
References Model::isModified(), model_, and Model::setNotModified().

|
private |
Machine Object Model which the document represents.
Definition at line 67 of file MDFDocument.hh.
Referenced by getModel(), OnNewDocument(), OnSaveDocument(), openADF(), update(), and ~MDFDocument().