Instance_Discard function

Applies To: Implementing a custom GeoTransformer

Discards an instance of a custom GeoTransformer. It should free any resources used by specified GeoTransformer instance. On return, given handle will be considered invalid.

This function will be called by GeoTransCore component when finishes using the instance associated with given handle.

[C / C++]

extern "C" void __stdcall Instance_Discard(

HGeoTrans hInstance // instance handle to be released

);

Arguments

[in] hInstance

Handle of a valid GeoTransformer instance to be released. It can be a pointer to a C data structure, an address of a C++ class instance, or anything else that your implementation understands and was returned by either Instance_Create, Instance_TryReuseCached or Instance_UnSerialize.

HGeoTrans type is defined in GeoTransCreation namespace and it is basically a HANDLE.

Note: It is not required to test against NULL since GeoTransCore component ensures the validity of the handle.

Remarks

Must also discard, if any generated, the associated serialization buffer.

For further details on serialization, please see Instance_Serialize and Instance_UnSerialize.

Exception handling: Please ensure a proper implementation of freeing associated resources, in order to avoid memory leaks or heap corruption.

Requirements

Platform

32 bit Windows OS

Environment

ANSI C / C++ Standard compliant

API

__stdcall calling convention; by name, undecorated "C" export

Example

This is an example of how easily can this function be implemented through inheritance:

[C++]

extern "C" void __stdcall Instance_Discard(HGeoTrans hInstance) {

delete (ICustomGeoTransformer*) hInstance; // virtual destructor discards proper derived class

}

For a detailed example on how to implement this function, please see Custom GeoTransformer VC++ Sample.

Related Topics

See also: Instance_Create, Instance_TryReuseCached, Instance_UnSerialize, GeoTransCreation