CDPDataProvider *




Detailed Description

class CDPDataProviderFactory

A Data Provider Plugin has two classes.

One CDPDataProviderFactory and one CDPDataProvider. The host will instantiate the factory once (usually at startup), and use the factory to determine if a given modelKey is supported by the plugin or not.

If the modelKey is supported, the host will use the factory to create a CDPDataProvider instance. Whenever the model/analysis is closed, the CDPDataProvider will be deleted.

The factory is only created once per process, and usually kept until the app/server closes.

The factory has two roles:

  1. Provide information about the associated data provider and check if a modelKey is supported by the provider.

  2. Create and destroy the associated data provider.

Public Functions

inline virtual ~CDPDataProviderFactory()
virtual bool getProviderInfo(CDPDataProviderInfo *info) = 0

Gets information about the provider produced by this factory.

Populate the info object with information relevant to your provider.

virtual bool isSupportedByProvider(const CDPString &modelKey) = 0

Checks if the given modelKey is supported by the data providers produced by this factory.

In this method you need to check if the incoming modelKey points to a resource that your provider can read.

Returns true if the modelKey is supported, false if it is not.

If you return true, the next action from the host will be to create a CDPDataProvider with the createProviderInstance() method, and then call init on this object with the given modelKey.

virtual CDPDataProvider *createProviderInstance() = 0

Creates and returns an instance of the data provider associated with this factory.

Creates and returns the new instance. The instance is managed by the host, but it will be deleted with the destroyProviderInstance() method to ensure that it is allocated and deleted with the same heap manager.

virtual void destroyProviderInstance(CDPDataProvider *instance) = 0

Destroys the given data provider.

This method will be called whenever the host is done with the use of the data provider. The provider passed to this method will always have been allocated with createProviderInstance() in the same factory. This is to ensure that it is allocated and deleted with the same heap manager.