#pragma once

#include "BlockItem.h"
class CBlockItem_InputProps;

class CBlockItem_Input : public CBlockItem
{
	DECLARE_SERIAL(CBlockItem_Input)
protected:
	CBlockItem_Input();
	virtual ~CBlockItem_Input();
public:
	static CBlockItem_Input* CreateInstance();

	CString GetName() const;
	CString GetDescription() const; 

	BOOL SetName(const CString strName);
	BOOL SetDescription(const CString strDesc);
	CString GetStatus() const;
	CString GetOutputPortName(DWORD dwPort) const;

	virtual BOOL InitInstance();
	virtual BOOL ExitInstance();

	virtual BOOL Run();
	virtual BOOL Stop();

	virtual void Serialize(CArchive& ar);
	
	BOOL ShowProperties(BOOL bTest = FALSE);

	BOOL Assign(DWORD dwPort);
	BOOL UnAssign();
	BOOL GetAssignment(LPDWORD pdwPort) const;
	BOOL UpdatePortList();
private:
	CString	m_strName;
	CString	m_strDesc;
	CBlockItem_InputProps* m_pWndProps;
	DWORD m_dwTargetPort;
	/*CBlockItem_Virtual *m_pTargetBlock;*/
	BLOCKDATA m_blockData;
public:
	virtual const PORTDATA GetOutputPortData(DWORD dwPort) const;
	virtual LPCRITICAL_SECTION GetOutputCriticalSectionPtr(DWORD dwPort) const;
	virtual BOOL Process(DWORD dwProcessId, REVDATAMAP &rRevDataMap);
};