DCCL v4
test.proto
1 // Copyright 2013-2023:
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 // File authors:
6 // Toby Schneider <toby@gobysoft.org>
7 // Chris Murphy <cmurphy@aphysci.com>
8 //
9 //
10 // This file is part of the Dynamic Compact Control Language Library
11 // ("DCCL").
12 //
13 // DCCL is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU Lesser General Public License as published by
15 // the Free Software Foundation, either version 2.1 of the License, or
16 // (at your option) any later version.
17 //
18 // DCCL is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public License
24 // along with DCCL. If not, see <http://www.gnu.org/licenses/>.
25 syntax = "proto2";
26 import "dccl/option_extensions.proto";
27 package dccl.test;
28 
29 message NumericMsg
30 {
31  option (dccl.msg).id = 10;
32  option (dccl.msg).max_bytes = 32;
33  option (dccl.msg).codec_version = 4;
34 
35  optional double a = 1 [
36  (dccl.field).max = 180,
37  (dccl.field).min = -180,
38  (dccl.field).precision = 12,
39  (dccl.field).in_head = true
40  ];
41 
42  optional double b = 2 [
43  (dccl.field).max = 18,
44  (dccl.field).min = -18,
45  (dccl.field).precision = 4
46  ];
47 
48  // max is 2^64 rounded to 1e5
49  required uint64 u1 = 3 [
50  (dccl.field).max = 18446744073709500000,
51  (dccl.field).min = 0,
52  (dccl.field).precision = -5
53  ];
54 
55  // max is 2^64 rounded to 1e5
56  required uint64 u2 = 4 [
57  (dccl.field).max = 18446744073709500000,
58  (dccl.field).min = 0,
59  (dccl.field).precision = -5
60  ];
61 }
62 
63 message NegativePrecisionNumericMsg
64 {
65  option (dccl.msg).id = 10;
66  option (dccl.msg).max_bytes = 32;
67  option (dccl.msg).codec_version = 4;
68 
69  optional double a = 1 [
70  (dccl.field).min = -20,
71  (dccl.field).max = 20,
72  (dccl.field).precision = -1
73  ];
74 
75  optional int32 b = 2 [
76  (dccl.field).min = -500000,
77  (dccl.field).max = 500000,
78  (dccl.field).precision = -3
79  ];
80 }
81 
82 message TooBigNumericMsg
83 {
84  option (dccl.msg).id = 11;
85  option (dccl.msg).max_bytes = 32;
86  option (dccl.msg).codec_version = 4;
87 
88  optional double a = 1 [
89  (dccl.field).max = 180,
90  (dccl.field).min = -180,
91  (dccl.field).precision = 15
92  ];
93 }