blob: c57797e1a95b0b9da5e4cbe19dce44aad4c8150e (
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
46
47
48
49
50
|
// Copyright (C) 2014-2017 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_SERIALIZER_HPP
#define VSOMEIP_SERIALIZER_HPP
#include <vector>
#include <vsomeip/export.hpp>
#include <vsomeip/primitive_types.hpp>
namespace vsomeip {
class serializable;
class VSOMEIP_IMPORT_EXPORT serializer {
public:
serializer(std::uint32_t _buffer_shrink_threshold);
virtual ~serializer();
bool serialize(const serializable *_from);
bool serialize(const uint8_t _value);
bool serialize(const uint16_t _value);
bool serialize(const uint32_t _value, bool _omit_last_byte = false);
bool serialize(const uint8_t *_data, uint32_t _length);
bool serialize(const std::vector<byte_t> &_data);
virtual const uint8_t * get_data() const;
virtual uint32_t get_capacity() const;
virtual uint32_t get_size() const;
virtual void set_data(uint8_t *_data, uint32_t _capacity);
virtual void reset();
#ifdef VSOMEIP_DEBUGGING
virtual void show();
#endif
private:
std::vector<byte_t> data_;
std::uint32_t shrink_count_;
std::uint32_t buffer_shrink_threshold_;
};
} // namespace vsomeip
#endif // VSOMEIP_SERIALIZER_IMPL_HPP
|