Registry Registration

About

A component (interface implementation) can be added to a registry. The component is typically registered along its implementation (see Interface Implementation).

Registration

A given component can be registered at a registry using the MAXON_COMPONENT_CLASS_REGISTER macro. It is used to add the component to the registry and to define its ID:

// This example implements the given interface, registers
// the component and adds it to the given registry.
// implementation
class ColorRedImpl : public maxon::Component<ColorRedImpl, ColorInterface>
{
public:
MAXON_METHOD maxon::String GetName() const
{
return "Red"_s;
}
{
color.r = 1.0;
color.g = 0.0;
color.b = 0.0;
return color;
}
};
using namespace maxon;
// register component class and add it to registry "ColorClasses"
MAXON_COMPONENT_CLASS_REGISTER(ColorRedImpl, ColorClasses, "net.maxonexample.class.colors.red")

Further Reading

maxon::ComponentWithBase
Definition: objectbase.h:2604
maxon::Col3::g
T g
Definition: col.h:33
maxon
The maxon namespace contains all declarations of the MAXON API.
Definition: c4d_basedocument.h:15
MAXON_COMPONENT
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2166
maxon::String
Definition: string.h:1213
MAXON_COMPONENT_CLASS_REGISTER
#define MAXON_COMPONENT_CLASS_REGISTER(C,...)
Definition: objectbase.h:2363
MAXON_METHOD
#define MAXON_METHOD
Definition: interfacebase.h:877
maxon::Col3::b
T b
Definition: col.h:34
maxon::Col3
A color consisting of three components R, G and B.
Definition: col.h:14
maxon::Col3::r
T r
Definition: col.h:32