00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef DEVICEMANAGER_H
00024 #define DEVICEMANAGER_H
00025
00026
00027 #include "Neuron.h"
00028 #include "DBInterface.h"
00029 #include "UDPSynchronizedClient.h"
00030 #include "UDPSynchronizedServer.h"
00031 #include "TCPSynchronizedClient.h"
00032 #include "TCPSynchronizedServer.h"
00033
00034
00035 #include <google/dense_hash_map>
00036 using HASH_NAMESPACE::hash;
00037 using GOOGLE_NAMESPACE::dense_hash_map;
00038
00039
00040
00041
00042
00043
00044
00045
00046 class DeviceManager {
00047
00048 public:
00049 DeviceManager(unsigned int devID, unsigned int neurGrpID, double devFiringMode, DBInterface* deviceDB, DBInterface *networkDB);
00050 DeviceManager();
00051 ~DeviceManager();
00052 bool closeDevice();
00053 bool fetchData();
00054 unsigned int getDeviceType();
00055 unsigned int getExternalComputeTime_us();
00056 bool getExternalSyncDelay();
00057 bool isInputDevice();
00058 bool isOutputDevice();
00059 void setNeuronArray(Neuron **neurArr);
00060 void setNeuronUpdateMap(dense_hash_map<unsigned int, bool, hash<unsigned int> >* neurUdtMp);
00061 void setNeuronVector(vector<unsigned int> *neurVectPtr, unsigned int startNeuronID);
00062 bool updateDevice();
00063 void updateNeurons();
00064
00065
00066 private:
00067
00068
00069 DBInterface *deviceDBInterface;
00070 DBInterface *networkDBInterface;
00071
00072
00073 unsigned int deviceID;
00074
00075
00076 unsigned int deviceType;
00077
00078
00079 bool deviceOpen;
00080
00081
00082 unsigned int neuronGrpWidth;
00083 unsigned int neuronGrpLength;
00084 unsigned int startNeuronID;
00085 unsigned int neuronGrpID;
00086
00087
00088 Neuron **neuronArray;
00089
00090
00091
00092
00093
00094
00095 dense_hash_map<unsigned int, bool, hash<unsigned int> >* neuronUpdateMap;
00096
00097
00098
00099 bool rotatePattern;
00100
00101
00102 dense_hash_map<unsigned int, bool, hash<unsigned int> > deviceBuffer[NUMBER_OF_DELAY_VALUES];
00103
00104
00105 unsigned int bufferCounter;
00106
00107
00108 UDPSynchronizedClient* udpSyncClient;
00109 UDPSynchronizedServer* udpSyncServer;
00110 TCPSynchronizedClient* tcpSyncClient;
00111 TCPSynchronizedServer* tcpSyncServer;
00112
00113
00114
00115 bool directFiringMode;
00116
00117
00118
00119 double synapticWeight;
00120
00121
00122
00123
00124 DeviceManager (const DeviceManager&);
00125
00126
00127 DeviceManager operator = (const DeviceManager&);
00128
00129 void clearSynchronizationDelay();
00130 void fillDeviceBuffer();
00131 void loadDeviceInformation();
00132
00133 };
00134
00135
00136 #endif //DEVICEMANAGER_H
00137
00138