RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
runtimeRepoAdapter.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_COMPONENTFRAMEWORK_RUNTIMEREPOADAPTER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_RUNTIMEREPOADAPTER_HPP
15
19
21
22// forward declaration for internal usage
23class RtrClient;
24
31public:
32 inline static const std::string SUPPORTED_URI_SCHEME = "rtr";
33
36
39
42
45
48
55 explicit RuntimeRepoAdapter(const elt::mal::Uri& baseuri);
56
57 virtual ~RuntimeRepoAdapter();
58
59protected:
61
62 template <typename T>
64
65 template <typename T>
67
68 template <typename T>
70
71 template <typename T>
73
74 template <typename T>
76
79
85
89
90 virtual void InvokeRequestHandler(std::any&, RtrClient&);
92
93 std::string m_ip;
95 std::string m_topic;
96
98 mutable std::mutex m_mutex;
99
112
123
124 std::list<ValueSubscription> m_value_subscriptions;
125 std::list<CreateDeleteSubscription> m_create_delete_subscriptions;
126
127 // TODO: ideally we would not instantiate a concrete EventService here,
128 // but currently we cant get the abstract service interface from the service container,
129 // so how to solve this?
132 std::unique_ptr<EventSubscriberIf> m_event_subscriber;
133
134 using DispatchFunction = std::function<void(RuntimeRepoAdapter*, std::any&, RtrClient&)>;
135 using LookupTable = std::unordered_map<std::type_index, DispatchFunction>;
136 using TableEntry = typename LookupTable::value_type;
137
138 template <typename T>
139 static TableEntry Bind(void (RuntimeRepoAdapter::*method)(T&, RtrClient&));
140
142};
143
144} // namespace rtctk::componentFramework
145
146#endif // RTCTK_COMPONENTFRAMEWORK_RUNTIMEREPOADAPTER_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
Interface class for providing pub/sub facilities for JSON events.
Definition eventServiceIf.hpp:29
Implementation of low-level event service using CII MAL DDS as middleware.
Definition malDdsEventService.hpp:36
std::vector< std::any > RequestList
Definition repositoryIf.hpp:106
std::function< void(const DataPointPath &)> CallbackType
Signature of the callback functions that can be registered with the repository requests.
Definition repositoryIf.hpp:114
std::function< void(std::exception_ptr)> ErrorCallbackType
Definition repositorySubscriberIf.hpp:49
std::function< void(const DataPointPath &, const MetaData &)> NotifyCallbackType
Definition repositorySubscriberIf.hpp:48
size_t SubscriptionId
Definition repositorySubscriberIf.hpp:51
This internal class implements the basic communication and commands toward the server.
Definition runtimeRepoAdapter.cpp:53
Implementation of the Runtime Configuration Repository Adapter.
Definition runtimeRepoAdapter.hpp:30
void WriteImpl(detail::WriteRequest< T > &, RtrClient &)
Definition runtimeRepoAdapter.cpp:720
void CreateImpl(detail::CreateRequest< T > &, RtrClient &)
Definition runtimeRepoAdapter.cpp:703
void DeleteImpl(detail::DeleteRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:858
RuntimeRepoAdapter(RuntimeRepoAdapter &&)=default
Objects of this class can be moved.
std::list< CreateDeleteSubscription > m_create_delete_subscriptions
Definition runtimeRepoAdapter.hpp:125
RuntimeRepoAdapter & operator=(RuntimeRepoAdapter &&)=default
Objects of this class can be moved with the move assignment operator.
std::function< void(RuntimeRepoAdapter *, std::any &, RtrClient &)> DispatchFunction
Definition runtimeRepoAdapter.hpp:134
virtual ~RuntimeRepoAdapter()
Definition runtimeRepoAdapter.cpp:429
BatchResponse ProcessRequests(const RequestList &requests) override
Definition runtimeRepoAdapter.cpp:1069
RuntimeRepoAdapter()=delete
Do not allow construction with no arguments.
void GetChildrenImpl(detail::GetChildrenRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:874
void ReadMetaDataImpl(detail::ReadMetaDataRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:841
RuntimeRepoAdapter & operator=(const RuntimeRepoAdapter &)=delete
This class cannot be copy assigned.
void UpdateLinkImpl(detail::UpdateSymlinkRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:890
void ExistsImpl(detail::ExistsRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:866
typename LookupTable::value_type TableEntry
Definition runtimeRepoAdapter.hpp:136
void CreateDeleteSubscribeImpl(detail::CreateDeleteSubscribeRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:925
EventServiceIf & m_event_service
Definition runtimeRepoAdapter.hpp:131
virtual void InvokeRequestHandler(std::any &, RtrClient &)
Definition runtimeRepoAdapter.cpp:1114
MalDdsEventService m_mal_event_service
Definition runtimeRepoAdapter.hpp:130
RuntimeRepoAdapter(const RuntimeRepoAdapter &)=delete
This class cannot be copy constructed.
std::mutex m_mutex
Mutex for synchronising access to subscriptions.
Definition runtimeRepoAdapter.hpp:98
std::string m_ip
Definition runtimeRepoAdapter.hpp:93
static TableEntry Bind(void(RuntimeRepoAdapter::*method)(T &, RtrClient &))
Definition runtimeRepoAdapter.cpp:1125
std::unique_ptr< EventSubscriberIf > m_event_subscriber
Definition runtimeRepoAdapter.hpp:132
std::list< ValueSubscription > m_value_subscriptions
Definition runtimeRepoAdapter.hpp:124
void PartialReadImpl(detail::PartialReadRequest< T > &, RtrClient &)
Definition runtimeRepoAdapter.cpp:804
static const std::string SUPPORTED_URI_SCHEME
Definition runtimeRepoAdapter.hpp:32
void SubscriptionCallbackHandler(const JsonPayload &)
Definition runtimeRepoAdapter.cpp:968
std::unordered_map< std::type_index, DispatchFunction > LookupTable
Definition runtimeRepoAdapter.hpp:135
std::string m_topic
Definition runtimeRepoAdapter.hpp:95
uint16_t m_port
Definition runtimeRepoAdapter.hpp:94
void PartialWriteImpl(detail::PartialWriteRequest< T > &, RtrClient &)
Definition runtimeRepoAdapter.cpp:737
void WriteMetaDataImpl(detail::WriteMetaDataRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:760
void ReadImpl(detail::ReadRequest< T > &, RtrClient &)
Definition runtimeRepoAdapter.cpp:774
void UnsubscribeImpl(detail::UnsubscribeRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:932
void SubscribeImpl(detail::ValueSubscribeRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:915
static const LookupTable S_REQUEST_DISPATCHER_TABLE
Definition runtimeRepoAdapter.hpp:141
void CreateLinkImpl(detail::CreateSymlinkRequest &, RtrClient &)
Definition runtimeRepoAdapter.cpp:882
Base interface for all Runtime Configuration Repository adapters.
Definition runtimeRepoIf.hpp:27
Low-level interface of the event service.
Implementation of the event service.
Definition commandReplier.cpp:22
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Header file for RuntimeRepoIf, which defines the API for RuntimeRepoAdapters.
CallbackType cb_deleted
Definition runtimeRepoAdapter.hpp:117
CallbackType cb_created
Definition runtimeRepoAdapter.hpp:116
ErrorCallbackType cb_error
Definition runtimeRepoAdapter.hpp:118
CreateDeleteSubscription(SubscriptionId, CallbackType, CallbackType, ErrorCallbackType)
Definition runtimeRepoAdapter.cpp:905
std::atomic< size_t > cb_created_busy
Definition runtimeRepoAdapter.hpp:119
std::atomic< size_t > cb_deleted_busy
Definition runtimeRepoAdapter.hpp:120
std::atomic< size_t > cb_error_busy
Definition runtimeRepoAdapter.hpp:121
SubscriptionId id
Definition runtimeRepoAdapter.hpp:115
ValueSubscription(SubscriptionId, const DataPointPath &, NotifyCallbackType, ErrorCallbackType)
Definition runtimeRepoAdapter.cpp:898
std::atomic< size_t > cb_value_busy
Definition runtimeRepoAdapter.hpp:109
ErrorCallbackType cb_error
Definition runtimeRepoAdapter.hpp:108
NotifyCallbackType cb_value
Definition runtimeRepoAdapter.hpp:107
SubscriptionId id
Definition runtimeRepoAdapter.hpp:105
std::atomic< size_t > cb_error_busy
Definition runtimeRepoAdapter.hpp:110
DataPointPath path
Definition runtimeRepoAdapter.hpp:106
Definition repositorySubscriberIf.ipp:41
Definition repositorySubscriberIf.ipp:27