DIPlib Documentation - ©1995-2014 Quantitative Imaging Group, Delft University of Technology.

ResourcesMerge

Add one resource list to another

SYNOPSIS

dip_Error dip_ResourcesMerge( resources, mergee )

FUNCTION

Adds one resource list to another. This function is very useful when writing functions that will support a dip_Resources parameter. Typically you want to allocate a number of resources and only add these to the user-supplied dip_Resources when all these allocations have been successful. This is where ResourcesMerge comes in. Allocate a local dip_Resources structure and register all resources with it. When no errors occured the local dip_Resources structure can be merged with the user-supplied dip_Resources structure. If an error did occur, simply free all local resources by calling ResourcesFree. In addition it is the convention that functions supporting resource tracking also accept a zero indicating that no tracking should be performed. When resources in dip_ResourcesMerge is 0, the mergee tracking structure is freed, but the resources it contains are not. In this way you get support for the "resources = 0 means no tracking" convention for free.

ARGUMENTS

Data typeNameDescription
dip_ResourcesresourcesThe dip_Resources structure with which the additional resources much be merged
dip_Resources *mergeeA pointer to the dip_Resources structure containing the additional resources to be merged. After the merge, mergee is set to 0.

SEE ALSO

ResourcesNew, ResourcesFree, ResourceSubscribe, ResourceUnsubscribe