#pragma once

#include "BlockItem.h"
class CBlockItem_OutputProps;

class CBlockItem_Output : public CBlockItem
{
	DECLARE_SERIAL(CBlockItem_Output)
protected:
	CBlockItem_Output();
	virtual ~CBlockItem_Output();
public:
	static CBlockItem_Output* CreateInstance();
	CString GetName() const;
	CString GetDescription() const; 

	BOOL SetName(const CString strName);
	BOOL SetDescription(const CString strDesc);
	CString GetStatus() const;
	CString GetInputPortName(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_OutputProps* m_pWndProps;
	DWORD m_dwTargetPort;
	BLOCKDATA m_blockData;
public:
	virtual const PORTDATA GetOutputPortData(DWORD dwPort);
	virtual LPCRITICAL_SECTION GetOutputCriticalSectionPtr(DWORD dwPort);
	virtual BOOL Process(DWORD dwProcessId, REVDATAMAP &rRevDataMap);
};