Skip to content

Pylon::IBufferFactory#

Module: Instant Camera

Usable to create a custom buffer factory when needed.

#include <pylon/BufferFactory.h>

Public Functions#

Name
virtual ~IBufferFactory() =0
Ensure proper destruction by using a virtual destructor.
virtual void AllocateBuffer(size_t bufferSize, void ** pCreatedBuffer, intptr_t & bufferContext) =0
Allocates a buffer and provides additional context information.
virtual void FreeBuffer(void * pCreatedBuffer, intptr_t bufferContext) =0
Frees a previously allocated buffer.
virtual void DestroyBufferFactory() =0
Destroys the buffer factory.

Public Functions Documentation#

function ~IBufferFactory#

inline virtual ~IBufferFactory() =0

Ensure proper destruction by using a virtual destructor.

function AllocateBuffer#

virtual void AllocateBuffer(
    size_t bufferSize,
    void ** pCreatedBuffer,
    intptr_t & bufferContext
) =0

Allocates a buffer and provides additional context information.

Parameters:

  • bufferSize The size of the buffer that has to be allocated.
  • pCreatedBuffer Return the pointer to the allocated buffer. May return NULL if the allocation fails.
  • bufferContext Context information that belongs to the buffer. This context information is provided when FreeBuffer() is called. The value can be left unchanged if not needed.

Thread Safety:

This method can be run by different threads. It is called from threads that call Pylon::CInstantCamera::StartGrabbing() and it can be called by the internal grab engine thread.

Error Safety:

May throw an exception if the allocation fails.

function FreeBuffer#

virtual void FreeBuffer(
    void * pCreatedBuffer,
    intptr_t bufferContext
) =0

Frees a previously allocated buffer.

Parameters:

  • pCreatedBuffer The pointer to the allocated buffer. Created by this factory.
  • bufferContext Context information of the buffer returned by AllocateBuffer().

Error Safety:

Does not throw C++ exceptions.

function DestroyBufferFactory#

virtual void DestroyBufferFactory() =0

Destroys the buffer factory.

Thread Safety:

This method can be run by different threads. It is called from threads that are running the destructor of a Pylon::CGrabResultPtr or call Pylon::CInstantCamera::StopGrabbing().

Error Safety:

C++ exceptions from this call will be caught and ignored.

This method is called when the buffer factory is not needed any longer. The object implementing IBufferFactory can be deleted by calling: delete this.