ProcUnit::TmpDataAlloc
Allocates temporary work data space
BYTE *TmpDataAlloc(
int size
);
Parameters
size
|
Size to be allocated as a workspace
|
Return Value
Returns the starting address of the workspace, when the workspace is successfully allocated.
Returns NULL when the workspace could not be allocated.
Description
Allocates a workspace of the size specified by the argument.
This space is mainly used in the measurement processing of processing items to allocate the memory area when you need to store work data temporarily.
Do not use the memory space allocated by this method for storing the data which needs to be retained (even after finishing the measurement).
When the memory space allocated by this method is no longer needed, be sure to release the space by using TmpDataFree() method (see "
ProcUnit::TmpDataFree").
The 10 MB space is allocated as a temporary workspace. You cannot allocate the space greater than 10 MB.
Example
int Sample::MeasureDispI(ProcUnit *ptrProcUnit, int subNo, ImageWindow *ptrImageWindow)
{
BYTE *ptrTmp;
BYTE *ptrMeasureImage;
BYTE *ptrImage1;
BYTE *ptrImage2;
// Allocate the temporary workspace
ptrImage1 = ptrProcUnit->TmpDataAlloc(640*480*3);
ptrImage2 = ptrProcUnit->TmpDataAlloc(640*480*3);
ptrMeasureImage = ptrProcUnit->GetMeasureImage(0);
if (subNo == 0) {
// Convert the ptrMeasureImage image, and store it in the temporary workspace
// Display the image stored in the temporary space
ptrImageWindow->ImageDisp(ptrImage1);
} else {
// Convert the ptrMeasureImage image, and store it in the temporary workspace
// Display the image stored in the temporary space
ptrImageWindow->ImageDisp(ptrImage2);
}
// Release the temporary workspace
ptrProcUnit->TmpDataFree(ptrImage2);
ptrProcUnit->TmpDataFree(ptrImage1);
}