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:2655
Definition: string.h:1237
#define MAXON_COMPONENT(KIND,...)
Definition: objectbase.h:2212
#define MAXON_COMPONENT_CLASS_REGISTER(C,...)
Definition: objectbase.h:2410
#define MAXON_METHOD
Definition: interfacebase.h:1012
The maxon namespace contains all declarations of the MAXON API.
Definition: autoweight.h:14
A color consisting of three components R, G and B.
Definition: col.h:16
T r
Definition: col.h:34
T g
Definition: col.h:35
T b
Definition: col.h:36

Further Reading