Registry Declaration

Table of Contents


A registry is used to share implementations of a certain interface. The declaration of the registry is typically found in the same header file that defines the interface.


The declaration of a registry is placed between the two .hxx files generated for the given header file. The registry is defined using the MAXON_REGISTRY attribute. It defines:

  • The type of the exposed object. This is typically a maxon::Class referencing the interface using the reference class.
  • The class name of the registry. A static class with that name is used to access the registry.
  • The ID of the registry.
// This example shows a simple interface. Additionally a registry
// is declared that will give access to implementations of this interface.
// ---------------------------------------------------------------------
// Simple class to store a color.
// ---------------------------------------------------------------------
class ColorInterface : MAXON_INTERFACE_BASES(maxon::ObjectInterface)
MAXON_INTERFACE(ColorInterface, MAXON_REFERENCE_NORMAL, "net.maxonexample.interface.color");
// ---------------------------------------------------------------------
// Returns the name of the color.
// ---------------------------------------------------------------------
MAXON_METHOD maxon::String GetName() const;
// ---------------------------------------------------------------------
// Returns the RGB value of the color.
// ---------------------------------------------------------------------
MAXON_METHOD maxon::Color32 GetRGB() const;
#include "example_registry1.hxx"
// Define registry "ColorClasses" to give access to implementations of the ColorInterface interface
MAXON_REGISTRY(maxon::Class<ColorRef>, ColorClasses, "net.maxonexample.registry.colors");
#include "example_registry2.hxx"
Definition: objectbase.h:699
Definition: string.h:1226
#define MAXON_REGISTRY(T, Name, id)
Definition: registrybase.h:384
Definition: interfacebase.h:1090
Definition: objectbase.h:1125
Definition: interfacebase.h:942
Definition: objectbase.h:1054
A color consisting of three components R, G and B.
Definition: col.h:16

Further Reading