00001 /* 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU General Public License * 00014 * along with this program; if not, write to the * 00015 * Free Software Foundation, Inc., * 00016 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00017 */ 00018 00030 #ifndef TRUTHTABLEMANAGER_HPP_ 00031 #define TRUTHTABLEMANAGER_HPP_ 00032 00033 #include "truthTableView.hpp" 00034 #include "truthTable.hpp" 00035 #include "fileManagerView.hpp" 00036 #include "truthTableDiskManager.hpp" 00037 #include "mainController.hpp" 00038 #include <wx/wx.h> 00039 #include <map> 00040 00041 using namespace std; 00042 00043 class TruthTableView; 00044 class TruthTableDiskManager; 00045 class MainController; 00046 00047 class TruthTableManager 00048 { 00049 public: 00050 TruthTableManager(MainController *controller); 00051 virtual ~TruthTableManager(); 00052 wxArrayString getTableList(); 00053 void setView(TruthTableView *view); 00054 void newTable(wxString name, int inputs, int outputs); 00055 void newTable(TruthTable *table); 00056 void tableSelected(wxString TableId); 00057 void tableChanged(vector<bool> input, int output); 00058 void removeTable(); 00059 bool saveFile(); 00060 bool saveFileAs(); 00061 void openFile(); 00062 bool openPFile(wxString file); 00063 bool saveFilename(wxString file); 00064 int getInputs(wxString tableId); 00065 int getOutputs(wxString tableId); 00066 bool isModified(); 00067 wxString getFileName(); 00068 void clean(); 00069 TruthTable * getTable(wxString id); 00070 00071 private: 00073 TruthTableView *view; 00075 FileManagerView fileView; 00077 MainController *controller; 00079 TruthTableDiskManager *diskManager; 00081 map<wxString, TruthTable*> tableList; 00083 wxString currentTable; 00085 wxString fileName; 00087 bool modified; 00089 bool needNewFile; 00090 void updateTable(); 00091 void updateList(); 00092 bool appendTables(bool mustDeleteTables, bool newFile); 00093 void deleteTables(); 00094 }; 00095 00096 #endif /*TRUTHTABLEMANAGER_HPP_*/