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

TaskHolder.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 TASKHOLDER_H
00024 #define TASKHOLDER_H
00025 
00026 //SpikeStream includes
00027 #include "ConnectionHolder.h"
00028 #include "GlobalVariables.h"
00029 
00030 //Other includes
00031 #include <vector>
00032 using namespace std;
00033 
00034  
00035 //---------------------------- Task Holder --------------------------------
00036 /*! Used to send a list of spikes to a specific task or number of tasks
00037         Mainly created to send a list of spikes to a specific task. However it
00038         can     also send spike lists to several tasks to support monitoring and 
00039         recording functions. */
00040 //-------------------------------------------------------------------------
00041 
00042 class TaskHolder {
00043 
00044         public:
00045                 TaskHolder(int thisTaskID, int primaryDestTaskID);
00046                 ~TaskHolder();
00047                 void addReceivingTask(int);
00048                 void printBuffers();
00049                 void removeReceivingTask(int);
00050                 bool sendSpikeMessages();
00051                 void setMaxBufferSize(int maxSize);
00052 
00053                 /*! Neuron class needs access to some of the private data members
00054                         so that it can copy its connection holders into this class when
00055                         it fires. */
00056                 friend class Neuron;
00057 
00058 
00059         private:
00060                 //=========================== VARIABLES =====================================
00061                 /*! Keep a record of this task here for error messages.*/
00062                 int thisTaskID;
00063                 
00064                 /*! The taskID of the primary destination for spike lists from this task. 
00065                         This should be another task processing neurons.*/
00066                 int primaryDestinationID;
00067 
00068                 /*! Array of vectors containing pointers to connection holders that hold
00069                         the spike data that is to be sent.*/
00070                 vector<ConnectionHolder*> spikeMessageBuffer[NUMBER_OF_DELAY_VALUES];
00071                 
00072                 /*! Records how many spikes are in each message buffer. This is different from the message
00073                         buffer length, which holds how many Connection holders are in the message buffer. Each
00074                         connection holder can hold many spikes so the spike count needs to be done separately.*/
00075                 unsigned int messageSpikeCount[NUMBER_OF_DELAY_VALUES];
00076                 
00077                 /*! The maximum size of the arrays held in spikeArrays. 
00078                         This will be the number of neurons in the other task that the neurons in this
00079                         task are connected to.*/
00080                 unsigned int maxBufferSize;
00081                 
00082                 /*! Controls which is the current spike array. This is the spike array that will be sent
00083                         when sendSpikes() is called.*/
00084                 unsigned int bufferCounter;
00085 
00086                 /*! Array of task IDs of the tasks that will be sent the spike lists held in this task holder.
00087                         There will be a main task id containing the other neuron groups that need to receive the
00088                         spike list and there may also be tasks that need to receive the spike list for 
00089                         monitoring or archiving. This is stored as an integer array to make it simpler to 
00090                         send using pvm_mcast. Vector would have to be converted.*/
00091                 int  *destinationTaskIDs;
00092 
00093                 /*! Size of the destination task id array.*/
00094                 int numberOfTasks;
00095 
00096 
00097                 //=============================== METHODS ===================================
00098                 /*! Declare copy constructor private so it cannot be used inadvertently.*/
00099                 TaskHolder (const TaskHolder&);
00100 
00101                 /*! Declare assignment private so it cannot be used.*/
00102                 TaskHolder operator = (const TaskHolder&);
00103 
00104 };
00105 
00106 
00107 #endif //TASKHOLDER_H
00108 
00109 
00110 
00111 

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