/*
 *  Timeline.h
 *  BrainSim
 *
 *  Created by Will on 10/30/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */
#include "Message.h"
#include <new>

#pragma once

// the Timeline is simply a circular buffer which represents time in the simulation
//the max size of the buffer is the same as the longest delta_t between cells
//we'll use '120' until we know better

class Timeline
{
	public:
		Timeline();
		~Timeline();

		//we'll also need to queue messages (message) to cell (int) at a specific delta_t (int) from now
		void queueMessage(int, int, int, Message*); 

		//when everything is ready the Timeline 'ticks' to the next moment in the simulation
		//this could even return a list<message>[] that way other threads could grab at it

		void tick(int);
		Message * getMailbox(int, int);

		//we'll also need to do all the basic stuff that the circ buffer does
		void build (int, int);
	
	

	private:
		int MAX_DELTA_T;
		int number_of_cells;
	
		//this is basically our data structure, and array of arryas of lists messages for cells
		//in the 2d array one dimension is the step in time and the other is the cell number
		//will assume that the cell number is the same as it's position in the array.
		Message ***messagesForCells;
};