1 // Copyright (C) 2014-2017 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 #include <vsomeip/payload.hpp> 7 #include <vsomeip/runtime.hpp> 8 #include <vsomeip/internal/logger.hpp> 9 10 #include "../include/payload_impl.hpp" 11 #ifdef ANDROID 12 # include "../../../configuration/include/internal_android.hpp" 13 #else 14 # include "../../../configuration/include/internal.hpp" 15 #endif 16 17 namespace vsomeip { 18 payload_impl(const std::shared_ptr<vsomeip_v3::payload> & _impl)19payload_impl::payload_impl(const std::shared_ptr<vsomeip_v3::payload> &_impl) 20 : impl_(_impl) { 21 } 22 ~payload_impl()23payload_impl::~payload_impl() { 24 } 25 26 bool operator ==(const payload & _other)27payload_impl::operator==(const payload &_other) { 28 29 bool is_equal(true); 30 try { 31 const payload_impl &other = dynamic_cast< const payload_impl & >(_other); 32 is_equal = (*(impl_.get()) == *(other.impl_.get())); 33 } 34 catch (...) { 35 is_equal = false; 36 } 37 return is_equal; 38 } 39 40 byte_t * get_data()41payload_impl::get_data() { 42 43 return impl_->get_data(); 44 } 45 46 const byte_t * get_data() const47payload_impl::get_data() const { 48 49 return impl_->get_data(); 50 } 51 52 length_t get_length() const53payload_impl::get_length() const { 54 55 return impl_->get_length(); 56 } 57 58 void set_capacity(length_t _capacity)59payload_impl::set_capacity(length_t _capacity) { 60 61 impl_->set_capacity(_capacity); 62 } 63 64 void set_data(const byte_t * _data,const length_t _length)65payload_impl::set_data(const byte_t *_data, const length_t _length) { 66 67 impl_->set_data(_data, _length); 68 } 69 70 void set_data(const std::vector<byte_t> & _data)71payload_impl::set_data(const std::vector< byte_t > &_data) { 72 73 impl_->set_data(_data); 74 } 75 76 void set_data(std::vector<byte_t> && _data)77payload_impl::set_data(std::vector< byte_t > &&_data) { 78 79 impl_->set_data(_data); 80 } 81 82 bool serialize(serializer * _to) const83payload_impl::serialize(serializer *_to) const { 84 85 (void)_to; 86 VSOMEIP_ERROR << "payload_impl::" << __func__ 87 << ": Must not be called from compatibility layer."; 88 return false; 89 } 90 91 bool deserialize(deserializer * _from)92payload_impl::deserialize(deserializer *_from) { 93 94 (void)_from; 95 VSOMEIP_ERROR << "payload_impl::" << __func__ 96 << ": Must not be called from compatibility layer."; 97 return false; 98 } 99 100 } // namespace vsomeip 101