Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
15 #include <mal/utility/Uri.hpp>
21 #include <unordered_map>
68 const elt::mal::Uri& uri,
135 template <
typename R,
typename F>
136 Response ProcessRequest(
const R& request, F dispatch)
const;
143 virtual ~IoFunctions() =
default;
148 void* buffer)
const = 0;
151 const void* buffer)
const = 0;
166 template <
typename T>
167 class IoFunctionsImpl :
public IoFunctions {
169 IoFunctionsImpl(
const std::string& yaml_type) : m_yaml_type(yaml_type){};
170 virtual ~IoFunctionsImpl() =
default;
172 const DataPointPath& path)
const override;
174 const DataPointPath& path,
175 void* buffer)
const override;
177 const DataPointPath& path,
178 const void* buffer)
const override;
181 std::string m_yaml_type;
184 using IoFunctionMap = std::unordered_map<std::type_index, std::shared_ptr<IoFunctions>>;
191 template <
typename T>
192 static auto MakeMapEntry(
const std::string& yaml_type);
194 using TypeMap = std::unordered_map<std::string, const std::type_info&>;
200 mutable std::mutex m_mutex;
203 PathMapper m_path_mapper;
206 static const TypeMap S_TYPE_MAP;
212 static const IoFunctionMap S_IO_FUNCTIONS;
217 #endif // RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
Exception indicating a general CII configuration service error.
Definition: persistentRepoAdapter.hpp:57
Provides macros and utilities for exception handling.
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
Definition: persistentRepoIf.hpp:19
PersistentRepoAdapter(PersistentRepoAdapter &&)=default
Objects of this class can be moved.
A request object to pass information about datapoints that should be read from the repository.
Definition: repositoryIf.hpp:44
Exception indicating that validation checks of a CII configuration document failed.
Definition: persistentRepoAdapter.hpp:65
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
Header file declaring PathMapper.
PersistentRepoAdapter & operator=(const PersistentRepoAdapter &)=delete
This class cannot be copy assigned.
Implements the Persistent Configuration Repository adapter that uses the CII configuration service as...
Definition: persistentRepoAdapter.hpp:50
Definition: commandReplier.cpp:20
The RtctkException class is the base class for all Rtctk exceptions.
Definition: exceptions.hpp:207
bool DataPointExists(const DataPointPath &path) const override
Checks for the existence of a datapoint in the repository.
Definition: persistentRepoAdapter.cpp:527
const std::type_info & GetDataPointType(const DataPointPath &path) const override
Fetches the type of the datapoint.
Definition: persistentRepoAdapter.cpp:401
Response SendWriteRequest(const WriteRequest &request) override
Sends a request to write data to the repository.
Definition: persistentRepoAdapter.cpp:630
Response SendReadRequest(const ReadRequest &request) const override
Sends a request to read data from the repository.
Definition: persistentRepoAdapter.cpp:623
A request object to pass information about datapoints that should be written to the repository.
Definition: repositoryIf.hpp:115
Exception indicating a datapoint path does not exist.
Definition: persistentRepoAdapter.hpp:75
PersistentRepoAdapter()=delete
Do not allow construction with no arguments.
void ReadDataPoint(const DataPointPath &path, T &buffer) const
Reads a datapoint from the repository.
Definition: repositoryIf.hpp:592
Declaration of FileRepository that provides a simple file based repository.
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition: repositoryIf.hpp:617
ServiceFailureException(const DataPointPath &path)
Definition: persistentRepoAdapter.cpp:231
virtual ~PersistentRepoAdapter()=default
PersistentRepoAdapter(const PersistentRepoAdapter &)=delete
This class cannot be copy constructed.
std::pair< PathList, PathList > GetChildren(const DataPointPath &path) const override
Queries the datapoints and child paths for a given path.
Definition: persistentRepoAdapter.cpp:549
PathMissingException(const DataPointPath &path)
Definition: persistentRepoAdapter.cpp:246
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
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::size_t GetDataPointSize(const DataPointPath &path) const override
Fetches the size of the datapoint's data.
Definition: persistentRepoAdapter.cpp:433
InvalidDocumentException(const DataPointPath &path, const elt::mal::Uri &uri, const std::string &message)
Definition: persistentRepoAdapter.cpp:237
PersistentRepoAdapter & operator=(PersistentRepoAdapter &&)=default
Objects of this class can be moved with the move assignment operator.
void DeleteDataPoint(const DataPointPath &path) override
Deletes a datapoint.
Definition: persistentRepoAdapter.cpp:286