ChunkAdapterGeneric.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //-----------------------------------------------------------------------------
  2. // (c) 2006 by Leutron Vision
  3. // Project: GenApi
  4. // Author: Jan Becvar
  5. // $Header$
  6. //
  7. // License: This file is published under the license of the EMVA GenICam Standard Group.
  8. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  9. // If for some reason you are missing this file please contact the EMVA or visit the website
  10. // (http://www.genicam.org) for a full copy.
  11. //
  12. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
  13. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  14. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  15. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
  16. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  17. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  21. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  22. // POSSIBILITY OF SUCH DAMAGE.
  23. //-----------------------------------------------------------------------------
  24. /**
  25. \file
  26. \brief Declaration of the CChunkAdapterGeneric class.
  27. */
  28. #ifndef GENAPI_CHUNKADAPTERGENERIC_H
  29. #define GENAPI_CHUNKADAPTERGENERIC_H
  30. #include <GenApi/ChunkAdapter.h>
  31. namespace GENAPI_NAMESPACE
  32. {
  33. /* ------------------------------------------- */
  34. // Single chunk info
  35. // make sure everything is properly packed
  36. #pragma pack(push, 1)
  37. typedef struct SingleChunkData_t
  38. {
  39. uint64_t ChunkID;
  40. ptrdiff_t ChunkOffset;
  41. size_t ChunkLength;
  42. } SingleChunkData_t;
  43. // the extended version holding ChunkID as string should be used only in special cases
  44. // when the ChunkID does not fit into a 64-bit integer
  45. typedef struct SingleChunkDataStr_t
  46. {
  47. GENICAM_NAMESPACE::gcstring ChunkID;
  48. ptrdiff_t ChunkOffset;
  49. size_t ChunkLength;
  50. } SingleChunkDataStr_t;
  51. // restore the previous packing
  52. #pragma pack(pop)
  53. /* ------------------------------------------- */
  54. //! Connects a generic chunked buffer to a node map
  55. class GENAPI_DECL CChunkAdapterGeneric : public CChunkAdapter
  56. {
  57. public:
  58. //! Constructor
  59. CChunkAdapterGeneric(INodeMap* pNodeMap = NULL, int64_t MaxChunkCacheSize = -1);
  60. //! Destructor
  61. virtual ~CChunkAdapterGeneric();
  62. // Does not have implementation, use the version with EventID
  63. virtual bool CheckBufferLayout(uint8_t *pBuffer, int64_t BufferLength);
  64. // Does not have implementation, use the generic version
  65. virtual void AttachBuffer(uint8_t *pBuffer, int64_t BufferLength, AttachStatistics_t *pAttachStatistics = NULL);
  66. virtual void AttachBuffer(uint8_t *pBuffer, SingleChunkData_t *ChunkData, int64_t NumChunks, AttachStatistics_t *pAttachStatistics = NULL);
  67. virtual void AttachBuffer(uint8_t *pBuffer, SingleChunkDataStr_t *ChunkData, int64_t NumChunks, AttachStatistics_t *pAttachStatistics = NULL);
  68. };
  69. }
  70. #endif // GENAPI_CHUNKADAPTERGENERIC_H