|
RTC Toolkit 6.0.0
|
Implementation of the OLDB Adapter. More...
#include <rtctk/componentFramework/oldbAdapter.hpp>
Classes | |
| struct | MethodsRecord |
| Structure of method pointers to methods that implement certain OLDB operations for a specific datapoint type. More... | |
| struct | SubscriptionEntry |
Public Member Functions | |
| OldbAdapter ()=delete | |
| Do not allow construction with no arguments. | |
| OldbAdapter (const OldbAdapter &)=delete | |
| This class cannot be copy constructed. | |
| OldbAdapter & | operator= (const OldbAdapter &)=delete |
| This class cannot be copy assigned. | |
| OldbAdapter (OldbAdapter &&)=delete | |
| Objects of this class can not be moved because we have a mutex. | |
| OldbAdapter & | operator= (OldbAdapter &&)=delete |
| OldbAdapter (const elt::mal::Uri &baseuri) | |
| Constructs an adapter for the CII OLDB service with the default OLDB client instance. | |
| OldbAdapter (const elt::mal::Uri &baseuri, const std::shared_ptr< elt::oldb::CiiOldb > &oldb) | |
| Constructs an adapter for the OLDB service with a specific OLDB client instance. | |
| ~OldbAdapter () override=default | |
| Destroys the adapter for the OLDB service releasing allocated resources. | |
| elt::mal::Uri | GetUri () const override |
| Get the URI used when creating this adapter object. | |
| template<typename CiiType> | |
| auto | GetOldbTypedDataPoint (auto &request) |
| template<typename T> | |
| Lut::TableEntries | BindRequestHandlers () |
Public Member Functions inherited from rtctk::componentFramework::OldbIf | |
| ~OldbIf () override=default | |
Public Member Functions inherited from rtctk::componentFramework::RepositorySubscriberIf | |
| RepositorySubscriberIf ()=default | |
| template<typename T = void, typename F> | |
| Subscription | Subscribe (const DataPointPath &path, const F &cb_value, const ErrorCallbackType &cb_error) const |
| Subscribes to datapoint values change events by registering callbacks. | |
| Subscription | Subscribe (const CallbackType &cb_created, const CallbackType &cb_deleted, const ErrorCallbackType &cb_error) const |
| Subscribes to datapoint creation and deletion events by registering callbacks. | |
Public Member Functions inherited from rtctk::componentFramework::RepositoryIf | |
| RepositoryIf ()=default | |
| virtual | ~RepositoryIf ()=default |
| BatchResponse | SendRequest (const BatchRequest &request) |
| BatchResponse | SendRequest (const BatchRequest &request) const |
| template<typename T> | |
| void | CreateDataPoint (const DataPointPath &path) |
| Creates a new empty datapoint in the repository. | |
| template<typename T> | |
| void | CreateDataPoint (const DataPointPath &path, const T &initial_value) |
| Creates a new datapoint in the repository with an initial value. | |
| void | CreateDataPoint (const DataPointPath &path, const char *initial_value) |
| void | DeleteDataPoint (const DataPointPath &path, bool recurse=false) |
| Deletes a datapoint. | |
| const std::type_info & | GetDataPointType (const DataPointPath &path) const |
| Fetches the type of the datapoint. | |
| size_t | GetDataPointSize (const DataPointPath &path) const |
| Fetches the size of the datapoint's data. | |
| RtcVectorUInt64 | GetDataPointShape (const DataPointPath &path) const |
| Fetches the shape of the datapoint's data. | |
| bool | DataPointExists (const DataPointPath &path) const |
| Checks for the existence of a datapoint in the repository. | |
| std::pair< PathList, PathList > | GetChildren (const DataPointPath &path, bool recurse=false) const |
| Queries the child datapoints and paths for a given parent path. | |
| template<typename T> | |
| T | GetDataPoint (const DataPointPath &path) const |
| Fetches a datapoint from the repository. | |
| template<typename T> | |
| std::optional< T > | TryGetDataPoint (const DataPointPath &path) const |
| Fetches a datapoint from the repository. | |
| template<typename T> | |
| void | SetDataPoint (const DataPointPath &path, const T &value) |
| Sets a datapoint in the repository. | |
| void | SetDataPoint (const DataPointPath &path, const char *value) |
| template<typename T> | |
| void | ReadDataPoint (const DataPointPath &path, T &buffer) const |
| Reads a datapoint from the repository. | |
| template<typename T> | |
| void | WriteDataPoint (const DataPointPath &path, const T &buffer) |
| Writes a datapoint to the repository. | |
| void | WriteDataPoint (const DataPointPath &path, const char *buffer) |
| template<typename... T> | |
| void | WriteDataPoints (const T &... args) |
| template<typename... T> | |
| void | ReadDataPoints (T &... args) const |
Static Public Attributes | |
| static const std::string | SUPPORTED_URI_SCHEME = "cii.oldb" |
Protected Types | |
| using | CiiOldbTypedDataBase = elt::oldb::CiiOldbTypedDataBase |
| using | CiiOldbDpSubscriptionBase = elt::oldb::CiiOldbDpSubscriptionBase |
| using | MethodLookupTable = std::unordered_map<std::type_index, MethodsRecord> |
| using | MethodLookupTableEntry = typename MethodLookupTable::value_type |
Protected Types inherited from rtctk::componentFramework::RepositoryIf | |
| using | RequestList = std::vector<std::any> |
Static Protected Member Functions | |
| template<typename T> | |
| static MethodLookupTableEntry | BindTypeHandlers () |
| Helper method to bind a set of handler methods for a particular datapoint type. | |
| static const MethodsRecord & | FindTypeHandlers (const std::type_info &type) |
| Find the handler methods to use for a given datapoint type. | |
| template<typename T> | |
| static RequestDispatcher< OldbAdapter >::TableEntries | BindRequestHandlers () |
| Helper method to bind multiple handler methods for templated requests. | |
Protected Attributes | |
| const elt::mal::Uri | m_baseuri |
| The prefix part for OLDB URIs. | |
| std::shared_ptr< elt::oldb::CiiOldb > | m_client |
| Pointer to the CII OLDB API client object. | |
| std::mutex | m_mutex |
| Mutex for synchronising access to subscriptions. | |
| DynamicThreadPool | m_thread_pool {"oldb_worker"} |
| worker threadpool | |
| std::map< SubscriptionId, SubscriptionEntry > | m_subscriptions |
Static Protected Attributes | |
| static const MethodLookupTable | S_TYPE_DISPATCH_TABLE |
| A lookup table of methods for handling different datapoint types. | |
| static const RequestDispatcher< OldbAdapter > | S_REQUEST_DISPATCHER |
| A lookup table of methods for handling different request types. | |
Additional Inherited Members | |
Public Types inherited from rtctk::componentFramework::OldbIf | |
| using | AdapterIdType = elt::mal::Uri |
| The type used to distinguish between different adapters implementing OldbIf. | |
Public Types inherited from rtctk::componentFramework::RepositorySubscriberIf | |
| template<typename T> | |
| using | ValueCallbackType = std::function<void(const DataPointPath&, T&, const MetaData&)> |
| using | NotifyCallbackType = std::function<void(const DataPointPath&, const MetaData&)> |
| using | ErrorCallbackType = std::function<void(std::exception_ptr)> |
| using | SubscriptionId = size_t |
Public Types inherited from rtctk::componentFramework::RepositoryIf | |
| using | PathList = std::vector<DataPointPath> |
| using | Clock = taiclock::TaiClock |
| using | Timestamp = Clock::time_point |
| using | CallbackType = std::function<void(const DataPointPath&)> |
| Signature of the callback functions that can be registered with the repository requests. | |
Static Public Member Functions inherited from rtctk::componentFramework::OldbIf | |
| static std::unique_ptr< OldbIf > | CreateAdapter (const elt::mal::Uri &uri) |
| Factory method used to create the appropriate OLDB adapter depending on the URI scheme. | |
Static Public Member Functions inherited from rtctk::componentFramework::RepositoryIf | |
| static const std::type_info & | StringToType (const std::string &arg) |
| Converts an RTC datapoint type string to a type_info. | |
| static std::string | TypeToString (const std::type_info &arg) |
| Converts a type_info to an RTC datapoint type string. | |
| static std::any | MakeAnyBuffer (const MetaData &metadata) |
| Helper method to create an std::any buffer compatible with a specific datapoint. | |
Implementation of the OLDB Adapter.
|
protected |
|
protected |
|
protected |
|
protected |
|
delete |
Do not allow construction with no arguments.
|
delete |
This class cannot be copy constructed.
|
delete |
Objects of this class can not be moved because we have a mutex.
|
explicit |
Constructs an adapter for the CII OLDB service with the default OLDB client instance.
| [in] | baseuri | A URI with a CII OLDB scheme, e.g.: cii.oldb:/basepath The URI must contain a base path where the datapoints are stored. |
|
explicit |
Constructs an adapter for the OLDB service with a specific OLDB client instance.
| [in] | baseuri | A URI with a CII OLDB scheme, e.g.: cii.oldb:/basepath The URI must contain a base path where the datapoints are stored. |
| [in] | oldb | The OLDB client object to use for accessing the OLDB. |
|
overridedefault |
Destroys the adapter for the OLDB service releasing allocated resources.
|
staticprotected |
Helper method to bind multiple handler methods for templated requests.
| T | The element type of the request class, e.g. CreateRequest<T>. |
| Lut::TableEntries rtctk::componentFramework::OldbAdapter::BindRequestHandlers | ( | ) |
|
staticprotected |
Helper method to bind a set of handler methods for a particular datapoint type.
| T | The datapoint type, e.g. RtcInt64. |
|
protected |
Operation not supported by this backend, invocation will result in exception.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
Find the handler methods to use for a given datapoint type.
| [in] | type | The datapoint type that needs to be handled. |
| UnsupportedType | No handler methods could be found for the given datapoint type. |
|
protected |
|
protected |
|
protected |
|
protected |
| auto rtctk::componentFramework::OldbAdapter::GetOldbTypedDataPoint | ( | auto & | request | ) |
|
inlineoverridevirtual |
Get the URI used when creating this adapter object.
Implements rtctk::componentFramework::OldbIf.
|
delete |
This class cannot be copy assigned.
|
delete |
|
protected |
|
protected |
|
overrideprotectedvirtual |
Implements rtctk::componentFramework::RepositoryIf.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
The prefix part for OLDB URIs.
All datapoint paths given to the public OldbAdapter methods are relative to this prefix.
|
mutableprotected |
Pointer to the CII OLDB API client object.
|
mutableprotected |
Mutex for synchronising access to subscriptions.
|
protected |
|
protected |
worker threadpool
|
staticprotected |
A lookup table of methods for handling different request types.
|
staticprotected |
A lookup table of methods for handling different datapoint types.
|
inlinestatic |