//-------------------------------------------------------------------------------------------------
// <copyright file="LWForwardAnyEventReceivedInternalCmd.h" company="LiquidRobotics">
//  Copyright (c) Liquid Robotics Corporation, confidential and proprietary.  All rights reserved. 
// </copyright>
//
// <summary>
//	Declarations for LWForwardAnyEventReceivedInternalCmd, a delegate class that
//	carries an event that was received and is queued up on the lua instance specific
//	thread.  When it runs, it forwards the received event to the script on the
//	SMCReportEvent method.
// </summary>
//
// <owner>Mike Cookson</owner>
//-------------------------------------------------------------------------------------------------

#ifndef __LWForwardAnyEventReceivedInternalCmd_h__
#define __LWForwardAnyEventReceivedInternalCmd_h__

#include "LWConcreteCmd.h"

namespace LiquidRobotics {

namespace SMACFramework {
	class IObjectBroker;
	class LuaInstance;
}

namespace EventLib {
	class IEventBase;
}

namespace LuaWrapper {

class SHARED_LIB_PUBLIC LWForwardAnyEventReceivedInternalCmd : public LWConcreteCmd
{
public:

	typedef LWConcreteCmd::CmdBasePtr CmdPtr;
	typedef LiquidRobotics::EventLib::IEventBase IEventBase;
	typedef boost::shared_ptr<IEventBase> IEventBasePtr;
	typedef LiquidRobotics::SMACFramework::IObjectBroker IObjectBroker;
	typedef LiquidRobotics::SMACFramework::LuaInstance LuaInstance;

	LWForwardAnyEventReceivedInternalCmd(TCon& _ctrl, const string& _cmd, const string& _instanceName, IEventBasePtr _rxEvt, IObjectBroker& _broker);
	virtual ~LWForwardAnyEventReceivedInternalCmd();

	// this method is called by the background thread to execute the command
	virtual void Execute();

	// get the output of the command
	virtual string GetResult();

	// determines if the instance wants fowarded generic events
	static bool InstanceWantsForwarding(LuaInstance& L);

private:

	LWControllerBase0& ctrl;
	string cmd;
	string instanceName;
	IEventBasePtr rxEvt;
	IObjectBroker& broker;
};

}
}

#endif
