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")
Definition: objectbase.h:2632
Definition: string.h:1226
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2193
#define MAXON_COMPONENT_CLASS_REGISTER(C,...)
Definition: objectbase.h:2390
#define MAXON_METHOD
Definition: interfacebase.h:942
The maxon namespace contains all declarations of the MAXON API.
Definition: c4d_basedocument.h:16
A color consisting of three components R, G and B.
Definition: col.h:16
T r
Definition: col.h:32
T g
Definition: col.h:33
T b
Definition: col.h:34

Further Reading