GenApi 3.5.1
ChunkAdapterDcam.h
1//-----------------------------------------------------------------------------
2// (c) 2004 by Basler Vision Technologies
3// Author: Fritz Dierks
4//
5// License: This file is published under the license of the EMVA GenICam Standard Group.
6// A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7// If for some reason you are missing this file please contact the EMVA or visit the website
8// (http://www.genicam.org) for a full copy.
9//
10// THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20// POSSIBILITY OF SUCH DAMAGE.
21//
22//-----------------------------------------------------------------------------
28#ifndef GENAPI_CHUNKADAPTERDCAM_H
29#define GENAPI_CHUNKADAPTERDCAM_H
30
31#include <cstring>
32#include <Base/GCTypes.h>
33#include <GenApi/ChunkAdapter.h>
34#include <GenApi/Compatibility.h>
35
36namespace GENAPI_NAMESPACE
37{
38
39 void GENAPI_DECL SET_GUID(GUID& name, uint32_t l, uint16_t w1, uint16_t w2, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6, uint8_t b7, uint8_t b8);
40
41
42 // make sure everything is properly packed
43# pragma pack(push, 1)
44
45 typedef struct DCAM_CHUNK_TRAILER
46 {
47 GUID ChunkID;
48 uint32_t ChunkLength;
49 uint32_t InverseChunkLength;
50 explicit DCAM_CHUNK_TRAILER() : ChunkLength(0), InverseChunkLength(0)
51 {
52 memset(&ChunkID, 0, sizeof(ChunkID));
53 }
54 } DCAM_CHUNK_TRAILER;
55
56 typedef struct DCAM_CHECKSUM
57 {
58 uint32_t CRCChecksum;
59 } DCAM_CHECKSUM;
60
61 // restore the previous packing
62# pragma pack(pop)
63 /* ------------------------------------------- */
64
66 class GENAPI_DECL CChunkAdapterDcam : public CChunkAdapter
67 {
68
69 public:
71 CChunkAdapterDcam(INodeMap* pNodeMap = NULL, int64_t MaxChunkCacheSize = -1);
72
75
77 virtual bool CheckBufferLayout(uint8_t *pBuffer, int64_t BufferLength);
78
80 virtual void AttachBuffer(uint8_t *pBuffer, int64_t BufferLength, AttachStatistics_t *pAttachStatistics = NULL);
81
83 bool HasCRC(uint8_t *pBuffer, int64_t BufferLength);
84
86 bool CheckCRC(uint8_t *pBuffer, int64_t BufferLength);
87
88 protected:
90 uint32_t CRC16(const unsigned char *pData, uint32_t nbyLength );
91
93 bool CheckBuffer(const unsigned char* pData, uint32_t nbyLength );
94
95 };
96
97}
98
99#endif // GENAPI_CHUNKADAPTERDCAM_H
Declaration of the CChunkAdapter class.
Platform-dependent type definitions.
Connects a chunked DCAM buffer to a node map.
Definition ChunkAdapterDcam.h:67
bool HasCRC(uint8_t *pBuffer, int64_t BufferLength)
Checks if buffer has a CRC attached.
bool CheckCRC(uint8_t *pBuffer, int64_t BufferLength)
Checks CRC sum of buffer.
CChunkAdapterDcam(INodeMap *pNodeMap=NULL, int64_t MaxChunkCacheSize=-1)
Constructor.
uint32_t CRC16(const unsigned char *pData, uint32_t nbyLength)
Checks the CRC of a buffer.
virtual void AttachBuffer(uint8_t *pBuffer, int64_t BufferLength, AttachStatistics_t *pAttachStatistics=NULL)
Attaches a buffer to the matching ChunkPort.
virtual bool CheckBufferLayout(uint8_t *pBuffer, int64_t BufferLength)
Checks if a buffer contains chunks in a known format.
virtual ~CChunkAdapterDcam()
Destructor.
bool CheckBuffer(const unsigned char *pData, uint32_t nbyLength)
Checks the CRC of a buffer.
Connects a chunked buffer to a node map.
Definition ChunkAdapter.h:56
Definition ChunkAdapter.h:44