ApparatusFramework::Registrator Class Reference
[Pattern Services]

#include <PatternServices/current/include/Registrator.h>

List of all members.

Public Member Functions

 Registrator (ComponentCreateFp createFunction, void *argument=0)

Detailed Description

A tiny helper class to register a component with the startup handler. Makes components available by just linking the corresponding object file. To use this, make a static instance of this class, like in the following example:

Registrator MyRegistrator(MyComponent::Create);

MyComponent::Create must be a static function that creates an instance of your component. Optionally you can specify an void* argument that will be passed to your Create function. This can be useful to create multiple instances of your component.

Although this class has been tested on multiple targets, it is not guaranteed to work. Proper operation depends on the fact that static memory is filled with 0 before the constructors of static objects are called (such that the memory of the startup handler is ready before any component is registered). This seems to be the fact with most compilers, but it is not required by any standard.

Definition at line 73 of file Registrator.h.

Constructor & Destructor Documentation

ApparatusFramework::Registrator::Registrator ( ComponentCreateFp  createFunction,
void *  argument = 0 

Construction, Destruction Constructor, registers the specified create function with the startup handler.

createFunction Pointer to a function creating an instance of your component and returning a pointer to a StartupIf. Please refer also to Startup.h.
argument Optional argument that will be passed to your create function.
© 2004-2010 bbv Software Services AG / Apparatus Services