Question

I'd like to link my custom domain object into the Petrel free memory command. My domain object caches data while visualised and this cache could be cleared when the user wants to free memory.

I have found the IMemorySaver interface and tried declaring this on my custom domain object but the FreeMemory method is not called when the user choose to free memory in Petrel.

Any ideas?

Neal

Was it helpful?

Solution

In Ocean 2013.1 a new API has been introduced that allows custom domain objects and ToggleWindows from a plug-in to be told when the user has invoked the ‘Free memory’ feature (this will also work for programmatic calls to PetrelSystem.ForceFreeMemory()).

The API follows a similar pattern to the existing INameInfoFactory and IImageInfoFactory APIs.

In order to use the API you need to create a factory object for your custom domain object (or ToggleWindow) that implements the new IResourceSaverFactory interface.

This interface requires that you implement a single method called GetResourceSaver(). This method will return a ResourceSaver object that is associated with your custom domain object (or ToggleWindow).

ResourceSaver is an abstract class and you should implement the FreeResources() method on your derived class.

When the ‘Free memory’ feature is invoked the system will use your ResourceSaverFactory to obtain a ResourceSaver object for each of your custom domain object (or ToggleWindow) instances.

The FreeResources() method will be called on your ResouceSaver objects.

Regards,

Chippy

OTHER TIPS

Neal, the IMemorySaver is declared as a service interface, which you should not re-implement.

Having said that, participation in Petrel's controlled resource management is a fair requirement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top