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()
Ensure proper destruction by using a virtual destructor.
virtual void AllocateBuffer(size_t bufferSize, void ** pCreatedBuffer, intptr_t & bufferContext)
Allocates a buffer and provides additional context information.
virtual void FreeBuffer(void * pCreatedBuffer, intptr_t bufferContext)
Frees a previously allocated buffer.
virtual void DestroyBufferFactory()
Destroys the buffer factory.

Public Functions Documentation#

~IBufferFactory#

inline virtual ~IBufferFactory() 

Ensure proper destruction by using a virtual destructor.

AllocateBuffer#

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

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.

FreeBuffer#

virtual void FreeBuffer(
    void * pCreatedBuffer,
    intptr_t bufferContext
) 

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.

DestroyBufferFactory#

virtual void DestroyBufferFactory() 

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.


Updated on 5 July 2022 at 15:30:01