blob: 89153add7fb239995137417fd6fdba78cecc944a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef VSOMEIP_EVENT_IMPL_HPP
#define VSOMEIP_EVENT_IMPL_HPP
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/address.hpp>
#include <boost/asio/system_timer.hpp>
#include <vsomeip/primitive_types.hpp>
namespace vsomeip {
class endpoint;
class endpoint_definition;
class message;
class payload;
class routing_manager;
class event: public std::enable_shared_from_this<event> {
public:
event(routing_manager *_routing);
service_t get_service() const;
void set_service(service_t _service);
instance_t get_instance() const;
void set_instance(instance_t _instance);
event_t get_event() const;
void set_event(event_t _event);
const std::shared_ptr<payload> get_payload() const;
void set_payload(std::shared_ptr<payload> _payload, const client_t _client);
void set_payload(std::shared_ptr<payload> _payload,
const std::shared_ptr<endpoint_definition> _target);
void set_payload(std::shared_ptr<payload> _payload);
void unset_payload();
bool is_field() const;
void set_field(bool _is_field);
bool is_reliable() const;
void set_reliable(bool _is_reliable);
bool is_provided() const;
void set_provided(bool _is_provided);
// SIP_RPC_357
void set_update_cycle(std::chrono::milliseconds &_cycle);
// SIP_RPC_358
void set_update_on_change(bool _is_on);
// SIP_RPC_359 (epsilon change) is not supported!
const std::set<eventgroup_t> & get_eventgroups() const;
void add_eventgroup(eventgroup_t _eventgroup);
void set_eventgroups(const std::set<eventgroup_t> &_eventgroups);
void notify_one(const std::shared_ptr<endpoint_definition> &_target);
void notify_one(client_t _client);
void add_ref();
uint32_t remove_ref();
private:
void update_cbk(boost::system::error_code const &_error);
void notify();
void notify(client_t _client, const std::shared_ptr<endpoint_definition> &_target);
private:
bool set_payload_helper(std::shared_ptr<payload> _payload);
routing_manager *routing_;
std::mutex mutex_;
std::shared_ptr<message> message_;
bool is_field_;
boost::asio::system_timer cycle_timer_;
std::chrono::milliseconds cycle_;
bool is_updating_on_change_;
std::set<eventgroup_t> eventgroups_;
bool is_set_;
bool is_provided_;
uint32_t ref_;
};
} // namespace vsomeip
#endif // VSOMEIP_EVENT_IMPL_HPP
|