//===========================================================================//
// File:	testclas.hh                                                         //
// Project: MUNGA           Brick: Dynamic Dispatch, Event and Journalling   //
// Contents: defines test classes for use by Dispatch and Events             //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 11/03/94  JMA  Initial coding.                                            //
// 11/05/94  JMA  Made compatible with GNU C++                               //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc. All Rights reserved //
//                      PROPRIETARY AND CONFIDENTIAL                         //
//===========================================================================//

#if !defined(TESTCLAS_HPP)
#	define TESTCLAS_HPP)

#	if !defined(RECEIVER_HPP)
#		include "receiver.hpp"
#	endif

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Alpha ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class Alpha:
	public Receiver
{
protected:
	static SharedData
		DefaultData;

public:
	int
		x;

	enum {
		message0ID = Receiver::NextMessageID,
		message1ID,
		NextMessageID
	};

	static Derivation
		ClassDerivations;

	Alpha(
		ClassID class_ID = TrivialReceiverClassID,
		SharedData &vdata = DefaultData);
	~Alpha();

	void
		Method0Handler(Message*);
	void
		Method1Handler(Message*);

	inline void Method0()
		{Message m(message0ID,sizeof(Message)); Dispatch(&m);}
	inline void Method1()
		{Message m(message1ID,sizeof(Message)); Dispatch(&m);}

	static MessageHandlerSet
		handlerSet;
};

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Beta ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class Beta:
	public Alpha
{
protected:
	static SharedData
		DefaultData;

public:
	enum {
		message2ID=Alpha::NextMessageID,
		message3ID,
		NextMessageID
	};

	static Derivation
		ClassDerivations;

	Beta(
		ClassID class_id = TrivialReceiverClassID,
		SharedData &vdata = DefaultData
	);
	~Beta();

	void
		Method1aHandler(Message*);
	void
		Method2Handler(Message*);
	void
		Method3Handler(Message*);

	inline void Method1()
		{Message m(message1ID,sizeof(Message)); Dispatch(&m);}
	inline void Method2()
		{Message m(message2ID,sizeof(Message)); Dispatch(&m);}
	inline void Method3()
		{Message m(message3ID,sizeof(Message)); Dispatch(&m);}

	static MessageHandlerSet
		handlerSet;
};

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Gamma ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class Gamma:
	public Beta
{
public:
	enum {
		message4ID=Beta::NextMessageID,
		NextMessageID
	};

	static Derivation
		ClassDerivations;

	Gamma();
	~Gamma();

	void
		Method4Handler(Message*);

	inline void Method4()
		{Message m(message4ID,sizeof(Message)); Dispatch(&m);}

	static MessageHandlerSet
		handlerSet;

protected:
	static SharedData
		DefaultData;
};

#endif
