MainController Class Reference

Main controller application. More...

#include <mainController.hpp>

Collaboration diagram for MainController:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MainController ()
 Constructor.
 ~MainController ()
 Destructor.
void initControllers ()
 Creates the controllers.
RuleManagergetRules ()
 Returns the rule controller.
LayoutManagergetLayouts ()
 Returns the space controller.
ForbiddenPatternManagergetForbiddenPatterns ()
 Returns the forbidden pattern controller.
TruthTableManagergetTruthTables ()
 Returns the truth table controller.
void setNanoFrame (NanoFrame *frame)
 Sets the application main window.
void setRules (RuleManager *rules)
 Sets the rule controller.
void setLayouts (LayoutManager *layouts)
 Sets the space controller.
void setForbiddenPatterns (ForbiddenPatternManager *forbiddenPatterns)
 Sets the forbidden pattern controller.
void setTruthTables (TruthTableManager *truthTables)
 Sets the truth table controller.
void tablesChanged ()
 Method called when the table collection changes.
void FPsChanged ()
 Method called when the pattern collection changes.
void rulesChanged ()
 Method called when the rule collection changes.
void setStatusMessage (wxString message)
 Sets a message on the status bar.
void save ()
 Save project.
void saveAs ()
 Saves the project in a new file.
void open ()
 Opens a project file.
void newFile ()
 Creates a new project.
void startSimulation ()
 Starts the simulation.
void prepareSimulation ()
 Checks all the parameters to start a simulation.
void elementChanged ()
 Method called when any collection changes its status.
NanoFramegetNanoFrame ()
 Member accessor.

Private Member Functions

void saveFileNames (wxTextOutputStream *stream)
 Saves the collection file names to a stream.
void saveTables (wxTextOutputStream *stream)
 Saves the tables information to a stream.
void saveRules (wxTextOutputStream *stream)
 Saves the rules information to a stream.
void savePatterns (wxTextOutputStream *stream)
 Saves the patterns information to a stream.
bool openFile (wxString file)
 Opens a project file.
bool openTables (wxFileInputStream *fileStream, wxTextInputStream *inStream)
 Opens the tables information from a stream.
bool openRules (wxFileInputStream *fileStream, wxTextInputStream *inStream)
 Opens the rules information from a stream.
bool openFPs (wxFileInputStream *fileStream, wxTextInputStream *inStream)
 Opens the forbidden patterns information from a stream.

Private Attributes

NanoFrameframe
 Main window.
RuleManagerrules
 Rule controller.
LayoutManagerlayouts
 Space controller.
ForbiddenPatternManagerforbiddenPatterns
 Forbidden pattern controller.
TruthTableManagertruthTables
 Truth table controller.
SimulationManagersimulation
 Simulation controller.
FileManagerView fileView
 File system presentation layer.
wxString fileName
 Project file name.

Detailed Description

Main controller application.

This is the main controller for the application. It controls the main flow of the program and, more importantly, comunicates all the other controllers between them. It has also the control over the main window class and the project persistance data.

Author:
Bernat Ràfales Mulet <the_bell@users.sourceforge.net>
Version:
Revision
1.13

Definition at line 51 of file mainController.hpp.


Constructor & Destructor Documentation

MainController::MainController  ) 
 

Constructor.

Definition at line 25 of file mainController.cpp.

References fileName, and initControllers().

Here is the call graph for this function:

MainController::~MainController  ) 
 

Destructor.

Definition at line 33 of file mainController.cpp.

References forbiddenPatterns, layouts, rules, and truthTables.


Member Function Documentation

void MainController::elementChanged  ) 
 

Method called when any collection changes its status.

Definition at line 849 of file mainController.cpp.

References LayoutManager::elementChanged(), and layouts.

Referenced by ForbiddenPatternManager::appendFPs(), RuleManager::appendRules(), TruthTableManager::appendTables(), RuleManager::cellChanged(), LayoutManager::cellChanged(), ForbiddenPatternManager::cellChanged(), RuleManager::clean(), LayoutManager::clean(), ForbiddenPatternManager::clean(), ForbiddenPatternManager::deleteFPs(), RuleManager::deleteRules(), TruthTableManager::deleteTables(), ForbiddenPatternManager::newFP(), LayoutManager::newLayout(), RuleManager::newRule(), TruthTableManager::openPFile(), RuleManager::openPFile(), LayoutManager::openPFile(), ForbiddenPatternManager::openPFile(), and TruthTableManager::tableChanged().

Here is the call graph for this function:

void MainController::FPsChanged  ) 
 

Method called when the pattern collection changes.

Definition at line 161 of file mainController.cpp.

References LayoutManager::FPsChanged(), and layouts.

Referenced by ForbiddenPatternManager::clean(), and ForbiddenPatternManager::newFP().

Here is the call graph for this function:

ForbiddenPatternManager * MainController::getForbiddenPatterns  ) 
 

Returns the forbidden pattern controller.

Returns:
The forbidden pattern controller.

Definition at line 137 of file mainController.cpp.

References forbiddenPatterns.

LayoutManager * MainController::getLayouts  ) 
 

Returns the space controller.

Returns:
The space controller.

Definition at line 127 of file mainController.cpp.

References layouts.

NanoFrame * MainController::getNanoFrame  ) 
 

Member accessor.

Returns:
The application main window.

Definition at line 56 of file mainController.cpp.

References frame.

Referenced by SimulationManager::results().

RuleManager * MainController::getRules  ) 
 

Returns the rule controller.

Returns:
The rule controller.

Definition at line 117 of file mainController.cpp.

References rules.

TruthTableManager * MainController::getTruthTables  ) 
 

Returns the truth table controller.

Returns:
The truth table controller.

Definition at line 147 of file mainController.cpp.

References truthTables.

void MainController::initControllers  ) 
 

Creates the controllers.

Definition at line 103 of file mainController.cpp.

References forbiddenPatterns, layouts, rules, simulation, and truthTables.

Referenced by MainController().

void MainController::newFile  ) 
 

Creates a new project.

The user is asked to save the current project if desired.

Definition at line 338 of file mainController.cpp.

References LayoutManager::clean(), TruthTableManager::clean(), ForbiddenPatternManager::clean(), RuleManager::clean(), fileName, forbiddenPatterns, frame, layouts, rules, save(), NanoFrame::setTitleBar(), and truthTables.

Referenced by NanoFrame::OnNew().

Here is the call graph for this function:

void MainController::open  ) 
 

Opens a project file.

Definition at line 287 of file mainController.cpp.

References forbiddenPatterns, LayoutManager::isLayoutModified(), TruthTableManager::isModified(), ForbiddenPatternManager::isModified(), RuleManager::isModified(), layouts, rules, save(), and truthTables.

Referenced by NanoFrame::OnOpen().

Here is the call graph for this function:

bool MainController::openFile wxString  file  )  [private]
 

Opens a project file.

Parameters:
file the file to open.
Returns:
True iif the project was correctly opened.

Definition at line 441 of file mainController.cpp.

References NanoFrame::errorMsg(), frame, and line.

Here is the call graph for this function:

bool MainController::openFPs wxFileInputStream *  fileStream,
wxTextInputStream *  inStream
[private]
 

Opens the forbidden patterns information from a stream.

Parameters:
fileStream file stream.
inStream the text input stream.
Returns:
True if the forbidden patterns information was correctly opened.

Definition at line 769 of file mainController.cpp.

References LayoutManager::getFPs(), and layouts.

Here is the call graph for this function:

bool MainController::openRules wxFileInputStream *  fileStream,
wxTextInputStream *  inStream
[private]
 

Opens the rules information from a stream.

Parameters:
fileStream file stream.
inStream the text input stream.
Returns:
True if the rules information was correctly opened.

Definition at line 717 of file mainController.cpp.

References LayoutManager::getRules(), and layouts.

Here is the call graph for this function:

bool MainController::openTables wxFileInputStream *  fileStream,
wxTextInputStream *  inStream
[private]
 

Opens the tables information from a stream.

Parameters:
fileStream file stream.
inStream the text input stream.
Returns:
True if the tables information was correctly opened.

Definition at line 612 of file mainController.cpp.

References LayoutManager::getTables(), and layouts.

Here is the call graph for this function:

void MainController::prepareSimulation  ) 
 

Checks all the parameters to start a simulation.

Definition at line 824 of file mainController.cpp.

References RuleManager::checkRules(), NanoFrame::errorMsg(), frame, and rules.

Referenced by LayoutManager::prepareSimulation().

Here is the call graph for this function:

void MainController::rulesChanged  ) 
 

Method called when the rule collection changes.

Definition at line 168 of file mainController.cpp.

References layouts, and LayoutManager::rulesChanged().

Referenced by RuleManager::clean(), and RuleManager::newRule().

Here is the call graph for this function:

void MainController::save  ) 
 

Save project.

Saves a project. The different components are saved and then the project is copied into a file. All the components are saved on the same directory.

Definition at line 193 of file mainController.cpp.

References fileName, fileView, forbiddenPatterns, frame, LayoutManager::getFileName(), TruthTableManager::getFileName(), ForbiddenPatternManager::getFileName(), RuleManager::getFileName(), layouts, rules, LayoutManager::saveFile(), TruthTableManager::saveFile(), ForbiddenPatternManager::saveFile(), RuleManager::saveFile(), FileManagerView::saveFileChoose(), LayoutManager::saveFilename(), TruthTableManager::saveFilename(), ForbiddenPatternManager::saveFilename(), RuleManager::saveFilename(), saveFileNames(), savePatterns(), saveRules(), saveTables(), NanoFrame::setTitleBar(), and truthTables.

Referenced by newFile(), NanoFrame::OnSave(), and open().

Here is the call graph for this function:

void MainController::saveAs  ) 
 

Saves the project in a new file.

Definition at line 240 of file mainController.cpp.

References fileName, fileView, forbiddenPatterns, frame, layouts, rules, LayoutManager::saveFile(), TruthTableManager::saveFile(), ForbiddenPatternManager::saveFile(), RuleManager::saveFile(), FileManagerView::saveFileChoose(), and truthTables.

Referenced by NanoFrame::OnSaveAs().

Here is the call graph for this function:

void MainController::saveFileNames wxTextOutputStream *  stream  )  [private]
 

Saves the collection file names to a stream.

Parameters:
stream the stream to write.

Definition at line 357 of file mainController.cpp.

References forbiddenPatterns, LayoutManager::getFileName(), TruthTableManager::getFileName(), ForbiddenPatternManager::getFileName(), RuleManager::getFileName(), layouts, rules, and truthTables.

Referenced by save().

Here is the call graph for this function:

void MainController::savePatterns wxTextOutputStream *  stream  )  [private]
 

Saves the patterns information to a stream.

Parameters:
stream the stream to write.

Definition at line 426 of file mainController.cpp.

References LayoutManager::getFPEnabled(), and layouts.

Referenced by save().

Here is the call graph for this function:

void MainController::saveRules wxTextOutputStream *  stream  )  [private]
 

Saves the rules information to a stream.

Parameters:
stream the stream to write.

Definition at line 412 of file mainController.cpp.

References LayoutManager::getRuleEnabled(), and layouts.

Referenced by save().

Here is the call graph for this function:

void MainController::saveTables wxTextOutputStream *  stream  )  [private]
 

Saves the tables information to a stream.

Parameters:
stream the stream to write.

Definition at line 370 of file mainController.cpp.

References LayoutManager::getTableEnabled(), LayoutManager::getTableInputs(), LayoutManager::getTableOutputs(), and layouts.

Referenced by save().

Here is the call graph for this function:

void MainController::setForbiddenPatterns ForbiddenPatternManager forbiddenPatterns  ) 
 

Sets the forbidden pattern controller.

Parameters:
forbiddenPatterns the forbidden pattern controller.

Definition at line 86 of file mainController.cpp.

References forbiddenPatterns.

void MainController::setLayouts LayoutManager layouts  ) 
 

Sets the space controller.

Parameters:
layouts the space controller.

Definition at line 76 of file mainController.cpp.

References layouts.

void MainController::setNanoFrame NanoFrame frame  ) 
 

Sets the application main window.

Parameters:
frame the application main window.

Definition at line 46 of file mainController.cpp.

References frame.

void MainController::setRules RuleManager rules  ) 
 

Sets the rule controller.

Parameters:
rules the rule controller.

Definition at line 66 of file mainController.cpp.

References rules.

void MainController::setStatusMessage wxString  message  ) 
 

Sets a message on the status bar.

Parameters:
message the status bar message.

Definition at line 178 of file mainController.cpp.

References frame, and NanoFrame::setStatusMessage().

Referenced by LayoutManager::cellChanged(), and startSimulation().

Here is the call graph for this function:

void MainController::setTruthTables TruthTableManager truthTables  ) 
 

Sets the truth table controller.

Parameters:
truthTables the truth table controller.

Definition at line 96 of file mainController.cpp.

References truthTables.

void MainController::startSimulation  ) 
 

Starts the simulation.

Definition at line 816 of file mainController.cpp.

References SimulationManager::prepareSimulation(), setStatusMessage(), and simulation.

Referenced by LayoutManager::startSimulation().

Here is the call graph for this function:

void MainController::tablesChanged  ) 
 

Method called when the table collection changes.

Definition at line 154 of file mainController.cpp.

References layouts, and LayoutManager::tablesChanged().

Referenced by TruthTableManager::clean().

Here is the call graph for this function:


Member Data Documentation

wxString MainController::fileName [private]
 

Project file name.

Definition at line 95 of file mainController.hpp.

Referenced by MainController(), newFile(), save(), and saveAs().

FileManagerView MainController::fileView [private]
 

File system presentation layer.

Definition at line 93 of file mainController.hpp.

Referenced by save(), and saveAs().

ForbiddenPatternManager* MainController::forbiddenPatterns [private]
 

Forbidden pattern controller.

Definition at line 87 of file mainController.hpp.

Referenced by getForbiddenPatterns(), initControllers(), newFile(), open(), save(), saveAs(), saveFileNames(), setForbiddenPatterns(), and ~MainController().

NanoFrame* MainController::frame [private]
 

Main window.

Definition at line 81 of file mainController.hpp.

Referenced by getNanoFrame(), newFile(), openFile(), prepareSimulation(), save(), saveAs(), setNanoFrame(), and setStatusMessage().

LayoutManager* MainController::layouts [private]
 

Space controller.

Definition at line 85 of file mainController.hpp.

Referenced by elementChanged(), FPsChanged(), getLayouts(), initControllers(), newFile(), open(), openFPs(), openRules(), openTables(), rulesChanged(), save(), saveAs(), saveFileNames(), savePatterns(), saveRules(), saveTables(), setLayouts(), tablesChanged(), and ~MainController().

RuleManager* MainController::rules [private]
 

Rule controller.

Definition at line 83 of file mainController.hpp.

Referenced by getRules(), initControllers(), newFile(), open(), prepareSimulation(), save(), saveAs(), saveFileNames(), setRules(), and ~MainController().

SimulationManager* MainController::simulation [private]
 

Simulation controller.

Definition at line 91 of file mainController.hpp.

Referenced by initControllers(), and startSimulation().

TruthTableManager* MainController::truthTables [private]
 

Truth table controller.

Definition at line 89 of file mainController.hpp.

Referenced by getTruthTables(), initControllers(), newFile(), open(), save(), saveAs(), saveFileNames(), setTruthTables(), and ~MainController().


The documentation for this class was generated from the following files:
Generated on Fri Sep 1 23:59:06 2006 for NanoComp by  doxygen 1.4.6