7#ifndef PXR_BASE_PLUG_STATIC_INTERFACE_H
8#define PXR_BASE_PLUG_STATIC_INTERFACE_H
13#include "pxr/base/plug/api.h"
19PXR_NAMESPACE_OPEN_SCOPE
22class Plug_StaticInterfaceBase {
27 bool IsInitialized()
const
34 void _LoadAndInstantiate(
const std::type_info& type)
const;
38 mutable std::atomic<bool> _initialized;
138template <
class Interface>
141 static_assert(std::is_abstract<Interface>::value,
142 "Interface type must be abstract.");
146 using Plug_StaticInterfaceBase::IsInitialized;
150 explicit operator bool()
const
152 return static_cast<bool>(_GetPtr());
178 Interface* _GetPtr()
const
181 _LoadAndInstantiate(
typeid(Interface));
186 return static_cast<Interface*
>(_ptr);
190PXR_NAMESPACE_CLOSE_SCOPE
Provides access to an interface into a plugin.
Interface * Get() const
Returns the interface pointer, loading the plugin if necessary.
Interface & operator*() const
Returns the interface pointer as a reference, loading the plugin if necessary.
Interface * operator->() const
Returns the interface pointer, loading the plugin if necessary.