Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
64 const std::type_info& type,
65 const std::function<
void()>& callback)
86 template <
typename T,
typename F>
88 template <
typename T,
typename F>
90 inline const std::vector<Parameters>&
GetParams()
const {
95 std::vector<Parameters> m_params;
108 explicit Response(std::future<void>&& future) noexcept;
138 bool Wait(
const std::chrono::seconds timeout);
144 std::future<void> m_future;
182 template <
typename T>
184 template <
typename T>
265 template <
typename T>
267 template <
typename T>
269 template <
typename T>
271 template <
typename T>
339 template <
typename T>
341 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer),
nullptr));
353 template <
typename T>
355 m_params.push_back(
Parameters(path,
const_cast<T*
>(&buffer),
typeid(buffer),
nullptr));
383 template <
typename T,
typename F>
388 auto callback = [handler, &buffer]() ->
void { handler(buffer); };
389 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer), callback));
415 template <
typename T,
typename F>
417 auto callback = [handler, &buffer]() ->
void { handler(buffer); };
418 m_params.push_back(
Parameters(path,
const_cast<T*
>(&buffer),
typeid(buffer), callback));
431 template <
typename T>
447 template <
typename T>
449 CreateDataPoint<T>(path);
467 template <
typename T>
488 template <
typename T>
507 template <
typename T>
510 request.
Add(path, buffer);
532 template <
typename T>
535 request.
Add(path, buffer);
549 #endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
void SetDataPoint(const DataPointPath &path, const T value)
Sets a datapoint in the repository.
Definition: repositoryIf.hpp:489
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition: repositoryIf.hpp:468
virtual Response SendWriteRequest(const Request &request)=0
Sends a request to write data to the repository.
A request object to pass information about datapoints that should be read (written) from (to) the rep...
Definition: repositoryIf.hpp:45
std::function< void()> m_callback
The callback function to invoke when a datapoint is received.
Definition: repositoryIf.hpp:79
Definition: commandReplier.cpp:20
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:62
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.
Declaration of the MatrixBuffer template class used in APIs.
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:90
void * m_buffer
The buffer of data to read (write) for a write (read) request.
Definition: repositoryIf.hpp:73
virtual void DeleteDataPoint(const DataPointPath &path)=0
Deletes a datapoint.
DataPointPath m_path
The datapoint path to read or write.
Definition: repositoryIf.hpp:70
std::vector< std::string > StringList
Definition: repositoryIf.hpp:37
void Add(const DataPointPath &path, T &buffer)
Adds a datapoint to the request for reading.
Definition: repositoryIf.hpp:340
void Wait()
Waits for the request sent to the repository to complete.
Definition: repositoryIf.cpp:30
Abstract interface providing basic read and write facilities to a repository.
Definition: repositoryIf.hpp:35
virtual std::pair< StringList, StringList > GetChildren(const DataPointPath &path) const =0
Queries the datapoints and child paths for a given path.
Response & operator=(Response &&other) noexcept
Definition: repositoryIf.cpp:25
Response(std::future< void > &&future) noexcept
Definition: repositoryIf.cpp:17
void ReadDataPoint(const DataPointPath &path, T &buffer) const
Reads a datapoint from the repository.
Definition: repositoryIf.hpp:508
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition: repositoryIf.hpp:533
A structure to hold the arguments passed with one of the Add methods.
Definition: repositoryIf.hpp:50
const std::type_info & m_type
This stores the type information for the buffer.
Definition: repositoryIf.hpp:76
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 RepositoryIf and related base classes.
virtual Response SendReadRequest(const Request &request) const =0
Sends a request to read data from the repository.
This class provides a wraper for DataPoint paths which ensures that they only contain valid character...
Definition: dataPointPath.hpp:34
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:106
virtual ~RepositoryIf()
Definition: repositoryIf.cpp:43