1 // Copyright (C) 2014-2018 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_V3_SD_EVENTGROUPENTRY_IMPL_HPP_ 7 #define VSOMEIP_V3_SD_EVENTGROUPENTRY_IMPL_HPP_ 8 9 #include "entry_impl.hpp" 10 #include "../../endpoints/include/endpoint_definition.hpp" 11 #include "message_impl.hpp" 12 13 namespace vsomeip_v3 { 14 namespace sd { 15 16 class selective_option_impl; 17 18 class eventgroupentry_impl: public entry_impl { 19 public: 20 eventgroupentry_impl(); 21 eventgroupentry_impl(const eventgroupentry_impl &_entry); 22 virtual ~eventgroupentry_impl(); 23 24 eventgroup_t get_eventgroup() const; 25 void set_eventgroup(eventgroup_t _eventgroup); 26 27 uint16_t get_reserved() const; 28 void set_reserved(uint16_t _reserved); 29 30 uint8_t get_counter() const; 31 void set_counter(uint8_t _counter); 32 33 bool serialize(vsomeip_v3::serializer *_to) const; 34 bool deserialize(vsomeip_v3::deserializer *_from); 35 operator ==(const eventgroupentry_impl & _other) const36 bool operator==(const eventgroupentry_impl& _other) const { 37 return (ttl_ == _other.ttl_ && 38 service_ == _other.service_ && 39 instance_ == _other.instance_ && 40 eventgroup_ == _other.eventgroup_ && 41 index1_ == _other.index1_ && 42 index2_ == _other.index2_ && 43 num_options_[0] == _other.num_options_[0] && 44 num_options_[1] == _other.num_options_[1] && 45 major_version_ == _other.major_version_ && 46 counter_ == _other.counter_); 47 } 48 49 bool matches(const eventgroupentry_impl &_other, 50 const message_impl::options_t &_options) const; 51 52 void add_target(const std::shared_ptr<endpoint_definition> &_target); 53 std::shared_ptr<endpoint_definition> get_target(bool _reliable) const; 54 55 std::shared_ptr<selective_option_impl> get_selective_option() const; 56 57 private: 58 eventgroup_t eventgroup_; 59 uint16_t reserved_; 60 61 // counter field to differentiate parallel subscriptions on same event group 62 // 4Bit only (max 16. parralel subscriptions) 63 uint8_t counter_; 64 65 std::shared_ptr<endpoint_definition> target_reliable_; 66 std::shared_ptr<endpoint_definition> target_unreliable_; 67 }; 68 69 } // namespace sd 70 } // namespace vsomeip_v3 71 72 #endif // VSOMEIP_V3_SD_EVENTGROUPENTRY_IMPL_HPP_ 73 74