//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#pragma once

#include "VWPluginLibraryApp.h"

// dispatch routine definition
#define		DEFINE_LIB_DISPATCH_MAP					virtual void DispatchRoutine(long routineSelector, VWPluginLibraryArgTable& argTable)
#define		BEGIN_LIB_DISPATCH_MAP(clas	)			void clas::DispatchRoutine(long routineSelector, VWPluginLibraryArgTable& argTable) { switch( routineSelector ) {
#define		END_LIB_DISPATCH_MAP					case -2: case -1: break; default: break; } }
#define		ADD_LIB_FUNCTION(id, fun)				case id: this->fun( argTable ); break;

namespace VWFC
{
	namespace PluginSupport
	{
		class VWPluginLibraryRoutine
		{
		public:
												VWPluginLibraryRoutine();
			virtual								~VWPluginLibraryRoutine();

		public:
			virtual PluginLibraryInitFlags		InitPluginLibrary();
			virtual PluginLibraryDisposeFlags	DestroyPluginLibrary();

			virtual void						SetUserData(long userData);
			virtual long						GetUserData() const;
			virtual void						DispatchRoutine(long routineSelector, VWPluginLibraryArgTable& argTable) = 0;

		// VCOM
		public:
			virtual VCOMError					RegisterInterfaces(void* pModule);
			virtual void						CreateInterfaceInstance(const VWIID& iid, IVWUnknown** ppOutInterface);
			virtual void						DeleteInterfaceInstance(const VWIID& iid, IVWUnknown* pInterface);
		};
	}
}