Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
62 const std::type_info&
type,
63 const std::function<
void()>& callback)
64 : m_path(path), m_buffer(buffer), m_type(&
type), m_callback(callback) {
73 inline const std::type_info&
GetType()
const {
88 const std::type_info* m_type;
91 std::function<void()> m_callback;
96 template <
typename T,
typename F>
98 inline const std::vector<Parameters>&
GetParams()
const {
106 std::vector<Parameters> m_params;
133 const std::type_info&
type,
134 const std::function<
void()>& callback)
135 : m_path(path), m_buffer(buffer), m_type(&
type), m_callback(callback) {
144 inline const std::type_info&
GetType()
const {
156 const void* m_buffer;
159 const std::type_info* m_type;
162 std::function<void()> m_callback;
165 template <
typename T>
167 template <
typename T,
typename F>
169 inline const std::vector<Parameters>&
GetParams()
const {
177 std::vector<Parameters> m_params;
190 explicit Response(std::future<void>&& future) noexcept;
219 bool Wait(
const std::chrono::microseconds& timeout);
225 std::future<void> m_future;
263 template <
typename T>
265 template <
typename T>
346 template <
typename T>
348 template <
typename T>
350 template <
typename T>
352 template <
typename T>
420 template <
typename T>
422 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer),
nullptr));
450 template <
typename T,
typename F>
455 auto callback = [handler, &buffer]() ->
void { handler(buffer); };
456 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer), callback));
468 template <
typename T>
470 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer),
nullptr));
497 template <
typename T,
typename F>
499 auto callback = [handler, &buffer]() ->
void { handler(buffer); };
500 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer), callback));
514 template <
typename T>
531 template <
typename T>
533 CreateDataPoint<T>(path);
551 template <
typename T>
572 template <
typename T>
591 template <
typename T>
594 request.
Add(path, buffer);
616 template <
typename T>
619 request.
Add(path, buffer);
633 #endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
const std::type_info & GetType() const
Definition: repositoryIf.hpp:73
void SetDataPoint(const DataPointPath &path, const T value)
Sets a datapoint in the repository.
Definition: repositoryIf.hpp:573
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition: repositoryIf.hpp:552
void Add(const DataPointPath &path, const T &buffer)
Adds a datapoint to the request for writing.
Definition: repositoryIf.hpp:469
std::vector< Parameters > & GetParams()
Definition: repositoryIf.hpp:172
A request object to pass information about datapoints that should be read from the repository.
Definition: repositoryIf.hpp:44
const std::type_info & GetType() const
Definition: repositoryIf.hpp:144
virtual Response SendReadRequest(const ReadRequest &request) const =0
Sends a request to read data from the repository.
void * GetBuffer() const
Definition: repositoryIf.hpp:70
Definition: commandReplier.cpp:20
Declaration of the MatrixSpan template class used in APIs.
virtual bool DataPointExists(const DataPointPath &path) const =0
Checks for the existence of a datapoint in the repository.
virtual const std::type_info & GetDataPointType(const DataPointPath &path) const =0
Fetches the type of the datapoint.
Parameters(const DataPointPath &path, void *buffer, const std::type_info &type, const std::function< void()> &callback)
Allows to explicitly construct a complete parameters structure.
Definition: repositoryIf.hpp:60
Declaration of the MatrixBuffer template class used in APIs.
Parameters(const DataPointPath &path, const void *buffer, const std::type_info &type, const std::function< void()> &callback)
Allows to explicitly construct a complete parameters structure.
Definition: repositoryIf.hpp:131
virtual std::pair< PathList, PathList > GetChildren(const DataPointPath &path) const =0
Queries the datapoints and child paths for a given path.
virtual size_t GetDataPointSize(const DataPointPath &path) const =0
Fetches the size of the datapoint's data.
const std::vector< Parameters > & GetParams() const
Definition: repositoryIf.hpp:169
A request object to pass information about datapoints that should be written to the repository.
Definition: repositoryIf.hpp:115
void Add(const DataPointPath &path, T &buffer)
Adds a datapoint to the request for reading.
Definition: repositoryIf.hpp:421
virtual void DeleteDataPoint(const DataPointPath &path)=0
Deletes a datapoint.
const void * GetBuffer() const
Definition: repositoryIf.hpp:141
void Wait()
Waits for the request that was sent to the repository to complete.
Definition: repositoryIf.cpp:31
Abstract interface providing basic read and write facilities to a repository.
Definition: repositoryIf.hpp:34
Response & operator=(Response &&other) noexcept
Definition: repositoryIf.cpp:25
Response(std::future< void > &&future) noexcept
Definition: repositoryIf.cpp:17
A structure to hold the arguments passed with one of the Add methods.
Definition: repositoryIf.hpp:49
const std::function< void()> & GetCallback() const
Definition: repositoryIf.hpp:147
const DataPointPath & GetPath() const
Definition: repositoryIf.hpp:67
void ReadDataPoint(const DataPointPath &path, T &buffer) const
Reads a datapoint from the repository.
Definition: repositoryIf.hpp:592
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition: repositoryIf.hpp:617
const DataPointPath & GetPath() const
Definition: repositoryIf.hpp:138
std::vector< DataPointPath > PathList
Definition: repositoryIf.hpp:36
const std::vector< Parameters > & GetParams() const
Definition: repositoryIf.hpp:98
virtual Response SendWriteRequest(const WriteRequest &request)=0
Sends a request to write data to the repository.
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
Header file for DataPointPath.
This class provides a wrapper for a data point path.
Definition: dataPointPath.hpp:65
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:188
std::vector< Parameters > & GetParams()
Definition: repositoryIf.hpp:101
A structure to hold the arguments passed with one of the Add methods.
Definition: repositoryIf.hpp:120
virtual ~RepositoryIf()
Definition: repositoryIf.cpp:44
const std::function< void()> & GetCallback() const
Definition: repositoryIf.hpp:76