Registry Declaration

内容表

关于

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. // --------------------------------------------------------------------- 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"

延伸阅读

MAXON_REGISTRY
#define MAXON_REGISTRY(T, Name, id)
定义: registrybase.h:384
maxon::Class
定义: objectbase.h:681
MAXON_INTERFACE_BASES
#define MAXON_INTERFACE_BASES(...)
定义: objectbase.h:977
maxon::String
定义: string.h:1197
MAXON_METHOD
#define MAXON_METHOD
定义: interfacebase.h:855
MAXON_INTERFACE
#define MAXON_INTERFACE(Name, REFKIND, ID)
定义: objectbase.h:1048
MAXON_REFERENCE_NORMAL
#define MAXON_REFERENCE_NORMAL(DUMMY)
定义: interfacebase.h:957
maxon::Col3
A color consisting of three components R, G and B.
定义: col.h:14

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1