7#ifndef PXR_BASE_PLUG_INTERFACE_FACTORY_H
8#define PXR_BASE_PLUG_INTERFACE_FACTORY_H
13#include "pxr/base/tf/type.h"
15PXR_NAMESPACE_OPEN_SCOPE
18class Plug_InterfaceFactory {
22 virtual void* New() = 0;
25 template <
class Interface,
class Implementation>
26 struct SingletonFactory :
public Base {
30 static_assert(std::is_abstract<Interface>::value,
31 "Interface type must be abstract.");
32 static Implementation impl;
33 return static_cast<Interface*
>(&impl);
50#define PLUG_REGISTER_INTERFACE_SINGLETON_TYPE(Interface, Implementation) \
51TF_REGISTRY_FUNCTION(TfType) \
53 TfType::Define<Interface>() \
54 .SetFactory<Plug_InterfaceFactory::SingletonFactory< \
55 Interface, Implementation> >(); \
58PXR_NAMESPACE_CLOSE_SCOPE
Base class of all factory types.