CustomProcess_Create Function
Applies To: Implementing a custom process
Initializes the process module and creates a client handle.
This function accepts process properties in the form of an array of NVM's. These are the properties defined in the process xml, along with some other properties.
It returns a pointer to a client handle which is passed as an argument for every subsequent function call. This ensures that the DLL can differentiate between the different clients.
[C++]
CustomProcess_API void* __stdcall CustomProcess_Create(int numProps,void* processProps);
Arguments
[in] numProps
Number of properties in the array pointed to by processProps.
[in] processProps
Pointer to an array of NVM's. These are the properties for the process as edited by the user.
Return Value
A void pointer to a client handle object. This is a unique identifier for the DLL to identify a particular client for any subsequent function calls.
Reporting errors and warnings: A null return value for the Client Handle can be regarded as an error. The error can be obtained by calling the GetLastError function which will give out the error message for the last error in the DLL.
Example
The following example represents a partial C++ implementation of this function:
[C++]
typedef struct
{
AreaOfInterest* myAoi;
NVM* myProcessProps;
unsigned long myNumProps;
CustomRasterInfo* myOutputRasterInfo;
unsigned long bufferSize;
char errorString[2048];
unsigned char* myOutputBuffer;
void* myCallbackObject;
NVM* myProcessMetadata;
unsigned long myNumMetadata;
tGetRowfn myGetRowfn;
tGetPropertyfn myGetPropertyfn;
tCreateAuxRasterfn myCreateAuxRasterfn;
tGetAuxRowfn myGetAuxRowfn;
}ClientHandle;
CustomProcess_API void* __stdcall CustomProcess_Create(int numProps,
void* processProps)
{
ClientHandle* myClientHandle = malloc(sizeof(ClientHandle));
myClientHandle->myAoi = 0;
myClientHandle->myProcessProps = (NVM*)processProps;
myClientHandle->myNumProps = numProps;
myClientHandle->myOutputRasterInfo = 0;
myClientHandle->bufferSize = 0;
myClientHandle->myOutputBuffer = 0;
myClientHandle->myCallbackObject = 0;
myClientHandle->myProcessMetadata = 0;
myClientHandle->myNumMetadata = 0;
myClientHandle->myGetRowfn = 0;
myClientHandle->myGetPropertyfn = 0;
myClientHandle->myCreateAuxRasterfn = 0;
myClientHandle->myGetAuxRowfn = 0;
return (void*)myClientHandle;
}
For a detailed example on how to implement this function, see Sample custom process.
Related Topics
See also: CustomProcess_SetWindow, CustomProcess_Initialize, CustomProcess_GetRow, CustomProcess_GetMetadata, CustomProcess_GetLastError, CustomProcess_Cleanup, CustomProcess_SetCallbackFunctions, CustomProcess_SetAreaOfInterest, CustomProcessUI_Init, CustomProcessUI_ShowModalDialog, CustomProcessUI_GetUpdatedXML, CustomProcessUI_GetStatus, CustomProcessUI_GetProperty, CustomProcessUI_SetProperty, CustomProcessUIForm_GetUpdatedXML, CustomProcessUIForm_Init