Go to the documentation of this file. 1 #ifndef MOCKRUNTIMEREPO_HPP
2 #define MOCKRUNTIMEREPO_HPP
4 #include <gmock/gmock.h>
8 using ::testing::HasSubstr;
9 using ::testing::InSequence;
10 using ::testing::Return;
11 using ::testing::SetArgPointee;
36 if(req.m_type == std::type_index(
typeid(
bool)))
37 ReadBool(req.m_path, (
bool*)req.m_buffer);
38 else if(req.m_type == std::type_index(
typeid(
int32_t)))
39 ReadInt(req.m_path, (
int32_t*)req.m_buffer);
40 else if(req.m_type == std::type_index(
typeid(
float)))
41 ReadFloat(req.m_path, (
float*)req.m_buffer);
42 else if(req.m_type == std::type_index(
typeid(
double)))
43 ReadDouble(req.m_path, (
double*)req.m_buffer);
44 else if(req.m_type == std::type_index(
typeid(std::vector<float>)))
45 ReadVectorFloat(req.m_path, (std::vector<float>*)req.m_buffer);
49 ReadVoid(req.m_path, req.m_buffer);
59 if(req.m_type == std::type_index(
typeid(
bool)))
60 WriteBool(req.m_path, *(
bool*)req.m_buffer);
61 else if(req.m_type == std::type_index(
typeid(
int32_t)))
62 WriteInt(req.m_path, *(
int32_t*)req.m_buffer);
63 else if(req.m_type == std::type_index(
typeid(
float)))
64 WriteFloat(req.m_path, *(
float*)req.m_buffer);
65 else if(req.m_type == std::type_index(
typeid(
double)))
66 WriteDouble(req.m_path, *(
double*)req.m_buffer);
67 else if(req.m_type == std::type_index(
typeid(std::vector<float>)))
68 WriteVectorFloat(req.m_path, *(std::vector<float>*)req.m_buffer);
72 WriteVoid(req.m_path, req.m_buffer);
MOCK_CONST_METHOD2(WriteVectorFloat, void(const DataPointPath &path, std::vector< float >))
Response SendReadRequest(const Request &request) const override
Sends a request to read data from the repository.
Definition: mockRunTimeRepo.hpp:33
void Subscribe(const Subscription &subscription) const override
Definition: mockRunTimeRepo.hpp:79
A request object to pass information about datapoints that should be read (written) from (to) the rep...
Definition: repositoryIf.hpp:37
MOCK_CONST_METHOD2(ReadDouble, void(const DataPointPath &path, double *))
Definition: rtcComponent.hpp:17
MOCK_CONST_METHOD2(WriteVoid, void(const DataPointPath &path, void *))
Definition: runtimeRepoApiIf.hpp:21
Declaration of the MatrixBuffer template class used in APIs.
string path
Definition: rtctkExampleDataTaskRobotTest.py:228
MOCK_CONST_METHOD2(WriteMatrixFloat, void(const DataPointPath &path, MatrixBuffer< float > &))
std::pair< StringList, StringList > GetChildren(const DataPointPath &path) const override
Queries the datapoints and child paths for a given path.
Definition: mockRunTimeRepo.hpp:29
Definition: mockRunTimeRepo.hpp:20
const std::vector< Parameters > & GetParams() const
Definition: repositoryIf.hpp:62
MOCK_CONST_METHOD2(ReadVectorFloat, void(const DataPointPath &path, std::vector< float > *))
MOCK_CONST_METHOD2(ReadBool, void(const DataPointPath &path, bool *))
MOCK_CONST_METHOD2(ReadFloat, void(const DataPointPath &path, float *))
MOCK_CONST_METHOD2(ReadInt, void(const DataPointPath &path, int32_t *))
std::vector< std::string > StringList
Definition: repositoryIf.hpp:30
MOCK_CONST_METHOD2(WriteFloat, void(const DataPointPath &path, float))
MOCK_CONST_METHOD2(ReadVoid, void(const DataPointPath &path, void *))
virtual ~MockRuntimeRepo()
Definition: mockRunTimeRepo.hpp:23
Definition: runtimeRepoApiIf.hpp:59
void CreateDataPoint(const DataPointPath &path, const std::string &type) override
Creates a new datapoint in the repository with a specified type.
Definition: mockRunTimeRepo.hpp:24
MockRuntimeRepo()
Definition: mockRunTimeRepo.hpp:22
rtctk::componentFramework::RepositoryIf::Response Response
Definition: testFileRepository.cpp:15
void DeleteDataPoint(const DataPointPath &path) override
Deletes a datapoint.
Definition: mockRunTimeRepo.hpp:25
size_t GetDataPointSize(const DataPointPath &path) const override
Fetches the size of the datapoint's data.
Definition: mockRunTimeRepo.hpp:27
std::string GetDataPointType(const DataPointPath &path) const override
Fetches the type of the datapoint.
Definition: mockRunTimeRepo.hpp:26
MOCK_CONST_METHOD2(WriteInt, void(const DataPointPath &path, int))
void Unsubscribe(const Subscription &subscription) const override
Definition: mockRunTimeRepo.hpp:80
Header file for RuntimeRepoApiIf, which defines the API for RuntimeRepoAdapters.
int int32_t
Definition: mudpi.h:17
MOCK_CONST_METHOD2(WriteBool, void(const DataPointPath &path, bool))
Definition: dataPointPath.hpp:30
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:74
bool DataPointExists(const DataPointPath &path) const override
Checks for the existence of a datapoint in the repository.
Definition: mockRunTimeRepo.hpp:28
MOCK_CONST_METHOD2(ReadMatrixFloat, void(const DataPointPath &path, MatrixBuffer< float > *))
Definition: matrixBuffer.hpp:19
Response SendWriteRequest(const Request &request) override
Sends a request to write data to the repository.
Definition: mockRunTimeRepo.hpp:56
MOCK_CONST_METHOD2(WriteDouble, void(const DataPointPath &path, double))