Main Class Reference

#include <Pt/Cosmo/Main.h>

Main component. More...

Inherits Component.

Public Member Functions

 Main (int &argc, char **argv, ComponentManager &cm)
 Constructs the main component. More...
 
virtual ~Main ()
 Destructor.
 
void run ()
 Launches the application. More...
 
void init (const IComponentType *type, const IComponentDeclaration *decl)
 Initializes the component. More...
 
bool hasFeatureId (const char *featureId) const
 Returns true if the given feature ID is implemented. More...
 
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. More...
 

Detailed Description

Entry point for a Cosmo-based application. Ties together the ComponentManager, plugin loading, and the application main loop driven by an ILauncher component.

Constructor & Destructor Documentation

◆ Main()

Main ( int &  argc,
char **  argv,
ComponentManager cm 
)
Parameters
argcReference to the argument count.
argvThe argument array.
cmThe component manager to use.

Member Function Documentation

◆ run()

void run ( )

Loads all registered components and invokes the ILauncher.

◆ 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.