#ifndef _COMMON_CALLBACKPOINTER_HPP_
#define _COMMON_CALLBACKPOINTER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_PURECALLBACK_HPP_
#include <common/pcallbck.hpp>
#endif

class CallbackPointer
{
public:
	CallbackPointer(void);
	CallbackPointer(PureCallback *lpCallback);
	CallbackPointer(const CallbackPointer &someCallbackPointer);
	virtual ~CallbackPointer();
	void operator=(CallbackPointer &someCallbackPointer);
	WORD operator==(const CallbackPointer &someCallbackPointer)const;
	CallbackData::ReturnType callback(CallbackData &someCallbackData);
	bool isOkay(void)const;
private:
	PureCallback *mlpCallback;
};

inline
CallbackPointer::CallbackPointer(void)
: mlpCallback(0)
{
}

inline
CallbackPointer::CallbackPointer(PureCallback *lpCallback)
: mlpCallback(lpCallback)
{
}

inline
CallbackPointer::CallbackPointer(const CallbackPointer &someCallbackPointer)
: mlpCallback(someCallbackPointer.mlpCallback)
{
}

inline
CallbackPointer::~CallbackPointer()
{
}

inline
void CallbackPointer::operator=(CallbackPointer &someCallbackPointer)
{
	mlpCallback=someCallbackPointer.mlpCallback;
}

inline
WORD CallbackPointer::operator==(const CallbackPointer &someCallbackPointer)const
{
	return (mlpCallback==someCallbackPointer.mlpCallback);
}

inline
CallbackData::ReturnType CallbackPointer::callback(CallbackData &someCallbackData)
{
	if(!mlpCallback)return (CallbackData::ReturnType)0;
	return mlpCallback->operator*(someCallbackData);
}

inline
bool CallbackPointer::isOkay(void)const
{
  return mlpCallback?true:false;
}
#endif