#pragma once
#include "IntPropertyInternal.h"

///////////////////////////////////////////////////////////////////////////////
// NDTS2100 Specific HardwareAccessClass derived classes
// that aren't based around a register accessing the hardware.
// e.g. Clear error log or take snapshot.
///////////////////////////////////////////////////////////////////////////////


namespace NDTS
{
namespace NDTS2100
{
	
using namespace SCO;

// All classes in the NDTS2100 must return a card number and sequence step to allow
// properties to be identified in the post set hook.  This is implemented by deriving all the 
// hardware access classes from this base class.
class NDTS2100HardwareAccess : public HardwareAccessClass 
{
public:

	NDTS2100HardwareAccess() {};
	~NDTS2100HardwareAccess(void) {};

	virtual int getCardNumber()=0;
	virtual int getStepNumber()=0;
	virtual int getGateNumber()=0;
};

// A Null hardware access class that does nothing - used to store an integer value or for properties where
// all the processing is done in the hooks.
class DoNothing : public NDTS2100HardwareAccess 
{
public:

	DoNothing(int card, int step, int gate=0);
	~DoNothing(void);

	// Implementation of the HardwareAccessClass interface - does nothing
	virtual bool setValue(int newValue);
	virtual int getValue();

	virtual int getCardNumber();
	virtual int getStepNumber();
	virtual int getGateNumber();
private:
	int card;
	int step;
	int gate;
};


// There is a separate snapshot for each card at the moment - may make this global?
class SnapshotInternal;
class TakeSnapshot : public NDTS2100HardwareAccess 
{
public:
	TakeSnapshot(SnapshotInternal *pSnapshot, int card);
	~TakeSnapshot();

	virtual bool setValue(int newValue); 
	virtual int getValue();
	virtual int getCardNumber();
	virtual int getStepNumber();
	virtual int getGateNumber();
private:
	int card;
	SnapshotInternal *pSnapshot;
};

class GetNumberOfBScansInSnapshot : public NDTS2100HardwareAccess 
{
public:
	GetNumberOfBScansInSnapshot(SnapshotInternal *pSnapshot, int card);
	~GetNumberOfBScansInSnapshot();
	// Implementation of the HardwareAccessClass interface
	virtual bool setValue(int newValue); 
	virtual int getValue();
	virtual int getCardNumber();
	virtual int getStepNumber();
	virtual int getGateNumber();
private:
	int card;
	SnapshotInternal *pSnapshot;
};

class ClearErrorLog : public NDTS2100HardwareAccess 
{
public:
	ClearErrorLog();
	~ClearErrorLog();
	// Implementation of the HardwareAccessClass interface
	virtual bool setValue(int newValue);
	virtual int getValue();
	virtual int getCardNumber();
	virtual int getStepNumber();
	virtual int getGateNumber();
};

// There is one take snapshot for the system but each card has its own NumberOfBScansInSnapshot
class GetNumberOfErrorLogLines : public NDTS2100HardwareAccess 
{
public:
	GetNumberOfErrorLogLines();
	~GetNumberOfErrorLogLines();
	// Implementation of the HardwareAccessClass interface
	virtual bool setValue(int newValue);
	virtual int getValue();
	virtual int getCardNumber();
	virtual int getStepNumber();
	virtual int getGateNumber();
};
}
}