/home/enzo/treballs/fib/pfc/nanocomp/src/simulationManager.hpp

Go to the documentation of this file.
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 SIMULATIONMANAGER_HPP_
00031 #define SIMULATIONMANAGER_HPP_
00032 
00033 #include "mainController.hpp"
00034 #include "layoutManager.hpp"
00035 #include "truthTableManager.hpp"
00036 #include "ruleManager.hpp"
00037 #include "forbiddenPatternManager.hpp"
00038 #include "layoutManager.hpp"
00039 #include "simulation.hpp"
00040 #include "simulationView.hpp"
00041 #include "resultsView.hpp"
00042 #include <vector>
00043 #include <list>
00044 
00045 using namespace std;
00046 
00047 class LayoutManager;
00048 class SimulationView;
00049 class ResultsView;
00050 class Simulation;
00051 
00052 struct simulationStep;
00053 
00054 class SimulationManager
00055 {
00056 public:
00057         SimulationManager(MainController *controller, TruthTableManager *tableManager, ForbiddenPatternManager *FPManager, RuleManager *ruleManager, LayoutManager *layoutManager);
00058         virtual ~SimulationManager();
00059     void prepareSimulation();
00060     void startSimulation();
00061     bool nextRow();
00062     void simulateRow();
00063     void finishedRow();
00064     void results();
00065     void rowSelected(int row);
00066     void informationSelected(int information);
00067     void pathSelected(int path);
00068     
00069 private:
00070     void addRule(Rule newRule);
00071     void addPattern(ForbiddenPattern newPattern);
00072     bool findRule(Rule rule);
00073     bool findPattern(ForbiddenPattern pattern);
00074     void printRule(Rule rule);
00075     void printPattern(Grid pattern);
00076     bool rotateGrid(Grid originalGrid, Grid *destGrid);
00077     void rotateHexCoordinate(int center, int i, int j, int *ii, int *jj);
00078     void updateRowList();
00079     void updateInformationList();
00080     void updatePathList();
00081     void updateGrid();
00082     bool verifyRow(int row);
00083     bool verifyGrid(int row, Grid g);
00084     
00086     TruthTableManager *tableManager;
00088     ForbiddenPatternManager *FPManager;
00090     RuleManager *ruleManager;
00092     LayoutManager *layoutManager;
00094     MainController *controller;
00095     
00097     list<Rule> rules;
00099     list<ForbiddenPattern> patterns;
00101     TruthTable table;
00103     matrix layout;
00105     vector<coordinate> tableInputs;
00107     vector<coordinate> tableOutputs;
00109     vector< list<Grid> > processedLayouts;
00111     vector< list<simulationStep> > finalLayouts;
00113     vector< list<simulationStep> > forbiddenLayouts;
00115     vector< list<simulationStep> > cycles;
00117     int row;
00119     SimulationView *view;
00121     ResultsView *resultsView;
00123     Simulation *simulation;
00125     int rRow;
00127     int rInformation;
00129     int rPath;
00131     Grid initialGrid;
00132 };
00133 
00134 #endif /*SIMULATIONMANAGER_HPP_*/

Generated on Fri Sep 1 23:55:14 2006 for NanoComp by  doxygen 1.4.6