EmbeddedProto 4.0.0.dev19__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.
- EmbeddedProto/EmbeddedProto.py +63 -0
- EmbeddedProto/Field.py +578 -0
- EmbeddedProto/Oneof.py +78 -0
- EmbeddedProto/ProtoFile.py +188 -0
- EmbeddedProto/TypeDefinitions.py +255 -0
- EmbeddedProto/__init__.py +0 -0
- EmbeddedProto/__main__.py +35 -0
- EmbeddedProto/embedded_proto_options_pb2.py +37 -0
- EmbeddedProto/main.py +199 -0
- EmbeddedProto/templates/FieldBasic_Deserialize.h.jinja2 +33 -0
- EmbeddedProto/templates/FieldBasic_GetSet.h.jinja2 +92 -0
- EmbeddedProto/templates/FieldBasic_Serialize.h.jinja2 +37 -0
- EmbeddedProto/templates/FieldBytes_GetSet.h.jinja2 +86 -0
- EmbeddedProto/templates/FieldEnum_Deserialize.h.jinja2 +33 -0
- EmbeddedProto/templates/FieldEnum_GetSet.h.jinja2 +86 -0
- EmbeddedProto/templates/FieldEnum_Serialize.h.jinja2 +37 -0
- EmbeddedProto/templates/FieldErrorRecursive_GetSet.h.jinja2 +36 -0
- EmbeddedProto/templates/FieldMsg_Deserialize.h.jinja2 +33 -0
- EmbeddedProto/templates/FieldMsg_GetSet.h.jinja2 +100 -0
- EmbeddedProto/templates/FieldMsg_Serialize.h.jinja2 +37 -0
- EmbeddedProto/templates/FieldRepeated_GetSet.h.jinja2 +95 -0
- EmbeddedProto/templates/FieldRepeated_Serialize.h.jinja2 +33 -0
- EmbeddedProto/templates/FieldStringBytes_Serialize.h.jinja2 +37 -0
- EmbeddedProto/templates/FieldString_GetSet.h.jinja2 +86 -0
- EmbeddedProto/templates/Header.h.jinja2 +75 -0
- EmbeddedProto/templates/TypeDefEnum.h.jinja2 +35 -0
- EmbeddedProto/templates/TypeDefMsg.h.jinja2 +473 -0
- EmbeddedProto/templates/TypeOneof.h.jinja2 +180 -0
- EmbeddedProto/version.json +3 -0
- EmbeddedProto-4.0.0.dev19.dist-info/METADATA +210 -0
- EmbeddedProto-4.0.0.dev19.dist-info/RECORD +34 -0
- EmbeddedProto-4.0.0.dev19.dist-info/WHEEL +5 -0
- EmbeddedProto-4.0.0.dev19.dist-info/entry_points.txt +3 -0
- EmbeddedProto-4.0.0.dev19.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
|
|
31
|
+
{% if field.oneof is not none %}
|
|
32
|
+
inline bool has_{{field.get_name()}}() const
|
|
33
|
+
{
|
|
34
|
+
return FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}};
|
|
35
|
+
}
|
|
36
|
+
inline void clear_{{field.get_name()}}()
|
|
37
|
+
{
|
|
38
|
+
if(FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}})
|
|
39
|
+
{
|
|
40
|
+
{{field.get_which_oneof()}} = FieldNumber::NOT_SET;
|
|
41
|
+
{{field.get_variable_name()}}.~{{field.get_short_type()}}();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& value)
|
|
45
|
+
{
|
|
46
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
47
|
+
{
|
|
48
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
49
|
+
}
|
|
50
|
+
{{field.get_variable_name()}} = value;
|
|
51
|
+
}
|
|
52
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}&& value)
|
|
53
|
+
{
|
|
54
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
55
|
+
{
|
|
56
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
57
|
+
}
|
|
58
|
+
{{field.get_variable_name()}} = value;
|
|
59
|
+
}
|
|
60
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}()
|
|
61
|
+
{
|
|
62
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
63
|
+
{
|
|
64
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
65
|
+
}
|
|
66
|
+
return {{field.get_variable_name()}};
|
|
67
|
+
}
|
|
68
|
+
{% elif field.optional %}
|
|
69
|
+
inline bool has_{{field.get_name()}}() const
|
|
70
|
+
{
|
|
71
|
+
return 0 != (presence::mask(presence::fields::{{field.get_name().upper()}}) & presence_[presence::index(presence::fields::{{field.get_name().upper()}})]);
|
|
72
|
+
}
|
|
73
|
+
inline void clear_{{field.get_name()}}()
|
|
74
|
+
{
|
|
75
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] &= ~(presence::mask(presence::fields::{{field.get_name().upper()}}));
|
|
76
|
+
{{field.get_variable_name()}}.clear();
|
|
77
|
+
}
|
|
78
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& value)
|
|
79
|
+
{
|
|
80
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
|
|
81
|
+
{{field.get_variable_name()}} = value;
|
|
82
|
+
}
|
|
83
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}&& value)
|
|
84
|
+
{
|
|
85
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
|
|
86
|
+
{{field.get_variable_name()}} = value;
|
|
87
|
+
}
|
|
88
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}()
|
|
89
|
+
{
|
|
90
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
|
|
91
|
+
return {{field.get_variable_name()}};
|
|
92
|
+
}
|
|
93
|
+
{% else %}
|
|
94
|
+
inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}}.clear(); }
|
|
95
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& value) { {{field.get_variable_name()}} = value; }
|
|
96
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}&& value) { {{field.get_variable_name()}} = value; }
|
|
97
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}() { return {{field.get_variable_name()}}; }
|
|
98
|
+
{% endif %}
|
|
99
|
+
inline const {{field.get_type()}}& get_{{field.get_name()}}() const { return {{field.get_variable_name()}}; }
|
|
100
|
+
inline const {{field.get_type()}}& {{field.get_name()}}() const { return {{field.get_variable_name()}}; }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
{% if (field.optional or (field.oneof is not none)) %}
|
|
31
|
+
if(has_{{field.get_name()}}() && (::EmbeddedProto::Error::NO_ERRORS == return_value))
|
|
32
|
+
{% else %}
|
|
33
|
+
if(::EmbeddedProto::Error::NO_ERRORS == return_value)
|
|
34
|
+
{% endif %}
|
|
35
|
+
{
|
|
36
|
+
return_value = {{field.get_variable_name()}}.serialize_with_id(static_cast<uint32_t>(FieldNumber::{{field.get_variable_id_name()}}), buffer, {{ "true" if (field.optional or (field.oneof is not none)) else "false" }});
|
|
37
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
|
|
31
|
+
{% if field.oneof is not none %}
|
|
32
|
+
inline bool has_{{field.get_name()}}() const
|
|
33
|
+
{
|
|
34
|
+
return FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}};
|
|
35
|
+
}
|
|
36
|
+
inline void clear_{{field.get_name()}}()
|
|
37
|
+
{
|
|
38
|
+
if(FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}})
|
|
39
|
+
{
|
|
40
|
+
{{field.get_which_oneof}} = FieldNumber::NOT_SET;
|
|
41
|
+
{{field.get_variable_name()}}.~{{field.get_short_type()}}();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
inline void set_{{field.get_name()}}(uint32_t index, const {{field.get_type()}}& value)
|
|
45
|
+
{
|
|
46
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
47
|
+
{
|
|
48
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
49
|
+
}
|
|
50
|
+
{{field.get_variable_name()}}.set(index, value);
|
|
51
|
+
}
|
|
52
|
+
inline void set_{{field.get_name()}}(uint32_t index, const {{field.get_type()}}&& value)
|
|
53
|
+
{
|
|
54
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
55
|
+
{
|
|
56
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
57
|
+
}
|
|
58
|
+
{{field.get_variable_name()}}.set(index, value);
|
|
59
|
+
}
|
|
60
|
+
inline void set_{{field.get_name()}}(const {{field.repeated_type}}& values)
|
|
61
|
+
{
|
|
62
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
63
|
+
{
|
|
64
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
65
|
+
}
|
|
66
|
+
{{field.get_variable_name()}} = values;
|
|
67
|
+
}
|
|
68
|
+
inline void add_{{field.get_name()}}(const {{field.get_type()}}& value)
|
|
69
|
+
{
|
|
70
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
71
|
+
{
|
|
72
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
73
|
+
}
|
|
74
|
+
{{field.get_variable_name()}}.add(value);
|
|
75
|
+
}
|
|
76
|
+
inline {{field.repeated_type}}& mutable_{{field.get_name()}}()
|
|
77
|
+
{
|
|
78
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
79
|
+
{
|
|
80
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
81
|
+
}
|
|
82
|
+
return {{field.get_variable_name()}};
|
|
83
|
+
}
|
|
84
|
+
{% else %}
|
|
85
|
+
inline const {{field.get_base_type()}}& {{field.get_name()}}(uint32_t index) const { return {{field.get_variable_name()}}[index]; }
|
|
86
|
+
inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}}.clear(); }
|
|
87
|
+
inline void set_{{field.get_name()}}(uint32_t index, const {{field.get_base_type()}}& value) { {{field.get_variable_name()}}.set(index, value); }
|
|
88
|
+
inline void set_{{field.get_name()}}(uint32_t index, const {{field.get_base_type()}}&& value) { {{field.get_variable_name()}}.set(index, value); }
|
|
89
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& values) { {{field.get_variable_name()}} = values; }
|
|
90
|
+
inline void add_{{field.get_name()}}(const {{field.get_base_type()}}& value) { {{field.get_variable_name()}}.add(value); }
|
|
91
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}() { return {{field.get_variable_name()}}; }
|
|
92
|
+
inline {{field.get_base_type()}}& mutable_{{field.get_name()}}(uint32_t index) { return {{field.get_variable_name()}}[index]; }
|
|
93
|
+
{% endif %}
|
|
94
|
+
inline const {{field.get_type()}}& get_{{field.get_name()}}() const { return {{field.get_variable_name()}}; }
|
|
95
|
+
inline const {{field.get_type()}}& {{field.get_name()}}() const { return {{field.get_variable_name()}}; }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
if(::EmbeddedProto::Error::NO_ERRORS == return_value)
|
|
31
|
+
{
|
|
32
|
+
return_value = {{field.get_variable_name()}}.serialize_with_id(static_cast<uint32_t>(FieldNumber::{{field.get_variable_id_name()}}), buffer, {{ "true" if (field.optional or (field.oneof is not none)) else "false" }});
|
|
33
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
{% if (field.optional or (field.oneof is not none)) %}
|
|
31
|
+
if(has_{{field.get_name()}}() && (::EmbeddedProto::Error::NO_ERRORS == return_value))
|
|
32
|
+
{% else %}
|
|
33
|
+
if(::EmbeddedProto::Error::NO_ERRORS == return_value)
|
|
34
|
+
{% endif %}
|
|
35
|
+
{
|
|
36
|
+
return_value = {{field.get_variable_name()}}.serialize_with_id(static_cast<uint32_t>(FieldNumber::{{field.get_variable_id_name()}}), buffer, {{ "true" if (field.optional or (field.oneof is not none)) else "false" }});
|
|
37
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
static constexpr char const* {{field.get_name()|upper}}_NAME = "{{field.get_name()}}";
|
|
31
|
+
{% if field.oneof is not none %}
|
|
32
|
+
inline bool has_{{field.get_name()}}() const
|
|
33
|
+
{
|
|
34
|
+
return FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}};
|
|
35
|
+
}
|
|
36
|
+
inline void clear_{{field.get_name()}}()
|
|
37
|
+
{
|
|
38
|
+
if(FieldNumber::{{field.get_variable_id_name()}} == {{field.get_which_oneof()}})
|
|
39
|
+
{
|
|
40
|
+
{{field.get_which_oneof()}} = FieldNumber::NOT_SET;
|
|
41
|
+
{{field.get_variable_name()}}.~{{field.get_short_type()}}();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}()
|
|
45
|
+
{
|
|
46
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
47
|
+
{
|
|
48
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
49
|
+
}
|
|
50
|
+
return {{field.get_variable_name()}};
|
|
51
|
+
}
|
|
52
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& rhs)
|
|
53
|
+
{
|
|
54
|
+
if(FieldNumber::{{field.get_variable_id_name()}} != {{field.get_which_oneof()}})
|
|
55
|
+
{
|
|
56
|
+
init_{{field.get_oneof_name()}}(FieldNumber::{{field.get_variable_id_name()}});
|
|
57
|
+
}
|
|
58
|
+
{{field.get_variable_name()}}.set(rhs);
|
|
59
|
+
}
|
|
60
|
+
{% elif field.optional %}
|
|
61
|
+
inline bool has_{{field.get_name()}}() const
|
|
62
|
+
{
|
|
63
|
+
return 0 != (presence::mask(presence::fields::{{field.get_name().upper()}}) & presence_[presence::index(presence::fields::{{field.get_name().upper()}})]);
|
|
64
|
+
}
|
|
65
|
+
inline void clear_{{field.get_name()}}()
|
|
66
|
+
{
|
|
67
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] &= ~(presence::mask(presence::fields::{{field.get_name().upper()}}));
|
|
68
|
+
{{field.get_variable_name()}}.clear();
|
|
69
|
+
}
|
|
70
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}()
|
|
71
|
+
{
|
|
72
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
|
|
73
|
+
return {{field.get_variable_name()}};
|
|
74
|
+
}
|
|
75
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& rhs)
|
|
76
|
+
{
|
|
77
|
+
presence_[presence::index(presence::fields::{{field.get_name().upper()}})] |= presence::mask(presence::fields::{{field.get_name().upper()}});
|
|
78
|
+
{{field.get_variable_name()}}.set(rhs);
|
|
79
|
+
}
|
|
80
|
+
{% else %}
|
|
81
|
+
inline void clear_{{field.get_name()}}() { {{field.get_variable_name()}}.clear(); }
|
|
82
|
+
inline {{field.get_type()}}& mutable_{{field.get_name()}}() { return {{field.get_variable_name()}}; }
|
|
83
|
+
inline void set_{{field.get_name()}}(const {{field.get_type()}}& rhs) { {{field.get_variable_name()}}.set(rhs); }
|
|
84
|
+
{% endif %}
|
|
85
|
+
inline const {{field.get_type()}}& get_{{field.get_name()}}() const { return {{field.get_variable_name()}}; }
|
|
86
|
+
inline const char* {{field.get_name()}}() const { return {{field.get_variable_name()}}.get_const(); }
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
/*
|
|
31
|
+
* This file is generated with Embedded Proto, PLEASE DO NOT EDIT!
|
|
32
|
+
* source: {{proto_file.descriptor.name}}
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
// This file is generated. Please do not edit!
|
|
36
|
+
#ifndef {{proto_file.get_header_guard()}}_H
|
|
37
|
+
#define {{proto_file.get_header_guard()}}_H
|
|
38
|
+
|
|
39
|
+
#include <cstdint>
|
|
40
|
+
{% if proto_file.msg_definitions %}
|
|
41
|
+
#include <MessageInterface.h>
|
|
42
|
+
#include <WireFormatter.h>
|
|
43
|
+
#include <Fields.h>
|
|
44
|
+
#include <MessageSizeCalculator.h>
|
|
45
|
+
#include <ReadBufferSection.h>
|
|
46
|
+
#include <RepeatedFieldFixedSize.h>
|
|
47
|
+
#include <FieldStringBytes.h>
|
|
48
|
+
#include <Errors.h>
|
|
49
|
+
#include <Defines.h>
|
|
50
|
+
#include <limits>
|
|
51
|
+
|
|
52
|
+
{% endif %}
|
|
53
|
+
{% if proto_file.get_dependencies() is defined %}
|
|
54
|
+
// Include external proto definitions
|
|
55
|
+
{% for dependency in proto_file.get_dependencies() %}
|
|
56
|
+
#include "{{dependency}}"
|
|
57
|
+
{% endfor %}
|
|
58
|
+
|
|
59
|
+
{% endif %}
|
|
60
|
+
{% for namespace in proto_file.get_namespaces() %}
|
|
61
|
+
namespace {{ namespace }} {
|
|
62
|
+
{% endfor %}
|
|
63
|
+
|
|
64
|
+
{% for enum in proto_file.enum_definitions %}
|
|
65
|
+
{{ enum.render(environment) }}
|
|
66
|
+
|
|
67
|
+
{% endfor %}
|
|
68
|
+
{% for msg in proto_file.msg_definitions %}
|
|
69
|
+
{{ msg.render(environment) }}
|
|
70
|
+
|
|
71
|
+
{% endfor %}
|
|
72
|
+
{% for namespace in proto_file.get_namespaces()|reverse %}
|
|
73
|
+
} // End of namespace {{ namespace }}
|
|
74
|
+
{% endfor %}
|
|
75
|
+
#endif // {{proto_file.get_header_guard()}}_H
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{#
|
|
2
|
+
Copyright (C) 2020-2024 Embedded AMS B.V. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
This file is part of Embedded Proto.
|
|
5
|
+
|
|
6
|
+
Embedded Proto is open source software: you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU General Public License as published
|
|
8
|
+
by the Free Software Foundation, version 3 of the license.
|
|
9
|
+
|
|
10
|
+
Embedded Proto is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
For commercial and closed source application please visit:
|
|
19
|
+
<https://embeddedproto.com/pricing/>.
|
|
20
|
+
|
|
21
|
+
Embedded AMS B.V.
|
|
22
|
+
Info:
|
|
23
|
+
info at EmbeddedProto dot com
|
|
24
|
+
|
|
25
|
+
Postal address:
|
|
26
|
+
Atoomweg 2
|
|
27
|
+
1627 LE, Hoorn
|
|
28
|
+
the Netherlands
|
|
29
|
+
#}
|
|
30
|
+
enum class {{ typedef.name }} : uint32_t
|
|
31
|
+
{
|
|
32
|
+
{% for value in typedef.values() %}
|
|
33
|
+
{{ value.name }} = {{ value.number }}{{ "," if not loop.last }}
|
|
34
|
+
{% endfor %}
|
|
35
|
+
};
|