BLT_Module Interface

Interface implemented by objects that create other objects. More...

Data Structures

struct  BLT_ModuleInfo
 Information about a module. More...
struct  BLT_BaseModule
 Base implementation of the BLT_Module interface that other implementation of that interface can inherit from. More...

Defines

#define BLT_MODULE_PROBE_MATCH_DEFAULT   0
#define BLT_MODULE_PROBE_MATCH_MIN   1
#define BLT_MODULE_PROBE_MATCH_LOW   64
#define BLT_MODULE_PROBE_MATCH_MEDIUM   128
#define BLT_MODULE_PROBE_MATCH_HIGH   192
#define BLT_MODULE_PROBE_MATCH_MAX   253
#define BLT_MODULE_PROBE_MATCH_EXACT   254
#define BLT_MODULE_PROBE_MATCH_FORCE   255
#define BLT_ERROR_NO_MATCHING_MODULE   (BLT_ERROR_BASE_MODULE - 0)
#define BLT_Module_GetInfo(object, info)   ATX_INTERFACE(object)->GetInfo(object, info)
#define BLT_Module_Attach(object, core)   ATX_INTERFACE(object)->Attach(object, core)
#define BLT_Module_CreateInstance(object, core, parameters_type, parameters, interface_id, new_object)
#define BLT_Module_Probe(object, core, type, query, match)   ATX_INTERFACE(object)->Probe(object, core, type, query, match)
#define BLT_MODULE_IMPLEMENT_SIMPLE_CONSTRUCTOR(_module_class,_module_name,_module_flags)

Typedefs

typedef unsigned char BLT_ModuleId [16]
 Module identifier.

Enumerations

enum  BLT_ModuleParametersType { BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR }
 Type identifiers for the parameters argument of the Probe method of the BLT_Module interface. More...

Functions

BLT_Result BLT_BaseModule_Construct (BLT_BaseModule *self, BLT_CString name, BLT_ModuleId id, BLT_Flags flags)
BLT_Result BLT_BaseModule_Destruct (BLT_BaseModule *self)
BLT_Result BLT_BaseModule_Create (BLT_CString name, BLT_ModuleId id, BLT_Flags flags, const BLT_ModuleInterface *module_interface, const ATX_ReferenceableInterface *referenceable_interface, BLT_Module **object)
BLT_Result BLT_BaseModule_Destroy (BLT_BaseModule *self)
BLT_DIRECT_METHOD BLT_BaseModule_GetInfo (BLT_Module *self, BLT_ModuleInfo *info)
BLT_DIRECT_METHOD BLT_BaseModule_Attach (BLT_Module *self, BLT_Core *core)

Variables

BLT_Result(* GetInfo )(BLT_Module *self, BLT_ModuleInfo *info)
 Get the module's info.
BLT_Result(* Attach )(BLT_Module *self, BLT_Core *core)
 Attach the module to a BLT_Core object.
BLT_Result(* CreateInstance )(BLT_Module *self, BLT_Core *core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, const ATX_InterfaceId *interface_id, ATX_Object **object)
 Create an instance of the module that implements a given interface.
BLT_Result(* Probe )(BLT_Module *self, BLT_Core *core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, BLT_Cardinal *match)
 Probe the module to know if it is able to create an oject instance that can handle a certain task.

Detailed Description

Interface implemented by objects that create other objects.

A Module object is responsible for creating object instance of a certain class. Module objects implement the BLT_Module interface, and clients that want to create instances of that module will call the CreateObject method.


Define Documentation

#define BLT_Module_CreateInstance ( object,
core,
parameters_type,
parameters,
interface_id,
new_object   ) 

Value:

ATX_INTERFACE(object)->CreateInstance(object,               \
                                      core,                 \
                                      parameters_type,      \
                                      parameters,           \
                                      interface_id,         \
                                      new_object)

#define BLT_MODULE_IMPLEMENT_SIMPLE_CONSTRUCTOR ( _module_class,
_module_name,
_module_flags   ) 

Value:

static BLT_Result                                                   \
_module_class##_Create(BLT_Module** object)                         \
{                                                                   \
    _module_class* module;                                          \
                                                                    \
    /* allocate memory for the object */                            \
    module = (_module_class*)                                       \
        ATX_AllocateZeroMemory(sizeof(_module_class));              \
                                                                    \
    /* construct the inherited object */                            \
    BLT_BaseModule_Construct(&ATX_BASE(module, BLT_BaseModule),     \
                             _module_name,                          \
                             NULL,                                  \
                             _module_flags);                        \
                                                                    \
    /* setup interfaces */                                          \
    ATX_SET_INTERFACE_EX(module, _module_class,                     \
                        BLT_BaseModule, BLT_Module);                \
    ATX_SET_INTERFACE_EX(module, _module_class,                     \
                         BLT_BaseModule, ATX_Referenceable);        \
    *object = &ATX_BASE_EX(module, BLT_BaseModule, BLT_Module);     \
    return BLT_SUCCESS;                                             \
}


Enumeration Type Documentation

enum BLT_ModuleParametersType

Type identifiers for the parameters argument of the Probe method of the BLT_Module interface.

Enumerator:
BLT_MODULE_PARAMETERS_TYPE_MEDIA_NODE_CONSTRUCTOR  The parameters pointer points to a BLT_MediaNodeConstructor.


Variable Documentation

BLT_Result(* Attach)(BLT_Module *self, BLT_Core *core)

Attach the module to a BLT_Core object.

The BLT_Core object reprents the context in which the module is running. This allows the module, amongst other things, to access the core's registry.

Parameters:
self Pointer to the BLT_Module object on which the method is called
core Pointer the BLT_Core object to which this module is being attached.

BLT_Result(* CreateInstance)(BLT_Module *self, BLT_Core *core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, const ATX_InterfaceId *interface_id, ATX_Object **object)

Create an instance of the module that implements a given interface.

Parameters:
self Pointer to the BLT_Module object on which the method is called
parameters Generic parameters used for constructing the object
interface_id Interface ID that the object needs to implement
object address of an object reference where the created object will be returned if the call succeeds.

BLT_Result(* GetInfo)(BLT_Module *self, BLT_ModuleInfo *info)

Get the module's info.

Parameters:
self Pointer to the BLT_Module object on which the method is called
info Pointer to a BLT_ModuleInfo structure in which the module's info will be returned.

BLT_Result(* Probe)(BLT_Module *self, BLT_Core *core, BLT_ModuleParametersType parameters_type, BLT_AnyConst parameters, BLT_Cardinal *match)

Probe the module to know if it is able to create an oject instance that can handle a certain task.

Parameters:
self Pointer to the BLT_Module object on which the method is called
core Pointer to the BLT_Core object that represents the core context for the call.
parameters_type Type identifier that indicates which specific structure the parameters point to.
parameters Pointer to a parameters structure. The type of the structure pointed to is indicated by the parameters_type parameter. The type of parameters passed to this method indicates what type of query is being made and what the query parameters are.