|
OpenASIP 2.2
|
#include <Model.hh>

Public Member Functions | |
| Model () | |
| Model (const std::string &fileName) | |
| ~Model () | |
| TTAMachine::Machine * | getMachine () |
| void | undo () |
| void | redo () |
| bool | canUndo () |
| bool | canRedo () |
| void | addObserver (ModelObserver *observer) |
| void | notifyObservers (bool modified=true) |
| void | pushToStack () |
| void | popFromStack (bool modified=false) |
| void | setNotModified () |
| bool | isModified () const |
Private Types | |
| typedef std::vector< ModelObserver * > | ObserverTable |
| Table of model observers. | |
| typedef std::deque< TTAMachine::Machine * > | UndoStack |
| Machine stack for undo functionality. | |
Private Member Functions | |
| Model (const Model &) | |
| Copying not allowed. | |
| Model & | operator= (const Model &) |
| Assignment not allowed. | |
Private Attributes | |
| TTAMachine::Machine * | machine_ |
| Machine assigned for this Model. Singleton within a Model. | |
| ObserverTable | observers_ |
| Model observers. | |
| unsigned | undoStackSize_ |
| Maximum size of the undo stack. | |
| UndoStack | undoStack_ |
| TTAMachine::Machine * | undone_ |
| Undone modification cache for the redo funciton. | |
| bool | modified_ |
Static Private Attributes | |
| static const unsigned int | UNDO_STACK_MAX_SIZE |
| Maximum undo stack size. | |
|
private |
|
private |
| Model::Model | ( | ) |
The Constructor.
Definition at line 53 of file Model.cc.
| Model::Model | ( | const std::string & | fileName | ) |
The Constructor.
Creates model from a specified file.
| fileName | The file name of the machine description to open. |
Definition at line 77 of file Model.cc.
References machine_, ADFSerializer::readMachine(), and XMLSerializer::setSourceFile().

| Model::~Model | ( | ) |
The Destructor.
Definition at line 60 of file Model.cc.
References machine, and undoStack_.
|
private |
Copying not allowed.
| void Model::addObserver | ( | ModelObserver * | observer | ) |
Adds an observer for this Model.
| observer | The observer to add. |
Definition at line 143 of file Model.cc.
References observers_.
Referenced by MDFDocument::OnNewDocument(), and MDFDocument::openADF().
| bool Model::canRedo | ( | ) |
Returns true if the last undone command can be redone.
Definition at line 228 of file Model.cc.
References undone_.
Referenced by RedoCmd::isEnabled().
| bool Model::canUndo | ( | ) |
Returns true if the undo stack is not empty.
Definition at line 213 of file Model.cc.
References undoStack_.
Referenced by UndoCmd::isEnabled().
| Machine * Model::getMachine | ( | ) |
Returns the Machine.
Definition at line 88 of file Model.cc.
References machine_.
Referenced by AddASCmd::Do(), AddBridgeCmd::Do(), AddBusCmd::Do(), AddFUCmd::Do(), AddGCUCmd::Do(), AddIUCmd::Do(), AddRFCmd::Do(), AddSocketCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), EditMachineCmd::Do(), EditOTAFormatsCmd::Do(), EditTemplatesCmd::Do(), FullyConnectBussesCmd::Do(), PasteComponentCmd::Do(), FullyConnectBussesCmd::isEnabled(), AddFUFromHDBDialog::onAdd(), AddIUFromHDBDialog::onAdd(), AddRFFromHDBDialog::onAdd(), CallExplorerPluginWindow::onRun(), MDFDocument::OnSaveDocument(), and MDFView::OnUpdate().
|
inline |
| void Model::notifyObservers | ( | bool | modified = true | ) |
Notifies all observers of this Model to update themselves.
Definition at line 152 of file Model.cc.
References modified_, and observers_.
Referenced by AddASCmd::Do(), AddBridgeCmd::Do(), AddBusCmd::Do(), AddFUCmd::Do(), AddGCUCmd::Do(), AddIUCmd::Do(), AddRFCmd::Do(), AddSocketCmd::Do(), BlocksConnectICCmd::Do(), CallExplorerPluginCmd::Do(), CutComponentCmd::Do(), DeleteComponentCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), EditMachineCmd::Do(), EditOTAFormatsCmd::Do(), EditTemplatesCmd::Do(), FullyConnectBussesCmd::Do(), ModifyComponentCmd::Do(), PasteComponentCmd::Do(), VLIWConnectICCmd::Do(), ConnectTool::leftClick(), AddFUFromHDBDialog::onAdd(), AddIUFromHDBDialog::onAdd(), AddRFFromHDBDialog::onAdd(), popFromStack(), and redo().
| void Model::popFromStack | ( | bool | modified = false | ) |
Replaces the current machine with the one that is in the top of the undo stack.
Definition at line 195 of file Model.cc.
References machine_, notifyObservers(), and undoStack_.
Referenced by AddASCmd::Do(), AddBridgeCmd::Do(), AddBusCmd::Do(), AddFUCmd::Do(), AddGCUCmd::Do(), AddIUCmd::Do(), AddRFCmd::Do(), AddSocketCmd::Do(), BlocksConnectICCmd::Do(), CallExplorerPluginCmd::Do(), DeleteComponentCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), EditMachineCmd::Do(), EditOTAFormatsCmd::Do(), EditTemplatesCmd::Do(), ModifyComponentCmd::Do(), PasteComponentCmd::Do(), VLIWConnectICCmd::Do(), ConnectTool::leftClick(), and undo().

| void Model::pushToStack | ( | ) |
Pushes the current machine to the undo stack.
Definition at line 167 of file Model.cc.
References machine_, options, undone_, and undoStack_.
Referenced by AddASCmd::Do(), AddBridgeCmd::Do(), AddBusCmd::Do(), AddFUCmd::Do(), AddGCUCmd::Do(), AddIUCmd::Do(), AddRFCmd::Do(), AddSocketCmd::Do(), BlocksConnectICCmd::Do(), CallExplorerPluginCmd::Do(), CutComponentCmd::Do(), DeleteComponentCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), EditMachineCmd::Do(), EditOTAFormatsCmd::Do(), EditTemplatesCmd::Do(), FullyConnectBussesCmd::Do(), ModifyComponentCmd::Do(), PasteComponentCmd::Do(), VLIWConnectICCmd::Do(), ConnectTool::leftClick(), AddFUFromHDBDialog::onAdd(), AddIUFromHDBDialog::onAdd(), AddRFFromHDBDialog::onAdd(), and redo().
| void Model::redo | ( | ) |
Redoes last undoed modification.
Definition at line 118 of file Model.cc.
References assert, machine_, notifyObservers(), pushToStack(), and undone_.

|
inline |
| void Model::undo | ( | ) |
Restores Machine to the state before the last modification.
Definition at line 97 of file Model.cc.
References machine_, popFromStack(), and undone_.

|
private |
Machine assigned for this Model. Singleton within a Model.
Definition at line 73 of file Model.hh.
Referenced by getMachine(), Model(), popFromStack(), pushToStack(), redo(), and undo().
|
private |
Definition at line 94 of file Model.hh.
Referenced by isModified(), notifyObservers(), and setNotModified().
|
private |
Model observers.
Definition at line 79 of file Model.hh.
Referenced by addObserver(), and notifyObservers().
|
staticprivate |
|
private |
|
private |
Definition at line 90 of file Model.hh.
Referenced by canUndo(), popFromStack(), pushToStack(), and ~Model().
|
private |