#ifndef APP_LvObject_H
#define APP_LvObject_H
#include <APlusPlus/exec/amiproc/amiproc.h>		// by Doug Walker and Steve Krueger
/******************************************************************************
 **
 **	C++ Class Library for the Amiga© system software.
 **
 **	Copyright (C) 1994 by Armin Vogt  **  EMail: armin@uni-paderborn.de
 **	All Rights Reserved.
 **
 **	$VER: apphome:APlusPlus/exec/LvObject.h 1.04 (04.05.94) $
 **	
 ******************************************************************************/


/****************************************************************************************
      » class LivingObject «	virtual base class
	
	Each Living object runs on its own task and has its main procedure which can be
	overwritten easily in derived classes. Within this main procedure all kinds of objects
	may be created, also objects that have static data since each living object gets its
	private near data section. The object starts its 'life' at the moment of creation 
	and ceases from existence with the destruction.
	
	
	Any access to the object should be done via semaphores or inter process communications.
	 
	This class takes advantage of the AmiProc package by Doug Walker and Steve Krueger
	that allows creating several child tasks with their personal copy of the near data
	section. THEREFORE IT ONLY WORKS COMPILED WITH SAS/C.
	AMIPROC Copyright (c) 1994 Steve Krueger and Doug Walker

 ****************************************************************************************/

class LivingObject
{
	private:
		struct AmiProcMsg *ap_msg;		
		static int func(void *);
		
   protected:
		virtual int main()=0;	// overwrite to make your own object main loop
		
	public:
		LivingObject();		// create object on its own task. Start it with activate()
		~LivingObject();		// terminate the LivingObject (waits for self termination)
		
		BOOL activate();		// bring the object task to life
		BOOL isLiving();		// check for life signs (not implemented)

};

#endif
