RTC Toolkit  2.0.0
Public Member Functions | List of all members
rtctk::componentFramework::FileRuntimeRepoAdapter Class Reference

#include <fileRuntimeRepoAdapter.hpp>

Inheritance diagram for rtctk::componentFramework::FileRuntimeRepoAdapter:
rtctk::componentFramework::FileRepository rtctk::componentFramework::RuntimeRepoIf rtctk::componentFramework::RepositoryIf rtctk::componentFramework::RepositoryIf rtctk::componentFramework::RepositorySubscriberIf

Public Member Functions

 FileRuntimeRepoAdapter ()=delete
 
 FileRuntimeRepoAdapter (const FileRuntimeRepoAdapter &)=delete
 
FileRuntimeRepoAdapteroperator= (const FileRuntimeRepoAdapter &)=delete
 
 FileRuntimeRepoAdapter (FileRuntimeRepoAdapter &&)=default
 
FileRuntimeRepoAdapteroperator= (FileRuntimeRepoAdapter &&)=default
 
 FileRuntimeRepoAdapter (const elt::mal::Uri &datauri, const int dirdepth=1)
 Constructor to create a Runtime Repository Repository adapter for a simple file based implementation. More...
 
virtual ~FileRuntimeRepoAdapter ()
 
RepositoryIf::Response SendSubscribeRequest (const SubscribeRequest &request) const override
 This is called to asynchronously send a subscription request for datapoints. More...
 
RepositoryIf::Response SendUnsubscribeRequest (const UnsubscribeRequest &request) const override
 This is called to asynchronously send a request to unsubscribe from various notifications. More...
 
- Public Member Functions inherited from rtctk::componentFramework::FileRepository
 FileRepository ()=delete
 
 FileRepository (const FileRepository &)=delete
 
FileRepositoryoperator= (const FileRepository &)=delete
 
 FileRepository (const elt::mal::Uri &datauri, const int dirdepth)
 
virtual ~FileRepository () noexcept=default
 
void CreateDataPoint (const DataPointPath &path, const std::type_info &type) override
 Creates a new datapoint in the repository with a specified type. More...
 
void DeleteDataPoint (const DataPointPath &path) override
 Deletes a datapoint. More...
 
const std::type_info & GetDataPointType (const DataPointPath &path) const override
 Fetches the type of the datapoint. More...
 
size_t GetDataPointSize (const DataPointPath &path) const override
 Fetches the size of the datapoint's data. More...
 
bool DataPointExists (const DataPointPath &path) const override
 Checks for the existence of a datapoint in the repository. More...
 
std::pair< PathList, PathListGetChildren (const DataPointPath &path) const override
 Queries the datapoints and child paths for a given path. More...
 
Response SendReadRequest (const ReadRequest &request) const override
 Sends a request to read data from the repository. More...
 
Response SendWriteRequest (const WriteRequest &request) override
 Sends a request to write data to the repository. More...
 
size_t GetFitsWriteThreshold () const
 
void SetFitsWriteThreshold (size_t value)
 Sets the threshold for storing numerical matrices and vectors in FITS files rather than the YAML file. More...
 
virtual void CreateDataPoint (const DataPointPath &path, const std::type_info &type)=0
 Creates a new datapoint in the repository with a specified type. More...
 
template<typename T >
void CreateDataPoint (const DataPointPath &path)
 Creates a new datapoint in the repository. More...
 
template<typename T >
void CreateDataPoint (const DataPointPath &path, const T default_value)
 Creates a new datapoint in the repository and sets a default value. More...
 
template<>
void CreateDataPoint (const DataPointPath &path, const char *default_value)
 
- Public Member Functions inherited from rtctk::componentFramework::RepositoryIf
virtual ~RepositoryIf ()
 
template<typename T >
void CreateDataPoint (const DataPointPath &path)
 Creates a new datapoint in the repository. More...
 
template<typename T >
void CreateDataPoint (const DataPointPath &path, const T default_value)
 Creates a new datapoint in the repository and sets a default value. More...
 
template<typename T >
GetDataPoint (const DataPointPath &path) const
 Fetches a datapoint from the repository. More...
 
template<typename T >
void SetDataPoint (const DataPointPath &path, const T value)
 Sets a datapoint in the repository. More...
 
template<typename T >
void ReadDataPoint (const DataPointPath &path, T &buffer) const
 Reads a datapoint from the repository. More...
 
template<typename T >
void WriteDataPoint (const DataPointPath &path, const T &buffer)
 Writes a datapoint to the repository. More...
 
void WriteDataPoint (const DataPointPath &path, const char *buffer)
 
template<>
void CreateDataPoint (const DataPointPath &path, const char *default_value)
 
template<>
void SetDataPoint (const DataPointPath &path, const char *value)
 
- Public Member Functions inherited from rtctk::componentFramework::RuntimeRepoIf
virtual ~RuntimeRepoIf ()=default
 
- Public Member Functions inherited from rtctk::componentFramework::RepositorySubscriberIf
virtual ~RepositorySubscriberIf ()
 
template<typename T , typename F >
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. More...
 
void Unsubscribe (const DataPointPath &path) const
 A simple convenience function that will deregister all callbacks for receiving new datapoint values. More...
 

Additional Inherited Members

- Public Types inherited from rtctk::componentFramework::RepositoryIf
using PathList = std::vector< DataPointPath >
 
- Static Public Member Functions inherited from rtctk::componentFramework::RuntimeRepoIf
static std::unique_ptr< RuntimeRepoIfCreateAdapter (const elt::mal::Uri &uri)
 Factory method used to create the appropriate Runtime Configuration Repository adapter depending on the URI scheme. More...
 

Constructor & Destructor Documentation

◆ FileRuntimeRepoAdapter() [1/4]

rtctk::componentFramework::FileRuntimeRepoAdapter::FileRuntimeRepoAdapter ( )
delete

◆ FileRuntimeRepoAdapter() [2/4]

rtctk::componentFramework::FileRuntimeRepoAdapter::FileRuntimeRepoAdapter ( const FileRuntimeRepoAdapter )
delete

◆ FileRuntimeRepoAdapter() [3/4]

rtctk::componentFramework::FileRuntimeRepoAdapter::FileRuntimeRepoAdapter ( FileRuntimeRepoAdapter &&  )
default

◆ FileRuntimeRepoAdapter() [4/4]

rtctk::componentFramework::FileRuntimeRepoAdapter::FileRuntimeRepoAdapter ( const elt::mal::Uri &  datauri,
const int  dirdepth = 1 
)
explicit

Constructor to create a Runtime Repository Repository adapter for a simple file based implementation.

Parameters
[in]datauriMust be a file scheme URI with the path indicating the location of the repository YAML files.
[in]dirdepthIndicates how deep the directory structure should be. The default value is 1, which means the first component of a datapoint path is used as the name of the YAML file.

◆ ~FileRuntimeRepoAdapter()

rtctk::componentFramework::FileRuntimeRepoAdapter::~FileRuntimeRepoAdapter ( )
virtual

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ SendSubscribeRequest()

RepositoryIf::Response rtctk::componentFramework::FileRuntimeRepoAdapter::SendSubscribeRequest ( const SubscribeRequest request) const
overridevirtual

This is called to asynchronously send a subscription request for datapoints.

One or more datapoints can be subscribed to by constructing a SubscribeRequest object and sending it to the repository service with this method. A typical usage is indicated in the following code sample:

void OnRemoved(const DataPointPath& path) {
...
}
void OnNewValue(const DataPointPath& path, int64_t& buffer) {
...
}
RepositorySubscriberIf& repo = ...;
int64_t buffer = ...;
SubscribeRequest request;
request.AddRemoveHandler("/test/datapoint"_dppath, OnRemoved);
request.AddNewValueHandler("/test/datapoint"_dppath, buffer, OnNewValue);
auto response = repo.SendSubscribeRequest(request);
... can do some work here ...
response.Wait();
Note
One must not access the buffers added to a SubscribeRequest object once SendSubscribeRequest has been invoked. At least not without using some form of synchronisation, e.g. a mutex, since the buffers will be updated asynchronously in different threads to the one used by the caller.
Parameters
[in]requestThe subscription request to send to the repository.
Returns
A response object (a future) that is used to wait for completion of the request.
Thread Safety
thread-safe
Exception Safety
basic

Implements rtctk::componentFramework::RepositorySubscriberIf.

◆ SendUnsubscribeRequest()

RepositoryIf::Response rtctk::componentFramework::FileRuntimeRepoAdapter::SendUnsubscribeRequest ( const UnsubscribeRequest request) const
overridevirtual

This is called to asynchronously send a request to unsubscribe from various notifications.

One can stop receiving notifications for one or more datapoints by constructing a UnsubscribeRequest object and sending it to the repository service with this method. A typical usage is indicated in the following code sample:

void OnRemoved(const DataPointPath& path) {
...
}
void OnNewValue(const DataPointPath& path, int64_t& buffer) {
...
}
RepositorySubscriberIf& repo = ...;
UnsubscribeRequest request;
request.AddRemoveHandler("/test/datapoint"_dppath);
request.AddNewValueHandler("/test/datapoint"_dppath);
auto response = repo.SendUnsubscribeRequest(request);
... can do some work here ...
response.Wait();
Parameters
[in]requestThe request to send to the repository.
Returns
A response object (a future) that is used to wait for completion of the request.
Thread Safety
thread-safe
Exception Safety
basic

Implements rtctk::componentFramework::RepositorySubscriberIf.


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