Main Page | Namespace List | Alphabetical List | Class List | Directories | File List | Class Members | File Members

ClassLoader.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   SpikeStream Simulation                                                *
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 CLASSLOADER_H
00024 #define CLASSLOADER_H
00025 
00026 //SpikeStream includes
00027 #include "DBInterface.h"
00028 #include "Neuron.h"
00029 #include "Synapse.h"
00030 
00031 //Other includes
00032 #include <map>
00033 #include <string>
00034 using namespace std;
00035 
00036 
00037 /*! The type of the function used to create neurons. */
00038 typedef Neuron* (*CreateNeuronFunctionType)();
00039 
00040 /*! The type of the function used to create synapses. */
00041 typedef Synapse* (*CreateSynapseFunctionType)();
00042 
00043 
00044 //---------------------------- Class Loader -------------------------------
00045 /*! Dynamically loads neuron and synapse classes from libraries.
00046         The location of these libraries is defined in the NeuronTypes and
00047         SynapseTypes tables. */
00048 //-------------------------------------------------------------------------
00049 
00050 class ClassLoader {
00051 
00052         public:
00053                 ClassLoader(DBInterface *netDBInter);
00054                 ~ClassLoader();
00055                 string getConnGrpParameterTableName(unsigned int connGrpID);
00056                 string getNeuronParameterTableName(unsigned short neuronType);
00057                 Neuron* getNewNeuron(unsigned short neuronType);
00058                 Synapse* getNewSynapse(unsigned short synapseType);
00059 
00060 
00061         private:
00062                 //========================== VARIABLES ============================
00063                 /*! Hold reference to dbinterface.*/
00064                 DBInterface *networkDBInterface;
00065 
00066                 /*! Map holding function pointers that create neurons of each type.*/
00067                 map<unsigned short, CreateNeuronFunctionType> neuronFunctionMap;
00068 
00069                 /*! Map holding function pointers that create synapses of each type.*/
00070                 map<unsigned short, CreateSynapseFunctionType> synapseFunctionMap;
00071 
00072                 /*! Map holding details about neuron parameter tables.*/
00073                 map<unsigned short, string> neuronParameterTableMap;//Key is neuron type
00074 
00075                 /*! Map holding details about synapse parameter tables.*/
00076                 map<unsigned int, string> synapseParameterTableMap;//Key is connection group id
00077 
00078 
00079                 //========================== METHODS ============================
00080                 /*! Declare copy constructor private so it cannot be used inadvertently.*/
00081                 ClassLoader (const ClassLoader&);
00082 
00083                 /*! Declare assignment private so it cannot be used inadvertently.*/
00084                 ClassLoader operator = (const ClassLoader&);
00085 
00086                 void loadNeuronClasses();
00087                 void loadSynapseClasses();
00088 
00089 };
00090 
00091 
00092 #endif //CLASSLOADER_H

Generated on Mon Sep 3 22:24:34 2007 for SpikeStream Simulation by  doxygen 1.4.4