RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rtctk::componentFramework::RepositoryFactory< BaseIf, Adapter > Class Template Reference

A base class for factories that create instances of repository adapters from URIs. More...

#include <repositoryFactory.hpp>

Inheritance diagram for rtctk::componentFramework::RepositoryFactory< BaseIf, Adapter >:
rtctk::componentFramework::FactoryRegistry< BaseIf >::FactoryIf

Public Member Functions

 RepositoryFactory ()=default
 
 ~RepositoryFactory () override=default
 
bool CanHandle (const elt::mal::Uri &uri) const override
 Check if this repository factory is compatible with the given URI.
 
std::unique_ptr< BaseIfCreateInstance (const elt::mal::Uri &uri) const override
 Create a new adapter instance to access the repository specified by the given URI.
 
- Public Member Functions inherited from rtctk::componentFramework::FactoryRegistry< BaseIf >::FactoryIf
 FactoryIf ()=default
 
virtual ~FactoryIf ()=default
 
virtual bool CanHandle (const AdapterIdType &id) const =0
 Check if this factory is compatible with the given service identifier.
 
virtual std::unique_ptr< BaseIfCreateInstance (const AdapterIdType &id) const =0
 Create a new adapter instance to access the service specified by the given identifier.
 

Additional Inherited Members

- Public Types inherited from rtctk::componentFramework::FactoryRegistry< BaseIf >::FactoryIf
using AdapterIdType = typename BaseIf::AdapterIdType
 

Detailed Description

template<class BaseIf, class Adapter>
class rtctk::componentFramework::RepositoryFactory< BaseIf, Adapter >

A base class for factories that create instances of repository adapters from URIs.

This template class imposes the restriction that BaseIf has a type declaration for AdapterIdType that is equivalent to elt::mal::Uri. For example:

class MyBaseIf {
public:
using AdapterIdType = elt::mal::Uri;
...
};
typename BaseIf::AdapterIdType AdapterIdType
Definition factoryRegistry.hpp:59
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23

In addition, the Adapter class must declare the static class string member SUPPORTED_URI_SCHEME, which defines the URI scheme that the Adapter supports. For example:

class MyAdapter : public MyBaseIf {
public:
inline static const std::string SUPPORTED_URI_SCHEME = "http";
...
}
Template Parameters
BaseIfThe abstract/base interface class for which this factory creates service adapter instances.
AdapterThe new instances will be created using the Adapter class.

Constructor & Destructor Documentation

◆ RepositoryFactory()

template<class BaseIf , class Adapter >
rtctk::componentFramework::RepositoryFactory< BaseIf, Adapter >::RepositoryFactory ( )
default

◆ ~RepositoryFactory()

Member Function Documentation

◆ CanHandle()

template<class BaseIf , class Adapter >
bool rtctk::componentFramework::RepositoryFactory< BaseIf, Adapter >::CanHandle ( const elt::mal::Uri & uri) const
override

Check if this repository factory is compatible with the given URI.

Parameters
[in]uriThe URI to check for compatibility.
Returns
true if the factory supports the URI and false otherwise.
Thread Safety
thread-safe

◆ CreateInstance()

template<class BaseIf , class Adapter >
std::unique_ptr< BaseIf > rtctk::componentFramework::RepositoryFactory< BaseIf, Adapter >::CreateInstance ( const elt::mal::Uri & uri) const
override

Create a new adapter instance to access the repository specified by the given URI.

Parameters
[in]uriThe URI to the repository.
Returns
A unique pointer holding the instance to the adapter used to access the repository.
Exceptions
RtctkExceptionAn exception deriving from RtctkException, and possibly nested, will be thrown if this method failed to create a new instance.
Thread Safety
thread-safe

The documentation for this class was generated from the following files: