/**
 * \file    M_Port.hpp
 * \author  Silvan Murer
 * \date    01 Aug 2022
 *
 * \brief   Internal class used to link GenTL and GenApi
 */

#ifndef SRC_M_PORT
#define SRC_M_PORT

#include "GTL_Producer.hpp"
#include "Mimic_Exception.hpp"

#define GENICAM_NO_AUTO_IMPLIB
#include "GenICam.h"

namespace mimic {

/**
 * \class GS_Port
 * \brief helper class used for GanApi nodemap access
 */
class M_Port : public GenApi::IPort
{
private:
	GenTL::PORT_HANDLE hPort;
	std::shared_ptr<genSDK::GTL_Producer> gtl_producer; ///< shared pointer to the gtl_producer

public:
	M_Port(std::shared_ptr<genSDK::GTL_Producer> gtl_producer, GenTL::PORT_HANDLE _hPort);
	virtual ~M_Port(void);

	//! Reads a chunk of bytes from the port
	virtual void Read(void* pBuffer, int64_t Address, int64_t Length);
	//! Writes a chunk of bytes to the port
	virtual void Write(const void* pBuffer, int64_t Address, int64_t Length);

	virtual GenApi::EAccessMode GetAccessMode(void) const;
};

} /* namespace genSDK */

#endif
