RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
rtctk::componentFramework::OldbAdapter Class Reference

Implementation of the OLDB Adapter. More...

#include <rtctk/componentFramework/oldbAdapter.hpp>

Inheritance diagram for rtctk::componentFramework::OldbAdapter:
rtctk::componentFramework::OldbIf rtctk::componentFramework::RepositorySubscriberIf rtctk::componentFramework::RepositoryIf

Classes

struct  SubscriptionEntry
 

Public Member Functions

 OldbAdapter ()=delete
 Do not allow construction with no arguments.
 
 OldbAdapter (const OldbAdapter &)=delete
 This class cannot be copy constructed.
 
OldbAdapteroperator= (const OldbAdapter &)=delete
 This class cannot be copy assigned.
 
 OldbAdapter (OldbAdapter &&)=default
 Objects of this class can be moved.
 
OldbAdapteroperator= (OldbAdapter &&)=default
 Objects of this class can be moved with the move assignment operator.
 
 OldbAdapter (const elt::mal::Uri &baseuri)
 Constructs an adapter for the CII OLDB service.
 
virtual ~OldbAdapter ()
 
template<typename T >
void AddSubscription (detail::ValueSubscribeRequest &req, const std::shared_ptr< CiiOldbTypedDataBase > &dp_base)
 
- Public Member Functions inherited from rtctk::componentFramework::OldbIf
virtual ~OldbIf ()=default
 
- Public Member Functions inherited from rtctk::componentFramework::RepositorySubscriberIf
 RepositorySubscriberIf ()=default
 
virtual ~RepositorySubscriberIf ()=default
 
template<typename T = void, typename F , std::enable_if_t< std::is_convertible_v< F, NotifyCallbackType > or(not std::is_same_v< T, void > and std::is_convertible_v< F, ValueCallbackType< std::conditional_t< std::is_same_v< T, void >, std::byte, T > > >), bool > = true>
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.
 
virtual RepositoryIf::Response SendSubscribeRequest (const SubscribeRequest &request) const
 This is called to asynchronously send a subscription request for datapoints.
 
virtual RepositoryIf::Response SendUnsubscribeRequest (const UnsubscribeRequest &request) const
 This is called to asynchronously send a request to unsubscribe from various notifications.
 
template<typename T , typename F , std::enable_if_t< not std::is_convertible_v< T, RepositorySubscriberIf::NotifyCallbackType >, bool > = true>
void Subscribe (const DataPointPath &path, T &buffer, F handler) const
 A convenience template function that will register a callback to receive new datapoint values in a synchronous manner.
 
template<typename F >
void Subscribe (const DataPointPath &path, F handler) const
 A convenience template function that will register a callback to receive datapoint value change notifications in a synchronous manner.
 
void Unsubscribe (const DataPointPath &path) const
 A simple convenience function that will deregister all callbacks for receiving new datapoint values.
 
- 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 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, PathListGetChildren (const DataPointPath &path, bool recurse=false) const
 Queries the child datapoints and paths for a given parent path.
 
template<typename T >
GetDataPoint (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
 
virtual void CreateDataPoint (const DataPointPath &path, const std::type_info &type)
 Creates a new datapoint in the repository with a specified type.
 
virtual Response SendReadRequest (const ReadRequest &request) const
 Sends a request to read data from the repository.
 
virtual Response SendWriteRequest (const WriteRequest &request)
 Sends a request to write data to the repository.
 

Static Public Attributes

static const std::string SUPPORTED_URI_SCHEME = "cii.oldb"
 

Protected Types

using DispatchFunction = std::function<void(OldbAdapter*, std::any&)>
 
using LookupTable = std::unordered_map<std::type_index, DispatchFunction>
 
using TableEntry = typename LookupTable::value_type
 
- Protected Types inherited from rtctk::componentFramework::RepositoryIf
using RequestList = std::vector<std::any>
 

Protected Member Functions

BatchResponse ProcessRequests (const RequestList &requests) override
 
template<typename T >
void CreateImpl (detail::CreateRequest< T > &)
 
template<typename T >
void WriteImpl (detail::WriteRequest< T > &)
 
template<typename T >
void ReadImpl (detail::ReadRequest< T > &)
 
template<typename T >
void PartialWriteImpl (detail::PartialWriteRequest< T > &)
 operation not supported by this backend, invocation will result in exception
 
template<typename T >
void PartialReadImpl (detail::PartialReadRequest< T > &)
 operation not supported by this backend, invocation will result in exception
 
void WriteMetaDataImpl (detail::WriteMetaDataRequest &)
 operation partially supported by this backend, limited metadata functionality
 
void ReadMetaDataImpl (detail::ReadMetaDataRequest &)
 operation partially supported by this backend, limited metadata functionality
 
void DeleteImpl (detail::DeleteRequest &)
 
void ExistsImpl (detail::ExistsRequest &)
 
void GetChildrenImpl (detail::GetChildrenRequest &)
 
void GetChildrenImplRecursive (const DataPointPath &, PathList &, PathList &, bool)
 
void CreateLinkImpl (detail::CreateSymlinkRequest &)
 
void UpdateLinkImpl (detail::UpdateSymlinkRequest &)
 operation not supported by this backend, invocation will result in exception
 
void SubscribeImpl (detail::ValueSubscribeRequest &)
 
void CreateDeleteSubscribeImpl (detail::CreateDeleteSubscribeRequest &)
 operation not supported by this backend, invocation will result in exception
 
void UnsubscribeImpl (detail::UnsubscribeRequest &)
 
virtual void InvokeRequestHandler (std::any &)
 
template<typename T >
void AddSubscription (detail::ValueSubscribeRequest &, const std::shared_ptr< elt::oldb::CiiOldbTypedDataBase > &)
 
- Protected Member Functions inherited from rtctk::componentFramework::RepositoryIf
virtual void DeleteDataPointLegacy (const DataPointPath &path)
 Deletes a datapoint.
 
virtual const std::type_info & GetDataPointTypeLegacy (const DataPointPath &path) const
 Fetches the type of the datapoint.
 
virtual size_t GetDataPointSizeLegacy (const DataPointPath &path) const
 Fetches the size of the datapoint's data.
 
virtual bool DataPointExistsLegacy (const DataPointPath &path) const
 Checks for the existence of a datapoint in the repository.
 
virtual std::pair< PathList, PathListGetChildrenLegacy (const DataPointPath &path) const
 Queries the datapoints and child paths for a given path.
 

Static Protected Member Functions

template<typename T >
static TableEntry Bind (void(OldbAdapter::*method)(T &))
 

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.
 
std::map< SubscriptionId, SubscriptionEntrym_subscriptions
 

Static Protected Attributes

static const LookupTable S_REQUEST_DISPATCHER_TABLE
 

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< OldbIfCreateAdapter (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 type string to a type_info.
 
static std::string TypeToString (const std::type_info &arg)
 Converts a type_info to an RTC type string.
 

Detailed Description

Implementation of the OLDB Adapter.

Member Typedef Documentation

◆ DispatchFunction

◆ LookupTable

using rtctk::componentFramework::OldbAdapter::LookupTable = std::unordered_map<std::type_index, DispatchFunction>
protected

◆ TableEntry

Constructor & Destructor Documentation

◆ OldbAdapter() [1/4]

rtctk::componentFramework::OldbAdapter::OldbAdapter ( )
delete

Do not allow construction with no arguments.

◆ OldbAdapter() [2/4]

rtctk::componentFramework::OldbAdapter::OldbAdapter ( const OldbAdapter & )
delete

This class cannot be copy constructed.

◆ OldbAdapter() [3/4]

rtctk::componentFramework::OldbAdapter::OldbAdapter ( OldbAdapter && )
default

Objects of this class can be moved.

◆ OldbAdapter() [4/4]

OldbAdapter::OldbAdapter ( const elt::mal::Uri & baseuri)
explicit

Constructs an adapter for the CII OLDB service.

Parameters
[in]baseuriA URI with a CII OLDB scheme, e.g.: cii.oldb:/basepath

◆ ~OldbAdapter()

OldbAdapter::~OldbAdapter ( )
virtual

Member Function Documentation

◆ AddSubscription() [1/2]

template<typename T >
void rtctk::componentFramework::OldbAdapter::AddSubscription ( detail::ValueSubscribeRequest & ,
const std::shared_ptr< elt::oldb::CiiOldbTypedDataBase > &  )
protected

◆ AddSubscription() [2/2]

template<typename T >
void rtctk::componentFramework::OldbAdapter::AddSubscription ( detail::ValueSubscribeRequest & req,
const std::shared_ptr< CiiOldbTypedDataBase > & dp_base )

◆ Bind()

template<typename T >
OldbAdapter::TableEntry OldbAdapter::Bind ( void(OldbAdapter::*)(T &) method)
staticprotected

◆ CreateDeleteSubscribeImpl()

void OldbAdapter::CreateDeleteSubscribeImpl ( detail::CreateDeleteSubscribeRequest & req)
protected

operation not supported by this backend, invocation will result in exception

◆ CreateImpl()

template<typename T >
void OldbAdapter::CreateImpl ( detail::CreateRequest< T > & req)
protected

◆ CreateLinkImpl()

void OldbAdapter::CreateLinkImpl ( detail::CreateSymlinkRequest & req)
protected

◆ DeleteImpl()

void OldbAdapter::DeleteImpl ( detail::DeleteRequest & req)
protected

◆ ExistsImpl()

void OldbAdapter::ExistsImpl ( detail::ExistsRequest & req)
protected

◆ GetChildrenImpl()

void OldbAdapter::GetChildrenImpl ( detail::GetChildrenRequest & req)
protected

◆ GetChildrenImplRecursive()

void OldbAdapter::GetChildrenImplRecursive ( const DataPointPath & path,
PathList & child_paths,
PathList & datapoints,
bool recurse )
protected

◆ InvokeRequestHandler()

void OldbAdapter::InvokeRequestHandler ( std::any & request)
protectedvirtual

◆ operator=() [1/2]

OldbAdapter & rtctk::componentFramework::OldbAdapter::operator= ( const OldbAdapter & )
delete

This class cannot be copy assigned.

◆ operator=() [2/2]

OldbAdapter & rtctk::componentFramework::OldbAdapter::operator= ( OldbAdapter && )
default

Objects of this class can be moved with the move assignment operator.

◆ PartialReadImpl()

template<typename T >
void OldbAdapter::PartialReadImpl ( detail::PartialReadRequest< T > & req)
protected

operation not supported by this backend, invocation will result in exception

◆ PartialWriteImpl()

template<typename T >
void OldbAdapter::PartialWriteImpl ( detail::PartialWriteRequest< T > & req)
protected

operation not supported by this backend, invocation will result in exception

◆ ProcessRequests()

RepositoryIf::BatchResponse OldbAdapter::ProcessRequests ( const RequestList & requests)
overrideprotectedvirtual

◆ ReadImpl()

template<typename T >
void OldbAdapter::ReadImpl ( detail::ReadRequest< T > & req)
protected

◆ ReadMetaDataImpl()

void OldbAdapter::ReadMetaDataImpl ( detail::ReadMetaDataRequest & req)
protected

operation partially supported by this backend, limited metadata functionality

◆ SubscribeImpl()

void OldbAdapter::SubscribeImpl ( detail::ValueSubscribeRequest & req)
protected

◆ UnsubscribeImpl()

void OldbAdapter::UnsubscribeImpl ( detail::UnsubscribeRequest & req)
protected

◆ UpdateLinkImpl()

void OldbAdapter::UpdateLinkImpl ( detail::UpdateSymlinkRequest & req)
protected

operation not supported by this backend, invocation will result in exception

◆ WriteImpl()

template<typename T >
void OldbAdapter::WriteImpl ( detail::WriteRequest< T > & req)
protected

◆ WriteMetaDataImpl()

void OldbAdapter::WriteMetaDataImpl ( detail::WriteMetaDataRequest & req)
protected

operation partially supported by this backend, limited metadata functionality

Member Data Documentation

◆ m_baseuri

const elt::mal::Uri rtctk::componentFramework::OldbAdapter::m_baseuri
protected

The prefix part for OLDB URIs.

All datapoint paths given to the public OldbAdapter methods are relative to this prefix.

◆ m_client

std::shared_ptr<elt::oldb::CiiOldb> rtctk::componentFramework::OldbAdapter::m_client
mutableprotected

Pointer to the CII OLDB API client object.

◆ m_mutex

std::mutex rtctk::componentFramework::OldbAdapter::m_mutex
mutableprotected

Mutex for synchronising access to subscriptions.

◆ m_subscriptions

std::map<SubscriptionId, SubscriptionEntry> rtctk::componentFramework::OldbAdapter::m_subscriptions
protected

◆ S_REQUEST_DISPATCHER_TABLE

const OldbAdapter::LookupTable OldbAdapter::S_REQUEST_DISPATCHER_TABLE
staticprotected

◆ SUPPORTED_URI_SCHEME

const std::string rtctk::componentFramework::OldbAdapter::SUPPORTED_URI_SCHEME = "cii.oldb"
inlinestatic

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