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

SpikeStreamArchiver Class Reference

#include <SpikeStreamArchiver.h>

List of all members.

Public Member Functions

 SpikeStreamArchiver (int argc, char **argv)
 ~SpikeStreamArchiver ()

Static Public Member Functions

static void systemError (const string &message)
static void systemError (const char *message, int messageData1)
static void systemError (const char *message)

Private Member Functions

 SpikeStreamArchiver (const SpikeStreamArchiver &)
SpikeStreamArchiver operator= (const SpikeStreamArchiver &)
bool archiveNeuralNetwork ()
void cleanUpArchiver ()
string getString (unsigned int)
bool loadTaskIDs ()
void processFiringNeuronList (int senderTID)
void processSpikeList (int senderTID)
void run ()
void startArchiving ()
void stopArchiving ()
bool storeNetworkData (unsigned int unixTime, string networkDataString)

Static Private Member Functions

static bool sendMessage (int taskID, int msgtag)
static bool sendMessage (int taskId, int msgtag, unsigned int msgInteger)
static bool sendMessage (int taskID, int msgtag, const char *charArray)

Private Attributes

int myTaskID
DBInterface * archiveDBInterface
DBInterface * neuralNetworkDBInterface
bool stop
bool networkDataStored
unsigned int archiveType
unsigned int spikeMessageTotal
map< int, unsigned int > taskToNeuronGrpMap
map< unsigned int, TimeStepHoldertimeStepMap
map< unsigned int, bool > firingNeuronMap
unsigned int numberOfSpikes
unsigned int * unpackArray
unsigned int unpkFromNeurID
unsigned int messageTimeStep
unsigned int simulationStartTime
char archiveName [MAX_DATABASE_NAME_LENGTH]
map< int, unsigned int > startNeurIDTaskMap

Static Private Attributes

static int parentTaskID = 0
static bool errorState = false


Detailed Description

Main class for the archiver that records firing neuron or spike patterns in the database. Patterns are stored as a model XML file, which records the structure of the neural network, and data XML files that record the firing or spike pattern of the network at each time step.

Definition at line 52 of file SpikeStreamArchiver.h.


Constructor & Destructor Documentation

SpikeStreamArchiver::SpikeStreamArchiver int  argc,
char **  argv
 

Constructor

Definition at line 45 of file SpikeStreamArchiver.cpp.

References archiveDBInterface, archiveName, archiveNeuralNetwork(), archiveType, loadTaskIDs(), myTaskID, networkDataStored, neuralNetworkDBInterface, parentTaskID, run(), sendMessage(), simulationStartTime, stop, systemError(), and unpackArray.

SpikeStreamArchiver::~SpikeStreamArchiver  ) 
 

Destructor

Definition at line 155 of file SpikeStreamArchiver.cpp.

References archiveDBInterface, myTaskID, neuralNetworkDBInterface, and unpackArray.

SpikeStreamArchiver::SpikeStreamArchiver const SpikeStreamArchiver  )  [private]
 

Declare copy constructor private so that it cannot be used inadvertently.


Member Function Documentation

bool SpikeStreamArchiver::archiveNeuralNetwork  )  [private]
 

Store an XML file recording the essential details of the neural network. This is to enable the archive to be played back even after the network has changed For the moment just store the neuron groups

Definition at line 283 of file SpikeStreamArchiver.cpp.

References archiveDBInterface, archiveName, archiveType, neuralNetworkDBInterface, simulationStartTime, and systemError().

Referenced by SpikeStreamArchiver().

void SpikeStreamArchiver::cleanUpArchiver  )  [private]
 

Called just before exiting run method to do any final tasks, such as storing spike lists or deleting network model if no spike lists have been stored.

Definition at line 380 of file SpikeStreamArchiver.cpp.

References archiveDBInterface, networkDataStored, parentTaskID, sendMessage(), simulationStartTime, storeNetworkData(), systemError(), and timeStepMap.

Referenced by run().

string SpikeStreamArchiver::getString unsigned int  uInt  )  [private]
 

Converts an unsigned integer to a string.

Definition at line 426 of file SpikeStreamArchiver.cpp.

Referenced by processFiringNeuronList(), and processSpikeList().

bool SpikeStreamArchiver::loadTaskIDs  )  [private]
 

Fills the map connecting NeuronGrpIDs and TaskIDs.

Definition at line 434 of file SpikeStreamArchiver.cpp.

References neuralNetworkDBInterface, spikeMessageTotal, startNeurIDTaskMap, systemError(), and taskToNeuronGrpMap.

Referenced by SpikeStreamArchiver().

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

Declare assignment private so that it cannot be used inadvertently.

void SpikeStreamArchiver::processFiringNeuronList int  senderTID  )  [private]
 

Processes a list of firing neurons from the task simulating a neuron group. Need to receive all the neuron groups, which is checked using task ids. For each neuron group add the firing neurons to the archive.

Definition at line 490 of file SpikeStreamArchiver.cpp.

References getString(), messageTimeStep, numberOfSpikes, spikeMessageTotal, storeNetworkData(), taskToNeuronGrpMap, timeStepMap, and unpackArray.

Referenced by run().

void SpikeStreamArchiver::processSpikeList int  senderTID  )  [private]
 

Processes a list of spikes from the task simulating the neuron group that is being monitored. Need to receive all the neuron groups. This is checked using task ids. For each neuron group add the firing neurons to the archive.

Definition at line 578 of file SpikeStreamArchiver.cpp.

References firingNeuronMap, getString(), messageTimeStep, numberOfSpikes, spikeMessageTotal, startNeurIDTaskMap, storeNetworkData(), systemError(), taskToNeuronGrpMap, timeStepMap, unpackArray, and unpkFromNeurID.

Referenced by run().

void SpikeStreamArchiver::run  )  [private]
 

Main run method

Definition at line 170 of file SpikeStreamArchiver.cpp.

References cleanUpArchiver(), errorState, myTaskID, processFiringNeuronList(), processSpikeList(), startArchiving(), stop, stopArchiving(), and systemError().

Referenced by SpikeStreamArchiver().

bool SpikeStreamArchiver::sendMessage int  taskID,
int  msgtag,
const char *  charArray
[static, private]
 

Sends a message containing a char string.

Definition at line 732 of file SpikeStreamArchiver.cpp.

bool SpikeStreamArchiver::sendMessage int  taskID,
int  msgtag,
unsigned int  msgInteger
[static, private]
 

Sends a message with a single integer.

Definition at line 700 of file SpikeStreamArchiver.cpp.

bool SpikeStreamArchiver::sendMessage int  taskID,
int  msgtag
[static, private]
 

Sends a message without any contents.

Definition at line 677 of file SpikeStreamArchiver.cpp.

Referenced by cleanUpArchiver(), SpikeStreamArchiver(), startArchiving(), stopArchiving(), and systemError().

void SpikeStreamArchiver::startArchiving  )  [private]
 

Sends a message to all simulation tasks requesting them to start sending spike messages.

Definition at line 776 of file SpikeStreamArchiver.cpp.

References archiveType, sendMessage(), and taskToNeuronGrpMap.

Referenced by run().

void SpikeStreamArchiver::stopArchiving  )  [private]
 

Sends a message to all simulation taks requesting them to stop sending spike messages.

Definition at line 788 of file SpikeStreamArchiver.cpp.

References archiveType, sendMessage(), and taskToNeuronGrpMap.

Referenced by run().

bool SpikeStreamArchiver::storeNetworkData unsigned int  timeStep,
string  xmlString
[private]
 

Stores the network data in the database.

Definition at line 799 of file SpikeStreamArchiver.cpp.

References archiveDBInterface, networkDataStored, simulationStartTime, and systemError().

Referenced by cleanUpArchiver(), processFiringNeuronList(), and processSpikeList().

void SpikeStreamArchiver::systemError const char *  message  )  [static]
 

Writes an error message to the standard output and sends a message to the parent task with the error message. Also puts archiver into error state, in which it only responds to exit message so that SimulationManager can shut simulation down cleanly.

Definition at line 247 of file SpikeStreamArchiver.cpp.

References errorState, parentTaskID, and sendMessage().

void SpikeStreamArchiver::systemError const char *  message,
int  messageData1
[static]
 

Writes an error message to the standard output and sends a message to the parent task with the error message. Also puts archiver into error state, in which it only responds to exit message so that SimulationManager can shut simulation down cleanly.

Definition at line 257 of file SpikeStreamArchiver.cpp.

References errorState, parentTaskID, and sendMessage().

void SpikeStreamArchiver::systemError const string &  message  )  [static]
 

Writes an error message to the standard output and sends a message to the parent task with the error message. Also puts archiver into error state, in which it only responds to exit message so that SimulationManager can shut simulation down cleanly.

Definition at line 269 of file SpikeStreamArchiver.cpp.

References errorState, parentTaskID, and sendMessage().

Referenced by archiveNeuralNetwork(), cleanUpArchiver(), loadTaskIDs(), processSpikeList(), run(), SpikeStreamArchiver(), and storeNetworkData().


Member Data Documentation

DBInterface* SpikeStreamArchiver::archiveDBInterface [private]
 

Reference to archive database handling class.

Definition at line 72 of file SpikeStreamArchiver.h.

Referenced by archiveNeuralNetwork(), cleanUpArchiver(), SpikeStreamArchiver(), storeNetworkData(), and ~SpikeStreamArchiver().

char SpikeStreamArchiver::archiveName[MAX_DATABASE_NAME_LENGTH] [private]
 

Name of the archive.

Definition at line 127 of file SpikeStreamArchiver.h.

Referenced by archiveNeuralNetwork(), and SpikeStreamArchiver().

unsigned int SpikeStreamArchiver::archiveType [private]
 

Controls whether the archive records firing neurons or spikes.

Definition at line 87 of file SpikeStreamArchiver.h.

Referenced by archiveNeuralNetwork(), SpikeStreamArchiver(), startArchiving(), and stopArchiving().

bool SpikeStreamArchiver::errorState = false [static, private]
 

When the archiver has an error it enters error state, waits for an exit message and then exits. This is to enable the Simulation Manager to clean up properly.

Definition at line 137 of file SpikeStreamArchiver.h.

Referenced by run(), and systemError().

map<unsigned int, bool> SpikeStreamArchiver::firingNeuronMap [private]
 

Holds all the currently firing neurons. Use a map for this to eliminate duplicates

Definition at line 105 of file SpikeStreamArchiver.h.

Referenced by processSpikeList().

unsigned int SpikeStreamArchiver::messageTimeStep [private]
 

Keeps track of the time step in the current and previous messages.

Definition at line 119 of file SpikeStreamArchiver.h.

Referenced by processFiringNeuronList(), and processSpikeList().

int SpikeStreamArchiver::myTaskID [private]
 

PVM task id of this process

Definition at line 65 of file SpikeStreamArchiver.h.

Referenced by run(), SpikeStreamArchiver(), and ~SpikeStreamArchiver().

bool SpikeStreamArchiver::networkDataStored [private]
 

A network model is stored at the beginning of each simulation run. This variable keeps track of whether any network data has been stored for this archive. If not, then the network model is deleted when this task exits to avoid the build up of empty archives.

Definition at line 84 of file SpikeStreamArchiver.h.

Referenced by cleanUpArchiver(), SpikeStreamArchiver(), and storeNetworkData().

DBInterface* SpikeStreamArchiver::neuralNetworkDBInterface [private]
 

Reference to network database handling class.

Definition at line 75 of file SpikeStreamArchiver.h.

Referenced by archiveNeuralNetwork(), loadTaskIDs(), SpikeStreamArchiver(), and ~SpikeStreamArchiver().

unsigned int SpikeStreamArchiver::numberOfSpikes [private]
 

Used to unpack the number of spikes from a message. Declare it here to save declaring it each time a message is received.

Definition at line 110 of file SpikeStreamArchiver.h.

Referenced by processFiringNeuronList(), and processSpikeList().

int SpikeStreamArchiver::parentTaskID = 0 [static, private]
 

PVM task id of the process that spawned this process. Static so that it can be used in the static systemError methods.

Definition at line 69 of file SpikeStreamArchiver.h.

Referenced by cleanUpArchiver(), SpikeStreamArchiver(), and systemError().

unsigned int SpikeStreamArchiver::simulationStartTime [private]
 

Records when the simulation is started. This is used to link the model and data files for a simulation run.

Definition at line 123 of file SpikeStreamArchiver.h.

Referenced by archiveNeuralNetwork(), cleanUpArchiver(), SpikeStreamArchiver(), and storeNetworkData().

unsigned int SpikeStreamArchiver::spikeMessageTotal [private]
 

The sum of the task ids from the neuron groups that send data to this class. Used to keeps track of whether all messages have been received.

Definition at line 92 of file SpikeStreamArchiver.h.

Referenced by loadTaskIDs(), processFiringNeuronList(), and processSpikeList().

map<int, unsigned int> SpikeStreamArchiver::startNeurIDTaskMap [private]
 

Holds the start neuron ID for each task processing neurons The key is the task id, the data is the start neuron id of that neuron group.

Definition at line 132 of file SpikeStreamArchiver.h.

Referenced by loadTaskIDs(), and processSpikeList().

bool SpikeStreamArchiver::stop [private]
 

Controls whether the main run method is running.

Definition at line 78 of file SpikeStreamArchiver.h.

Referenced by run(), and SpikeStreamArchiver().

map<int, unsigned int> SpikeStreamArchiver::taskToNeuronGrpMap [private]
 

Records the link between taskIDs and neuron groups IDs The key is the taskID, the data is the neuronGrpID.

Definition at line 96 of file SpikeStreamArchiver.h.

Referenced by loadTaskIDs(), processFiringNeuronList(), processSpikeList(), startArchiving(), and stopArchiving().

map<unsigned int, TimeStepHolder> SpikeStreamArchiver::timeStepMap [private]
 

Holds the time step holders for each time step. These are removed when all messages have been received for the time step.

Definition at line 101 of file SpikeStreamArchiver.h.

Referenced by cleanUpArchiver(), processFiringNeuronList(), and processSpikeList().

unsigned int* SpikeStreamArchiver::unpackArray [private]
 

Array to unpack the spikes or neuron ids into.

Definition at line 113 of file SpikeStreamArchiver.h.

Referenced by processFiringNeuronList(), processSpikeList(), SpikeStreamArchiver(), and ~SpikeStreamArchiver().

unsigned int SpikeStreamArchiver::unpkFromNeurID [private]
 

Define integer here to extract from neuron id.

Definition at line 116 of file SpikeStreamArchiver.h.

Referenced by processSpikeList().


The documentation for this class was generated from the following files:
Generated on Mon Sep 3 22:09:16 2007 for SpikeStream Archiver by  doxygen 1.4.4