//===========================================================================//
// 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                         //
//===========================================================================//

#pragma once

#include "Adept.hpp"
#include "Receiver.hpp"

namespace Adept {

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

	//-------------------------------------------------------------------------
	// The following helper classes must always be typedef'd or overriden by an
	// inheritor
	//

	typedef Receiver__ClassData	Alpha__ClassData;
	typedef Receiver__Message		Alpha__Message;

	//----------------- End of helper stuff -----------------

	class Alpha:
		public Receiver
	{
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		static ClassID
			alphaClassID;

	//##########################################################################
	// Inheritance support
	//
	public:
		typedef Alpha__ClassData	ClassData;
		typedef Alpha__Message		Message;

	public:
		static ClassData
			*DefaultData;

	public:
		int
			x;

		enum {
			Method0MessageID = Receiver::NextMessageID,
			Method1MessageID,
			NextMessageID
		};

		Alpha(ClassData *class_data = DefaultData);
		~Alpha();

		void
			Method0MessageHandler(const Message*);
		void
			Method1MessageHandler(const Message*);

		inline void Method0()
			{
				Message
					m(
						Method0MessageID,
						sizeof(Message),
						0,
						Message::DefaultFlags
					);
				Dispatch(&m);
			}
		inline void Method1()
			{
				Message
					m(
						Method1MessageID,
						sizeof(Message),
						0,
						Message::DefaultFlags
					);
				Dispatch(&m);
			}
	};

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

	//-------------------------------------------------------------------------
	// The following helper classes must always be typedef'd or overriden by an
	// inheritor
	//

	typedef Alpha__ClassData	Beta__ClassData;
	typedef Alpha__Message		Beta__Message;

	//----------------- End of helper stuff -----------------

	class Beta:
		public Alpha
	{
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		static ClassID
			betaClassID;

	//##########################################################################
	// Inheritance support
	//
	public:
		typedef Beta__ClassData	ClassData;
		typedef Beta__Message		Message;

	public:
		static ClassData
			*DefaultData;

	public:
		enum {
			Method2MessageID=Alpha::NextMessageID,
			Method3MessageID,
			NextMessageID
		};

		Beta(ClassData *class_data = DefaultData);
		~Beta();

		void
			Method1MessageHandler(const Message*);
		void
			Method2MessageHandler(const Message*);
		void
			Method3MessageHandler(const Message*);

		inline void Method1()
			{
				Message
					m(
						Method1MessageID,
						sizeof(Message),
						0,
						Message::DefaultFlags
					);
				Dispatch(&m);
			}
		inline void Method2()
			{
				Message
					m(
						Method2MessageID,
						sizeof(Message),
						0,
						Message::DefaultFlags
					);
				Dispatch(&m);
			}
		inline void Method3()
			{
				Message
					m(
						Method3MessageID,
						sizeof(Message),
						0,
						Message::DefaultFlags
					);
				Dispatch(&m);
			}
	};

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

	//-------------------------------------------------------------------------
	// The following helper classes must always be typedef'd or overriden by an
	// inheritor
	//

	typedef Beta__ClassData	Gamma__ClassData;
	typedef Beta__Message		Gamma__Message;

	//----------------- End of helper stuff -----------------

	class Gamma:
		public Beta
	{
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		static ClassID gammaClassID;

	//##########################################################################
	// Inheritance support
	//
	public:
		typedef Gamma__ClassData	ClassData;
		typedef Gamma__Message		Message;

	public:
		enum {
			Method4MessageID=Beta::NextMessageID,
			NextMessageID
		};

		Gamma();
		~Gamma();

		void
			Method4MessageHandler(const Message*);

		inline void Method4()
			{
				Message
					m(
						Method4MessageID,
						sizeof(Message),
						0,
						Message::DefaultFlags
					);
				Dispatch(&m);
			}

	public:
		static ClassData
			*DefaultData;
	};

}

