SpikeStream Library  0.2
NeuronGroup.h
Go to the documentation of this file.
00001 #ifndef NEURONGROUP_H
00002 #define NEURONGROUP_H
00003 
00004 //SpikeStream includes
00005 #include "Box.h"
00006 #include "NeuronGroupInfo.h"
00007 #include "Neuron.h"
00008 using namespace spikestream;
00009 
00010 //Qt includes
00011 #include <stdint.h>
00012 #include <QMap>
00013 
00015 typedef QHash<unsigned int, Neuron*> NeuronMap;
00016 
00018 typedef QMap<uint64_t, Neuron*>::iterator NeuronPositionIterator;
00019 
00021 typedef NeuronMap::iterator NeuronIterator;
00022 
00023 namespace spikestream {
00024 
00026     class NeuronGroup {
00027                 public:
00028                         NeuronGroup(const NeuronGroupInfo& info);
00029                         ~NeuronGroup();
00030                         void addLayer(int width, int height, int xPos, int yPos, int zPos);
00031                         Neuron* addNeuron(float xPos, float yPos, float zPos);
00032                         NeuronMap::iterator begin() { return neuronMap->begin(); }
00033                         NeuronMap::iterator end() { return neuronMap->end(); }
00034                         NeuronPositionIterator positionBegin();
00035                         NeuronPositionIterator positionEnd();
00036                         void buildPositionMap();
00037                         void clearNeurons();
00038                         bool contains(unsigned int neurID);
00039                         bool contains(unsigned int neurID, float x, float y, float z);
00040                         Box getBoundingBox();
00041                         unsigned int getID();
00042                         NeuronGroupInfo getInfo() {return info;}
00043                         Neuron* getNearestNeuron(const Point3D& point);
00044                         unsigned int getNeuronIDAtLocation(const Point3D& location);
00045                         QList<unsigned int> getNeuronIDs() { return neuronMap->keys(); }
00046                         Point3D& getNeuronLocation(unsigned int neuronID);
00047                         NeuronMap* getNeuronMap() { return neuronMap; }
00048                         QList<Neuron*> getNeurons(const Box& box);
00049                         unsigned getNeuronTypeID();
00050                         double getParameter(const QString& key);
00051                         QHash<QString, double> getParameters() { return parameterMap; }
00052                         static Point3D getPointFromPositionKey(uint64_t positionKey);
00053                         static uint64_t getPositionKey(int xPos, int yPos, int zPos);
00054                         unsigned int getStartNeuronID() { return startNeuronID; }
00055                         bool isWeightless();
00056                         bool parametersSet();
00057                         void print();
00058                         void setID(unsigned int id);
00059                         void setDescription(const QString& description);
00060                         void setName(const QString& name);
00061                         void setNeuronMap(NeuronMap* newMap);
00062                         void setParameters(QHash<QString, double>& paramMap);
00063                         void setStartNeuronID(unsigned int id) { this->startNeuronID = id; }
00064                         int size();
00065 
00066 
00067                 private:
00068                         //==========================  VARIABLES  =========================
00071                         NeuronGroupInfo info;
00072 
00076                         NeuronMap* neuronMap;
00077 
00081                         QMap<uint64_t, Neuron*> neuronPositionMap;
00082 
00086                         bool positionMapBuilt;
00087 
00090                         unsigned int startNeuronID;
00091 
00093                         QHash<QString, double> parameterMap;
00094 
00096                         Box boundingBox;
00097 
00099                         bool calculateBoundingBox;
00100 
00103                         static unsigned neuronIDCounter;
00104 
00105 
00106                         //====================  METHODS  ==========================
00107                         unsigned getTemporaryID();
00108                         void neuronGroupChanged();
00109                         NeuronGroup(const NeuronGroup& connGrp);
00110                         NeuronGroup& operator=(const NeuronGroup& rhs);
00111     };
00112 
00113 }
00114 
00115 #endif//NEURONGROUP_H
00116 
 All Classes Files Functions Variables Typedefs Defines