#include <Interface.h>
Inherited by AZ::Internal::IdHandler< Interface, Traits, ContainerType >, AZ::Internal::MultiHandler< Interface, Traits, ContainerType >, and AZ::Internal::NonIdHandler< Interface, Traits, ContainerType >.
template<typename T>
class AZ::Interface< T >
Interface class for accessing registered singletons across module boundaries. The raw interface pointer is handed to you; the assumption is that the registered system will outlive cached references. A system must register itself with the interface at initialization time by calling Register(); and unregister at shutdown by calling Unregister(). The provided Registrar class will do this for you automatically. Registration will only succeed after the AZ::Environment has been attached and is ready.
Example Usage:
class ISystem
{
public:
virtual ~ISystem();
virtual void DoSomething() = 0;
};
class System
{
public:
void DoSomething() override;
};
{
system->DoSomething();
}
Definition: Interface.h:62
◆ Get()
Returns the registered interface pointer, if it exists. This method is thread-safe in that you can call Get from multiple threads. Likewise, calls to Register / Unregister are guarded, but it is highly recommended to restrict Register / Unregister to a dedicated serial code path.
◆ Register()
Registers an instance pointer to the interface. Only one instance is allowed to register at a time.
◆ Unregister()
Unregisters from the interface. An unregister must occur in the same module as the original Register call; the pointer must match the original call to Register.
The documentation for this class was generated from the following file:
- Code/Framework/AzCore/AzCore/Interface/Interface.h