WvStreams
|
Various utility functions, macros and templates. More...
#include <stddef.h>
#include <xplc/core.h>
#include <xplc/IWeakRef.h>
Go to the source code of this file.
Classes | |
struct | UUID_Info |
Utility structure used for the interface map. More... | |
struct | IObjectImplInternal |
Helper internal structure. More... | |
class | WeakRef |
Common implementation of a weak reference. More... | |
Macros | |
#define | UUID_MAP_BEGIN(component) const UUID_Info component::xplc_iobject_uuids[] = { |
Start the interface map for "component". | |
#define | UUID_MAP_ENTRY(iface) { &iface##_IID, reinterpret_cast<ptrdiff_t>(static_cast<iface*>(reinterpret_cast<ThisXPLCComponent*>(1))) - 1 }, |
Add an entry to an interface map. | |
#define | UUID_MAP_ENTRY_2(iface, iface2) { &iface##_IID, reinterpret_cast<ptrdiff_t>(static_cast<iface2*>(reinterpret_cast<ThisXPLCComponent*>(1))) - 1 }, |
Add an entry to an interface map for an ambiguous interface. | |
#define | UUID_MAP_END { 0, 0 } }; |
Marks the end of an interface map. | |
#define | xplcdelete delete |
Internal macro. | |
#define | IMPLEMENT_IOBJECT(component) |
Helper macro to implement the IObject methods automatically. | |
Functions | |
template<class Interface > | |
Interface * | get (IObject *aObj) |
XPLC equivalent to dynamic_cast. | |
template<class Interface > | |
Interface * | mutate (IObject *aObj) |
A version of get() that releases its parameter. | |
Various utility functions, macros and templates.
Definition in file include/xplc/utils.h.
#define UUID_MAP_BEGIN | ( | component | ) | const UUID_Info component::xplc_iobject_uuids[] = { |
Start the interface map for "component".
Definition at line 63 of file include/xplc/utils.h.
#define UUID_MAP_ENTRY | ( | iface | ) | { &iface##_IID, reinterpret_cast<ptrdiff_t>(static_cast<iface*>(reinterpret_cast<ThisXPLCComponent*>(1))) - 1 }, |
Add an entry to an interface map.
Definition at line 68 of file include/xplc/utils.h.
#define UUID_MAP_ENTRY_2 | ( | iface, | |
iface2 | |||
) | { &iface##_IID, reinterpret_cast<ptrdiff_t>(static_cast<iface2*>(reinterpret_cast<ThisXPLCComponent*>(1))) - 1 }, |
Add an entry to an interface map for an ambiguous interface.
The second parameter is the interface that should be used to disambiguate.
Definition at line 75 of file include/xplc/utils.h.
#define UUID_MAP_END { 0, 0 } }; |
Marks the end of an interface map.
Definition at line 80 of file include/xplc/utils.h.
#define xplcdelete delete |
Internal macro.
This macro is needed to cooperate correctly with the "delete detector".
Definition at line 112 of file include/xplc/utils.h.
#define IMPLEMENT_IOBJECT | ( | component | ) |
Helper macro to implement the IObject methods automatically.
Put this at the beginning of your class, specifiying the class name as the parameter, and it will automatically implement all the IObject methods. You also need to define an interface map.
Definition at line 123 of file include/xplc/utils.h.
Interface * get | ( | IObject * | aObj | ) |
XPLC equivalent to dynamic_cast.
This templated function is a typesafe way to call the getInterface method of a component and cast it properly. If the component does not support the interface, a NULL pointer will be returned.
Definition at line 184 of file include/xplc/utils.h.
References IObject::getInterface().
Interface * mutate | ( | IObject * | aObj | ) |
A version of get() that releases its parameter.
This templated function is very similar to the "get" one, except that it automatically releases the inbound reference, without regard whether the getInterface actually yielded something.
Definition at line 198 of file include/xplc/utils.h.
References IObject::getInterface(), and IObject::release().