29#ifndef GENAPI_CHUNKPORT_H
30#define GENAPI_CHUNKPORT_H
38# pragma warning(disable: 4251)
41namespace GENAPI_NAMESPACE
73 virtual void Read(
void *pBuffer, int64_t Address, int64_t Length);
76 virtual void Write(
const void *pBuffer, int64_t Address, int64_t Length);
82 virtual void SetPortImpl(GENAPI_NAMESPACE::IPortStacked* pPort);
108 void AttachChunk(uint8_t *pBaseAddress, int64_t ChunkOffset, int64_t Length,
bool Cache);
116 return m_ChunkIDLength;
134 if (!m_ptrPort.IsValid())
137 return m_ptrPort->GetNodeMap()->GetLock();
Definition of interface INodeMap.
virtual CLock & GetLock() const =0
Returns the lock which guards the node map.
virtual void InvalidateNode()=0
Indicates that the node's value may have changed.
Definition of interface IPortConstruct.
Definition of template CPointer.
Port attachable to a chunk in a buffer.
Definition ChunkPort.h:49
uint8_t * m_pChunkIDBuffer
Binary version of the chunk ID.
Definition ChunkPort.h:160
int m_ChunkIDLength
Length of the chunk ID buffer.
Definition ChunkPort.h:163
CNodePtr m_ptrPort
Pointer to the node holding a reference to this implementation.
Definition ChunkPort.h:157
bool CheckChunkID(uint8_t *pChunkIDBuffer, int ChunkIDLength)
Checks if a ChunkID matches.
virtual void SetPortImpl(GENAPI_NAMESPACE::IPortStacked *pPort)
Called from the port node to give the chunk port a pointer to itself.
virtual EYesNo GetSwapEndianess()
Determines if the port adapter must perform an endianess swap.
Definition ChunkPort.h:85
virtual void SetPortImpl(GENAPI_NAMESPACE::IPort *pPort)
Called from the port node to give the chunk port a pointer to itself.
int GetChunkIDLength()
Gets the ChunkID length.
Definition ChunkPort.h:114
void DetachChunk()
Detaches the Chunk from the ChunkPort.
virtual void Write(const void *pBuffer, int64_t Address, int64_t Length)
Writes a chunk of bytes to the port.
uint64_t m_ChunkIDNumber
Chunk ID stored as a number (for more straightforward access)
Definition ChunkPort.h:172
bool m_CacheData
indicates if the data needs to be cached
Definition ChunkPort.h:169
void DetachPort()
Detaches the ChunkPort to the Port.
int64_t m_Length
Length of the chunk.
Definition ChunkPort.h:151
bool CheckChunkID(uint64_t ChunkID)
Checks if a ChunkID matches, version using uint64_t ID representation.
bool m_ChunkIDNumberValid
indicates if the m_ChunkIDNumber is valid (could be invalid eg. if the ID does not fit in 64-bit rang...
Definition ChunkPort.h:175
uint8_t * m_pBaseAddress
Pointer to the begin of the buffer.
Definition ChunkPort.h:145
virtual void Read(void *pBuffer, int64_t Address, int64_t Length)
Reads a chunk of bytes from the port.
virtual EAccessMode GetAccessMode() const
Get the access mode of the node.
virtual EInterfaceType GetPrincipalInterfaceType() const
Get the type of the main interface of a node.
bool AttachPort(GENAPI_NAMESPACE::IPort *pPort)
Attaches the ChunkPort to the Port.
int64_t m_ChunkOffset
The chunk's offset within the buffer.
Definition ChunkPort.h:148
uint8_t * m_pChunkData
cache for the chunk data
Definition ChunkPort.h:166
virtual ~CChunkPort()
Destructor; detaches from the port.
int64_t m_LengthAlloc
Space allocated for the chunk.
Definition ChunkPort.h:154
CChunkPort(IPort *pPort=NULL)
Constructor; can attach to a port.
void UpdateBuffer(uint8_t *pBaseAddress)
Updates the base address of the chunk.
void ClearCache()
Clears the chunk cache.
void AttachChunk(uint8_t *pBaseAddress, int64_t ChunkOffset, int64_t Length, bool Cache)
Attaches the Chunk to the ChunkPort.
A lock class.
Definition Synch.h:62
#define RUNTIME_EXCEPTION
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
Definition GCException.h:246
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
enum GENAPI_NAMESPACE::_EYesNo EYesNo
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
@ No
no
Definition Types.h:141