The functionality presented by an interface is used by creating an instance of the reference class. The definition of that reference class is created automatically based on the interface class by the Source Processor and is stored in the automatically generated .hxx files.
A reference object gives access to a component or just contains a maxon::NullValue. Reference objects are typically reference counted (depending on the Reference Type).
A simple interface can be defined like this:
There are multiple ways to create a reference object. One way is to access the component class of the desired implementation. This component class is identified with a maxon::Id.
The direct way to obtain the component class is to get it from the global registry maxon::Classes with maxon::Classes::Get().
Alternatively a reference object can be created from an implementation that is exposed as a published object with MAXON_DECLARATION. See also Published Objects.
It is also possible to obtain components from a registry. See Registry Usage.
Component classes are based on maxon::ClassInterface. This base class provides basic functionality to create instances.
Functions for instance creation (behaviour depends on the Reference Types):
Information on the component class can be obtained with:
The components of the class are accessed with these functions. It is typically not needed to use these functions:
Most interfaces (and objects) are based on the maxon::ObjectInterface interface. For details see Object Interface.