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

UDPSynchronizedServer.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   SpikeStream Simulation                                                *
00003  *   Copyright (C) 2007 by David Gamez                                     *
00004  *   david@davidgamez.eu                                                   *
00005  *   Version 0.1                                                           *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 
00023 #ifndef UDPSYNCHRONIZEDSERVER_H
00024 #define UDPSYNCHRONIZEDSERVER_H
00025 
00026 //SpikeStream includes
00027 #include "DBInterface.h"
00028 
00029 //Other includes
00030 #include <arpa/inet.h>
00031 
00032 
00033 //--------------------- UDP Synchronized Server ---------------------------
00034 /*! Sends spikes out to external device using UDP synchronized method
00035         Does not technically operate as a server, but called such because it is
00036         a provider of spikes to the external device, rather than a receiver. */
00037 //-------------------------------------------------------------------------
00038 
00039 class UDPSynchronizedServer {
00040 
00041         public:
00042                 UDPSynchronizedServer(DBInterface* devDBInter, unsigned int neurGrpWidth);
00043                 ~UDPSynchronizedServer();
00044                 bool closeDevice();
00045                 bool openSocket(string addr, int pt);
00046                 bool sendSpikeData();
00047                 void setNeuronVector(vector<unsigned int> *neurVectPtr, unsigned int startNeurID);
00048 
00049 
00050         private:
00051                 //============================ VARIABLES ==============================
00052                 /*! Reference to database handling class. */
00053                 DBInterface* deviceDBInterface;
00054 
00055                 /*! Integer used to access the socket. */
00056                 int socketHandle;
00057 
00058                 /*! Address of the socket. */
00059                 struct sockaddr_in socketAddress;
00060 
00061                 /*! Records whether socket is open. */
00062                 bool socketOpen;
00063 
00064                 /*! Width neuron group. */
00065                 unsigned int neuronGrpWidth;
00066 
00067                 /*! First ID in neuron group. */
00068                 unsigned int startNeuronID;
00069 
00070                 /*! Vector of currently firing neurons. */
00071                 vector<unsigned int> *neuronVectorPtr;
00072 
00073 
00074                 //============================ METHODS ================================
00075                 /*! Declare copy constructor private so it cannot be used inadvertently. */
00076                 UDPSynchronizedServer (const UDPSynchronizedServer&);
00077 
00078                 /*! Declare assignment private so it cannot be used. */
00079                 UDPSynchronizedServer operator = (const UDPSynchronizedServer&);
00080 
00081                 bool simulationSynchronizationDelay();
00082 
00083 };
00084 
00085 
00086 #endif//UDPSYNCHRONIZEDSERVER_H
00087 
00088 

Generated on Mon Sep 3 22:24:34 2007 for SpikeStream Simulation by  doxygen 1.4.4