summaryrefslogtreecommitdiff
path: root/implementation/endpoints/include/buffer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'implementation/endpoints/include/buffer.hpp')
-rw-r--r--implementation/endpoints/include/buffer.hpp49
1 files changed, 29 insertions, 20 deletions
diff --git a/implementation/endpoints/include/buffer.hpp b/implementation/endpoints/include/buffer.hpp
index af0582d..089a526 100644
--- a/implementation/endpoints/include/buffer.hpp
+++ b/implementation/endpoints/include/buffer.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// 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/.
@@ -11,13 +11,18 @@
#include <memory>
#include <set>
-#include <boost/asio/io_service.hpp>
+#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>
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_MSVC_LANG)
#define DEFAULT_NANOSECONDS_MAX 1000000000
#else
#define DEFAULT_NANOSECONDS_MAX std::chrono::nanoseconds::max()
@@ -25,37 +30,41 @@
namespace vsomeip_v3 {
-typedef std::vector<byte_t> message_buffer_t;
-typedef std::shared_ptr<message_buffer_t> message_buffer_ptr_t;
+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(boost::asio::io_service& _io) : buffer_(std::make_shared<message_buffer_t>()),
- departure_(DEFAULT_NANOSECONDS_MAX),
- minimal_debounce_time_(DEFAULT_NANOSECONDS_MAX),
- minimal_max_retention_time_(DEFAULT_NANOSECONDS_MAX),
- last_departure_(std::chrono::steady_clock::now() - std::chrono::hours(1)),
- departure_timer_(std::make_shared<boost::asio::steady_timer>(_io)) {};
+ 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::chrono::nanoseconds departure_;
+ 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 last_departure_;
- std::shared_ptr<boost::asio::steady_timer> departure_timer_;
- std::set<std::pair<service_t, method_t> > passengers_;
- void update_departure_time_and_stop_departure() {
- departure_ = departure_timer_->expires_from_now();
- boost::system::error_code ec;
- departure_timer_->cancel(ec);
- }
+ std::chrono::steady_clock::time_point departure_;
};