R e a l T i m e F r a m e



#ifndef ___CMASTERH___
#define ___CMASTERH___
/****************************************
 * The Master Class (CMaster.h)		*
 *	Purpose:			*
 *		1) Keep time		*
 *		2) Choose Task to run	*
 *		3) Pass messages	*
 ****************************************

#include <string>
#include <list>

#include "CTimer.h"

class CProcess;		// CProcess include us so we declare up front

class CMaster
{
	CMaster();
	~CMaster();

	SendMessage( string mailto, string message );
	int Run();

	CTimer timer;
	list<CProcess> process_list;
};

#endif

	
#ifndef ___CPROCESSH___ #define ___CPROCESSH___ /************************************************ * The Process Class (CProcess.h) * * Purpose: * * Convenient container for related tasks. * * Hopefully each process will run on a * * separate computer if a beowulf exists * ************************************************/ #include <list> #include <string> #include "CMaster.h" class CTask; class CProcess { public: CProcess(CMaster *, string aname); ~CProcess(); AddTask(CTask *); GetTask(string aname); private: list<CTask>*jobs; string name; };
#ifndef ___CTASKH___ #define ___CTASKH___ /************************************************** * The CTask Class (CTask.h) * * Purpose: * * Handle a task- ie. compute a rotation * * Monitor a window exc. Basically whatever * * you want to do, a task can do it. * **************************************************/ #include <string> #include <list> #include "CProcess.h" enum priority { continous, sample_time, timer_int }; class CState; class CTask { public: CTask(CProcess *, priority aPri, const int time, const int importance, string aName); ~CTask(); private: priority myPri; const int mySampleTime; const int myPri; string myName; list<CState>*actions; };
#ifndef ___CSTATEH___ #define ___CSTATEH___ /**************************************** * The CState Class (CState.h) * * Purpose: * * Will hold a step on the way to * * completing a task. * **************************************** #include "CTask.h" class CState { public: CState(CTask *); ~CState(); virtual prepare(); // When state first moved to this runs virtual action(); // Actual action virtual CState *test(); // Test to see if time for new state // Returns a pointer to new state // return NULL if no new state private: CTask *myTask; };