TruthTableManager Class Reference

Main controller for the truth tables. More...

#include <truthTableManager.hpp>

Collaboration diagram for TruthTableManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TruthTableManager (MainController *controller)
 Constructor.
virtual ~TruthTableManager ()
 Destructor.
wxArrayString getTableList ()
 Returns the table names list.
void setView (TruthTableView *view)
 Sets the table view.
void newTable (wxString name, int inputs, int outputs)
 Creates a new table.
void newTable (TruthTable *table)
 Creates a new table.
void tableSelected (wxString TableId)
 Selects a table.
void tableChanged (vector< bool > input, int output)
 Changes the status of the selected table.
void removeTable ()
 Deletes the selected table.
bool saveFile ()
 Saves the table collection.
bool saveFileAs ()
 Saves the collection to a specified file.
void openFile ()
 Opens a truth table file.
bool openPFile (wxString file)
 Opens a truth table file for a new project.
bool saveFilename (wxString file)
 Saves the table collection to the file.
int getInputs (wxString tableId)
 Returns the input number of a table.
int getOutputs (wxString tableId)
 Returns the output number of a table.
bool isModified ()
 Modified status.
wxString getFileName ()
 Returns the tables file name.
void clean ()
 Deletes all the tables and information.
TruthTablegetTable (wxString id)
 Returns a truth table.

Private Member Functions

void updateTable ()
 Updates the table on the view to the selected one.
void updateList ()
 Updates the table list on the view.
bool appendTables (bool mustDeleteTables, bool newFile)
 Opens the tables from a file, adding them to the collection.
void deleteTables ()
 Deletes all the tables from the collection.

Private Attributes

TruthTableViewview
 Presentation layer.
FileManagerView fileView
 FIle system presentation layer.
MainControllercontroller
 Main application controller.
TruthTableDiskManagerdiskManager
 Data persistance controller.
map< wxString, TruthTable * > tableList
 The truth table collection.
wxString currentTable
 Current truth table selected.
wxString fileName
 File name for the collection.
bool modified
 Has the collection been modified after saving?
bool needNewFile
 Do we need a filename to save the collection?

Detailed Description

Main controller for the truth tables.

This class is the main controller for the truth table collection. It manages it's view and data persistance layers and also provides services to the other controllers.

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

Definition at line 47 of file truthTableManager.hpp.


Constructor & Destructor Documentation

TruthTableManager::TruthTableManager MainController controller  ) 
 

Constructor.

Parameters:
controller the main application controller.

Definition at line 29 of file truthTableManager.cpp.

References controller, currentTable, diskManager, fileName, modified, and needNewFile.

TruthTableManager::~TruthTableManager  )  [virtual]
 

Destructor.

Definition at line 41 of file truthTableManager.cpp.

References diskManager.


Member Function Documentation

bool TruthTableManager::appendTables bool  mustDeleteTables,
bool  newFile
[private]
 

Opens the tables from a file, adding them to the collection.

The actual tables are conserved or deleted.

Parameters:
mustDeleteTables if true, the tables are deleted before adding the new ones.
newFile if true, the file opened will be set as the tables file name.

Definition at line 352 of file truthTableManager.cpp.

References controller, currentTable, deleteTables(), diskManager, MainController::elementChanged(), fileName, fileView, modified, FileManagerView::openFileChoose(), TruthTableDiskManager::openTables(), TruthTableView::selectTable(), tableSelected(), updateList(), and view.

Here is the call graph for this function:

void TruthTableManager::clean  ) 
 

Deletes all the tables and information.

Definition at line 501 of file truthTableManager.cpp.

References controller, currentTable, deleteTables(), fileName, modified, TruthTableView::selectTable(), MainController::tablesChanged(), tableSelected(), updateList(), and view.

Referenced by MainController::newFile().

Here is the call graph for this function:

void TruthTableManager::deleteTables  )  [private]
 

Deletes all the tables from the collection.

Definition at line 337 of file truthTableManager.cpp.

References controller, currentTable, MainController::elementChanged(), and tableList.

Referenced by appendTables(), clean(), openFile(), and openPFile().

Here is the call graph for this function:

wxString TruthTableManager::getFileName  ) 
 

Returns the tables file name.

Returns:
The tables file name.

Definition at line 468 of file truthTableManager.cpp.

References fileName.

Referenced by MainController::save(), and MainController::saveFileNames().

int TruthTableManager::getInputs wxString  tableId  ) 
 

Returns the input number of a table.

Parameters:
tableId the table name.
Returns:
The number of inputs of the table

Definition at line 422 of file truthTableManager.cpp.

References tableList.

Referenced by LayoutManager::tablesChanged(), and LayoutManager::updateIOList().

int TruthTableManager::getOutputs wxString  tableId  ) 
 

Returns the output number of a table.

Parameters:
tableId the table name.
Returns:
The number of outputs of the table

Definition at line 440 of file truthTableManager.cpp.

References tableList.

Referenced by LayoutManager::tablesChanged(), and LayoutManager::updateIOList().

TruthTable * TruthTableManager::getTable wxString  id  ) 
 

Returns a truth table.

Parameters:
id the table name.
Returns:
The table identfied by id.

Definition at line 518 of file truthTableManager.cpp.

References tableList.

Referenced by LayoutManager::getTableSelected().

wxArrayString TruthTableManager::getTableList  ) 
 

Returns the table names list.

Returns:
The table names list.

Definition at line 404 of file truthTableManager.cpp.

References tableList.

Referenced by LayoutManager::tablesChanged().

bool TruthTableManager::isModified  ) 
 

Modified status.

Returns:
True if the collectin has not been modified since last save. False otherwise.

Definition at line 458 of file truthTableManager.cpp.

References modified.

Referenced by MainController::open().

void TruthTableManager::newTable TruthTable table  ) 
 

Creates a new table.

Parameters:
table the new table.

Definition at line 385 of file truthTableManager.cpp.

References TruthTableView::errorMsg(), TruthTable::getName(), tableList, and view.

Here is the call graph for this function:

void TruthTableManager::newTable wxString  name,
int  inputs,
int  outputs
 

Creates a new table.

Parameters:
name table name.
inputs table input number.
outputs table output number.

Definition at line 77 of file truthTableManager.cpp.

References TruthTableView::errorMsg(), tableList, and view.

Referenced by TruthTableDiskManager::returnTables().

Here is the call graph for this function:

void TruthTableManager::openFile  ) 
 

Opens a truth table file.

Definition at line 273 of file truthTableManager.cpp.

References deleteTables(), modified, TruthTableView::msgYesNo(), saveFile(), tableList, and view.

Referenced by TruthTableView::OnOpen().

Here is the call graph for this function:

bool TruthTableManager::openPFile wxString  file  ) 
 

Opens a truth table file for a new project.

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

Definition at line 322 of file truthTableManager.cpp.

References controller, currentTable, deleteTables(), diskManager, MainController::elementChanged(), fileName, TruthTableDiskManager::openTables(), TruthTableView::selectTable(), tableSelected(), updateList(), and view.

Here is the call graph for this function:

void TruthTableManager::removeTable  ) 
 

Deletes the selected table.

Definition at line 128 of file truthTableManager.cpp.

References currentTable, and tableList.

Referenced by TruthTableView::OnRemove().

bool TruthTableManager::saveFile  ) 
 

Saves the table collection.

If the collection has not been saved before, the user is asked to select a file name. Otherwise, the last file name is used.

Returns:
True iif the collection was correctly saved.

Definition at line 186 of file truthTableManager.cpp.

References diskManager, fileName, fileView, modified, needNewFile, FileManagerView::saveFileChoose(), TruthTableDiskManager::saveTables(), tableList, and view.

Referenced by TruthTableView::OnSave(), openFile(), MainController::save(), and MainController::saveAs().

Here is the call graph for this function:

bool TruthTableManager::saveFileAs  ) 
 

Saves the collection to a specified file.

Returns:
True iif the collection was saved correctly.

Definition at line 234 of file truthTableManager.cpp.

References fileName, fileView, FileManagerView::saveFileChoose(), tableList, and view.

Referenced by TruthTableView::OnSaveAs().

Here is the call graph for this function:

bool TruthTableManager::saveFilename wxString  file  ) 
 

Saves the table collection to the file.

Parameters:
file the file to save.
Returns:
True iif the tables were saved correctly.

Definition at line 479 of file truthTableManager.cpp.

References tableList.

Referenced by MainController::save().

void TruthTableManager::setView TruthTableView view  ) 
 

Sets the table view.

Parameters:
view the truth table view.

Definition at line 51 of file truthTableManager.cpp.

References view.

void TruthTableManager::tableChanged vector< bool >  input,
int  output
 

Changes the status of the selected table.

Parameters:
input the input combination.
output the new output values to set at the given input combination.

Definition at line 167 of file truthTableManager.cpp.

References controller, currentTable, MainController::elementChanged(), modified, and tableList.

Referenced by TruthTableView::OnClick().

Here is the call graph for this function:

void TruthTableManager::tableSelected wxString  tableId  ) 
 

Selects a table.

Parameters:
tableId the table name (identifier).

Definition at line 120 of file truthTableManager.cpp.

References currentTable, and updateTable().

Referenced by appendTables(), clean(), TruthTableView::OnSelection(), and openPFile().

Here is the call graph for this function:

void TruthTableManager::updateList  )  [private]
 

Updates the table list on the view.

Definition at line 105 of file truthTableManager.cpp.

References tableList.

Referenced by appendTables(), clean(), and openPFile().

void TruthTableManager::updateTable  )  [private]
 

Updates the table on the view to the selected one.

Definition at line 58 of file truthTableManager.cpp.

References currentTable, tableList, TruthTableView::updateTable(), and view.

Referenced by tableSelected().

Here is the call graph for this function:


Member Data Documentation

MainController* TruthTableManager::controller [private]
 

Main application controller.

Definition at line 77 of file truthTableManager.hpp.

Referenced by appendTables(), clean(), deleteTables(), openPFile(), tableChanged(), and TruthTableManager().

wxString TruthTableManager::currentTable [private]
 

Current truth table selected.

Definition at line 83 of file truthTableManager.hpp.

Referenced by appendTables(), clean(), deleteTables(), openPFile(), removeTable(), tableChanged(), tableSelected(), TruthTableManager(), and updateTable().

TruthTableDiskManager* TruthTableManager::diskManager [private]
 

Data persistance controller.

Definition at line 79 of file truthTableManager.hpp.

Referenced by appendTables(), openPFile(), saveFile(), TruthTableManager(), and ~TruthTableManager().

wxString TruthTableManager::fileName [private]
 

File name for the collection.

Definition at line 85 of file truthTableManager.hpp.

Referenced by appendTables(), clean(), getFileName(), openPFile(), saveFile(), saveFileAs(), and TruthTableManager().

FileManagerView TruthTableManager::fileView [private]
 

FIle system presentation layer.

Definition at line 75 of file truthTableManager.hpp.

Referenced by appendTables(), saveFile(), and saveFileAs().

bool TruthTableManager::modified [private]
 

Has the collection been modified after saving?

Definition at line 87 of file truthTableManager.hpp.

Referenced by appendTables(), clean(), isModified(), openFile(), saveFile(), tableChanged(), and TruthTableManager().

bool TruthTableManager::needNewFile [private]
 

Do we need a filename to save the collection?

Definition at line 89 of file truthTableManager.hpp.

Referenced by saveFile(), and TruthTableManager().

map<wxString, TruthTable*> TruthTableManager::tableList [private]
 

The truth table collection.

Definition at line 81 of file truthTableManager.hpp.

Referenced by deleteTables(), getInputs(), getOutputs(), getTable(), getTableList(), newTable(), openFile(), removeTable(), saveFile(), saveFileAs(), saveFilename(), tableChanged(), updateList(), and updateTable().

TruthTableView* TruthTableManager::view [private]
 

Presentation layer.

Definition at line 73 of file truthTableManager.hpp.

Referenced by appendTables(), clean(), newTable(), openFile(), openPFile(), saveFile(), saveFileAs(), setView(), and updateTable().


The documentation for this class was generated from the following files:
Generated on Sat Sep 2 00:01:39 2006 for NanoComp by  doxygen 1.4.6