![]() |
OpenNI 1.5.2
|
If our new node implementation supports any capabilities, it should both declare that and implement their interfaces.
Declaring the node implementation supported capabilities is done by implementing the xn::ModuleProductionNode::IsCapabilitySupported method. This method only declares if a certain capability is supported or not.
The actual implementation of the capability is done by implementing this capability interface. This implementation can be done in a different class, or in our node implementation class. In any case, our node implementation must implement the propert get method for this interface.
The following table summarizes all capabilities:
For example, let's say our hands generator supports the mirror capability as well as the error state capability. It implements error state in the same class and mirror in another one.
class MyHandsGeneratorMirror : public virtual xn::ModuleMirrorInterface { ... }; class MyHandGenerator: public virtual xn::ModuleHandsGenerator, public virtual xn::ModuleErrorStateInterface { public: ... virtual XnBool IsCapabilitySupported(const XnChar* strCapabilityName) { return ( strcmp(strCapabilityName, XN_CAPABILITY_MIRROR) == 0 || strcmp(strCapabilityName, XN_CAPABILITY_ERROR_STATE) == 0 ); } ... virtual ModuleErrorStateInterface* GetErrorStateInterface() { return this; } ... virtual ModuleMirrorInterface* GetMirrorInterface() { return &m_mirrorCap; } private: MyHandsGeneratorMirror m_mirrorCap; };