RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
repositoryFactory.ipp
Go to the documentation of this file.
1
11
12// Note this is a template implementation file and should not be included directly.
13// The typical header protection macro is not added to avoid it showing up in Doxygen API
14// documentation.
15#pragma once
16
18
20
21template <class BaseIf, class Adapter>
22bool RepositoryFactory<BaseIf, Adapter>::CanHandle(const elt::mal::Uri& uri) const {
24 "The BaseIf class must define the type AdapterIdType.");
25 static_assert(std::is_same_v<typename BaseIf::AdapterIdType, elt::mal::Uri>,
26 "BaseIf::AdapterIdType must be defined to be elt::mal::Uri.");
28 "The Adapter class must implement the static class attribute "
29 "SUPPORTED_URI_SCHEME, which should be a string.");
30
31 return uri.scheme().compare(Adapter::SUPPORTED_URI_SCHEME) == 0;
32}
33
34template <class BaseIf, class Adapter>
35std::unique_ptr<BaseIf>
37 return std::make_unique<Adapter>(uri);
38}
39
40} // namespace rtctk::componentFramework
bool CanHandle(const elt::mal::Uri &uri) const override
Check if this repository factory is compatible with the given URI.
Definition repositoryFactory.ipp:22
std::unique_ptr< BaseIf > CreateInstance(const elt::mal::Uri &uri) const override
Create a new adapter instance to access the repository specified by the given URI.
Definition repositoryFactory.ipp:36
constexpr bool IS_ADAPTER_ID_TYPE_DEFINED
Is true if the class contains the type declaration for AdapterIdType.
Definition typeTraits.hpp:266
constexpr bool IS_SUPPORTED_URI_SCHEME_DEFINED
Is true if the class contains the member SUPPORTED_URI_SCHEME.
Definition typeTraits.hpp:238
Definition commandReplier.cpp:21
Provides useful mechanisms to test various type traits.