IComponentPlugin Class Referenceabstract

#include <Pt/Cosmo/IComponentPlugin.h>

Component plugin interface. More...

Inherits IComponentType.

Inherited by ComponentPlugin< ComponentManager, ComponentManagerFactory >, ComponentPlugin< Main, MainFactory >, and ComponentPlugin< T, Factory >.

Public Member Functions

virtual ~IComponentPlugin ()
 Destructor.
const IEnumerable< const char * > & dependencies () const
 Returns the feature IDs of the dependencies.
ComponentMode mode () const
 Returns the component mode.
const char * info () const
 Returns the info string of the component.
Componentcreate (const IComponentDeclaration *decl)
 Creates a component instance.
void destroy (Component *instance)
 Destroys a component instance.
bool hasFeatureId (const char *featureId) const
 Returns true if the given feature ID is implemented.
const IEnumerable< const char * > & featureIds () const
 Returns the implemented feature IDs.
const char * classId () const
 Returns the class ID of the component.
template<typename I>
bool hasInterface () const
 Returns true if the interface is implemented.
template<typename I>
I * queryInterface (Component &c) const
 Returns the interface or null if not implemented.

Protected Member Functions

virtual void onAttach (IComponentManager &cm, const std::string &instance)=0
 The plugin is attached to a component manager.
virtual void onDetach (IComponentManager &cm, const std::string &instance)=0
 The plugin is detached from a component manager.
virtual void onDetach (IComponentManager &cm)=0
 The plugin is detached from a component manager.
virtual const IEnumerable< const char * > & onGetDependencies () const =0
 Returns the feature IDs of the depencies.
virtual ComponentMode onGetMode () const =0
 Returns the component mode.
virtual const char * onGetInfo () const =0
 Returns the info string of the component.
virtual ComponentonCreate ()=0
 Creates a component instance.
virtual void onDestroy (Component *instance)=0
 Destroys a component instance.
virtual bool onHasFeatureId (const char *featureId) const =0
 Returns true if the given feature ID is implemented.
virtual const IEnumerable< const char * > & onGetFeatureIds () const =0
 Returns the implemented feature IDs.
virtual const char * onGetClassId () const =0
 Returns the class ID of the component.
virtual bool onHasInterface (const std::type_info &ti) const =0
 Returns true if the interface is implemented.
virtual IUnknownonQueryInterface (Component &c, const std::type_info &ti) const =0
 Returns the interface or null if the interface is not implemented.

Detailed Description

A plugin describes a component class. It provides metadata such as class ID, feature IDs, dependencies, and component mode. The IComponentManager uses plugins to create, initialize and destroy component instances.

Member Function Documentation

◆ hasFeatureId()

bool hasFeatureId ( const char * featureId) const
inherited
Parameters
featureIdThe feature ID to check.

◆ queryInterface()

template<typename I>
I * queryInterface ( Component & c) const
inherited
Parameters
cThe component instance to query.