mx::Framework Class Reference
[Component Framework Plugin Manager]

Central component manager for the MxSDK. More...

#include <Framework.h>

Inheritance diagram for mx::Framework:

mxmObject List of all members.

Public Member Functions

 Framework (mxmList *statically_linked_components=0)
 Plugin manager constructor.
int numComponents ()
 Returns the number of installed components.
mxm::smart< mxmStringListenumerateComponents ()
 Returns the ids of the installed components.

Static Public Member Functions

static Frameworkframework ()
 Retrieves the framework instance.
static mx::EErrorCode getComponentInterface (const ComponentDescriptor &cd, mxm::smart< mx::IComponent > &spInterface)
 Returns a smart handle for a component satisfying the requested constraints.
static mx::EErrorCode getComponentInterface (const char *InterfaceId, mxm::smart< mx::IComponent > &spInterface, const mxmStringList &Capabilities)
 Convenience version.
static mx::EErrorCode getComponentInterface (const char *InterfaceId, mxm::smart< mx::IComponent > &spInterface, const mxmString &Capability="")
 Convenience version.
static mxm::smart< IComponentgetComponent (const ComponentDescriptor &cd)
 Returns smart handle for arbitrary type of component, but throws terminal exception in case of failure.
static mxm::smart< IComponentgetComponent (const mxmString &interface_id, const mxmStringList &interface_capabilities)
 Convenience version.
static mxm::smart< IComponentgetComponent (const mxmString &interface_id, const mxmString &interface_capability="")
 Convenience version.
static IComponentnewComponentInstance (const ComponentDescriptor &cd, mxm::flags selection_flags=0)
 Instantiates a multiple-instance type of component with semantics comparable to operator new(): returns dump pointer and throws terminal exception in case of failure.
static IComponentnewComponentInstance (const mxmString &interface_id, const mxmStringList &interface_capabilities, mxm::flags selection_flags=0)
 Convenience version.
static IComponentnewComponentInstance (const mxmString &interface_id, const mxmString &interface_capability="", mxm::flags selection_flags=0)
 Convenience version.

Static Public Attributes

static const mxm::flags HarmlessSelectionFailures = 1
 Selection flag.
static const char * IdHintKey = "_id"
static const char * ObsoletesHintKey = "_obsoletes"

Private Member Functions

int bindComponentPacks ()
 Dynamically loads all present component packs into the address space.
int useStaticallyLinkedComponents (mxmList *statically_linked_components)
 Installs components bootstrapped by the application context.
bool loadSharedLibrary (const mxmString &filename)
 Helper method doing the actual dynamic loading of component pack libraries.
mx::EErrorCode provideComponent (const ComponentDescriptor &cd, mxm::smart< mx::IComponent > &spInterface, bool &instantiated_new)
 Component selection (and possibly instantiation) algorithm.

Private Attributes

mxmList LoadedComponentPacks
mxmList ComponentList
void * StableABIDataExtension

Static Private Attributes

static Frameworks_pFramework = 0

Classes

class  ComponentDescriptor
 Holds meta-information describing a component type. More...
class  ComponentEntry
class  ComponentPackEntry

Detailed Description

Central component manager for the MxSDK.

Supports plugin and self-registration of components.

Warning:
Does not yet support multi-threading.
Author:
[agu] Alexander Gugau

[khe] Kai Hergenroether


Constructor & Destructor Documentation

mx::Framework::Framework mxmList statically_linked_components = 0  ) 
 

Plugin manager constructor.

The framwork scans the SDK's plugin folder for installed component packs and attempts to load what it finds. Unless you specify a list of statically linked components bootstrapped earlier - as for example via mxpeg_sdk::createStaticallyLinkedComponents() in simple MxPEG SDK scenarios (the MxPEG SDK is the subset of the MxSDK that is released to the general public under the BSD License in order to provide low level MxPEG decoding for integration purposes).

If dynamically_linked_components is given, the framework assumes ownership over the whole datastructure.


Member Function Documentation

int mx::Framework::bindComponentPacks  )  [private]
 

Dynamically loads all present component packs into the address space.

Returns:
The number of components installed from plugins. Note that this number can be greater than the number of component packs (plugins, shared objects, dynamic libraries) that have been bound, for component packs can contain multiple components / component invokers.

mxm::smart< mxmStringList > mx::Framework::enumerateComponents  ) 
 

Returns the ids of the installed components.

If less ids are returned than components are reported to be installed by numComponents(), that means some of the installed components are anonymous - exactly as many as the observed difference.

mx::EErrorCode mx::Framework::getComponentInterface const ComponentDescriptor cd,
mxm::smart< mx::IComponent > &  spInterface
[static]
 

Returns a smart handle for a component satisfying the requested constraints.

If the desired interface is implemented by a singleton component, a handle to the singleton is returned. If, on the other hand, there is a component generator for the desired interface, a new component object is created and a handle to it is returned.

Note:
[khe] I consider the name getComponentInterface() misleading, for this is the method an application context uses to obtain a component, or even to create a new component instance. The fact that the return value is typed as interface is an implementational detail.
Parameters:
cd Component description, allowing to specify multiple required interfaces together with their required capability modifiers.
spInterface smart pointer to the interface if successful, null-handle otherwise
Returns:
If successful, eOK is returned, see file mx_error_codes.h for other possible values. Otherwise, spInterface is set to a null handle and an appropriate error code is returned.

mx::IComponent * mx::Framework::newComponentInstance const ComponentDescriptor cd,
mxm::flags  selection_flags = 0
[static]
 

Instantiates a multiple-instance type of component with semantics comparable to operator new(): returns dump pointer and throws terminal exception in case of failure.

You need to use this dumb pointer method version in case you handle component ownership yourself. For example this applies to components that are Qt widgets as these will most likely be linked in as children of other widgets that then assume ownership. Get this right or you will crash!

Parameters:
selection_flags Specify HarmlessSelectionFailures in case you don't want failures to look up the requested component to be terminal, but to return 0 instead.

int mx::Framework::useStaticallyLinkedComponents mxmList statically_linked_components  )  [private]
 

Installs components bootstrapped by the application context.

Usable components get installed, the rest including the mxmList object is discarded.

Returns:
The number of components installed from the specified list of application-context-provided components.


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 17:21:06 2007 for MxPEG SDK by  doxygen 1.4.6