IActivator Class Referenceabstract

#include <Pt/Cosmo/IActivator.h>

Dependency resolver. More...

Public Member Functions

 IActivator ()
 Constructor.
 
virtual ~IActivator ()
 Destructor.
 
Componentget (const std::string &featureId) const
 Returns the component by feature ID or throws. More...
 
template<typename I >
I * get (const std::string &id) const
 Returns the interface from a component or throws. More...
 
Componentquery (const std::string &featureId) const
 Returns the component by feature ID or null. More...
 
template<typename I >
I * query (const std::string &id) const
 Returns the interface from a component or null. More...
 

Protected Member Functions

virtual ComponentonQuery (const std::string &featureId) const =0
 Gets the component by feature ID or null if not available.
 

Detailed Description

Passed to IActivate::onActivate() to resolve required dependencies by feature ID. Use get() when the dependency is mandatory (throws on failure) or query() when it may legitimately be absent.

Member Function Documentation

◆ get() [1/2]

Component * get ( const std::string &  featureId) const
Parameters
featureIdFeature ID of the required component.

◆ get() [2/2]

I * get ( const std::string &  id) const
Parameters
idFeature ID of the required component.

◆ query() [1/2]

Component * query ( const std::string &  featureId) const
Parameters
featureIdFeature ID of the component.

◆ query() [2/2]

I * query ( const std::string &  id) const
Parameters
idFeature ID of the component.