summaryrefslogtreecommitdiff
path: root/implementation/compat/message/include/payload_impl.hpp
blob: 1e8b49393636cce8c1db7b84fc681a8dfe3d2a27 (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
// Copyright (C) 2019 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_COMPAT_PAYLOAD_IMPL_HPP_
#define VSOMEIP_COMPAT_PAYLOAD_IMPL_HPP_

#include <compat/vsomeip/payload.hpp>
#include <vsomeip/payload.hpp>

namespace vsomeip {

class payload_impl
        : public payload {

public:
    payload_impl(const std::shared_ptr<vsomeip_v3::payload> &_impl);
    ~payload_impl();

    bool operator ==(const payload &_other);

    byte_t * get_data();
    const byte_t * get_data() const;

    void set_data(const byte_t *_data, length_t _length);
    void set_data(const std::vector<byte_t> &_data);
    void set_data(std::vector<byte_t> &&_data);

    length_t get_length() const;
    void set_capacity(length_t _length);

    bool deserialize(deserializer *_from);
    bool serialize(serializer *_to) const;

    // Wraps
    inline std::shared_ptr<vsomeip_v3::payload> get_impl() const { return impl_; }

private:
    std::shared_ptr<vsomeip_v3::payload> impl_;
};

} // namespace vsomeip

#endif // VSOMEIP_COMPAT_PAYLOAD_IMPL_HPP_