OpenAssetIO
An abstract API for generalising interactions between a host application and an asset management system

The UIDelegateFactory is the primary mechanism for querying for available UI Delegate plugins and constructing instances of them. More...

#include <UIDelegateFactory.hpp>

Classes

struct  UIDelegateDetail
 Simple struct containing the default configuration details of a potential UI delegate implementation. More...
 

Public Types

using Ptr = UIDelegateFactoryPtr
 
using ConstPtr = UIDelegateFactoryConstPtr
 
using HostInterfacePtr = openassetio::hostApi::HostInterfacePtr
 
using UIDelegateDetails = std::unordered_map< Identifier, UIDelegateDetail >
 Mapping of UI delegate identifier to its configuration details. More...
 

Public Member Functions

Identifiers identifiers () const
 All identifiers known to the factory. More...
 
UIDelegateDetails availableUIDelegates () const
 Get the details for each available UI delegate as a map of UI delegate identifier to UI delegate details. More...
 
UIDelegatePtr createUIDelegate (const Identifier &identifier) const
 Create a UIDelegate instance for the UI delegate associated with the given identifier. More...
 
 ~UIDelegateFactory ()=default
 
 UIDelegateFactory (const UIDelegateFactory &other)=delete
 
 UIDelegateFactory (UIDelegateFactory &&other) noexcept=default
 
UIDelegateFactoryoperator= (const UIDelegateFactory &other)=delete
 
UIDelegateFactoryoperator= (UIDelegateFactory &&other) noexcept=default
 

Static Public Member Functions

static UIDelegateFactoryPtr make (HostInterfacePtr hostInterface, UIDelegateImplementationFactoryInterfacePtr uiDelegateImplementationFactory, log::LoggerInterfacePtr logger)
 Construct an instance of this class. More...
 
static UIDelegatePtr createUIDelegateForInterface (const Identifier &identifier, const HostInterfacePtr &hostInterface, const UIDelegateImplementationFactoryInterfacePtr &uiDelegateImplementationFactory, const log::LoggerInterfacePtr &logger)
 Create a UIDelegate instance for the UI delegate associated with the given identifier. More...
 
static UIDelegatePtr defaultUIDelegateForInterface (const HostInterfacePtr &hostInterface, const UIDelegateImplementationFactoryInterfacePtr &uiDelegateImplementationFactory, const log::LoggerInterfacePtr &logger)
 Creates the default UIDelegate as defined by the TOML configuration file referenced by the $OPENASSETIO_DEFAULT_CONFIG. More...
 
static UIDelegatePtr defaultUIDelegateForInterface (std::string_view configPath, const HostInterfacePtr &hostInterface, const UIDelegateImplementationFactoryInterfacePtr &uiDelegateImplementationFactory, const log::LoggerInterfacePtr &logger)
 Creates the default UIDelegate as defined by the given TOML configuration file. More...
 

Static Public Attributes

static const Str kDefaultUIDelegateConfigEnvVarName
 The name of the env var used to define the default UI delegate config TOML file. More...
 

Detailed Description

The UIDelegateFactory is the primary mechanism for querying for available UI Delegate plugins and constructing instances of them.

The underlying UI delegate implementation is constructed using the supplied UIDelegateImplementationFactoryInterface factory implementation.

Hosts should never attempt to directly construct a UIDelegate class or interact with the implementation factory directly.

Member Typedef Documentation

using HostInterfacePtr = openassetio::hostApi::HostInterfacePtr
using UIDelegateDetails = std::unordered_map<Identifier, UIDelegateDetail>

Mapping of UI delegate identifier to its configuration details.

Constructor & Destructor Documentation

~UIDelegateFactory ( )
default
UIDelegateFactory ( const UIDelegateFactory other)
delete
UIDelegateFactory ( UIDelegateFactory &&  other)
defaultnoexcept

Member Function Documentation

UIDelegateDetails availableUIDelegates ( ) const

Get the details for each available UI delegate as a map of UI delegate identifier to UI delegate details.

This provides the default settings that can be taken and mutated before being used in the initialization of a UIDelegate.

Additional UI delegate metadata is also included that may be useful. For example, this may be presented as part of a UI delegate picker widget.

See also
UIDelegateDetail
Returns
A UIDelegateDetail instance for each available UI delegate.
UIDelegatePtr createUIDelegate ( const Identifier identifier) const

Create a UIDelegate instance for the UI delegate associated with the given identifier.

The instance returned should then be used for all interaction with the UI delegate.

Parameters
identifierUnique UI delegate identifier.
Returns
Newly instantiated UI delegate.
static UIDelegatePtr createUIDelegateForInterface ( const Identifier identifier,
const HostInterfacePtr hostInterface,
const UIDelegateImplementationFactoryInterfacePtr uiDelegateImplementationFactory,
const log::LoggerInterfacePtr logger 
)
static

Create a UIDelegate instance for the UI delegate associated with the given identifier.

The instance returned should then be used for all interaction with the UI delegate.

Parameters
identifierUnique UI delegate identifier.
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the UI delegate to query asset-related properties from the host.
uiDelegateImplementationFactoryThe factory that will be used to instantiate the UI delegate. See, for example, PythonPluginSystemUIDelegateImplementationFactory.
loggerThe logger instance that will be used for all messaging from the factory and instantiated UIDelegate instances.
Returns
Newly instantiated UI delegate.
static UIDelegatePtr defaultUIDelegateForInterface ( const HostInterfacePtr hostInterface,
const UIDelegateImplementationFactoryInterfacePtr uiDelegateImplementationFactory,
const log::LoggerInterfacePtr logger 
)
static

Creates the default UIDelegate as defined by the TOML configuration file referenced by the $OPENASSETIO_DEFAULT_CONFIG.

Note
This is the same environment variable that is used in the ManagerFactory. This means that if the config file location is specified by environment variable, then the same config file will be used to identify and configure both the manager plugin and UI delegate plugin.
See also
Alternative direct signature for more details.
Parameters
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the UI delegate to query asset-related properties from the host.
uiDelegateImplementationFactoryThe factory that will be used to instantiate UI delegates.
loggerThe logger instance that will be used for all messaging from the instantiated UIDelegate instances.
Returns
A default-configured UI delegate if $OPENASSETIO_DEFAULT_CONFIG is set, otherwise a nullptr if the var was not set.
Exceptions
errors.InputValidationExceptionif there are errors if the config file does not exist at the path provided in the $OPENASSETIO_DEFAULT_CONFIG env var.
errors.ConfigurationExceptionif there are errors occur whilst loading the TOML file referenced by the $OPENASSETIO_DEFAULT_CONFIG env var.
static UIDelegatePtr defaultUIDelegateForInterface ( std::string_view  configPath,
const HostInterfacePtr hostInterface,
const UIDelegateImplementationFactoryInterfacePtr uiDelegateImplementationFactory,
const log::LoggerInterfacePtr logger 
)
static

Creates the default UIDelegate as defined by the given TOML configuration file.

This allows deployments to centralize OpenAssetIO manager and UI delegate settings, and for hosts to instantiate this UI delegate without the need for their own settings and persistence mechanism.

The referenced TOML file should have the following structure.

1 [manager]
2 identifier = "some.identifier"
3 
4 [ui.settings] # Optional
5 some_ui_setting = "value"

Any occurrences of ${config_dir} within TOML string values will be substituted with the absolute path to the directory containing the TOML file, before being passed on to the UI delegate settings.

Parameters
configPathPath to the TOML config file, compatible with std::ifstream::open. Relative paths resolve to a platform/environment-dependent location.
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the UI delegate to query asset-related properties from the host.
uiDelegateImplementationFactoryThe factory that will be used to instantiate UI delegates.
loggerThe logger instance that will be used for all messaging from the instantiated UIDelegate instances.
Returns
A default-configured UI delegate.
Exceptions
errors.InputValidationExceptionif there are errors if the config file does not exist at the path provided in configPath.
errors.ConfigurationExceptionif there are errors occur whilst loading the TOML file.
Identifiers identifiers ( ) const

All identifiers known to the factory.

Note
This may result in a significant amount of work being performed by the supplied UI delegate interface factory.
See also
UIDelegate::identifier
static UIDelegateFactoryPtr make ( HostInterfacePtr  hostInterface,
UIDelegateImplementationFactoryInterfacePtr  uiDelegateImplementationFactory,
log::LoggerInterfacePtr  logger 
)
static

Construct an instance of this class.

Parameters
hostInterfaceThe host's implementation of the HostInterface that uniquely identifies the host and provides common hooks for the UI delegate to query asset-related properties from the host.
uiDelegateImplementationFactoryThe factory that will be used to instantiate UI delegates. See, for example, PythonPluginSystemUIDelegateImplementationFactory.
loggerThe logger instance that will be used for all messaging from the factory and instantiated UIDelegate instances.
UIDelegateFactory& operator= ( const UIDelegateFactory other)
delete
UIDelegateFactory& operator= ( UIDelegateFactory &&  other)
defaultnoexcept

Member Data Documentation

const Str kDefaultUIDelegateConfigEnvVarName
static

The name of the env var used to define the default UI delegate config TOML file.

The value of this is $OPENASSETIO_DEFAULT_CONFIG - the same as is used in the ManagerFactory.

See also
defaultUIDelegateForInterface.
ManagerFactory.kDefaultManagerConfigEnvVarName

The documentation for this class was generated from the following file:
  • /src/src/openassetio-ui/include/openassetio/ui/hostApi/UIDelegateFactory.hpp