DCCL v4
Loading...
Searching...
No Matches
test.proto
1// Copyright 2019-2023:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6// Davide Fenucci <davfen@noc.ac.uk>
7//
8//
9// This file is part of the Dynamic Compact Control Language Library
10// ("DCCL").
11//
12// DCCL is free software: you can redistribute it and/or modify
13// it under the terms of the GNU Lesser General Public License as published by
14// the Free Software Foundation, either version 2.1 of the License, or
15// (at your option) any later version.
16//
17// DCCL is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU Lesser General Public License for more details.
21//
22// You should have received a copy of the GNU Lesser General Public License
23// along with DCCL. If not, see <http://www.gnu.org/licenses/>.
24syntax = "proto2";
25
26import "dccl/option_extensions.proto";
27
28package dccl.test;
29
30message EmbeddedMsg1
31{
32 optional double val = 1 [
33 (dccl.field).min = 0,
34 (dccl.field).max = 126,
35 (dccl.field).precision = 3
36 ];
37 oneof nested_oneof
38 {
39 int32 int32_nested_oneof = 116
40 [(dccl.field).min = 0, (dccl.field).max = 31];
41 double double_nested_oneof = 117
42 [(dccl.field).min = -1, (dccl.field).max = 126];
43 }
44}
45
46message TestMsg
47{
48 option (dccl.msg).id = 2;
49 option (dccl.msg).max_bytes = 32;
50 option (dccl.msg).codec_version = 4;
51
52 oneof test_oneof1
53 {
54 double double_oneof1 = 118 [
55 (dccl.field).min = -100,
56 (dccl.field).max = 126,
57 (dccl.field).precision = 2
58 ];
59
60 EmbeddedMsg1 msg_oneof1 = 119;
61 double non_default_double = 122
62 [(dccl.field).codec = "dccl.native_protobuf"];
63 }
64
65 oneof test_oneof2
66 {
67 int32 int32_oneof2 = 120
68 [(dccl.field).min = -20, (dccl.field).max = 3000];
69 EmbeddedMsg1 msg_oneof2 = 121;
70 }
71}
72
73message InvalidTestMsg
74{
75 option (dccl.msg).id = 3;
76 option (dccl.msg).max_bytes = 32;
77 option (dccl.msg).codec_version = 4;
78
79 oneof test_oneof1
80 {
81 double double_oneof1 = 118 [
82 (dccl.field).min = -100,
83 (dccl.field).max = 126,
84 (dccl.field).in_head = true,
85 (dccl.field).precision = 2
86 ];
87
88 EmbeddedMsg1 msg_oneof1 = 119;
89 }
90
91 oneof test_oneof2
92 {
93 int32 int32_oneof2 = 120
94 [(dccl.field).min = -20, (dccl.field).max = 3000];
95 EmbeddedMsg1 msg_oneof2 = 121;
96 }
97}