IFactory Class Reference

Inheritance diagram for IFactory:

IBase FactoryBase Factory


Public Methods

virtual oa::oaUInt4 createInstance (IBase *reserved, const Guid &id, void **iPtr)=0

Detailed Description

This is the abstract factory interface. This factory is implemented by the plug-in and is used to create instances of interface objects as needed. There is generally one implementation of the IFactory interface for each type of component.


Member Function Documentation

uint32 IFactory::createInstance IBase *    reserved,
const Guid &    id,
void **    iPtr
[pure virtual]
 

This function creates an instance of the component that this factory is implemented to manage. Note that if there is any problem creating the component, or querying the requested interface from it, iPtr is set to NULL, and this function returns one of the values from IBase::Status to identify the problem. IBase::cOK is returned if no problems are encountered.

Parameters:
reserved This parameter is reserved for advanced usage of components. It represents the "outer object" in an aggregation relationship. For simple, non-aggregated components, this parameter must be set to NULL.
id This is a reference to the class id of the required interface. Note that if the component does not implement this interface, the factory deletes the instance it created and sets iPtr to NULL. If the particular interface that the component implements is not known (for instance, it may be another version of an interface, but both may not be available) the best strategy is to create the component and request the IBase interface, which is guartanteed to be implemented. Then, queryInterface can be used to determine which particular version of the interface is implemented.
*iPtr This parameter is set to a pointer to the requested interface from the new component, or NULL if there was a problem creating the component, or if the required interface is not implemented by this compoinent.

Implemented in Factory.


The documentation for this class was generated from the following files:

Return to top of page