Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
communication_group_client.h
1#ifndef COMMUNICATION_GROUP_CLIENT_H
2#define COMMUNICATION_GROUP_CLIENT_H
3
4#include <stdint.h>
5#include <functional>
6#include <future>
7
8namespace ara
9{
10 namespace com
11 {
12 namespace cg
13 {
16 template <typename T>
17 using RequestHandler = std::function<void(T)>;
18
22 template <typename T, typename R>
24 {
25 private:
26 RequestHandler<T> mRequestHandler;
27
28 public:
31 explicit CommunicationGroupClient(RequestHandler<T> requestHandler) : mRequestHandler{requestHandler}
32 {
33 }
34
35 ~CommunicationGroupClient() noexcept = default;
36
39 void Message(const T& msg)
40 {
41 mRequestHandler(msg);
42 }
43
47 std::future<void> Response(const R& responseMsg) const;
48 };
49 }
50 }
51}
52#endif
Communication group client proxy.
Definition: communication_group_client.h:24
void Message(const T &msg)
Receive a request message from the server.
Definition: communication_group_client.h:39
std::future< void > Response(const R &responseMsg) const
Send a response message to the server.
CommunicationGroupClient(RequestHandler< T > requestHandler)
Constructor.
Definition: communication_group_client.h:31