Fusion:Object
From DirectFBWiki
Objects are implemented on top of fusion reactors and reference counters.
Your object structure must have a FusionObject structure as its first member (which is typically called object), like this:
struct _MyObject
{
FusionObject object;
/* your object-specific data here */
}
typedef struct _MyOject MyObject;
By putting FUSION_OBJECT_METHODS macro in your header, you get a bunch of inline functions for your object. You tell it the type name of your object structure and also a prefix (e.g. “my_object”) that will be prepended to all the function names. The functions declared are:
| function | description |
|---|---|
| my_object_attach | attach to the object reactor |
| my_object_detach | detach from the object reactor |
| my_object_attach_global | global attach to the object reactor |
| my_object_detach_global | global detach from the object reactor |
| my_object_dispatch | dispatch via the object reactor |
| my_object_ref | add a local reference to the object |
| my_object_unref | remove a local reference from the object |
| my_object_link | add a global reference and store the object pointer (usually in another object) |
| my_object_unlink | remove the object link and the global reference that was added for it |
| my_object_globalize | add a global reference and remove a local one, i.e. detach the object from the fusionee |
TODO: Describe how to implement and use objects...
