Registry Declaration

Table of Contents

About

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.

Declaration

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");
public:
// ---------------------------------------------------------------------
// Returns the name of the color.
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Returns the RGB value of the color.
// ---------------------------------------------------------------------
};
#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"
[extensionpoint_basic_interface]
Definition: example_registry.h:16
MAXON_METHOD maxon::Color32 GetRGB() const
MAXON_METHOD maxon::String GetName() const
MAXON_INTERFACE(ColorInterface, MAXON_REFERENCE_NORMAL, "net.maxonexample.interface.color")
Definition: objectbase.h:696
Definition: string.h:1237
#define MAXON_REGISTRY(T, Name, id)
Definition: registrybase.h:381
#define MAXON_REFERENCE_NORMAL(FREEIMPL)
Definition: interfacebase.h:1184
#define MAXON_METHOD
Definition: interfacebase.h:1012
#define MAXON_INTERFACE_BASES(...)
Definition: objectbase.h:1049
A color consisting of three components R, G and B.
Definition: col.h:16

Further Reading