ChunkAdapter.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //-----------------------------------------------------------------------------
  2. // (c) 2006 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Fritz Dierks
  6. // $Header$
  7. //
  8. // License: This file is published under the license of the EMVA GenICam Standard Group.
  9. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  10. // If for some reason you are missing this file please contact the EMVA or visit the website
  11. // (http://www.genicam.org) for a full copy.
  12. //
  13. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
  14. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
  17. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  23. // POSSIBILITY OF SUCH DAMAGE.
  24. //-----------------------------------------------------------------------------
  25. /**
  26. \file
  27. \brief Declaration of the CChunkAdapter class.
  28. \ingroup GenApi_PublicUtilities
  29. */
  30. #ifndef GENAPI_CHUNKADAPTER_H
  31. #define GENAPI_CHUNKADAPTER_H
  32. #include <GenApi/Types.h>
  33. #include <GenApi/INodeMap.h>
  34. #include <GenApi/ChunkPort.h>
  35. #include <vector>
  36. namespace GENAPI_NAMESPACE
  37. {
  38. //! Delivers information about the attached chunks and nodes
  39. //! \ingroup GenApi_PublicUtilities
  40. typedef struct AttachStatistics_t
  41. {
  42. int NumChunkPorts; //!< Number of chunk ports found in the node map
  43. int NumChunks; //!< Number of chunks found in the buffer
  44. int NumAttachedChunks; //!< Number of chunks from the buffer attached to a chunk port
  45. } AttachStatistics_t;
  46. /**
  47. \brief Connects a chunked buffer to a node map
  48. \ingroup GenApi_PublicUtilities
  49. */
  50. class GENAPI_DECL CChunkAdapter
  51. {
  52. public:
  53. //! Destructor
  54. virtual ~CChunkAdapter();
  55. //! Attaches to a node map and retrieves the chunk ports
  56. void AttachNodeMap(INodeMap* pNodeMap);
  57. //! Detaches from the node map
  58. void DetachNodeMap();
  59. //! Checks if a buffer contains chunks in a known format
  60. /*! Implement that for a specific buffer layout */
  61. virtual bool CheckBufferLayout(uint8_t *pBuffer, int64_t BufferLength) = 0;
  62. //! Attaches a buffer to the matching ChunkPort
  63. /*! Implement that for a specific buffer layout */
  64. virtual void AttachBuffer(uint8_t *pBuffer, int64_t BufferLength, AttachStatistics_t *pAttachStatistics = NULL) = 0;
  65. //! Detaches a buffer
  66. void DetachBuffer();
  67. //! Updates the base address of the buffer
  68. void UpdateBuffer(uint8_t *pBaseAddress);
  69. //! Clears the chunk caches
  70. void ClearCaches();
  71. protected:
  72. //! Serves as default constructor
  73. CChunkAdapter(INodeMap* pNodeMap = NULL, int64_t MaxChunkCacheSize = -1);
  74. //! An array of attached ChunkPorts
  75. /*! Note that this must be a pointer otherwise we'll get into DLL hell (see warning C4251) */
  76. std::vector<CChunkPort*> *m_ppChunkPorts;
  77. //! the maximum size of a chunk to be cached
  78. /*! 0 : no caching, -1 : all caching */
  79. int64_t m_MaxChunkCacheSize;
  80. };
  81. }
  82. #endif // GENAPI_CHUNKADAPTER_H