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

A simple fake implementation of RepositorySubscriberIf to allow testing the interactions and callbacks over this API. More...

#include <rtctk/componentFramework/test/fakeRepositorySubscriber.hpp>

Inheritance diagram for rtctk::componentFramework::test::FakeRepositorySubscriber:
rtctk::componentFramework::RepositorySubscriberIf rtctk::componentFramework::test::FakeRepository rtctk::componentFramework::RepositoryIf rtctk::componentFramework::RepositoryIf rtctk::componentFramework::test::FakeOldbIf rtctk::componentFramework::test::FakeRuntimeRepoIf rtctk::componentFramework::test::MockRuntimeRepoIf

Classes

struct  CreateDeleteSubscription
 
struct  ValueSubscription
 

Public Member Functions

 FakeRepositorySubscriber ()=default
 
virtual ~FakeRepositorySubscriber ()=default
 
template<typename T >
Lut::TableEntries BindTypeHandlers ()
 
- 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.
 
- Public Member Functions inherited from rtctk::componentFramework::test::FakeRepository
 FakeRepository ()
 
virtual ~FakeRepository ()
 
template<typename T >
Lut::TableEntries BindTypeHandlers ()
 

Protected Member Functions

template<typename T >
void CreateImpl (detail::CreateRequest< T > &req)
 
template<typename T >
void ReadImpl (detail::ReadRequest< T > &req)
 
template<typename T >
void WriteImpl (detail::WriteRequest< T > &req)
 
template<typename T >
void PartialReadImpl (detail::PartialReadRequest< T > &req)
 
template<typename T >
void PartialWriteImpl (detail::PartialWriteRequest< T > &req)
 
void ReadMetaDataImpl (detail::ReadMetaDataRequest &req)
 
void WriteMetaDataImpl (detail::WriteMetaDataRequest &req)
 
void DeleteImpl (detail::DeleteRequest &req)
 
void ExistsImpl (detail::ExistsRequest &req)
 
void GetChildrenImpl (detail::GetChildrenRequest &req)
 
void CreateLinkImpl (detail::CreateSymlinkRequest &req)
 
void UpdateLinkImpl (detail::UpdateSymlinkRequest &req)
 
void SubscribeImpl (detail::ValueSubscribeRequest &req)
 
void CreateDeleteSubscribeImpl (detail::CreateDeleteSubscribeRequest &req)
 
void UnsubscribeImpl (detail::UnsubscribeRequest &req)
 
void InvokeRequestHandler (std::any &request) override
 
void InvokeCreateCallbacks (const DataPointPath &)
 
void InvokeDeleteCallbacks (const DataPointPath &)
 
void InvokeWriteCallbacks (const DataPointPath &)
 
- 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.
 
- Protected Member Functions inherited from rtctk::componentFramework::test::FakeRepository
template<typename T >
void CreateImpl (detail::CreateRequest< T > &req)
 
template<typename T >
void ReadImpl (detail::ReadRequest< T > &req)
 
template<typename T >
void WriteImpl (detail::WriteRequest< T > &req)
 
template<typename T >
void PartialReadImpl (detail::PartialReadRequest< T > &req)
 
template<typename T >
void PartialWriteImpl (detail::PartialWriteRequest< T > &req)
 
void ReadMetaDataImpl (detail::ReadMetaDataRequest &req)
 
void WriteMetaDataImpl (detail::WriteMetaDataRequest &req)
 
void DeleteImpl (detail::DeleteRequest &req)
 
void ExistsImpl (detail::ExistsRequest &req)
 
std::pair< PathList, PathListGetChildrenImpl (const DataPointPath &path)
 
std::pair< PathList, PathListGetChildrenRecursive (const DataPointPath &path)
 
void GetChildrenImpl (detail::GetChildrenRequest &req)
 
void CreateLinkImpl (detail::CreateSymlinkRequest &req)
 
void UpdateLinkImpl (detail::UpdateSymlinkRequest &req)
 
template<typename Request >
void InvokeCallback (const Request &req) const
 
template<typename T >
void ReadData (Data &data_node, const DataPointPath &path, gsl::span< T > &data, std::optional< std::reference_wrapper< MetaData > > &metadata, size_t offset)
 
template<typename T >
void WriteData (const DataPointPath &path, const gsl::span< const T > &data, const MetaData &metadata, size_t offset)
 
void ReadMetaData (const DataPointPath &path, MetaData &metadata, bool check_sequence_id=false)
 
void WriteMetaData (Data &data_node, const MetaData &metadata)
 
DataPointPath ResolvePath (const DataPointPath &path)
 
DataCreateNewDataNode (const DataPointPath &path)
 
DataGetDataNode (const DataPointPath &path)
 
void CheckDataNodeExists (const DataPointPath &path)
 
BatchResponse ProcessRequests (const RequestList &requests) override
 

Static Protected Member Functions

template<typename T >
static RequestDispatcher< FakeRepositorySubscriber >::TableEntries BindTypeHandlers ()
 
- Static Protected Member Functions inherited from rtctk::componentFramework::test::FakeRepository
template<typename T >
static RequestDispatcher< FakeRepository >::TableEntries BindTypeHandlers ()
 

Protected Attributes

std::list< ValueSubscriptionm_value_subscriptions
 
std::list< CreateDeleteSubscriptionm_create_delete_subscriptions
 
- Protected Attributes inherited from rtctk::componentFramework::test::FakeRepository
std::mutex m_mutex
 Mutex for synchronising access to m_data.
 
std::map< DataPointPath, Datam_data
 

Static Protected Attributes

static const RequestDispatcher< FakeRepositorySubscriberS_REQUEST_DISPATCHER
 
- Static Protected Attributes inherited from rtctk::componentFramework::test::FakeRepository
static const RequestDispatcher< FakeRepositoryS_REQUEST_DISPATCHER
 

Additional Inherited Members

- 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::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.
 
- Protected Types inherited from rtctk::componentFramework::RepositoryIf
using RequestList = std::vector<std::any>
 

Detailed Description

A simple fake implementation of RepositorySubscriberIf to allow testing the interactions and callbacks over this API.

Constructor & Destructor Documentation

◆ FakeRepositorySubscriber()

rtctk::componentFramework::test::FakeRepositorySubscriber::FakeRepositorySubscriber ( )
default

◆ ~FakeRepositorySubscriber()

virtual rtctk::componentFramework::test::FakeRepositorySubscriber::~FakeRepositorySubscriber ( )
virtualdefault

Member Function Documentation

◆ BindTypeHandlers() [1/2]

template<typename T >
Lut::TableEntries rtctk::componentFramework::test::FakeRepositorySubscriber::BindTypeHandlers ( )

◆ BindTypeHandlers() [2/2]

template<typename T >
static RequestDispatcher< FakeRepositorySubscriber >::TableEntries rtctk::componentFramework::test::FakeRepositorySubscriber::BindTypeHandlers ( )
staticprotected

◆ CreateDeleteSubscribeImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::CreateDeleteSubscribeImpl ( detail::CreateDeleteSubscribeRequest & req)
protected

◆ CreateImpl()

template<typename T >
void rtctk::componentFramework::test::FakeRepositorySubscriber::CreateImpl ( detail::CreateRequest< T > & req)
protected

◆ CreateLinkImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::CreateLinkImpl ( detail::CreateSymlinkRequest & req)
protected

◆ DeleteImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::DeleteImpl ( detail::DeleteRequest & req)
protected

◆ ExistsImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::ExistsImpl ( detail::ExistsRequest & req)
protected

◆ GetChildrenImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::GetChildrenImpl ( detail::GetChildrenRequest & req)
protected

◆ InvokeCreateCallbacks()

void rtctk::componentFramework::test::FakeRepositorySubscriber::InvokeCreateCallbacks ( const DataPointPath & path)
protected

◆ InvokeDeleteCallbacks()

void rtctk::componentFramework::test::FakeRepositorySubscriber::InvokeDeleteCallbacks ( const DataPointPath & path)
protected

◆ InvokeRequestHandler()

void rtctk::componentFramework::test::FakeRepositorySubscriber::InvokeRequestHandler ( std::any & request)
overrideprotectedvirtual

◆ InvokeWriteCallbacks()

void rtctk::componentFramework::test::FakeRepositorySubscriber::InvokeWriteCallbacks ( const DataPointPath & path1)
protected

◆ PartialReadImpl()

template<typename T >
void rtctk::componentFramework::test::FakeRepositorySubscriber::PartialReadImpl ( detail::PartialReadRequest< T > & req)
protected

◆ PartialWriteImpl()

template<typename T >
void rtctk::componentFramework::test::FakeRepositorySubscriber::PartialWriteImpl ( detail::PartialWriteRequest< T > & req)
protected

◆ ReadImpl()

template<typename T >
void rtctk::componentFramework::test::FakeRepositorySubscriber::ReadImpl ( detail::ReadRequest< T > & req)
protected

◆ ReadMetaDataImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::ReadMetaDataImpl ( detail::ReadMetaDataRequest & req)
protected

◆ SubscribeImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::SubscribeImpl ( detail::ValueSubscribeRequest & req)
protected

◆ UnsubscribeImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::UnsubscribeImpl ( detail::UnsubscribeRequest & req)
protected

◆ UpdateLinkImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::UpdateLinkImpl ( detail::UpdateSymlinkRequest & req)
protected

◆ WriteImpl()

template<typename T >
void rtctk::componentFramework::test::FakeRepositorySubscriber::WriteImpl ( detail::WriteRequest< T > & req)
protected

◆ WriteMetaDataImpl()

void rtctk::componentFramework::test::FakeRepositorySubscriber::WriteMetaDataImpl ( detail::WriteMetaDataRequest & req)
protected

Member Data Documentation

◆ m_create_delete_subscriptions

std::list<CreateDeleteSubscription> rtctk::componentFramework::test::FakeRepositorySubscriber::m_create_delete_subscriptions
protected

◆ m_value_subscriptions

std::list<ValueSubscription> rtctk::componentFramework::test::FakeRepositorySubscriber::m_value_subscriptions
protected

◆ S_REQUEST_DISPATCHER

const Lut rtctk::componentFramework::test::FakeRepositorySubscriber::S_REQUEST_DISPATCHER
staticprotected
Initial value:
= {
static TableEntries Bind(void(Adapter::*method)(T &, Args...))
Definition requestDispatcher.hpp:67
void ExistsImpl(detail::ExistsRequest &req)
Definition fakeRepositorySubscriber.cpp:61
void GetChildrenImpl(detail::GetChildrenRequest &req)
Definition fakeRepositorySubscriber.cpp:65
void UnsubscribeImpl(detail::UnsubscribeRequest &req)
Definition fakeRepositorySubscriber.cpp:100
void WriteMetaDataImpl(detail::WriteMetaDataRequest &req)
Definition fakeRepositorySubscriber.cpp:52
void ReadMetaDataImpl(detail::ReadMetaDataRequest &req)
Definition fakeRepositorySubscriber.cpp:48
void CreateLinkImpl(detail::CreateSymlinkRequest &req)
Definition fakeRepositorySubscriber.cpp:69
void CreateDeleteSubscribeImpl(detail::CreateDeleteSubscribeRequest &req)
Definition fakeRepositorySubscriber.cpp:136
void DeleteImpl(detail::DeleteRequest &req)
Definition fakeRepositorySubscriber.cpp:56
void UpdateLinkImpl(detail::UpdateSymlinkRequest &req)
Definition fakeRepositorySubscriber.cpp:74
void SubscribeImpl(detail::ValueSubscribeRequest &req)
Definition fakeRepositorySubscriber.cpp:93
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23

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