13#ifndef RTCTK_COMPONENTFRAMEWORK_TEST_FAKEREPOSITORYIF_HPP
14#define RTCTK_COMPONENTFRAMEWORK_TEST_FAKEREPOSITORYIF_HPP
20#include <unordered_map>
83 template <
typename R,
typename F>
84 Response ProcessRequest(
const R& request, F selector)
const;
90 static std::size_t GetDataPointSizeImpl(
const std::any& data);
100 template <
typename T>
101 static auto MakeMapEntry();
103 using IoFunctionMap = std::unordered_map<std::type_index, IoFunctionMapEntry>;
106 static const IoFunctionMap S_IO_FUNCTIONS;
This class provides a wrapper for a data point path.
Definition: dataPointPath.hpp:73
A request object to pass information about datapoints that should be read from the repository.
Definition: repositoryIf.hpp:49
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:197
A request object to pass information about datapoints that should be written to the repository.
Definition: repositoryIf.hpp:122
Abstract interface providing basic read and write facilities to a repository.
Definition: repositoryIf.hpp:38
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
Implementation of an in-memory fake repository for testing.
Definition: fakeRepositoryIf.hpp:31
virtual void PreDeleteDataPointHook(const DataPointPath &) const
Hook that is run before a DataPoint is deleted with the given DataPointPath.
Definition: fakeRepositoryIf.hpp:52
virtual void PostWriteDataPointHook(const DataPointPath &) const
Hook that is run after a DataPoint is created with the given DataPointPath.
Definition: fakeRepositoryIf.hpp:59
Response SendReadRequest(const ReadRequest &) const override
Sends a request to read data from the repository.
Definition: fakeRepositoryIf.cpp:99
static const IoFunctionMapEntry & GetIoFunctions(const std::type_info &type)
Definition: fakeRepositoryIf.cpp:228
const std::type_info & GetDataPointType(const DataPointPath &) const override
Fetches the type of the datapoint.
Definition: fakeRepositoryIf.cpp:41
Response SendWriteRequest(const WriteRequest &) override
Sends a request to write data to the repository.
Definition: fakeRepositoryIf.cpp:103
virtual void PostCreateDataPointHook(const DataPointPath &) const
Hook that is run after a DataPoint is created with the given DataPointPath.
Definition: fakeRepositoryIf.hpp:49
virtual void PreWriteDataPointHook(const DataPointPath &) const
Hook that is run before a DataPoint is written to with the given DataPointPath.
Definition: fakeRepositoryIf.hpp:57
virtual void PreCreateDataPointHook(const DataPointPath &) const
Hook that is run before a DataPoint is created with the given DataPointPath.
Definition: fakeRepositoryIf.hpp:47
std::size_t GetDataPointSize(const DataPointPath &) const override
Fetches the size of the datapoint's data.
Definition: fakeRepositoryIf.cpp:50
virtual void PostDeleteDataPointHook(const DataPointPath &) const
Hook that is run after a DataPoint is deleted with the given DataPointPath.
Definition: fakeRepositoryIf.hpp:54
bool DataPointExists(const DataPointPath &) const override
Checks for the existence of a datapoint in the repository.
Definition: fakeRepositoryIf.cpp:60
std::mutex m_mutex
Mutex for synchronising access to m_datapoints.
Definition: fakeRepositoryIf.hpp:80
std::map< DataPointPath, std::any > DataPointMap
Definition: fakeRepositoryIf.hpp:44
void DeleteDataPoint(const DataPointPath &) override
Deletes a datapoint.
Definition: fakeRepositoryIf.cpp:28
void CreateDataPoint(const DataPointPath &, const std::type_info &) override
Creates a new datapoint in the repository with a specified type.
Definition: fakeRepositoryIf.cpp:19
std::pair< PathList, PathList > GetChildren(const DataPointPath &) const override
Queries the datapoints and child paths for a given path.
Definition: fakeRepositoryIf.cpp:66
DataPointMap m_datapoints
A map storing the datapoint data in memory.
Definition: fakeRepositoryIf.hpp:62
Definition: fakeClock.cpp:15
Header file for RepositoryIf and related base classes.
Structure defining the contents of an entry in the IoFunctionMap.
Definition: fakeRepositoryIf.hpp:65
std::function< void(DataPointMap &, const DataPointPath &)> CreateFunction
Definition: fakeRepositoryIf.hpp:66
WriteFunction m_write_function
Definition: fakeRepositoryIf.hpp:74
std::function< void(const DataPointMap &, const DataPointPath &, void *)> ReadFunction
Definition: fakeRepositoryIf.hpp:68
SizeFunction m_size_function
Definition: fakeRepositoryIf.hpp:72
std::function< void(DataPointMap &, const DataPointPath &, const void *)> WriteFunction
Definition: fakeRepositoryIf.hpp:69
std::function< std::size_t(const std::any &)> SizeFunction
Definition: fakeRepositoryIf.hpp:67
CreateFunction m_create_function
Definition: fakeRepositoryIf.hpp:71
ReadFunction m_read_function
Definition: fakeRepositoryIf.hpp:73