Instance_Serialize function
Applies To: Implementing a custom GeoTransformer
Given a handle to an instance of custom GeoTransformer, it generates a serialization buffer. The serialization consists in saving transformation parameters (including possible precomputed variables) in binary format, enabling faster reconstruction.
When compiling services in ArcGIS Image Server, it is preferred to store binary the parameters required to create GeoTransformers. This function will be called by GeoTransCore component to obtain such a binary structure.
[C]
BOOL __stdcall Instance_Serialize(
HGeoTrans hInstance, // handle of GeoTransformer instance
LPVOID * dpBuffer, // double pointer to serialization buffer
size_t * nBytes // size of buffer, by reference
);
[C++]
extern "C" BOOL __stdcall Instance_Serialize(
HGeoTrans hInstance, // handle of GeoTransformer instance
LPVOID& dpBuffer, // address of serialization buffer
size_t& nBytes // size of buffer, by reference
);
Arguments
[in] hInstance
Custom GeoTransformer instance handle. Refer to the documentation of Instance_Create function for details about a handle to a GeoTransformer instance.
HGeoTrans type is defined in GeoTransCreation namespace and it is basically a HANDLE.
Note: It is not required to test against NULL the value of the handle, since GeoTransCore component ensures their validity.
[out] dpBuffer
The address of the serialization buffer. The double pointer is used to return the address that you've allocated to compile the binary serialization of the object. It is your duty to release the memory buffer when Instance_Discard will be called for the same instance.
[out] nBytes
Returns the size of the serialization buffer, in bytes.
Return Value
Must return FALSE when no serialization buffer is returned.
Remarks
It is not a requirement to support serialization, but it is highly recommended. Do not save in the serialization buffer structures containing pointers or references to memory locations, because will not be available at reconstruction time.
For efficiency reasoning, include possible precomputed variables in the serialization buffer.
Requirements
Platform |
32 bit Windows OS |
Environment |
ANSI C / C++ Standard compliant |
API |
__stdcall calling convention; by name, undecorated "C" export |
Example
For a basic example on how to implement this function, please see Custom GeoTransformer VC++ Sample.
Related Topics
See also: Instance_Create, Instance_Discard, Instance_UnSerialize, GeoTransCreation