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

Synapse.cpp

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 //SpikeStream includes
00024 #include "Synapse.h"
00025 #include "Debug.h"
00026 
00027 //Other includes
00028 #include <iostream>
00029 using namespace std;
00030 
00031 
00032 /*! Construtor. */
00033 Synapse::Synapse(){
00034         //Initialise monitoring data
00035         monitorData.dataArray = NULL;
00036         monitorData.length = 0;
00037 }
00038 
00039 
00040 /*! Destructor. */
00041 Synapse::~ Synapse(){
00042         #ifdef MEMORY_DEBUG
00043                 cout<<"DESTROYING SYNAPSE"<<endl;
00044         #endif//MEMORY_DEBUG            
00045 }
00046 
00047 
00048 //------------------------------------------------------------------------
00049 //------------------------- PUBLIC METHODS -------------------------------
00050 //------------------------------------------------------------------------
00051 
00052 /*! Returns a MonitorData structure containing a pointer to an array containing the current values 
00053         of the monitored data items in the same order as they were listed in the XML file. This data
00054         structure also contains the length of the array. */
00055 MonitorData* Synapse::getMonitoringData(){
00056         return &monitorData;
00057 }
00058 
00059 /*! Returns a string containing the data that is output by this neuron in monitoring mode in XML format.
00060         The implementation in Neuron does not contain any monitored parameters. Overload this method if you 
00061         want to send actual information back. */
00062 string Synapse::getMonitoringInfo(){
00063         string xmlString = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
00064         xmlString += "<monitor_info>";
00065         xmlString += "</monitor_info>";
00066         return xmlString;
00067 }
00068 
00069 
00070 /*! Returns the id of the neuron that connects to this synapse
00071         from another task. This can be used to access the synapse
00072         from the synapse map. */
00073 unsigned int Synapse::getPresynapticNeuronID(){
00074         return preSynapticNeuronID;
00075 }
00076 
00077 
00078 /*! Sets the weight of this synapse. Public to allow it to be dynamically
00079         modified. */
00080 void Synapse::setWeight(double wei){
00081         weight = wei;
00082 
00083         #ifdef LOAD_SYNAPSE_DEBUG
00084                 if(weight > MAX_DOUBLE_WEIGHT || weight < MIN_DOUBLE_WEIGHT)
00085                         cerr<<"Synapse: WEIGHT IS OUT OF RANGE: "<<weight<<endl;
00086         #endif //LOAD_SYNAPSE_DEBUG
00087 }
00088 
00089 
00090 //------------------------------------------------------------------------
00091 //-------------------------- PRIVATE METHODS -----------------------------
00092 //------------------------------------------------------------------------
00093 
00094 /*! Prints out information about this synapse for debugging. */
00095 void Synapse::print(){
00096         cout<<"["<<preSynapticNeuronID<<"->"<<postSynapticNeuron->getNeuronID()<<": "<<weight<<"]";
00097 }
00098 
00099 
00100 /*! Stores a reference to a map containing parameters for this synapse. */
00101 void Synapse::setParameterMapReference(map<string, double>* paramMap){
00102         parameterMap = paramMap;
00103 }
00104 
00105 
00106 /*! Sets the neuron that this synapse connects to. */
00107 void Synapse::setPostSynapticNeuron(Neuron *neuron){
00108         postSynapticNeuron = neuron;
00109 }
00110 
00111 
00112 /*! Sets the id of the neuron that connects to this synapse
00113         from another task. This can be used to access the synapse
00114         from the synapse map. */
00115 void Synapse::setPreSynapticNeuronID(unsigned int preSynNeurID){
00116         preSynapticNeuronID = preSynNeurID;
00117 }
00118 
00119 
00120 /*! Passes a reference to the simulation clock. */
00121 /* FIXME THIS WOULD BE BETTER STATIC, BUT HAD LINKING PROBLEMS
00122         WITH DYNAMIC LIBRARIES, WHICH WOULD NEED TO BE SOLVED FIRST. */
00123 void Synapse::setSimulationClock(SimulationClock* simClock){
00124         simulationClock = simClock;
00125 }
00126 

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