RTC Toolkit  1.0.0
Public Member Functions | List of all members
rtctk::componentFramework::PersistentRepoAdapter Class Reference

Implements the Persistent Configuration Repository adapter that uses the CII configuration service as the backend. More...

#include <persistentRepoAdapter.hpp>

Inheritance diagram for rtctk::componentFramework::PersistentRepoAdapter:
rtctk::componentFramework::PersistentRepoIf rtctk::componentFramework::RepositoryIf

Public Member Functions

 PersistentRepoAdapter ()=delete
 Do not allow construction with no arguments. More...
 
 PersistentRepoAdapter (const PersistentRepoAdapter &)=delete
 This class cannot be copy constructed. More...
 
PersistentRepoAdapteroperator= (const PersistentRepoAdapter &)=delete
 This class cannot be copy assigned. More...
 
 PersistentRepoAdapter (PersistentRepoAdapter &&)=default
 Objects of this class can be moved. More...
 
PersistentRepoAdapteroperator= (PersistentRepoAdapter &&)=default
 Objects of this class can be moved with the move assignment operator. More...
 
 PersistentRepoAdapter (const elt::mal::Uri &datauri)
 Constructs a Persistent Configuration Repository adapter backed by the CII configuration service. More...
 
virtual ~PersistentRepoAdapter ()=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...
 
std::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< StringList, StringListGetChildren (const DataPointPath &path) const override
 Queries the datapoints and child paths for a given path. More...
 
Response SendReadRequest (const Request &request) const override
 Sends a request to read data from the repository. More...
 
Response SendWriteRequest (const Request &request) override
 Sends a request to write data to the repository. 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::PersistentRepoIf
virtual ~PersistentRepoIf ()=default
 
- 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)
 

Additional Inherited Members

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

Detailed Description

Implements the Persistent Configuration Repository adapter that uses the CII configuration service as the backend.

Todo:
The current implementation is just a dummy with the methods throwing NotImplementedException.
Thread Safety
thread-safe

Constructor & Destructor Documentation

◆ PersistentRepoAdapter() [1/4]

rtctk::componentFramework::PersistentRepoAdapter::PersistentRepoAdapter ( )
delete

Do not allow construction with no arguments.

◆ PersistentRepoAdapter() [2/4]

rtctk::componentFramework::PersistentRepoAdapter::PersistentRepoAdapter ( const PersistentRepoAdapter )
delete

This class cannot be copy constructed.

◆ PersistentRepoAdapter() [3/4]

rtctk::componentFramework::PersistentRepoAdapter::PersistentRepoAdapter ( PersistentRepoAdapter &&  )
default

Objects of this class can be moved.

◆ PersistentRepoAdapter() [4/4]

rtctk::componentFramework::PersistentRepoAdapter::PersistentRepoAdapter ( const elt::mal::Uri &  datauri)
explicit

Constructs a Persistent Configuration Repository adapter backed by the CII configuration service.

Parameters
[in]baseuriThe CII configuration service URI containing a base path where the datapoints are stored. The URI must use the cii.config scheme.

◆ ~PersistentRepoAdapter()

virtual rtctk::componentFramework::PersistentRepoAdapter::~PersistentRepoAdapter ( )
virtualdefault

Member Function Documentation

◆ CreateDataPoint() [1/5]

template<typename T >
void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( typename T  )

Creates a new datapoint in the repository.

The type of the datapoint is derived from the template argument type.

Parameters
[in]pathThe datapoint path that should be created.
Thread Safety
thread-safe
Exception Safety
basic

◆ CreateDataPoint() [2/5]

template<>
void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( )

◆ CreateDataPoint() [3/5]

void rtctk::componentFramework::PersistentRepoAdapter::CreateDataPoint ( const DataPointPath path,
const std::type_info &  type 
)
overridevirtual

Creates a new datapoint in the repository with a specified type.

Parameters
[in]pathThe datapoint path that should be created.
[in]typeA type identifier object returned by typeid indicating the type of the new datapoint. Supported values are indicated below.

The following are the supported values for the type argument:

  • typeid(bool)
  • typeid(int32_t)
  • typeid(int64_t)
  • typeid(float)
  • typeid(double)
  • typeid(std::string)
  • typeid(std::vector<bool>)
  • typeid(std::vector<int32_t>)
  • typeid(std::vector<int64_t>)
  • typeid(std::vector<float>)
  • typeid(std::vector<double>)
  • typeid(std::vector<std::string>)
  • typeid(MatrixBuffer<bool>)
  • typeid(MatrixBuffer<int32_t>)
  • typeid(MatrixBuffer<int64_t>)
  • typeid(MatrixBuffer<float>)
  • typeid(MatrixBuffer<double>)
  • typeid(MatrixBuffer<std::string>)
Thread Safety
thread-safe
Exception Safety
basic

Implements rtctk::componentFramework::RepositoryIf.

◆ CreateDataPoint() [4/5]

virtual void rtctk::componentFramework::RepositoryIf::CreateDataPoint

Creates a new datapoint in the repository with a specified type.

Parameters
[in]pathThe datapoint path that should be created.
[in]typeA type identifier object returned by typeid indicating the type of the new datapoint. Supported values are indicated below.

The following are the supported values for the type argument:

  • typeid(bool)
  • typeid(int32_t)
  • typeid(int64_t)
  • typeid(float)
  • typeid(double)
  • typeid(std::string)
  • typeid(std::vector<bool>)
  • typeid(std::vector<int32_t>)
  • typeid(std::vector<int64_t>)
  • typeid(std::vector<float>)
  • typeid(std::vector<double>)
  • typeid(std::vector<std::string>)
  • typeid(MatrixBuffer<bool>)
  • typeid(MatrixBuffer<int32_t>)
  • typeid(MatrixBuffer<int64_t>)
  • typeid(MatrixBuffer<float>)
  • typeid(MatrixBuffer<double>)
  • typeid(MatrixBuffer<std::string>)
Thread Safety
thread-safe
Exception Safety
basic

◆ CreateDataPoint() [5/5]

template<typename T >
void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( typename T  )

Creates a new datapoint in the repository and sets a default value.

The type of the datapoint is derived from the template argument type.

Parameters
[in]pathThe datapoint path that should be created.
[in]default_valueThe default value that should be set for the new datapoint.
Thread Safety
thread-safe
Exception Safety
basic

◆ DataPointExists()

bool rtctk::componentFramework::PersistentRepoAdapter::DataPointExists ( const DataPointPath path) const
overridevirtual

Checks for the existence of a datapoint in the repository.

Parameters
[in]pathThe datapoint path to check.
Returns
true if the datapoint path exists in the repository and false otherwise.
Thread Safety
thread-safe
Exception Safety
strong

Implements rtctk::componentFramework::RepositoryIf.

◆ DeleteDataPoint()

void rtctk::componentFramework::PersistentRepoAdapter::DeleteDataPoint ( const DataPointPath path)
overridevirtual

Deletes a datapoint.

Parameters
[in]pathThe path of the datapoint to delete in the repository.
Thread Safety
thread-safe
Exception Safety
basic

Implements rtctk::componentFramework::RepositoryIf.

◆ GetChildren()

std::pair< StringList, StringList > rtctk::componentFramework::PersistentRepoAdapter::GetChildren ( const DataPointPath path) const
overridevirtual

Queries the datapoints and child paths for a given path.

This method will query all the available datapoints that are leaf nodes immediately below the given path and also the child paths, i.e. sub-folders when interpreting the repository as a hierarchical folder like structure. The set of immediate datapoint and child paths is returned as two separate lists.

If an error occurs when querying the the repository a rtctk::componentFramework::RtctkException is thrown.

Parameters
[in]pathThe path in which to search for datapoints and child paths.
Returns
A std::pair of string lists, i.e. std::vector<std::string>, with the first list in the pair containing the datapoints found and the second list containing the child paths found. If no datapoints are found then the list for datapoints is empty. Similarly if not child paths are found then the child path list is empty.
Thread Safety
thread-safe
Exception Safety
strong

Implements rtctk::componentFramework::RepositoryIf.

◆ GetDataPointSize()

std::size_t rtctk::componentFramework::PersistentRepoAdapter::GetDataPointSize ( const DataPointPath path) const
overridevirtual

Fetches the size of the datapoint's data.

This method will return one of the following values depending on the category of the datapoint's type:

Scalars
Will always return 1 for scalars such as RtcBool, RtcInt32, RtcInt64, RtcFloat, and RtcDouble.
Strings
Will return the length of the string, i.e. the number of characters in the string.
Vectors
Will return the number of elements in the vector.
Matrices
Will return the total number of elements in the matrix, i.e. the number of rows times the number of columns.
Returns
The number of elements in the datapoint's data.
Thread Safety
thread-safe
Exception Safety
strong

Implements rtctk::componentFramework::RepositoryIf.

◆ GetDataPointType()

const std::type_info & rtctk::componentFramework::PersistentRepoAdapter::GetDataPointType ( const DataPointPath path) const
overridevirtual

Fetches the type of the datapoint.

This will return the type used when the datapoint was created with the CreateDataPoint method.

Returns
The type_info object corresponding to the type of the datapoint.
Thread Safety
thread-safe
Exception Safety
strong

Implements rtctk::componentFramework::RepositoryIf.

◆ operator=() [1/2]

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

This class cannot be copy assigned.

◆ operator=() [2/2]

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

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

◆ SendReadRequest()

Response rtctk::componentFramework::PersistentRepoAdapter::SendReadRequest ( const Request request) const
overridevirtual

Sends a request to read data from the repository.

This method allows non-blocking and asynchronous reading of datapoints form the repository. The method returns immediately, allowing other work to be done in the calling thread while the read request is completed in the background. If any callback handlers were registered in request, they will be called as soon as the data is available for the respective datapoint.

Note
The buffers for the datapoints added to request must not be accessed until the Wait method of the response object returns successfully, i.e. without a timeout.

If an error occurs then a rtctk::componentFramework::RtctkException is thrown.

Note
This method is not transactional or fully atomic. If an error occurs while reading the datapoints, some or all of the datapoint buffers registered with the read request may be left unmodified. It is however guaranteed that any particular datapoint buffer is either updated completely or not modified at all.
Parameters
[in]requestThe request object that contains all the datapoints to read.
Returns
A response object that must be used to synchronise with the completion of the read request.

Implements rtctk::componentFramework::RepositoryIf.

◆ SendWriteRequest()

Response rtctk::componentFramework::PersistentRepoAdapter::SendWriteRequest ( const Request request)
overridevirtual

Sends a request to write data to the repository.

This method allows non-blocking writing of datapoints to the repository. The method returns immediately, allowing other work to be done in the calling thread while the write request is completed in the background. If any callback handlers were registered in request, they will be called as soon as the respective datapoint's data has been sent and the buffer will no longer be accessed by the API, i.e. the caller can modify or release the buffer from that point on.

Note
The buffers for the datapoints added to request must not be modified or released until the Wait method of the response object returns successfully, i.e. without a timeout.

If an error occurs then a rtctk::componentFramework::RtctkException is thrown.

Note
This method is not transactional or fully atomic. If an error occurs while writing the datapoints, only some of the datapoints registered with the write request may be actually updated in the repository. It is however guaranteed that any particular datapoint is either updated completely in the repository or not at all.
Parameters
[in]requestThe request object that contains all the datapoints to write.
Returns
A response object that must be used to synchronise with the completion of the write request.

Implements rtctk::componentFramework::RepositoryIf.


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