EmbeddedProto 4.0.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. EmbeddedProto/EmbeddedProto.py +122 -0
  2. EmbeddedProto/Features.py +255 -0
  3. EmbeddedProto/Field.py +1295 -0
  4. EmbeddedProto/Oneof.py +74 -0
  5. EmbeddedProto/ProtoFile.py +210 -0
  6. EmbeddedProto/TypeDefinitions.py +367 -0
  7. EmbeddedProto/__init__.py +0 -0
  8. EmbeddedProto/__main__.py +28 -0
  9. EmbeddedProto/config.py +173 -0
  10. EmbeddedProto/custom_header.py +513 -0
  11. EmbeddedProto/embedded_proto_options.proto +62 -0
  12. EmbeddedProto/embedded_proto_options_pb2.py +37 -0
  13. EmbeddedProto/field_options.py +344 -0
  14. EmbeddedProto/main.py +316 -0
  15. EmbeddedProto/src/EmbeddedProto/BytesStringCallback.h +476 -0
  16. EmbeddedProto/src/EmbeddedProto/Defines.h +118 -0
  17. EmbeddedProto/src/EmbeddedProto/EmptyArray.h +81 -0
  18. EmbeddedProto/src/EmbeddedProto/Errors.h +53 -0
  19. EmbeddedProto/src/EmbeddedProto/FieldStringBytes.h +793 -0
  20. EmbeddedProto/src/EmbeddedProto/Fields.h +832 -0
  21. EmbeddedProto/src/EmbeddedProto/Functional.h +412 -0
  22. EmbeddedProto/src/EmbeddedProto/MessageCallback.h +688 -0
  23. EmbeddedProto/src/EmbeddedProto/MessageInterface.h +792 -0
  24. EmbeddedProto/src/EmbeddedProto/MessageSizeCalculator.h +109 -0
  25. EmbeddedProto/src/EmbeddedProto/MessageState.h +207 -0
  26. EmbeddedProto/src/EmbeddedProto/ReadBufferFixedSize.h +204 -0
  27. EmbeddedProto/src/EmbeddedProto/ReadBufferInterface.h +181 -0
  28. EmbeddedProto/src/EmbeddedProto/ReadBufferSection.h +232 -0
  29. EmbeddedProto/src/EmbeddedProto/RepeatedField.h +1053 -0
  30. EmbeddedProto/src/EmbeddedProto/RepeatedFieldCallback.h +432 -0
  31. EmbeddedProto/src/EmbeddedProto/RepeatedFieldFixedSize.h +367 -0
  32. EmbeddedProto/src/EmbeddedProto/Version.h +39 -0
  33. EmbeddedProto/src/EmbeddedProto/WireFormatter.h +852 -0
  34. EmbeddedProto/src/EmbeddedProto/WriteBufferFixedSize.h +114 -0
  35. EmbeddedProto/src/EmbeddedProto/WriteBufferInterface.h +134 -0
  36. EmbeddedProto/src/EmbeddedProto.h +55 -0
  37. EmbeddedProto/templates/FieldBasic_Deserialize.h.jinja2 +26 -0
  38. EmbeddedProto/templates/FieldBasic_GetSet.h.jinja2 +89 -0
  39. EmbeddedProto/templates/FieldBytes_GetSet.h.jinja2 +86 -0
  40. EmbeddedProto/templates/FieldEnum_Deserialize.h.jinja2 +50 -0
  41. EmbeddedProto/templates/FieldEnum_GetSet.h.jinja2 +93 -0
  42. EmbeddedProto/templates/FieldErrorRecursive_GetSet.h.jinja2 +29 -0
  43. EmbeddedProto/templates/FieldMap_GetSet.h.jinja2 +203 -0
  44. EmbeddedProto/templates/FieldMsg_Deserialize.h.jinja2 +44 -0
  45. EmbeddedProto/templates/FieldMsg_GetSet.h.jinja2 +93 -0
  46. EmbeddedProto/templates/FieldRepeated_GetSet.h.jinja2 +94 -0
  47. EmbeddedProto/templates/FieldString_GetSet.h.jinja2 +86 -0
  48. EmbeddedProto/templates/Field_DeserializePartial.h.jinja2 +33 -0
  49. EmbeddedProto/templates/Field_Serialize.h.jinja2 +112 -0
  50. EmbeddedProto/templates/Field_SerializePartial.h.jinja2 +119 -0
  51. EmbeddedProto/templates/Header.h.jinja2 +108 -0
  52. EmbeddedProto/templates/TypeDefEnum.h.jinja2 +45 -0
  53. EmbeddedProto/templates/TypeDefMsg.h.jinja2 +791 -0
  54. EmbeddedProto/templates/TypeOneof.h.jinja2 +178 -0
  55. EmbeddedProto/version.json +3 -0
  56. embeddedproto-4.0.0b1.dist-info/METADATA +141 -0
  57. embeddedproto-4.0.0b1.dist-info/RECORD +63 -0
  58. embeddedproto-4.0.0b1.dist-info/WHEEL +5 -0
  59. embeddedproto-4.0.0b1.dist-info/entry_points.txt +3 -0
  60. embeddedproto-4.0.0b1.dist-info/licenses/LICENSE +30 -0
  61. embeddedproto-4.0.0b1.dist-info/licenses/LICENSES/GPL-3.0-only.txt +674 -0
  62. embeddedproto-4.0.0b1.dist-info/licenses/LICENSES/LicenseRef-EmbeddedProto-Commercial.txt +12 -0
  63. embeddedproto-4.0.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,114 @@
1
+ /*
2
+ * Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+ *
4
+ * This file is part of Embedded Proto.
5
+ *
6
+ * Embedded Proto is dual licensed. You may use it under the terms of the
7
+ * GNU General Public License version 3 (GPLv3) as published by the Free
8
+ * Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+ *
10
+ * Under the GPLv3 you must release the source code of
11
+ * any product you distribute that includes Embedded Proto or code
12
+ * generated by it. A commercial license removes that obligation.
13
+ * See <https://embeddedproto.com/pricing/>.
14
+ *
15
+ * Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ * See the LICENSE file in the root of the repository for details.
18
+ *
19
+ * SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+ *
21
+ * Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ */
23
+
24
+ #ifndef _WRITE_BUFFER_FIXED_H_
25
+ #define _WRITE_BUFFER_FIXED_H_
26
+
27
+ #include "WriteBufferInterface.h"
28
+ #include <array>
29
+
30
+ namespace EmbeddedProto
31
+ {
32
+
33
+ template<uint32_t BUFFER_SIZE>
34
+ class WriteBufferFixedSize : public ::EmbeddedProto::WriteBufferInterface
35
+ {
36
+ public:
37
+ WriteBufferFixedSize() = default;
38
+ ~WriteBufferFixedSize() = default;
39
+
40
+ //! \see ::EmbeddedProto::WriteBufferInterface::clear()
41
+ void clear() override
42
+ {
43
+ write_index_ = 0;
44
+ }
45
+
46
+
47
+ //! \see ::EmbeddedProto::WriteBufferInterface::get_size()
48
+ uint32_t get_size() const override
49
+ {
50
+ return write_index_;
51
+ }
52
+
53
+
54
+ //! \see ::EmbeddedProto::WriteBufferInterface::get_max_size()
55
+ uint32_t get_max_size() const override
56
+ {
57
+ return BUFFER_SIZE;
58
+ }
59
+
60
+ //! \see ::EmbeddedProto::WriteBufferInterface::get_available_size()
61
+ uint32_t get_available_size() const override
62
+ {
63
+ return BUFFER_SIZE - write_index_;
64
+ }
65
+
66
+ //! \see ::EmbeddedProto::WriteBufferInterface::push()
67
+ bool push(const uint8_t byte) override
68
+ {
69
+ bool return_value = BUFFER_SIZE > write_index_;
70
+ if(return_value)
71
+ {
72
+ data_[write_index_] = byte;
73
+ ++write_index_;
74
+ }
75
+ return return_value;
76
+ }
77
+
78
+ //! Keep the pointer and length form of push() reachable next to the override below.
79
+ using WriteBufferInterface::push;
80
+
81
+ //! \see ::EmbeddedProto::WriteBufferInterface::push(const const_bytes_view&)
82
+ bool push(const const_bytes_view& bytes) override
83
+ {
84
+ // Use >= so a block that exactly fills the remaining space still fits,
85
+ // matching the single-byte push() which allows filling up to BUFFER_SIZE.
86
+ bool return_value = BUFFER_SIZE >= (write_index_ + bytes.size);
87
+ if(return_value)
88
+ {
89
+ memcpy(data_.data() + write_index_, bytes.data, bytes.size);
90
+ write_index_ += bytes.size;
91
+ }
92
+ return return_value;
93
+ }
94
+
95
+ //! Return a pointer to the data array.
96
+ uint8_t* get_data()
97
+ {
98
+ return data_.data();
99
+ }
100
+
101
+ private:
102
+
103
+ //! The array in which the serialized data is stored.
104
+ std::array<uint8_t, BUFFER_SIZE> data_ = {0};
105
+
106
+ //! The number of bytes currently serialized in the array.
107
+ uint32_t write_index_ = 0 ;
108
+
109
+ };
110
+
111
+ } // End of namespace EmbeddedProto
112
+
113
+
114
+ #endif // _WRITE_BUFFER_FIXED_H_
@@ -0,0 +1,134 @@
1
+ /*
2
+ * Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+ *
4
+ * This file is part of Embedded Proto.
5
+ *
6
+ * Embedded Proto is dual licensed. You may use it under the terms of the
7
+ * GNU General Public License version 3 (GPLv3) as published by the Free
8
+ * Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+ *
10
+ * Under the GPLv3 you must release the source code of
11
+ * any product you distribute that includes Embedded Proto or code
12
+ * generated by it. A commercial license removes that obligation.
13
+ * See <https://embeddedproto.com/pricing/>.
14
+ *
15
+ * Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ * See the LICENSE file in the root of the repository for details.
18
+ *
19
+ * SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+ *
21
+ * Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ */
23
+
24
+ #ifndef _WRITE_BUFFER_INTERFACE_H_
25
+ #define _WRITE_BUFFER_INTERFACE_H_
26
+
27
+ #include "Defines.h"
28
+
29
+ #include <cstdint>
30
+
31
+
32
+ namespace EmbeddedProto
33
+ {
34
+ //! The pure virtual definition of a message buffer used for writing .
35
+ /*!
36
+ This interface is to be used by classes wishing to use the buffer. An actual implementation
37
+ is made specific to how you would like to store data.
38
+
39
+ The buffer deals with bytes (uint8_t) only.
40
+ */
41
+ class WriteBufferInterface
42
+ {
43
+ public:
44
+
45
+ WriteBufferInterface() = default;
46
+
47
+ #ifdef VIRTUAL_DESTRUCTORS_ENABLED
48
+ virtual ~WriteBufferInterface() = default;
49
+ #else
50
+ protected:
51
+ //! Protected and non-virtual by default, see VIRTUAL_DESTRUCTORS_ENABLED in Defines.h.
52
+ ~WriteBufferInterface() = default;
53
+
54
+ public:
55
+ #endif
56
+
57
+ //! Delete all data in the buffer.
58
+ virtual void clear() = 0;
59
+
60
+ //! Obtain the total number of bytes currently stored in the buffer.
61
+ virtual uint32_t get_size() const = 0;
62
+
63
+ //! Obtain the total number of bytes which can at most be stored in the buffer.
64
+ virtual uint32_t get_max_size() const = 0;
65
+
66
+ //! Obtain the total number of bytes still available in the buffer.
67
+ /*!
68
+ The value must never exceed the number of bytes a following push() actually
69
+ accepts. The partial serializers write a field tag and its value as a pair on the
70
+ strength of this value: once the tag is in the buffer the value has to fit, there
71
+ is no way to take the tag back. A buffer over-reporting its free space breaks that
72
+ guarantee and leaves a duplicate tag in the output on retry.
73
+
74
+ \return The number of bytes push() can still accept.
75
+ */
76
+ virtual uint32_t get_available_size() const = 0;
77
+
78
+ //! Push a single byte into the buffer.
79
+ /*!
80
+ \param[in] byte The data to append after previously added data in the buffer.
81
+ \return True when there was space to add the byte.
82
+ */
83
+ virtual bool push(const uint8_t byte) = 0;
84
+
85
+ //! Push an array of bytes into the buffer, all-or-nothing.
86
+ /*!
87
+ The given array will be appended after already added data in the buffer.
88
+ This call is all-or-nothing: either every byte is appended and true is
89
+ returned, or the buffer is left untouched and false is returned. The
90
+ packed repeated field serialization depends on this contract to retry an
91
+ element cleanly after BUFFER_FULL, so an implementation may never append
92
+ only part of the array.
93
+ \param[in] bytes A view on the array of bytes, bytes.size bytes are appended.
94
+ \return True when there was space to add all the bytes.
95
+ */
96
+ virtual bool push(const const_bytes_view& bytes) = 0;
97
+
98
+ //! Push an array of bytes into the buffer, pointer and length form of push(const const_bytes_view&).
99
+ /*!
100
+ \deprecated Use the array_view overload push(const const_bytes_view&), a view keeps
101
+ the pointer and its bound together.
102
+ \param[in] bytes Pointer to the array of bytes.
103
+ \param[in] length The number of bytes in the array.
104
+ \return True when there was space to add all the bytes.
105
+ */
106
+ [[deprecated("use the array_view overload push(const const_bytes_view&)")]]
107
+ virtual bool push(const uint8_t* bytes, const uint32_t length)
108
+ {
109
+ return push(const_bytes_view{bytes, length});
110
+ }
111
+
112
+ //! Account for a number of payload bytes without pushing their values.
113
+ /*!
114
+ A buffer storing data can not do this and returns false, the caller is to
115
+ push the actual bytes. A buffer only counting bytes, like the
116
+ MessageSizeCalculator, adds the given number to its count and returns true.
117
+ This way the caller can skip producing a payload of which the size is
118
+ already known.
119
+
120
+ \param[in] number_of_bytes The number of payload bytes to account for.
121
+ \return True when the bytes are accounted for and need not be pushed.
122
+ */
123
+ virtual bool count_only(const uint32_t number_of_bytes)
124
+ {
125
+ // Ignore the unused parameter, this buffer requires the actual data.
126
+ (void)number_of_bytes;
127
+ return false;
128
+ }
129
+
130
+ };
131
+
132
+ } // End of namespace EmbeddedProto
133
+
134
+ #endif // End of _WRITE_BUFFER_INTERFACE_H_
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+ *
4
+ * This file is part of Embedded Proto.
5
+ *
6
+ * Embedded Proto is dual licensed. You may use it under the terms of the
7
+ * GNU General Public License version 3 (GPLv3) as published by the Free
8
+ * Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+ *
10
+ * Under the GPLv3 you must release the source code of
11
+ * any product you distribute that includes Embedded Proto or code
12
+ * generated by it. A commercial license removes that obligation.
13
+ * See <https://embeddedproto.com/pricing/>.
14
+ *
15
+ * Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ * See the LICENSE file in the root of the repository for details.
18
+ *
19
+ * SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+ *
21
+ * Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ */
23
+
24
+ #ifndef _EMBEDDED_PROTO_H_
25
+ #define _EMBEDDED_PROTO_H_
26
+
27
+ //! Includes the whole Embedded Proto library.
28
+ /*!
29
+ One include for users who do not want to pick headers. Every header of the library is also
30
+ available on its own as <EmbeddedProto/Name.h>, which keeps compile times down when only a
31
+ few are needed.
32
+ */
33
+ #include <EmbeddedProto/BytesStringCallback.h>
34
+ #include <EmbeddedProto/Defines.h>
35
+ #include <EmbeddedProto/EmptyArray.h>
36
+ #include <EmbeddedProto/Errors.h>
37
+ #include <EmbeddedProto/Fields.h>
38
+ #include <EmbeddedProto/FieldStringBytes.h>
39
+ #include <EmbeddedProto/Functional.h>
40
+ #include <EmbeddedProto/MessageCallback.h>
41
+ #include <EmbeddedProto/MessageInterface.h>
42
+ #include <EmbeddedProto/MessageSizeCalculator.h>
43
+ #include <EmbeddedProto/MessageState.h>
44
+ #include <EmbeddedProto/ReadBufferFixedSize.h>
45
+ #include <EmbeddedProto/ReadBufferInterface.h>
46
+ #include <EmbeddedProto/ReadBufferSection.h>
47
+ #include <EmbeddedProto/RepeatedField.h>
48
+ #include <EmbeddedProto/RepeatedFieldCallback.h>
49
+ #include <EmbeddedProto/RepeatedFieldFixedSize.h>
50
+ #include <EmbeddedProto/Version.h>
51
+ #include <EmbeddedProto/WireFormatter.h>
52
+ #include <EmbeddedProto/WriteBufferFixedSize.h>
53
+ #include <EmbeddedProto/WriteBufferInterface.h>
54
+
55
+ #endif // End of _EMBEDDED_PROTO_H_
@@ -0,0 +1,26 @@
1
+ {#
2
+ Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+
4
+ This file is part of Embedded Proto.
5
+
6
+ Embedded Proto is dual licensed. You may use it under the terms of the
7
+ GNU General Public License version 3 (GPLv3) as published by the Free
8
+ Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+
10
+ Under the GPLv3 you must release the source code of
11
+ any product you distribute that includes Embedded Proto or code
12
+ generated by it. A commercial license removes that obligation.
13
+ See <https://embeddedproto.com/pricing/>.
14
+
15
+ Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ See the LICENSE file in the root of the repository for details.
18
+
19
+ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+
21
+ Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ #}
23
+ {% if field.optional %}
24
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
25
+ {% endif %}
26
+ return_value = {{field.get_variable_name()}}.deserialize_check_type(buffer, deserialize_wire_type_);
@@ -0,0 +1,89 @@
1
+ {#
2
+ Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+
4
+ This file is part of Embedded Proto.
5
+
6
+ Embedded Proto is dual licensed. You may use it under the terms of the
7
+ GNU General Public License version 3 (GPLv3) as published by the Free
8
+ Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+
10
+ Under the GPLv3 you must release the source code of
11
+ any product you distribute that includes Embedded Proto or code
12
+ generated by it. A commercial license removes that obligation.
13
+ See <https://embeddedproto.com/pricing/>.
14
+
15
+ Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ See the LICENSE file in the root of the repository for details.
18
+
19
+ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+
21
+ Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ #}
23
+ static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
24
+ {% if field.oneof is not none %}
25
+ inline bool has_{{field.get_name()}}() const
26
+ {
27
+ return FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}};
28
+ }
29
+ inline void clear_{{field.get_name()}}()
30
+ {
31
+ if(FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}})
32
+ {
33
+ {{field.get_which_oneof()}} = FieldNumber::NOT_SET;
34
+ ::EmbeddedProto::destroy_at(&{{field.get_variable_name()}});
35
+ }
36
+ }
37
+ inline void set_{{field.get_name()}}(const {{field.get_cstdint_type()}}& value)
38
+ {
39
+ if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
40
+ {
41
+ init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
42
+ }
43
+ {{field.get_variable_name()}} = value;
44
+ }
45
+ inline void set_{{field.get_name()}}(const {{field.get_cstdint_type()}}&& value)
46
+ {
47
+ if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
48
+ {
49
+ init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
50
+ }
51
+ {{field.get_variable_name()}} = value;
52
+ }
53
+ {% elif field.optional %}
54
+ inline bool has_{{field.get_name()}}() const
55
+ {
56
+ return 0 != (presence::mask(presence::fields::{{field.get_name().upper()}}) & presence_[presence::index(presence::fields::{{field.get_name().upper()}})]);
57
+ }
58
+ inline void clear_{{field.get_name()}}()
59
+ {
60
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] &= ~(presence::mask(presence::fields::{{field.get_name().upper()}}));
61
+ {% if field.has_default() %}
62
+ {{field.get_variable_name()}} = {{field.get_default_value()}};
63
+ {% else %}
64
+ {{field.get_variable_name()}}.clear();
65
+ {% endif %}
66
+ }
67
+ inline void set_{{field.get_name()}}(const {{field.get_cstdint_type()}}& value)
68
+ {
69
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
70
+ {{field.get_variable_name()}} = value;
71
+ }
72
+ inline void set_{{field.get_name()}}(const {{field.get_cstdint_type()}}&& value)
73
+ {
74
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
75
+ {{field.get_variable_name()}} = value;
76
+ }
77
+ inline {{field.get_cstdint_type()}}& mutable_{{field.get_name()}}()
78
+ {
79
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
80
+ return {{field.get_variable_name()}}.get();
81
+ }
82
+ {% else %}
83
+ inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}}.clear(); }
84
+ inline void set_{{field.get_name()}}(const {{field.get_cstdint_type()}}& value) { {{field.get_variable_name()}} = value; }
85
+ inline void set_{{field.get_name()}}(const {{field.get_cstdint_type()}}&& value) { {{field.get_variable_name()}} = value; }
86
+ inline {{field.get_cstdint_type()}}& mutable_{{field.get_name()}}() { return {{field.get_variable_name()}}.get(); }
87
+ {% endif %}
88
+ inline const {{field.get_cstdint_type()}}& get_{{field.get_name()}}() const { return {{field.get_variable_name()}}.get(); }
89
+ inline {{field.get_cstdint_type()}} {{field.get_name()}}() const { return {{field.get_variable_name()}}.get(); }
@@ -0,0 +1,86 @@
1
+ {#
2
+ Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+
4
+ This file is part of Embedded Proto.
5
+
6
+ Embedded Proto is dual licensed. You may use it under the terms of the
7
+ GNU General Public License version 3 (GPLv3) as published by the Free
8
+ Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+
10
+ Under the GPLv3 you must release the source code of
11
+ any product you distribute that includes Embedded Proto or code
12
+ generated by it. A commercial license removes that obligation.
13
+ See <https://embeddedproto.com/pricing/>.
14
+
15
+ Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ See the LICENSE file in the root of the repository for details.
18
+
19
+ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+
21
+ Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ #}
23
+ static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
24
+ {% if field.oneof is not none %}
25
+ inline bool has_{{field.get_name()}}() const
26
+ {
27
+ return FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}};
28
+ }
29
+ inline void clear_{{field.get_name()}}()
30
+ {
31
+ if(FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}})
32
+ {
33
+ {{field.get_which_oneof()}} = FieldNumber::NOT_SET;
34
+ ::EmbeddedProto::destroy_at(&{{field.get_variable_name()}});
35
+ }
36
+ }
37
+ inline {{field.get_type()}}& mutable_{{field.get_name()}}()
38
+ {
39
+ if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
40
+ {
41
+ init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
42
+ }
43
+ return {{field.get_variable_name()}};
44
+ }
45
+ inline void set_{{field.get_name()}}(const {{field.get_type()}}& rhs)
46
+ {
47
+ if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
48
+ {
49
+ init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
50
+ }
51
+ {{field.get_variable_name()}}.set(rhs);
52
+ }
53
+ {% elif field.optional %}
54
+ inline bool has_{{field.get_name()}}() const
55
+ {
56
+ return 0 != (presence::mask(presence::fields::{{field.get_name().upper()}}) & presence_[presence::index(presence::fields::{{field.get_name().upper()}})]);
57
+ }
58
+ inline void clear_{{field.get_name()}}()
59
+ {
60
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] &= ~(presence::mask(presence::fields::{{field.get_name().upper()}}));
61
+ {{field.get_variable_name()}}.clear();
62
+ }
63
+ inline {{field.get_type()}}& mutable_{{field.get_name()}}()
64
+ {
65
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
66
+ return {{field.get_variable_name()}};
67
+ }
68
+ inline void set_{{field.get_name()}}(const {{field.get_type()}}& rhs)
69
+ {
70
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
71
+ {{field.get_variable_name()}}.set(rhs);
72
+ }
73
+ {% else %}
74
+ inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}}.clear(); }
75
+ inline {{field.get_type()}}& mutable_{{field.get_name()}}() { return {{field.get_variable_name()}}; }
76
+ inline void set_{{field.get_name()}}(const {{field.get_type()}}& rhs) { {{field.get_variable_name()}}.set(rhs); }
77
+ {% endif %}
78
+ inline const {{field.get_type()}}& get_{{field.get_name()}}() const { return {{field.get_variable_name()}}; }
79
+ {% if field.has_callback_storage() %}
80
+ inline void set_{{field.get_name()}}_on_serialize_chunk(const {{field.get_type()}}::ChunkCallback& callback) { {{field.get_variable_name()}}.set_on_serialize_chunk(callback); }
81
+ inline void set_{{field.get_name()}}_on_deserialize_chunk(const {{field.get_type()}}::ChunkCallback& callback) { {{field.get_variable_name()}}.set_on_deserialize_chunk(callback); }
82
+ inline void set_{{field.get_name()}}_window(const {{field.get_type()}}::VIEW& window) { {{field.get_variable_name()}}.set_window(window); }
83
+ inline void set_{{field.get_name()}}_length(const uint32_t length) { {{field.get_variable_name()}}.set_length(length); }
84
+ {% else %}
85
+ inline const uint8_t* {{field.get_name()}}() const { return {{field.get_variable_name()}}.get_const(); }
86
+ {% endif %}
@@ -0,0 +1,50 @@
1
+ {#
2
+ Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+
4
+ This file is part of Embedded Proto.
5
+
6
+ Embedded Proto is dual licensed. You may use it under the terms of the
7
+ GNU General Public License version 3 (GPLv3) as published by the Free
8
+ Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+
10
+ Under the GPLv3 you must release the source code of
11
+ any product you distribute that includes Embedded Proto or code
12
+ generated by it. A commercial license removes that obligation.
13
+ See <https://embeddedproto.com/pricing/>.
14
+
15
+ Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ See the LICENSE file in the root of the repository for details.
18
+
19
+ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+
21
+ Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ #}
23
+ {% if field.is_closed() %}
24
+ {# CLOSED enum: decode, then validate. Unknown values are dropped (the field is
25
+ left at its default / unset) because EmbeddedProto keeps no unknown-field set. #}
26
+ return_value = {{field.get_variable_name()}}.deserialize_check_type(buffer, deserialize_wire_type_);
27
+ if(::EmbeddedProto::Error::NO_ERRORS == return_value)
28
+ {
29
+ if({{field.get_type_as_defined()}}_is_valid(static_cast<uint32_t>({{field.get_variable_name()}}.get())))
30
+ {
31
+ {% if field.optional %}
32
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
33
+ {% endif %}
34
+ }
35
+ else
36
+ {
37
+ {{field.get_variable_name()}} = {{field.get_default_value()}};
38
+ {% if field.oneof is not none %}
39
+ {# The unknown value is dropped, so this oneof member was not really set;
40
+ leave the oneof unset instead of reporting it present with a default. #}
41
+ {{field.get_which_oneof()}} = FieldNumber::NOT_SET;
42
+ {% endif %}
43
+ }
44
+ }
45
+ {% else %}
46
+ {% if field.optional %}
47
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
48
+ {% endif %}
49
+ return_value = {{field.get_variable_name()}}.deserialize_check_type(buffer, deserialize_wire_type_);
50
+ {% endif %}
@@ -0,0 +1,93 @@
1
+ {#
2
+ Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+
4
+ This file is part of Embedded Proto.
5
+
6
+ Embedded Proto is dual licensed. You may use it under the terms of the
7
+ GNU General Public License version 3 (GPLv3) as published by the Free
8
+ Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+
10
+ Under the GPLv3 you must release the source code of
11
+ any product you distribute that includes Embedded Proto or code
12
+ generated by it. A commercial license removes that obligation.
13
+ See <https://embeddedproto.com/pricing/>.
14
+
15
+ Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ See the LICENSE file in the root of the repository for details.
18
+
19
+ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+
21
+ Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ #}
23
+ static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
24
+ {% if field.oneof is not none %}
25
+ inline bool has_{{field.get_name()}}() const
26
+ {
27
+ return FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}};
28
+ }
29
+ inline void clear_{{field.get_name()}}()
30
+ {
31
+ if(FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}})
32
+ {
33
+ {{field.get_which_oneof()}} = FieldNumber::NOT_SET;
34
+ {{field.get_variable_name()}}.clear();
35
+ }
36
+ }
37
+ inline void set_{{field.get_name()}}(const {{field.get_type_as_defined()}}& value)
38
+ {
39
+ if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
40
+ {
41
+ init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
42
+ }
43
+ {{field.get_variable_name()}} = value;
44
+ }
45
+ inline void set_{{field.get_name()}}(const {{field.get_type_as_defined()}}&& value)
46
+ {
47
+ if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
48
+ {
49
+ init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
50
+ }
51
+ {{field.get_variable_name()}} = value;
52
+ }
53
+ {% elif field.optional %}
54
+ inline bool has_{{field.get_name()}}() const
55
+ {
56
+ return 0 != (presence::mask(presence::fields::{{field.get_name().upper()}}) & presence_[presence::index(presence::fields::{{field.get_name().upper()}})]);
57
+ }
58
+ inline void clear_{{field.get_name()}}()
59
+ {
60
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] &= ~(presence::mask(presence::fields::{{field.get_name().upper()}}));
61
+ {% if field.assign_default_on_clear() %}
62
+ {{field.get_variable_name()}} = {{field.get_default_value()}};
63
+ {% else %}
64
+ {{field.get_variable_name()}}.clear();
65
+ {% endif %}
66
+ }
67
+ inline void set_{{field.get_name()}}(const {{field.get_type_as_defined()}}& value)
68
+ {
69
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
70
+ {{field.get_variable_name()}} = value;
71
+ }
72
+ inline void set_{{field.get_name()}}(const {{field.get_type_as_defined()}}&& value)
73
+ {
74
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
75
+ {{field.get_variable_name()}} = value;
76
+ }
77
+ inline {{field.get_type_as_defined()}}& mutable_{{field.get_name()}}()
78
+ {
79
+ presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
80
+ return {{field.get_variable_name()}}.get();
81
+ }
82
+ {% else %}
83
+ {% if field.assign_default_on_clear() %}
84
+ inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}} = {{field.get_default_value()}}; }
85
+ {% else %}
86
+ inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}}.clear(); }
87
+ {% endif %}
88
+ inline void set_{{field.get_name()}}(const {{field.get_type_as_defined()}}& value) { {{field.get_variable_name()}} = value; }
89
+ inline void set_{{field.get_name()}}(const {{field.get_type_as_defined()}}&& value) { {{field.get_variable_name()}} = value; }
90
+ inline {{field.get_type_as_defined()}}& mutable_{{field.get_name()}}() { return {{field.get_variable_name()}}.get(); }
91
+ {% endif %}
92
+ inline const {{field.get_type_as_defined()}}& get_{{field.get_name()}}() const { return {{field.get_variable_name()}}.get(); }
93
+ inline {{field.get_type_as_defined()}} {{field.get_name()}}() const { return {{field.get_variable_name()}}.get(); }
@@ -0,0 +1,29 @@
1
+ {#
2
+ Copyright (C) 2020-2026 Embedded AMS B.V. - All Rights Reserved
3
+
4
+ This file is part of Embedded Proto.
5
+
6
+ Embedded Proto is dual licensed. You may use it under the terms of the
7
+ GNU General Public License version 3 (GPLv3) as published by the Free
8
+ Software Foundation, or under a commercial license from Embedded AMS B.V.
9
+
10
+ Under the GPLv3 you must release the source code of
11
+ any product you distribute that includes Embedded Proto or code
12
+ generated by it. A commercial license removes that obligation.
13
+ See <https://embeddedproto.com/pricing/>.
14
+
15
+ Embedded Proto is distributed WITHOUT ANY WARRANTY; without even the
16
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ See the LICENSE file in the root of the repository for details.
18
+
19
+ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-EmbeddedProto-Commercial
20
+
21
+ Embedded AMS B.V., Hoorn, the Netherlands - info at EmbeddedProto dot com
22
+ #}
23
+ #warning "You have a recursive inclusion with the field: '{{field.get_name()}}'. Embedded Proto is unable to determine the template parameters in this case. We could only generate this message by leaving it out."
24
+ static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
25
+ inline void clear_{{field.get_name()}}() { }
26
+ inline void set_{{field.get_name()}}(const uint8_t& value) { }
27
+ inline void set_{{field.get_name()}}(const uint8_t&& value) { }
28
+ inline const uint8_t get_{{field.get_name()}}() const { return 0; }
29
+ inline uint8_t {{field.get_name()}}() const { return 0; }