OpenASIP
2.0
|
#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. More... | |
typedef std::deque< TTAMachine::Machine * > | UndoStack |
Machine stack for undo functionality. More... | |
Private Member Functions | |
Model (const Model &) | |
Copying not allowed. More... | |
Model & | operator= (const Model &) |
Assignment not allowed. More... | |
Private Attributes | |
TTAMachine::Machine * | machine_ |
Machine assigned for this Model. Singleton within a Model. More... | |
ObserverTable | observers_ |
Model observers. More... | |
unsigned | undoStackSize_ |
Maximum size of the undo stack. More... | |
UndoStack | undoStack_ |
TTAMachine::Machine * | undone_ |
Undone modification cache for the redo funciton. More... | |
bool | modified_ |
Static Private Attributes | |
static const unsigned int | UNDO_STACK_MAX_SIZE |
Maximum undo stack size. More... | |
|
private |
|
private |
Model::Model | ( | ) |
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 | ( | ) |
|
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 EditMachineCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), AddFUCmd::Do(), AddRFCmd::Do(), AddSocketCmd::Do(), AddASCmd::Do(), AddBusCmd::Do(), AddIUCmd::Do(), EditOTAFormatsCmd::Do(), EditTemplatesCmd::Do(), AddBridgeCmd::Do(), AddGCUCmd::Do(), PasteComponentCmd::Do(), FullyConnectBussesCmd::Do(), FullyConnectBussesCmd::isEnabled(), AddIUFromHDBDialog::onAdd(), AddFUFromHDBDialog::onAdd(), AddRFFromHDBDialog::onAdd(), 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 EditMachineCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), BlocksConnectICCmd::Do(), AddRFCmd::Do(), DeleteComponentCmd::Do(), AddFUCmd::Do(), AddSocketCmd::Do(), AddASCmd::Do(), AddBusCmd::Do(), ModifyComponentCmd::Do(), AddIUCmd::Do(), VLIWConnectICCmd::Do(), CutComponentCmd::Do(), AddBridgeCmd::Do(), CallExplorerPluginCmd::Do(), EditOTAFormatsCmd::Do(), EditTemplatesCmd::Do(), AddGCUCmd::Do(), PasteComponentCmd::Do(), FullyConnectBussesCmd::Do(), ConnectTool::leftClick(), AddIUFromHDBDialog::onAdd(), AddRFFromHDBDialog::onAdd(), AddFUFromHDBDialog::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 EditMachineCmd::Do(), EditAddressSpacesCmd::Do(), BlocksConnectICCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), AddASCmd::Do(), AddFUCmd::Do(), AddSocketCmd::Do(), ModifyComponentCmd::Do(), VLIWConnectICCmd::Do(), AddIUCmd::Do(), AddBusCmd::Do(), DeleteComponentCmd::Do(), AddRFCmd::Do(), EditTemplatesCmd::Do(), AddBridgeCmd::Do(), CallExplorerPluginCmd::Do(), EditOTAFormatsCmd::Do(), AddGCUCmd::Do(), PasteComponentCmd::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 EditMachineCmd::Do(), EditAddressSpacesCmd::Do(), EditBusOrderCmd::Do(), EditImmediateSlotsCmd::Do(), BlocksConnectICCmd::Do(), AddRFCmd::Do(), DeleteComponentCmd::Do(), AddFUCmd::Do(), AddSocketCmd::Do(), AddASCmd::Do(), AddBusCmd::Do(), ModifyComponentCmd::Do(), VLIWConnectICCmd::Do(), AddIUCmd::Do(), CutComponentCmd::Do(), AddBridgeCmd::Do(), CallExplorerPluginCmd::Do(), EditTemplatesCmd::Do(), EditOTAFormatsCmd::Do(), AddGCUCmd::Do(), PasteComponentCmd::Do(), FullyConnectBussesCmd::Do(), ConnectTool::leftClick(), AddIUFromHDBDialog::onAdd(), AddRFFromHDBDialog::onAdd(), AddFUFromHDBDialog::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 |