KoMo2  1.0.0
A modern ARM emulator GUI.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
KoMo2Model Class Reference

The logical model of the entire application. All other models should be member variables of this model. More...

#include <KoMo2Model.h>

Inheritance diagram for KoMo2Model:
Model

Public Member Functions

 KoMo2Model (MainWindowView *const mainWindow, const std::string argv0, const std::string manual, const int refreshRate)
 Construct a new KoMo2Model - this constructor initialises the mainWindow pointer, as well as the absolutePathToProjectRoot member. It then constructs a member compileLoadModel, and sets the compile buttons on click events. More...
 
virtual void changeJimulatorState (const JimulatorState newState) override
 Changes the Jimulator state and calls each child models own changeJimulatorState function. More...
 
const bool refreshViews ()
 Refreshes the views. May be called on a looping timer. More...
 
const std::string getAbsolutePathToProjectRoot () const
 Gets the absolutePathToProjectRoot member variable. More...
 
MainWindowView *const getMainWindow () const
 Gets the mainWindow member variable. More...
 
CompileLoadModel *const getCompileLoadModel ()
 Gets the compileLoadModel member variable. More...
 
ControlsModel *const getControlsModel ()
 Gets the controlsModel member variable. More...
 
RegistersModel *const getRegistersModel ()
 Gets the RegistersModel member variable. More...
 
TerminalModel *const getTerminalModel ()
 Gets the terminalModel member variable. More...
 
DisassemblyModel *const getDisassemblyModel ()
 Gets the disassemblyModel member variable. More...
 
- Public Member Functions inherited from Model
 Model (KoMo2Model *const parent)
 Constructs a new Model object - just assigns the parent variable. More...
 
KoMo2Model *const getParent () const
 Returns the parent pointer. More...
 

Private Member Functions

virtual const bool handleKeyPress (const GdkEventKey *const e) override
 Passes the key press event off to other child models. More...
 
 KoMo2Model (const KoMo2Model &)=delete
 
 KoMo2Model (const KoMo2Model &&)=delete
 
KoMo2Modeloperator= (const KoMo2Model &)=delete
 
KoMo2Modeloperator= (const KoMo2Model &&)=delete
 

Private Attributes

MainWindowView *const mainWindow
 A pointer to the main window view.
 
const std::string absolutePathToProjectRoot
 The absolute path to the project root directory.
 
CompileLoadModel compileLoadModel
 The data model for the compile and load functionality of the program, represented by the browse and compile and load buttons in the view.
 
ControlsModel controlsModel
 The data model for the controls and status functionality of the program, represented by the series of buttons and labels running along the top of the view.
 
RegistersModel registersModel
 The data model for the registers view. Represented by the table of values on the left hand side of the main view.
 
TerminalModel terminalModel
 The data model associated with the terminal view. Represented by the input box and text view at the bottom of the view.
 
DisassemblyModel disassemblyModel
 The data model associated with the disassembly view. Represents the rows of memory values that take up the majority of the view.
 
const unsigned int refreshRate
 Defines how often the the refreshViews function should be called when KoMo2 is in the JimulatorState::RUNNING state.
 

Additional Inherited Members

- Protected Member Functions inherited from Model
template<class T1 , class T2 >
void setButtonListener (Gtk::Button *const button, const T1 b, const T2 c)
 Connect any button to any member function of. More...
 
void setButtonState (Gtk::Button *const button, const bool state, Gtk::Image *const img=nullptr, const std::string newTooltip="", const std::string newLabelText="") const
 Sets the state of a button to some boolean - the assumption is that if a button is not meant to be sensitive (get_sensitive() == false) then it should also not have a tooltip or many other attributes. You can also optionally update the buttons image, tooltip text, and label text. More...
 
JimulatorState getJimulatorState () const
 Return the jimulatorState member object. More...
 

Detailed Description

The logical model of the entire application. All other models should be member variables of this model.

This model exists in case separate models pertaining to different GUI elements need to logically interact - for example, the control bar at the top of the KoMo2 GUI window has buttons (controllers) which operate Jimulator, which will cause some function to run in this class (model) which in turn will have to affect the program memory window GUI element (view).

This model is in keeping with the MVC design pattern, where this class is the Model, and the main KoMo2 window contains all of the Controllers and Views.

Definition at line 34 of file KoMo2Model.h.

Constructor & Destructor Documentation

KoMo2Model::KoMo2Model ( MainWindowView *const  mainWindow,
const std::string  argv0,
const std::string  manual,
const int  refreshRate 
)

Construct a new KoMo2Model - this constructor initialises the mainWindow pointer, as well as the absolutePathToProjectRoot member. It then constructs a member compileLoadModel, and sets the compile buttons on click events.

Parameters
mainWindowA pointer to the mainWindow view object.
argv0The absolutePathToProjectRoot - parsed from argv[0].
manualA URI that describes where the user manual can be found.
refreshRateAn integer that describes how many milliseconds should be taken between refreshes when KoMo2 is in the JimulatorState::RUNNING state.

Definition at line 28 of file KoMo2Model.cpp.

Member Function Documentation

void KoMo2Model::changeJimulatorState ( const JimulatorState  newState)
overridevirtual

Changes the Jimulator state and calls each child models own changeJimulatorState function.

Parameters
newStateThe state to change into.

Implements Model.

Definition at line 97 of file KoMo2Model.cpp.

const std::string KoMo2Model::getAbsolutePathToProjectRoot ( ) const

Gets the absolutePathToProjectRoot member variable.

Returns
const std::string The absolute path to the project root.

Definition at line 178 of file KoMo2Model.cpp.

CompileLoadModel *const KoMo2Model::getCompileLoadModel ( )

Gets the compileLoadModel member variable.

Returns
CompileLoadModel* A pointer to the compileLoadModel.

Definition at line 143 of file KoMo2Model.cpp.

ControlsModel *const KoMo2Model::getControlsModel ( )

Gets the controlsModel member variable.

Returns
ControlsModel* A pointer to the controlsModel.

Definition at line 150 of file KoMo2Model.cpp.

DisassemblyModel *const KoMo2Model::getDisassemblyModel ( )

Gets the disassemblyModel member variable.

Returns
DisassemblyModel* A pointer to the disassemblyModel.

Definition at line 164 of file KoMo2Model.cpp.

MainWindowView *const KoMo2Model::getMainWindow ( ) const

Gets the mainWindow member variable.

Returns
MainWindowView* A pointer to the MainWindow.

Definition at line 136 of file KoMo2Model.cpp.

RegistersModel *const KoMo2Model::getRegistersModel ( )

Gets the RegistersModel member variable.

Returns
RegistersModel* A pointer to the RegistersModel.

Definition at line 157 of file KoMo2Model.cpp.

TerminalModel *const KoMo2Model::getTerminalModel ( )

Gets the terminalModel member variable.

Returns
TerminalModel* A pointer to the terminalModel.

Definition at line 171 of file KoMo2Model.cpp.

const bool KoMo2Model::handleKeyPress ( const GdkEventKey *const  e)
overrideprivatevirtual

Passes the key press event off to other child models.

Parameters
eThe key press event.
Returns
true if a key press was handled by the model.
false if a key press was not handled by the model by the model.

Implements Model.

Definition at line 84 of file KoMo2Model.cpp.

const bool KoMo2Model::refreshViews ( )

Refreshes the views. May be called on a looping timer.

Returns
bool True if to be called in a loop, otherwise False.

Definition at line 56 of file KoMo2Model.cpp.


The documentation for this class was generated from the following files: