1 // Copyright (C) 2019 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 2 // This Source Code Form is subject to the terms of the Mozilla Public 3 // License, v. 2.0. If a copy of the MPL was not distributed with this 4 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 6 #ifndef VSOMEIP_COMPAT_RUNTIME_IMPL_HPP_ 7 #define VSOMEIP_COMPAT_RUNTIME_IMPL_HPP_ 8 9 #include <map> 10 #include <mutex> 11 12 #include <compat/vsomeip/runtime.hpp> 13 14 namespace vsomeip { 15 16 class runtime_impl 17 : public runtime { 18 public: 19 static std::string get_property(const std::string &_name); 20 static void set_property(const std::string &_name, const std::string &_value); 21 22 static std::shared_ptr<runtime> get(); 23 24 ~runtime_impl(); 25 26 std::shared_ptr<application> create_application( 27 const std::string &_name = ""); 28 29 std::shared_ptr<message> create_message(bool _reliable = false) const; 30 31 std::shared_ptr<message> create_request(bool _reliable = false) const; 32 33 std::shared_ptr<message> create_response( 34 const std::shared_ptr<message> &_request) const; 35 36 std::shared_ptr<message> create_notification( 37 bool _reliable = false) const; 38 39 std::shared_ptr<payload> create_payload() const; 40 std::shared_ptr<payload> create_payload( 41 const byte_t *_data, uint32_t _size) const; 42 virtual std::shared_ptr<payload> create_payload( 43 const std::vector<byte_t> &_data) const; 44 45 std::shared_ptr<application> get_application( 46 const std::string &_name) const; 47 void remove_application( const std::string &_name); 48 49 private: 50 static std::shared_ptr<runtime> the_runtime_; 51 52 std::map<std::string, std::weak_ptr<application> > applications_; 53 mutable std::mutex applications_mutex_; 54 }; 55 56 } // namespace vsomeip 57 58 #endif // VSOMEIP_COMPAT_RUNTIME_IMPL_HPP_ 59