Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

layer.h

00001 /***************************************************************************
00002                           layer.h  -  description
00003                              -------------------
00004     begin                : Wed Apr 11 2001
00005     copyright            : (C) 2001 by Matt Grover
00006     email                : mgrover@amygdala.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef LAYER_H
00019 #define LAYER_H
00020 
00021 
00022 using namespace std;
00023 #include <vector>
00024 #include <string>
00025 #include <amygdala/neuron.h>
00026 #include <amygdala/network.h>
00027 #include <amygdala/types.h>
00028 
00029 class Network;
00030 class Neuron;
00031 
00032 
00033 
00044 class Layer {
00045 public:
00046     Layer();
00047     ~Layer();
00048 
00049     friend class Network;
00050 
00058     void AddNeuron(Neuron* nrn);
00059 
00067     void AddNeuronVector(vector<Neuron*> nrnVec);
00068     
00073     void LayerName(string name) { layerName = name; }
00074     
00077     string LayerName() { return layerName; }
00078     
00081     void SetLayerId(unsigned int id) { layerId = id; }
00082     
00085     unsigned int LayerId() { return layerId; }
00086     
00089     void SetLayerType(LayerType ltype) { layerType = ltype; }
00090     
00093     LayerType GetLayerType() { return layerType; }
00094     
00101     void SetPercentInhibitory( float percent );
00102     
00115     bool ConnectLayers(Layer* output, UniConnectType parms, float pctInhibitory = 0.0);
00116     
00129     bool ConnectLayers(Layer* output, GaussConnectType parms, float pctInhibitory = 0.0);
00130     
00137     bool SetLayerConstants(LayerConstants lconst);
00138     
00143     LayerConstants GetLayerConstants();
00144     
00147     void SetSynapticDelay(AmTimeInt delay) { synapticDelay = delay; }
00148 
00151     AmTimeInt GetSynapticDelay() const { return synapticDelay; }
00152 
00153     /*
00154      * Types and members refering to vector
00155      */
00156     
00158     unsigned int size() { return nrnLayer.size(); }
00159 
00160     typedef vector<Neuron*>::iterator iterator;
00161     typedef vector<Neuron*>::const_iterator const_iterator;
00162     typedef vector<Neuron*>::reverse_iterator reverse_iterator;
00163     typedef vector<Neuron*>::const_reverse_iterator const_reverse_iterator;
00164 
00166     iterator begin() { return nrnLayer.begin(); }
00168     iterator end() { return nrnLayer.end(); }
00170     const_iterator begin() const { return nrnLayer.begin(); }
00172     const_iterator end() const { return nrnLayer.end(); }
00174     reverse_iterator rbegin() { return nrnLayer.rbegin(); }
00176     reverse_iterator rend() { return nrnLayer.rend(); }
00178     const_reverse_iterator rbegin() const { return nrnLayer.rbegin(); }
00180     const_reverse_iterator rend() const { return nrnLayer.rend(); }
00181 
00184     Neuron* operator[](unsigned int& index) { return nrnLayer[index]; }
00185     
00186 protected:
00187     void SetLayerParent(Network* parent);
00188     inline bool ConnectionInhibitory(float& pctInhibitory);
00189     
00190     vector<Neuron*> nrnLayer;
00191     Network* parentNet;
00192     string layerName;
00193     LayerType layerType;
00194     unsigned int layerId;
00195 
00196     // Defaults for member neurons
00197     float learningConst;
00198     float memTimeConst;
00199     float synTimeConst;
00200     float restPtnl;
00201     float thresholdPtnl;
00202 
00203     bool constantsSet;
00204     float percentInhib;
00205     AmTimeInt synapticDelay;
00206 
00207 };
00208 
00209 #endif
00210 

Generated on Wed Sep 4 02:30:35 2002 for Amygdala by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002