SK91GigE-WIN  5.5.2
Functions
Memory Management

Memory management of the library. More...

Functions

size_t SK_QUEUEBUFFERSIZE (int CamID)
 Returns the size of the queue buffer. More...
 
PUCHAR SK_GETQUEUEBUFFER (int CamID)
 Returns the pointer to the queue buffer. More...
 
PVOID SK_GETBUFFER (int CamID, int BufferID, unsigned char *pData)
 Returns pointer to queue buffer. More...
 
void * SK_GETSCANADDR (int CamID, int BufferID, int lineNumber)
 Returns the address of the specified line scan number in buffer of specified buffer object. More...
 
PVOID SK_ALLOC_BUFFER (int CamID, size_t Size, int BufferID)
 Allocates memory buffer for line scan data with number of bytes. More...
 
PVOID SK_ALLOC_LINES (int CamID, size_t lines, int BufferID)
 Allocates memory buffer for line scan data with number of lines. More...
 
void SK_FREE_BUFFER (int CamID, int BufferID)
 Frees memory buffer, which were allocated by SK_ALLOC_BUFFER or SK_ALLOC_LINES. More...
 
size_t SK_GET_BUFFER_LINES (int CamID, int BufferID)
 Returns the number of lines which the memory can store. More...
 
size_t SK_GET_BUFFER_SIZE (int CamID, int BufferID)
 Returns the number of bytes which the memory can store. More...
 
int SK_SETUSERBUFFERQUEUE (int CamID, void *pBufferList, int buffersize, int NumberOfBuffers)
 Installs a user managed buffer queue. More...
 

Detailed Description

Memory management of the library.

Function Documentation

◆ SK_ALLOC_BUFFER()

PVOID SK_ALLOC_BUFFER ( int  CamID,
size_t  Size,
int  BufferID 
)

Allocates memory buffer for line scan data with number of bytes.

Example:

// initialize everything
// allocate memory for 2048 lines
SK_ALLOC_BUFFER(m_CamID, SK_GETBYTESPERLINE(m_CamID) * 2048, 0);
// now you can use this method (SK_GRAB with Buffer ID):
SK_GRAB_BUFFER(m_CamID, 0, 2000, false, 0, SK_FREERUN);
// or this (normal SK_GRAB with memory and number of lines):
SK_GRAB(m_CamID, SK_GETBUFFER(m_CamID, 0), SK_GET_BUFFER_LINES(m_CamID, 0), 2000, false, 0, SK_FREERUN);
// delete the memory
SK_FREE_BUFFER(m_CamID, 0);
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Sizesize of memory buffer in bytes (size results from SK_GETBYTESPERLINE * lines per image to acquire)
BufferIDnumber of memory object, default = 0 (range 0 ... 3)
Returns
pointer to buffer as (void *) pointer, else NULL

◆ SK_ALLOC_LINES()

PVOID SK_ALLOC_LINES ( int  CamID,
size_t  lines,
int  BufferID 
)

Allocates memory buffer for line scan data with number of lines.

Example:

// initialize everything
// allocate memory for 2048 lines
SK_ALLOC_LINES(m_CamID, 2048, 0);
// now you can use this method (SK_GRAB with Buffer ID):
SK_GRAB_BUFFER(m_CamID, 0, 2000, false, 0, SK_FREERUN);
// or this (normal SK_GRAB with memory and number of lines):
SK_GRAB(m_CamID, SK_GETBUFFER(m_CamID, 0), SK_GET_BUFFER_LINES(m_CamID, 0), 2000, false, 0, SK_FREERUN);
// delete the memory
SK_FREE_BUFFER(m_CamID, 0);
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
linesnumber of lines to scan
BufferIDnumber of memory object, default = 0 (range 0 ... 3)
Returns
pointer to buffer as (void *) pointer, else NULL

◆ SK_FREE_BUFFER()

void SK_FREE_BUFFER ( int  CamID,
int  BufferID 
)

Frees memory buffer, which were allocated by SK_ALLOC_BUFFER or SK_ALLOC_LINES.

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
BufferIDid of memory object, default = 0 (range -1, 0 ... 3)
-1 = free all memory objects
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_GET_BUFFER_LINES()

size_t SK_GET_BUFFER_LINES ( int  CamID,
int  BufferID 
)

Returns the number of lines which the memory can store.

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
BufferIDid of memory object, default = 0 (range 0 ... 3)
Returns
number of lines, else 0

◆ SK_GET_BUFFER_SIZE()

size_t SK_GET_BUFFER_SIZE ( int  CamID,
int  BufferID 
)

Returns the number of bytes which the memory can store.

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
BufferIDid of memory object, default = 0 (range 0 ... 3)
Returns
number of bytes, else 0

◆ SK_GETBUFFER()

PVOID SK_GETBUFFER ( int  CamID,
int  BufferID,
unsigned char *  pData 
)

Returns pointer to queue buffer.

This function returns the pointer to queue buffer and if pData is not NULL, pData get the pointer to the buffer too,

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
BufferIDnumber of memory object, default = 0
pDatapointer to user managed memory (if not NULL, then it will get the same value as returned pointer)
Returns
pointer to buffer, else NULL

◆ SK_GETQUEUEBUFFER()

PUCHAR SK_GETQUEUEBUFFER ( int  CamID)

Returns the pointer to the queue buffer.

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
pointer to queue buffer, else NULL

◆ SK_GETSCANADDR()

void* SK_GETSCANADDR ( int  CamID,
int  BufferID,
int  lineNumber 
)

Returns the address of the specified line scan number in buffer of specified buffer object.

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
BufferIDnumber of memory object, default = 0
lineNumberline scan number
Returns
pointer to specified line scan number in buffer, else NULL

◆ SK_QUEUEBUFFERSIZE()

size_t SK_QUEUEBUFFERSIZE ( int  CamID)

Returns the size of the queue buffer.

Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
size of the queue buffer in bytes, else see Error Code Table

◆ SK_SETUSERBUFFERQUEUE()

int SK_SETUSERBUFFERQUEUE ( int  CamID,
void *  pBufferList,
int  buffersize,
int  NumberOfBuffers 
)

Installs a user managed buffer queue.

This function allows the user to manage the buffer queue by himself. If it is not required, the function SK_GRABCONTINUOUS with grabInUserBufferQueue = false is recommended.

Example to create the buffer queue and call the function:

// initializing everything...
// Allocate data memory for m_iLines
m_imagesize = SK_GETBYTESPERLINE(m_CamID) * m_iLines;
// init image buffer for m_nrOfBuffer buffers
if (m_pData) delete m_pData;
m_pData = new unsigned char[m_nrOfBuffer * m_imagesize];
memset(m_pData, 0, m_nrOfBuffer * m_imagesize);
std::vector<unsigned char *> m_bufferList;
// create buffer list, type of m_bufferList: std::vector<unsigned char *>
for(int i = 0; i < m_nrOfBuffer; i++)
m_bufferList.push_back(static_cast<unsigned char *>(m_pData + i * m_imageSize));
// create user managed buffer queue
SK_SETUSERBUFFERQUEUE(m_CamID, static_cast<void *>(&m_bufferList[0]), m_imageSize, m_nrOfBuffer);
// grabbing images ...
Note
All frames must have the same size.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
pBufferListpointer to the buffer list
buffersizesize of each frame in bytes (max 65500 lines * SK_GETBYTESPERLINE )
NumberOfBuffersnumber of frames
Returns
SK_RESULT_OK on success, else see Error Code Table