|
RTC Toolkit 6.0.0
|
Abstract interface providing basic read and write facilities to a repository. More...
#include <rtctk/componentFramework/repositoryIf.hpp>
Classes | |
| class | AccessOutOfBounds |
| class | BatchRequest |
| An object representing one or more asynchronous I/O requests to a repository. More... | |
| class | BatchResponse |
| class | BufferTooSmall |
| class | DataPointAlreadyExists |
| class | DataPointDoesNotExist |
| class | DataPointPathNotAbsolute |
| class | IncompatibleType |
| class | MetaData |
| Class for passing/receiving metadata to/from the repository. More... | |
| class | MultipleRequestsFailed |
| class | OperationNotAllowed |
| class | ServiceFailure |
| class | UnsupportedType |
Public Types | |
| 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. | |
Public Member Functions | |
| 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 Member Functions | |
| 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. | |
Protected Types | |
| using | RequestList = std::vector<std::any> |
Protected Member Functions | |
| virtual BatchResponse | ProcessRequests (const RequestList &requests)=0 |
Abstract interface providing basic read and write facilities to a repository.
| using rtctk::componentFramework::RepositoryIf::CallbackType = std::function<void(const DataPointPath&)> |
Signature of the callback functions that can be registered with the repository requests.
| using rtctk::componentFramework::RepositoryIf::Clock = taiclock::TaiClock |
| using rtctk::componentFramework::RepositoryIf::PathList = std::vector<DataPointPath> |
|
protected |
| using rtctk::componentFramework::RepositoryIf::Timestamp = Clock::time_point |
|
default |
|
virtualdefault |
| void rtctk::componentFramework::RepositoryIf::CreateDataPoint | ( | const DataPointPath & | path | ) |
Creates a new empty datapoint in the repository.
The type of the datapoint is derived from the template argument type.
| T | The type of the datapoint to create. See RepositoryIf::CreateDataPoint for a list of supported types. |
| [in] | path | The datapoint path that should be created. |
| void rtctk::componentFramework::RepositoryIf::CreateDataPoint | ( | const DataPointPath & | path, |
| const char * | initial_value ) |
| void rtctk::componentFramework::RepositoryIf::CreateDataPoint | ( | const DataPointPath & | path, |
| const T & | initial_value ) |
Creates a new datapoint in the repository with an initial value.
The type of the datapoint is derived from the template argument type.
| T | The type of the datapoint to create. See RepositoryIf::CreateDataPoint for a list of supported types. |
| [in] | path | The datapoint path that should be created. |
| [in] | initial_value | The initial value that should be set for the new datapoint. |
| bool rtctk::componentFramework::RepositoryIf::DataPointExists | ( | const DataPointPath & | path | ) | const |
Checks for the existence of a datapoint in the repository.
| [in] | path | The datapoint path to check. |
true if the datapoint path exists in the repository and false otherwise.| void rtctk::componentFramework::RepositoryIf::DeleteDataPoint | ( | const DataPointPath & | path, |
| bool | recurse = false ) |
Deletes a datapoint.
| [in] | path | The path of the datapoint to delete in the repository. |
| [in] | recurse | Optional flag indicating if datapoints should be deleted recursively. |
| std::pair< RepositoryIf::PathList, RepositoryIf::PathList > rtctk::componentFramework::RepositoryIf::GetChildren | ( | const DataPointPath & | path, |
| bool | recurse = false ) const |
Queries the child datapoints and paths for a given parent path.
This method will synchronously query all the available datapoints that are leaf nodes immediately below the given path and also the non-leaf child paths, i.e. sub-folders when interpreting the repository as a hierarchical folder like structure.
The set of datapoint and child paths is returned as two separate lists. If recurse is false then only the immediate children are returned. Otherwise all datapoint and child sub-folder paths are returned recursively.
| [in] | path | The path in which to search for datapoints and child paths. |
| [in] | recurse | Optional flag indicating if paths should be queried recursively. |
std::pair of path lists, 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.| PathNotFound | If the path does not exist in the repository. |
| ServiceFailure | When the underlying back-end system indicates an unexpected failure. |
| T rtctk::componentFramework::RepositoryIf::GetDataPoint | ( | const DataPointPath & | path | ) | const |
Fetches a datapoint from the repository.
The datapoint is read from the repository and returned. If an error occurs then a rtctk::componentFramework::RtctkException is thrown.
| [in] | path | The path of the datapoint that should be fetched from the repository. |
| RtcVectorUInt64 rtctk::componentFramework::RepositoryIf::GetDataPointShape | ( | const DataPointPath & | path | ) | const |
Fetches the shape of the datapoint's data.
This method will return one of the following values depending on the category of the datapoint's type:
| [in] | path | The datapoint path for which to fetch the shape. |
| size_t rtctk::componentFramework::RepositoryIf::GetDataPointSize | ( | const DataPointPath & | path | ) | const |
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:
1 for scalars such as RtcBool, RtcInt32, RtcInt64, RtcFloat, and RtcDouble. | [in] | path | The datapoint path for which to fetch the size. |
| const std::type_info & rtctk::componentFramework::RepositoryIf::GetDataPointType | ( | const DataPointPath & | path | ) | const |
Fetches the type of the datapoint.
This will return the type used when the datapoint was created with the CreateDataPoint method.
| [in] | path | The datapoint path for which to fetch the type. |
type_info object corresponding to the type of the datapoint.
|
static |
Helper method to create an std::any buffer compatible with a specific datapoint.
This is used to prepare buffers for the BatchRequest::ReadDataPoint and BatchRequest::PartialReadDataPoint methods.
| [in] | metadata | The metadata fetched for a specific datapoint. |
|
protectedpure virtual |
| void rtctk::componentFramework::RepositoryIf::ReadDataPoint | ( | const DataPointPath & | path, |
| T & | buffer ) const |
Reads a datapoint from the repository.
Fetches the data for a datapoint from the repository and updates a local buffer in-place. If an error occurs then a rtctk::componentFramework::RtctkException is thrown.
| [in] | path | The path of the datapoint that should be fetched from the repository. |
| [in] | buffer | A reference to the local buffer that should be filled with the received data. |
| void rtctk::componentFramework::RepositoryIf::ReadDataPoints | ( | T &... | args | ) | const |
| RepositoryIf::BatchResponse rtctk::componentFramework::RepositoryIf::SendRequest | ( | const BatchRequest & | request | ) |
| RepositoryIf::BatchResponse rtctk::componentFramework::RepositoryIf::SendRequest | ( | const BatchRequest & | request | ) | const |
| void rtctk::componentFramework::RepositoryIf::SetDataPoint | ( | const DataPointPath & | path, |
| const char * | value ) |
| void rtctk::componentFramework::RepositoryIf::SetDataPoint | ( | const DataPointPath & | path, |
| const T & | value ) |
Sets a datapoint in the repository.
A new value for the datapoint is sent to the repository and updated. If an error occurs then a rtctk::componentFramework::RtctkException is thrown.
| [in] | path | The path of the datapoint that should be updated in the repository. |
| [in] | value | The new data for the datapoint. |
|
static |
Converts an RTC datapoint type string to a type_info.
| [in] | arg | The RTC datapoint type name string, e.g. RtcString. |
| UnsupportedType | If the type was not found. |
| std::optional< T > rtctk::componentFramework::RepositoryIf::TryGetDataPoint | ( | const DataPointPath & | path | ) | const |
Fetches a datapoint from the repository.
If the datapoint exists, it is read from the repository and returned. If an error occurs then a rtctk::componentFramework::RtctkException is thrown.
| [in] | path | The path of the datapoint that should be fetched from the repository. |
|
static |
Converts a type_info to an RTC datapoint type string.
| [in] | arg | The type_info to be resolved. |
| UnsupportedType | If the type was not found. |
| void rtctk::componentFramework::RepositoryIf::WriteDataPoint | ( | const DataPointPath & | path, |
| const char * | buffer ) |
| void rtctk::componentFramework::RepositoryIf::WriteDataPoint | ( | const DataPointPath & | path, |
| const T & | buffer ) |
Writes a datapoint to the repository.
Data is read from the buffer reference provided and sent to the repository to update the datapoint. If an error occurs then a rtctk::componentFramework::RtctkException is thrown.
This method is preferred over SetDataPoint for large vectors and matrices, since passing a reference to the buffer is more efficient.
| [in] | path | The path of the datapoint that should be updated in the repository. |
| [in] | buffer | A reference to the new data for the datapoint. |
| void rtctk::componentFramework::RepositoryIf::WriteDataPoints | ( | const T &... | args | ) |