RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
rtctk::componentFramework::test::MockRepository Class Reference

A GoogleTest mock of RepositoryIf. More...

#include <rtctk/componentFramework/test/mockRepository.hpp>

Inheritance diagram for rtctk::componentFramework::test::MockRepository:
rtctk::componentFramework::test::FakeRepository rtctk::componentFramework::RepositoryIf rtctk::componentFramework::test::MockPersistentRepoIf

Public Member Functions

 MockRepository ()
 
 MOCK_METHOD (void, CreateDataPoint,(const DataPointPath &, const std::type_info &),(override))
 
 MOCK_METHOD (void, DeleteDataPointLegacy,(const DataPointPath &),(override))
 
 MOCK_METHOD (const std::type_info &, GetDataPointTypeLegacy,(const DataPointPath &),(const override))
 
 MOCK_METHOD (std::size_t, GetDataPointSizeLegacy,(const DataPointPath &),(const override))
 
 MOCK_METHOD (bool, DataPointExistsLegacy,(const DataPointPath &),(const override))
 
 MOCK_METHOD ((std::pair< PathList, PathList >), GetChildrenLegacy,(const DataPointPath &),(const override))
 
 MOCK_METHOD (Response, SendReadRequest,(const ReadRequest &),(const override))
 
 MOCK_METHOD (Response, SendWriteRequest,(const WriteRequest &),(override))
 
 MOCK_METHOD (void, CreateDataPointRequest,(const DataPointPath &))
 
 MOCK_METHOD (void, DeleteDataPointRequest,(const DataPointPath &))
 
 MOCK_METHOD (void, GetDataPointTypeRequest,(const DataPointPath &),(const))
 
 MOCK_METHOD (void, GetDataPointSizeRequest,(const DataPointPath &),(const))
 
 MOCK_METHOD (void, DataPointExistsRequest,(const DataPointPath &),(const))
 
 MOCK_METHOD (void, ReceivedReadRequest,(const DataPointPath &),(const))
 
 MOCK_METHOD (void, ReceivedWriteRequest,(const DataPointPath &))
 
template<typename T >
void CreateDataPoint (const DataPointPath &path)
 Creates a new datapoint in the repository.
 
template<typename T >
void CreateDataPoint (const DataPointPath &path, const T &initial_value)
 Creates a new datapoint in the repository with an initial value.
 
void CreateDataPoint (const DataPointPath &path, const char *initial_value)
 
virtual void CreateDataPoint (const DataPointPath &path, const std::type_info &type)
 Creates a new datapoint in the repository with a specified type.
 
- Public Member Functions inherited from rtctk::componentFramework::test::FakeRepository
 FakeRepository ()
 
virtual ~FakeRepository ()
 
template<typename T >
Lut::TableEntries BindTypeHandlers ()
 
- Public Member Functions inherited from rtctk::componentFramework::RepositoryIf
 RepositoryIf ()=default
 
virtual ~RepositoryIf ()=default
 
BatchResponse SendRequest (const BatchRequest &request)
 
BatchResponse SendRequest (const BatchRequest &request) const
 
template<typename T >
void CreateDataPoint (const DataPointPath &path)
 Creates a new datapoint in the repository.
 
template<typename T >
void CreateDataPoint (const DataPointPath &path, const T &initial_value)
 Creates a new datapoint in the repository with an initial value.
 
void CreateDataPoint (const DataPointPath &path, const char *initial_value)
 
void DeleteDataPoint (const DataPointPath &path, bool recurse=false)
 Deletes a datapoint.
 
const std::type_info & GetDataPointType (const DataPointPath &path) const
 Fetches the type of the datapoint.
 
size_t GetDataPointSize (const DataPointPath &path) const
 Fetches the size of the datapoint's data.
 
RtcVectorUInt64 GetDataPointShape (const DataPointPath &path) const
 Fetches the shape of the datapoint's data.
 
bool DataPointExists (const DataPointPath &path) const
 Checks for the existence of a datapoint in the repository.
 
std::pair< PathList, PathListGetChildren (const DataPointPath &path, bool recurse=false) const
 Queries the child datapoints and paths for a given parent path.
 
template<typename T >
GetDataPoint (const DataPointPath &path) const
 Fetches a datapoint from the repository.
 
template<typename T >
void SetDataPoint (const DataPointPath &path, const T &value)
 Sets a datapoint in the repository.
 
void SetDataPoint (const DataPointPath &path, const char *value)
 
template<typename T >
void ReadDataPoint (const DataPointPath &path, T &buffer) const
 Reads a datapoint from the repository.
 
template<typename T >
void WriteDataPoint (const DataPointPath &path, const T &buffer)
 Writes a datapoint to the repository.
 
void WriteDataPoint (const DataPointPath &path, const char *buffer)
 
template<typename... T>
void WriteDataPoints (const T &... args)
 
template<typename... T>
void ReadDataPoints (T &... args) const
 
virtual Response SendReadRequest (const ReadRequest &request) const
 Sends a request to read data from the repository.
 
virtual Response SendWriteRequest (const WriteRequest &request)
 Sends a request to write data to the repository.
 

Protected Member Functions

BatchResponse ProcessRequests (const RequestList &requests) override
 
- Protected Member Functions inherited from rtctk::componentFramework::test::FakeRepository
template<typename T >
void CreateImpl (detail::CreateRequest< T > &req)
 
template<typename T >
void ReadImpl (detail::ReadRequest< T > &req)
 
template<typename T >
void WriteImpl (detail::WriteRequest< T > &req)
 
template<typename T >
void PartialReadImpl (detail::PartialReadRequest< T > &req)
 
template<typename T >
void PartialWriteImpl (detail::PartialWriteRequest< T > &req)
 
void ReadMetaDataImpl (detail::ReadMetaDataRequest &req)
 
void WriteMetaDataImpl (detail::WriteMetaDataRequest &req)
 
void DeleteImpl (detail::DeleteRequest &req)
 
void ExistsImpl (detail::ExistsRequest &req)
 
std::pair< PathList, PathListGetChildrenImpl (const DataPointPath &path)
 
std::pair< PathList, PathListGetChildrenRecursive (const DataPointPath &path)
 
void GetChildrenImpl (detail::GetChildrenRequest &req)
 
void CreateLinkImpl (detail::CreateSymlinkRequest &req)
 
void UpdateLinkImpl (detail::UpdateSymlinkRequest &req)
 
template<typename Request >
void InvokeCallback (const Request &req) const
 
template<typename T >
void ReadData (Data &data_node, const DataPointPath &path, gsl::span< T > &data, std::optional< std::reference_wrapper< MetaData > > &metadata, size_t offset)
 
template<typename T >
void WriteData (const DataPointPath &path, const gsl::span< const T > &data, const MetaData &metadata, size_t offset)
 
void ReadMetaData (const DataPointPath &path, MetaData &metadata, bool check_sequence_id=false)
 
void WriteMetaData (Data &data_node, const MetaData &metadata)
 
DataPointPath ResolvePath (const DataPointPath &path)
 
DataCreateNewDataNode (const DataPointPath &path)
 
DataGetDataNode (const DataPointPath &path)
 
void CheckDataNodeExists (const DataPointPath &path)
 
virtual void InvokeRequestHandler (std::any &request)
 
- Protected Member Functions inherited from rtctk::componentFramework::RepositoryIf
virtual void DeleteDataPointLegacy (const DataPointPath &path)
 Deletes a datapoint.
 
virtual const std::type_info & GetDataPointTypeLegacy (const DataPointPath &path) const
 Fetches the type of the datapoint.
 
virtual size_t GetDataPointSizeLegacy (const DataPointPath &path) const
 Fetches the size of the datapoint's data.
 
virtual bool DataPointExistsLegacy (const DataPointPath &path) const
 Checks for the existence of a datapoint in the repository.
 
virtual std::pair< PathList, PathListGetChildrenLegacy (const DataPointPath &path) const
 Queries the datapoints and child paths for a given path.
 

Additional Inherited Members

- Public Types inherited from rtctk::componentFramework::RepositoryIf
using PathList = std::vector<DataPointPath>
 
using Clock = taiclock::TaiClock
 
using Timestamp = Clock::time_point
 
using CallbackType = std::function<void(const DataPointPath&)>
 Signature of the callback functions that can be registered with the repository requests.
 
- Static Public Member Functions inherited from rtctk::componentFramework::RepositoryIf
static const std::type_info & StringToType (const std::string &arg)
 Converts an RTC type string to a type_info.
 
static std::string TypeToString (const std::type_info &arg)
 Converts a type_info to an RTC type string.
 
- Protected Types inherited from rtctk::componentFramework::RepositoryIf
using RequestList = std::vector<std::any>
 
- Static Protected Member Functions inherited from rtctk::componentFramework::test::FakeRepository
template<typename T >
static RequestDispatcher< FakeRepository >::TableEntries BindTypeHandlers ()
 
- Protected Attributes inherited from rtctk::componentFramework::test::FakeRepository
std::mutex m_mutex
 Mutex for synchronising access to m_data.
 
std::map< DataPointPath, Datam_data
 
- Static Protected Attributes inherited from rtctk::componentFramework::test::FakeRepository
static const RequestDispatcher< FakeRepositoryS_REQUEST_DISPATCHER
 

Detailed Description

A GoogleTest mock of RepositoryIf.

Constructor & Destructor Documentation

◆ MockRepository()

rtctk::componentFramework::test::MockRepository::MockRepository ( )
inline

Member Function Documentation

◆ CreateDataPoint() [1/4]

template<typename T >
void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( const DataPointPath & path)

Creates a new datapoint in the repository.

The type of the datapoint is derived from the template argument type.

Template Parameters
TThe type of the datapoint to create. See RepositoryIf::CreateDataPoint for a list of supported types.
Parameters
[in]pathThe datapoint path that should be created.
Thread Safety
thread-safe
Exception Safety
basic

◆ CreateDataPoint() [2/4]

void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( const DataPointPath & path,
const char * initial_value )

◆ CreateDataPoint() [3/4]

void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( const DataPointPath & path,
const std::type_info & type )
virtual

Creates a new datapoint in the repository with a specified type.

Parameters
[in]pathThe datapoint path that should be created.
[in]typeA type identifier object returned by typeid indicating the type of the new datapoint. Supported values are indicated below.

The following are the supported values for the type argument:

  • typeid(bool)
  • typeid(int32_t)
  • typeid(int64_t)
  • typeid(float)
  • typeid(double)
  • typeid(std::string)
  • typeid(std::vector<bool>)
  • typeid(std::vector<int32_t>)
  • typeid(std::vector<int64_t>)
  • typeid(std::vector<float>)
  • typeid(std::vector<double>)
  • typeid(std::vector<std::string>)
  • typeid(MatrixBuffer<bool>)
  • typeid(MatrixBuffer<int32_t>)
  • typeid(MatrixBuffer<int64_t>)
  • typeid(MatrixBuffer<float>)
  • typeid(MatrixBuffer<double>)
  • typeid(MatrixBuffer<std::string>)
Thread Safety
thread-safe
Exception Safety
basic
Deprecated
Use version that takes a default value instead.

Reimplemented from rtctk::componentFramework::RepositoryIf.

◆ CreateDataPoint() [4/4]

template<typename T >
void rtctk::componentFramework::RepositoryIf::CreateDataPoint ( const DataPointPath & path,
const T & initial_value )

Creates a new datapoint in the repository with an initial value.

The type of the datapoint is derived from the template argument type.

Template Parameters
TThe type of the datapoint to create. See RepositoryIf::CreateDataPoint for a list of supported types.
Parameters
[in]pathThe datapoint path that should be created.
[in]initial_valueThe initial value that should be set for the new datapoint.
Thread Safety
thread-safe
Exception Safety
basic

◆ MOCK_METHOD() [1/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( (std::pair< PathList, PathList >) ,
GetChildrenLegacy ,
(const DataPointPath &) ,
(const override)  )

◆ MOCK_METHOD() [2/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( bool ,
DataPointExistsLegacy ,
(const DataPointPath &) ,
(const override)  )

◆ MOCK_METHOD() [3/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( const std::type_info & ,
GetDataPointTypeLegacy ,
(const DataPointPath &) ,
(const override)  )

◆ MOCK_METHOD() [4/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( Response ,
SendReadRequest ,
(const ReadRequest &) ,
(const override)  )

◆ MOCK_METHOD() [5/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( Response ,
SendWriteRequest ,
(const WriteRequest &) ,
(override)  )

◆ MOCK_METHOD() [6/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( std::size_t ,
GetDataPointSizeLegacy ,
(const DataPointPath &) ,
(const override)  )

◆ MOCK_METHOD() [7/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
CreateDataPoint ,
(const DataPointPath &, const std::type_info &) ,
(override)  )

◆ MOCK_METHOD() [8/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
CreateDataPointRequest ,
(const DataPointPath &)  )

◆ MOCK_METHOD() [9/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
DataPointExistsRequest ,
(const DataPointPath &) ,
(const)  )

◆ MOCK_METHOD() [10/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
DeleteDataPointLegacy ,
(const DataPointPath &) ,
(override)  )

◆ MOCK_METHOD() [11/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
DeleteDataPointRequest ,
(const DataPointPath &)  )

◆ MOCK_METHOD() [12/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
GetDataPointSizeRequest ,
(const DataPointPath &) ,
(const)  )

◆ MOCK_METHOD() [13/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
GetDataPointTypeRequest ,
(const DataPointPath &) ,
(const)  )

◆ MOCK_METHOD() [14/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
ReceivedReadRequest ,
(const DataPointPath &) ,
(const)  )

◆ MOCK_METHOD() [15/15]

rtctk::componentFramework::test::MockRepository::MOCK_METHOD ( void ,
ReceivedWriteRequest ,
(const DataPointPath &)  )

◆ ProcessRequests()

BatchResponse rtctk::componentFramework::test::MockRepository::ProcessRequests ( const RequestList & requests)
inlineoverrideprotectedvirtual

The documentation for this class was generated from the following file: