#include <UDPSynchronizedClient.h>
Public Member Functions | |
| UDPSynchronizedClient (unsigned int neurGrpWidth, unsigned int neurGrpLength) | |
| ~UDPSynchronizedClient () | |
| bool | clientThreadRunning () |
| bool | closeDevice () |
| bool | deviceOpen () |
| unsigned int | getExternalComputeTime_us () |
| bool | getExternalSyncDelay () |
| void | lockMutex () |
| bool | openSocket (string groupAddress, int port) |
| void | run () |
| void | start () |
| void | stop () |
| void | unlockMutex () |
Public Attributes | |
| unsigned int | spikeCount |
| unsigned int * | spikeBuffer |
Private Member Functions | |
| UDPSynchronizedClient (const UDPSynchronizedClient &) | |
| UDPSynchronizedClient | operator= (const UDPSynchronizedClient &) |
Private Attributes | |
| unsigned int | neuronGrpWidth |
| unsigned int | neuronGrpLength |
| bool | threadRunning |
| bool | socketOpen |
| pthread_t | clientThread |
| bool | externalSyncDelay |
| unsigned int | externalComputeTime_us |
| unsigned int | timeStepsNoMessagesCount |
| int | socketHandle |
| sockaddr_in | socketAddress |
| unsigned char * | messageBuffer |
Definition at line 38 of file UDPSynchronizedClient.h.
|
||||||||||||
|
Constructor. Definition at line 70 of file UDPSynchronizedClient.cpp. References externalComputeTime_us, externalSyncDelay, MESSAGE_BUFFER_SIZE, messageBuffer, neuronGrpLength, neuronGrpWidth, socketOpen, SPIKE_BUFFER_SIZE, spikeBuffer, spikeCount, threadRunning, and timeStepsNoMessagesCount. |
|
|
Destructor. Definition at line 92 of file UDPSynchronizedClient.cpp. References closeDevice(), messageBuffer, and spikeBuffer. |
|
|
Declare copy constructor private so it cannot be used inadvertently. |
|
|
Returns true if the thread is still in its run method and in the state of receiving UDP data. Definition at line 112 of file UDPSynchronizedClient.cpp. References threadRunning. Referenced by DeviceManager::fetchData(). |
|
|
Closes the socket and/or stops the thread. Definition at line 118 of file UDPSynchronizedClient.cpp. References clientThread, socketHandle, socketOpen, SpikeStreamSimulation::systemError(), SpikeStreamSimulation::systemInfo(), and threadRunning. Referenced by DeviceManager::closeDevice(), and ~UDPSynchronizedClient(). |
|
|
Returns true if socket is open or thread is running. Definition at line 147 of file UDPSynchronizedClient.cpp. References socketOpen, and threadRunning. |
|
|
This method is called at each time step to get the current external compute time. It increases a counter each time it is called which is used to increase the external compute time in the absence of any messages from the other processes, up to a maximum. This prevents the external compute time remaining at a low value when there is no external input. Definition at line 160 of file UDPSynchronizedClient.cpp. References externalComputeTime_us, MAX_EXTERNAL_COMPUTE_TIME_US, and timeStepsNoMessagesCount. Referenced by DeviceManager::getExternalComputeTime_us(). |
|
|
Returns true if the external device is delaying itself. Definition at line 175 of file UDPSynchronizedClient.cpp. References externalSyncDelay. Referenced by DeviceManager::getExternalSyncDelay(). |
|
|
Used by external class to lock this thread's mutex and prevent it accessing shared data. Definition at line 182 of file UDPSynchronizedClient.cpp. References threadMutex. Referenced by DeviceManager::fillDeviceBuffer(). |
|
||||||||||||
|
Opens a socket to receive spikes Adapted from http://ntrg.cs.tcd.ie/undergrad/4ba2/multicast/antony/index.html. Definition at line 189 of file UDPSynchronizedClient.cpp. References socketHandle, socketOpen, and SpikeStreamSimulation::systemError(). Referenced by DeviceManager::loadDeviceInformation(). |
|
|
Declare assignment private so it cannot be used. |
|
|
Run method for this class, called by the thread that is started. Definition at line 247 of file UDPSynchronizedClient.cpp. References externalComputeTime_us, externalSyncDelay, MESSAGE_BUFFER_SIZE, messageBuffer, neuronGrpLength, neuronGrpWidth, socketAddress, socketHandle, socketOpen, SPIKE_BUFFER_SIZE, spikeBuffer, spikeCount, STEP_COUNTER_MAX, SpikeStreamSimulation::systemError(), SpikeStreamSimulation::systemInfo(), threadMutex, threadRunning, and timeStepsNoMessagesCount. |
|
|
Starts the thread running and listening for messages. Definition at line 399 of file UDPSynchronizedClient.cpp. References clientThread, startThreadFunction(), SpikeStreamSimulation::systemError(), and threadRunning. Referenced by DeviceManager::loadDeviceInformation(). |
|
|
Stops the thread from running. Definition at line 412 of file UDPSynchronizedClient.cpp. References threadRunning. |
|
|
Used by external applications to unlock the thread's mutex. Definition at line 418 of file UDPSynchronizedClient.cpp. References threadMutex. Referenced by DeviceManager::fillDeviceBuffer(). |
|
|
Thread to listen for incoming packets from broadcast group. Definition at line 80 of file UDPSynchronizedClient.h. Referenced by closeDevice(), and start(). |
|
|
Compute time of external device. Definition at line 86 of file UDPSynchronizedClient.h. Referenced by getExternalComputeTime_us(), run(), and UDPSynchronizedClient(). |
|
|
External device is delaying its time steps. Definition at line 83 of file UDPSynchronizedClient.h. Referenced by getExternalSyncDelay(), run(), and UDPSynchronizedClient(). |
|
|
Buffer used to receive messages from the network. Definition at line 99 of file UDPSynchronizedClient.h. Referenced by run(), UDPSynchronizedClient(), and ~UDPSynchronizedClient(). |
|
|
The first ID in the neuron group. Definition at line 71 of file UDPSynchronizedClient.h. Referenced by run(), and UDPSynchronizedClient(). |
|
|
Neuron group width. Definition at line 68 of file UDPSynchronizedClient.h. Referenced by run(), and UDPSynchronizedClient(). |
|
|
Address of the socket. Definition at line 96 of file UDPSynchronizedClient.h. Referenced by run(). |
|
|
Integer used to access the socket. Definition at line 93 of file UDPSynchronizedClient.h. Referenced by closeDevice(), openSocket(), and run(). |
|
|
Records whether the socket has been opened. Definition at line 77 of file UDPSynchronizedClient.h. Referenced by closeDevice(), deviceOpen(), openSocket(), run(), and UDPSynchronizedClient(). |
|
|
Buffer holding the spikes that have been received by this class from the external device. Definition at line 62 of file UDPSynchronizedClient.h. Referenced by DeviceManager::fillDeviceBuffer(), run(), UDPSynchronizedClient(), and ~UDPSynchronizedClient(). |
|
|
Number of spikes in the spike buffer. Definition at line 58 of file UDPSynchronizedClient.h. Referenced by DeviceManager::fillDeviceBuffer(), run(), and UDPSynchronizedClient(). |
|
|
Controls whether the thread is running. Definition at line 74 of file UDPSynchronizedClient.h. Referenced by clientThreadRunning(), closeDevice(), deviceOpen(), run(), start(), stop(), and UDPSynchronizedClient(). |
|
|
Counter to record the number of time steps that have taken place in the absence of input from the external process. Definition at line 90 of file UDPSynchronizedClient.h. Referenced by getExternalComputeTime_us(), run(), and UDPSynchronizedClient(). |
1.4.4