ComponentManager Class Reference

#include <Pt/Cosmo/ComponentManager.h>

Default component manager. More...

Inherits Component.

Public Member Functions

 ComponentManager ()
 Constructor.
 ~ComponentManager ()
 Destructor.
void setModulesDir (const std::string &dir)
 Set modules search directory.
void importComponents (const std::string &manifest)
 Imports all components from manifest.
void registerComponent (IComponentPlugin &plugin, const std::string &require, const std::string &instanceId)
 Registers component.
void load ()
 Loads all registered components.
void load (const std::string &instanceId)
 Loads registered component.
void unload (IComponentPlugin &plugin)
 Unloads a component plugin.
void unload (const std::string &instanceId)
 Unloads a component by instance ID.
const IEnumerable< ComponentInfo > & components () const
 Enumerates all components.
void init (const IComponentType *type, const IComponentDeclaration *decl)
 Initializes the component.
bool hasFeatureId (const char *featureId) const
 Returns true if the given feature ID is implemented.
const char * classId () const
 Returns the class ID.
template<typename I>
I * queryInterface ()
 Returns the interface or null if not available.

Protected Member Functions

virtual void onInitialize (const IComponentDeclaration &decl)
 Called when the component is initialized.

Detailed Description

Concrete implementation of IComponentManager. Manages plugin registration, manifest import, dependency resolution, and the component load/unload lifecycle.

Member Function Documentation

◆ init()

void init ( const IComponentType * type,
const IComponentDeclaration * decl )
inherited

Called by the component plugin after creation. Assigns the component type and declaration, then invokes onInitialize().

Parameters
typeThe component type providing interface metadata.
declThe instance declaration from the manifest.

◆ hasFeatureId()

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

◆ onInitialize()

virtual void onInitialize ( const IComponentDeclaration & decl)
protectedvirtualinherited

Override to perform setup that requires access to the instance declaration.

Parameters
declThe instance declaration from the manifest.