blob: 089a5263dc35d52af3960d4108e61f6f9f55c9c2 (
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
|
// Copyright (C) 2014-2021 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_V3_BUFFER_HPP_
#define VSOMEIP_V3_BUFFER_HPP_
#include <array>
#include <chrono>
#include <memory>
#include <set>
#if VSOMEIP_BOOST_VERSION < 106600
# include <boost/asio/io_service.hpp>
#define io_context io_service
#else
# include <boost/asio/io_context.hpp>
#endif
#include <boost/asio/steady_timer.hpp>
#include <vsomeip/defines.hpp>
#include <vsomeip/primitive_types.hpp>
#if defined(_WIN32) && !defined(_MSVC_LANG)
#define DEFAULT_NANOSECONDS_MAX 1000000000
#else
#define DEFAULT_NANOSECONDS_MAX std::chrono::nanoseconds::max()
#endif
namespace vsomeip_v3 {
using message_buffer_t = std::vector<byte_t>;
using message_buffer_ptr_t = std::shared_ptr<message_buffer_t>;
#if 0
struct timing {
timing() : debouncing_(0), maximum_retention_(DEFAULT_NANOSECONDS_MAX) {};
std::chrono::nanoseconds debouncing_;
std::chrono::nanoseconds maximum_retention_;
};
#endif
struct train {
train()
: buffer_(std::make_shared<message_buffer_t>()),
minimal_debounce_time_(DEFAULT_NANOSECONDS_MAX),
minimal_max_retention_time_(DEFAULT_NANOSECONDS_MAX),
departure_(std::chrono::steady_clock::now() + std::chrono::hours(6)) {
};
void reset() {
buffer_ = std::make_shared<message_buffer_t>();
passengers_.clear();
minimal_debounce_time_ = DEFAULT_NANOSECONDS_MAX;
minimal_max_retention_time_ = DEFAULT_NANOSECONDS_MAX;
departure_ = std::chrono::steady_clock::now() + std::chrono::hours(6);
}
message_buffer_ptr_t buffer_;
std::set<std::pair<service_t, method_t> > passengers_;
std::chrono::nanoseconds minimal_debounce_time_;
std::chrono::nanoseconds minimal_max_retention_time_;
std::chrono::steady_clock::time_point departure_;
};
} // namespace vsomeip_v3
#endif // VSOMEIP_V3_BUFFER_HPP_
|