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

DeviceManager Class Reference

#include <DeviceManager.h>

List of all members.

Public Member Functions

 DeviceManager (unsigned int devID, unsigned int neurGrpID, double devFiringMode, DBInterface *deviceDB, DBInterface *networkDB)
 DeviceManager ()
 ~DeviceManager ()
bool closeDevice ()
bool fetchData ()
unsigned int getDeviceType ()
unsigned int getExternalComputeTime_us ()
bool getExternalSyncDelay ()
bool isInputDevice ()
bool isOutputDevice ()
void setNeuronArray (Neuron **neurArr)
void setNeuronUpdateMap (dense_hash_map< unsigned int, bool, hash< unsigned int > > *neurUdtMp)
void setNeuronVector (vector< unsigned int > *neurVectPtr, unsigned int startNeuronID)
bool updateDevice ()
void updateNeurons ()

Private Member Functions

 DeviceManager (const DeviceManager &)
DeviceManager operator= (const DeviceManager &)
void clearSynchronizationDelay ()
void fillDeviceBuffer ()
void loadDeviceInformation ()

Private Attributes

DBInterface * deviceDBInterface
DBInterface * networkDBInterface
unsigned int deviceID
unsigned int deviceType
bool deviceOpen
unsigned int neuronGrpWidth
unsigned int neuronGrpLength
unsigned int startNeuronID
unsigned int neuronGrpID
Neuron ** neuronArray
dense_hash_map< unsigned int,
bool, hash< unsigned int > > * 
neuronUpdateMap
bool rotatePattern
dense_hash_map< unsigned int,
bool, hash< unsigned int > > 
deviceBuffer [NUMBER_OF_DELAY_VALUES]
unsigned int bufferCounter
UDPSynchronizedClientudpSyncClient
UDPSynchronizedServerudpSyncServer
TCPSynchronizedClienttcpSyncClient
TCPSynchronizedServertcpSyncServer
bool directFiringMode
double synapticWeight


Detailed Description

Used to get input from an external device, such as SIMNOS or CRONOS, or to send output to an external device and update the neurons' firing state appropriately.

Definition at line 46 of file DeviceManager.h.


Constructor & Destructor Documentation

DeviceManager::DeviceManager unsigned int  devID,
unsigned int  neurGrpID,
double  devFiringMode,
DBInterface *  devDBInter,
DBInterface *  netDBInter
 

Main constructor.

Definition at line 44 of file DeviceManager.cpp.

References clearSynchronizationDelay(), deviceBuffer, deviceDBInterface, deviceID, deviceOpen, deviceType, directFiringMode, loadDeviceInformation(), networkDBInterface, neuronGrpID, synapticWeight, and SpikeStreamSimulation::systemError().

DeviceManager::DeviceManager  ) 
 

Default constructor. Used when the device manager will not be used but might have methods called on it.

Definition at line 120 of file DeviceManager.cpp.

References deviceDBInterface, deviceID, deviceOpen, deviceType, and neuronGrpID.

DeviceManager::~DeviceManager  ) 
 

Destructor.

Definition at line 131 of file DeviceManager.cpp.

References clearSynchronizationDelay(), closeDevice(), deviceDBInterface, and deviceOpen.

DeviceManager::DeviceManager const DeviceManager  )  [private]
 

Declare copy constructor private so it cannot be used inadvertently.


Member Function Documentation

void DeviceManager::clearSynchronizationDelay  )  [private]
 

Empties the SynchronizationDelay database.

Definition at line 323 of file DeviceManager.cpp.

References deviceDBInterface, and SpikeStreamSimulation::systemError().

Referenced by DeviceManager(), and ~DeviceManager().

bool DeviceManager::closeDevice  ) 
 

Does anything else that is needed to reset device. Returns true if device closes successfully.

Definition at line 152 of file DeviceManager.cpp.

References TCPSynchronizedServer::closeDevice(), TCPSynchronizedClient::closeDevice(), UDPSynchronizedServer::closeDevice(), UDPSynchronizedClient::closeDevice(), deviceOpen, deviceType, SpikeStreamSimulation::systemError(), tcpSyncClient, tcpSyncServer, udpSyncClient, and udpSyncServer.

Referenced by SpikeStreamSimulation::cleanUpSimulation(), and ~DeviceManager().

bool DeviceManager::fetchData  ) 
 

Instructs the device to download data from the external device or if data is being obtained asynchronously it returns true if the thread is still running to do this.

Definition at line 190 of file DeviceManager.cpp.

References UDPSynchronizedClient::clientThreadRunning(), deviceType, TCPSynchronizedClient::fetchData(), SpikeStreamSimulation::systemError(), tcpSyncClient, and udpSyncClient.

Referenced by SpikeStreamSimulation::sendSpikeMessages().

void DeviceManager::fillDeviceBuffer  )  [private]
 

Fills up device buffer with data obtained from an external device.

Definition at line 344 of file DeviceManager.cpp.

References bufferCounter, deviceBuffer, deviceType, UDPSynchronizedClient::lockMutex(), neuronGrpWidth, TCPSynchronizedClient::spikeBuffer, UDPSynchronizedClient::spikeBuffer, TCPSynchronizedClient::spikeCount, UDPSynchronizedClient::spikeCount, SpikeStreamSimulation::systemError(), tcpSyncClient, udpSyncClient, and UDPSynchronizedClient::unlockMutex().

Referenced by updateNeurons().

unsigned int DeviceManager::getDeviceType  ) 
 

Returns the type of this device.

Definition at line 205 of file DeviceManager.cpp.

References deviceType.

Referenced by SpikeStreamSimulation::loadSimulationData(), SpikeStreamSimulation::sendSpikeMessages(), and SpikeStreamSimulation::setMinTimeStepDuration().

unsigned int DeviceManager::getExternalComputeTime_us  ) 
 

When synchronizing to an external device this returns the time between time steps of the external device.

Definition at line 212 of file DeviceManager.cpp.

References deviceType, UDPSynchronizedClient::getExternalComputeTime_us(), SpikeStreamSimulation::systemError(), and udpSyncClient.

Referenced by SpikeStreamSimulation::sendSpikeMessages().

bool DeviceManager::getExternalSyncDelay  ) 
 

When synchronizing to an external device, this returns whether the external device is delaying or not.

Definition at line 224 of file DeviceManager.cpp.

References deviceType, UDPSynchronizedClient::getExternalSyncDelay(), SpikeStreamSimulation::systemError(), and udpSyncClient.

Referenced by SpikeStreamSimulation::sendSpikeMessages().

bool DeviceManager::isInputDevice  ) 
 

Returns true if this is an input device - i.e. provides data TO SpikeStream Uses the same method as DeviceTypes method to determine this.

Definition at line 236 of file DeviceManager.cpp.

References deviceType.

Referenced by SpikeStreamSimulation::loadSimulationData(), and SpikeStreamSimulation::sendSpikeMessages().

bool DeviceManager::isOutputDevice  ) 
 

Returns true if this is an output device - i.e. receives data FROM SpikeStream Uses the same method as DeviceTypes method to determine this.

Definition at line 245 of file DeviceManager.cpp.

References deviceType.

Referenced by SpikeStreamSimulation::loadSimulationData(), and SpikeStreamSimulation::sendSpikeMessages().

void DeviceManager::loadDeviceInformation  )  [private]
 

Loads up information about the device that this class has to manage. Should only be called once when device manager initialises. NOTE: Exceptions should be handled by the calling class.

Definition at line 394 of file DeviceManager.cpp.

References deviceDBInterface, deviceID, deviceOpen, deviceType, networkDBInterface, neuronGrpID, neuronGrpLength, neuronGrpWidth, TCPSynchronizedServer::openSocket(), TCPSynchronizedClient::openSocket(), UDPSynchronizedServer::openSocket(), UDPSynchronizedClient::openSocket(), rotatePattern, TCPSynchronizedClient::setTwoByteCoords(), UDPSynchronizedClient::start(), SpikeStreamSimulation::systemError(), tcpSyncClient, tcpSyncServer, udpSyncClient, and udpSyncServer.

Referenced by DeviceManager().

DeviceManager DeviceManager::operator= const DeviceManager  )  [private]
 

Declare assignment private so it cannot be used.

void DeviceManager::setNeuronArray Neuron **  neurArr  ) 
 

Sets the neuron array for this device manager.

Definition at line 253 of file DeviceManager.cpp.

References neuronArray.

Referenced by SpikeStreamSimulation::loadSimulationData().

void DeviceManager::setNeuronUpdateMap dense_hash_map< unsigned int, bool, hash< unsigned int > > *  neurUdtMp  ) 
 

Sets a reference to the map used to record which neurons have been changed during the timestep.

Definition at line 260 of file DeviceManager.cpp.

References neuronUpdateMap.

Referenced by SpikeStreamSimulation::loadSimulationData().

void DeviceManager::setNeuronVector vector< unsigned int > *  neurVectPtr,
unsigned int  startNeurID
 

Passes a reference to the vector containing the currently firing neurons to the device, which passes it on to other classes as necessary.

Definition at line 267 of file DeviceManager.cpp.

References deviceType, TCPSynchronizedServer::setNeuronVector(), UDPSynchronizedServer::setNeuronVector(), startNeuronID, tcpSyncServer, and udpSyncServer.

Referenced by SpikeStreamSimulation::loadSimulationData().

bool DeviceManager::updateDevice  ) 
 

Sends the data from SpikeStream to the external device.

Definition at line 279 of file DeviceManager.cpp.

References deviceType, TCPSynchronizedServer::sendSpikeData(), UDPSynchronizedServer::sendSpikeData(), SpikeStreamSimulation::systemError(), tcpSyncServer, and udpSyncServer.

Referenced by SpikeStreamSimulation::sendSpikeMessages().

void DeviceManager::updateNeurons  ) 
 

Updates neurons with data from device.

Definition at line 296 of file DeviceManager.cpp.

References bufferCounter, Neuron::changePostSynapticPotential(), deviceBuffer, directFiringMode, fillDeviceBuffer(), Neuron::fireNeuron(), neuronArray, startNeuronID, and synapticWeight.

Referenced by SpikeStreamSimulation::sendSpikeMessages().


Member Data Documentation

unsigned int DeviceManager::bufferCounter [private]
 

Records the current active position in the device buffer.

Definition at line 105 of file DeviceManager.h.

Referenced by fillDeviceBuffer(), and updateNeurons().

dense_hash_map<unsigned int, bool, hash<unsigned int> > DeviceManager::deviceBuffer[NUMBER_OF_DELAY_VALUES] [private]
 

Holds the neurons that need to be fired at each time point.

Definition at line 102 of file DeviceManager.h.

Referenced by DeviceManager(), fillDeviceBuffer(), and updateNeurons().

DBInterface* DeviceManager::deviceDBInterface [private]
 

Definition at line 69 of file DeviceManager.h.

Referenced by clearSynchronizationDelay(), DeviceManager(), loadDeviceInformation(), and ~DeviceManager().

unsigned int DeviceManager::deviceID [private]
 

Device ID.

Definition at line 73 of file DeviceManager.h.

Referenced by DeviceManager(), and loadDeviceInformation().

bool DeviceManager::deviceOpen [private]
 

Is the device open or not.

Definition at line 79 of file DeviceManager.h.

Referenced by closeDevice(), DeviceManager(), loadDeviceInformation(), and ~DeviceManager().

unsigned int DeviceManager::deviceType [private]
 

Device type.

Definition at line 76 of file DeviceManager.h.

Referenced by closeDevice(), DeviceManager(), fetchData(), fillDeviceBuffer(), getDeviceType(), getExternalComputeTime_us(), getExternalSyncDelay(), isInputDevice(), isOutputDevice(), loadDeviceInformation(), setNeuronVector(), and updateDevice().

bool DeviceManager::directFiringMode [private]
 

Is the input pattern from an external device used to directly fire the neurons or not?

Definition at line 115 of file DeviceManager.h.

Referenced by DeviceManager(), and updateNeurons().

DBInterface* DeviceManager::networkDBInterface [private]
 

Definition at line 70 of file DeviceManager.h.

Referenced by DeviceManager(), and loadDeviceInformation().

Neuron** DeviceManager::neuronArray [private]
 

Reference to the neuron array in SpikeStreamSimulation.

Definition at line 88 of file DeviceManager.h.

Referenced by setNeuronArray(), and updateNeurons().

unsigned int DeviceManager::neuronGrpID [private]
 

Definition at line 85 of file DeviceManager.h.

Referenced by DeviceManager(), and loadDeviceInformation().

unsigned int DeviceManager::neuronGrpLength [private]
 

Definition at line 83 of file DeviceManager.h.

Referenced by loadDeviceInformation().

unsigned int DeviceManager::neuronGrpWidth [private]
 

Definition at line 82 of file DeviceManager.h.

Referenced by fillDeviceBuffer(), and loadDeviceInformation().

dense_hash_map<unsigned int, bool, hash<unsigned int> >* DeviceManager::neuronUpdateMap [private]
 

Pointer to the map holding all the neurons that have received a spike or been changed during this timestep. Neurons in this map are updated when all spikes have been received. Map is used rather than vector to avoid filtering out multiple spikes to the same neuron. The key is the full neuronID.

Definition at line 95 of file DeviceManager.h.

Referenced by setNeuronUpdateMap().

bool DeviceManager::rotatePattern [private]
 

Is the pattern rotated wrt the neuron group or not?.

Definition at line 99 of file DeviceManager.h.

Referenced by loadDeviceInformation().

unsigned int DeviceManager::startNeuronID [private]
 

Definition at line 84 of file DeviceManager.h.

Referenced by setNeuronVector(), and updateNeurons().

double DeviceManager::synapticWeight [private]
 

If we are in synaptic firing mode (i.e. !directFiringMode), this variable specifies the weight.

Definition at line 119 of file DeviceManager.h.

Referenced by DeviceManager(), and updateNeurons().

TCPSynchronizedClient* DeviceManager::tcpSyncClient [private]
 

Definition at line 110 of file DeviceManager.h.

Referenced by closeDevice(), fetchData(), fillDeviceBuffer(), and loadDeviceInformation().

TCPSynchronizedServer* DeviceManager::tcpSyncServer [private]
 

Definition at line 111 of file DeviceManager.h.

Referenced by closeDevice(), loadDeviceInformation(), setNeuronVector(), and updateDevice().

UDPSynchronizedClient* DeviceManager::udpSyncClient [private]
 

Definition at line 108 of file DeviceManager.h.

Referenced by closeDevice(), fetchData(), fillDeviceBuffer(), getExternalComputeTime_us(), getExternalSyncDelay(), and loadDeviceInformation().

UDPSynchronizedServer* DeviceManager::udpSyncServer [private]
 

Definition at line 109 of file DeviceManager.h.

Referenced by closeDevice(), loadDeviceInformation(), setNeuronVector(), and updateDevice().


The documentation for this class was generated from the following files:
Generated on Mon Sep 3 22:24:34 2007 for SpikeStream Simulation by  doxygen 1.4.4