00001 /*************************************************************************** 00002 * SpikeStream Application * 00003 * Copyright (C) 2007 by David Gamez * 00004 * david@davidgamez.eu * 00005 * Version 0.1 * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 ***************************************************************************/ 00022 00023 #ifndef CONNECTIONMATRIXLOADER_H 00024 #define CONNECTIONMATRIXLOADER_H 00025 00026 //SpikeStream includes 00027 #include "DBInterface.h" 00028 00029 //Qt includes 00030 #include <qstring.h> 00031 #include <qstringlist.h> 00032 00033 //--------------------- Connection Matrix Loader --------------------------- 00034 /*! Loads a connection matrix from a file and creates a neuron group and 00035 connection group. The matrix must be square or an error will be thrown. 00036 The neuron group is created with the first type of neuron and synapse 00037 in the database and starting at position 0, 0, 0. Will try and make 00038 the neuron group as close to square as possible. 00039 FIXME NEED A DIALOG TO SPECIFY THE DETAILS PROPERLY. 00040 FIXME THIS METHOD HAS NOT BEEN PROPERLY TESTED. */ 00041 //-------------------------------------------------------------------------- 00042 class ConnectionMatrixLoader { 00043 00044 public: 00045 ConnectionMatrixLoader(DBInterface* netDBInter); 00046 ~ConnectionMatrixLoader(); 00047 bool loadConnectionMatrix(QString& fileName); 00048 00049 private: 00050 //========================= VARIABLES ============================= 00051 DBInterface* networkDBInterface; 00052 00053 /*! Id of the neuron group is set here when it has been created. 00054 Also used to track whether the neuron group has been created.*/ 00055 unsigned int neurGrpID; 00056 00057 /*! Id of the connection group is set here when it has been created. 00058 Also used to track whether the connection group has been created.*/ 00059 unsigned int connGrpID; 00060 00061 /*! The synapse type. Should be the first type in the SynapseTypes 00062 database*/ 00063 unsigned int synapseType; 00064 00065 /*! The neuron type. Should be the first type in the NeuronTypes 00066 database*/ 00067 unsigned int neuronType; 00068 00069 /*! Width of the neuron group.*/ 00070 unsigned int neurGrpWidth; 00071 00072 /*! Length of the neuron group.*/ 00073 unsigned int neurGrpLength; 00074 00075 /*! The size of the neuron group that is being created.*/ 00076 unsigned int numNeur; 00077 00078 /*! Count of the number of connections that have been added.*/ 00079 unsigned int connectionCount; 00080 00081 /*! Count of the rows. */ 00082 unsigned int rowNum; 00083 00084 /*! The lowest ID in the neuron group.*/ 00085 unsigned int startNeurID; 00086 00087 /*! Flag set to true when an error is encountered.*/ 00088 bool errorState; 00089 00090 /*! The parameters table for the neurons.*/ 00091 QString neurParamTable; 00092 00093 00094 //======================== METHODS ============================= 00095 void addConnections(QStringList& neuronIDList); 00096 void createConnectionGroup(const QString& fileName); 00097 void createNeuronGroup(); 00098 void deleteDatabaseEntries(unsigned int nGrpID, unsigned int cGrpID); 00099 void showError(const char* errMsg); 00100 void showError(const QString& errMsg); 00101 00102 }; 00103 00104 #endif//CONNECTIONMATRIXLOADER_H 00105 00106
1.4.4