Component Class Reference

#include <Pt/Cosmo/Component.h>

Component base class. More...

Inherited by ComponentManager, and Main.

Public Member Functions

 Component ()
 Constructor.
 Component (const Component &)=delete
 No copy constructor.
virtual ~Component ()
 Destructor.
Componentoperator= (const Component &)=delete
 No copy assignment.
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

All Cosmo components derive from Component. A component exposes its capabilities through interfaces derived from IUnknown that are discovered via queryInterface().

Member Function Documentation

◆ init()

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

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
Parameters
featureIdThe feature ID to check.

◆ onInitialize()

virtual void onInitialize ( const IComponentDeclaration & decl)
protectedvirtual

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

Parameters
declThe instance declaration from the manifest.