-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathtest_structures.flatdata
More file actions
177 lines (145 loc) · 3.12 KB
/
test_structures.flatdata
File metadata and controls
177 lines (145 loc) · 3.12 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
namespace test_structures {
struct SmallRef {
ref : u32 : 4;
}
archive SmallRefArchive {
@optional
list1 : vector< SmallRef >;
list2 : vector< SmallRef >;
@optional
multi_list1 : multivector< 32, SmallRef >;
multi_list2 : multivector< 32, SmallRef >;
@optional
raw1 : raw_data;
raw2 : raw_data;
@explicit_reference( SmallRef.ref, list1 )
@explicit_reference( SmallRef.ref, list2 )
@explicit_reference( SmallRef.ref, multi_list1 )
@explicit_reference( SmallRef.ref, multi_list2 )
@explicit_reference( SmallRef.ref, raw1 )
@explicit_reference( SmallRef.ref, raw2 )
refs : vector< SmallRef >;
}
const i8 INVALID_ZERO = 0;
const i8 INVALID_MIN_INT = -128;
const i8 INVALID_MAX_INT = 127;
struct TestInvalidValue {
@optional( INVALID_ZERO )
invalid_zero : i8;
@optional( INVALID_MIN_INT )
invalid_min_int : i8;
@optional( INVALID_MAX_INT )
invalid_max_int : i8;
}
// Enumeration with some overlapping values
enum Enum1 : u16 : 3{
// = 0
VALUE_1,
// = 3
VALUE_2 = 3,
// = 4
VALUE_3,
// = 1
VALUE_4 = 1,
// = 2
VALUE_5
}
enum SignedEnum1 : i32 : 3 {
VALUE_INT4_MIN = -4,
VALUE_INT4_MAX = 3,
VALUE_INT3_MIN = -2,
VALUE_INT3_MAX = 1,
VALUE_MINUS_ONE = -1
}
struct StructWithEnum
{
a : u32 : 19;
b : Enum1 : 3;
c : Enum1;
}
struct StructWithSignedEnum
{
a : SignedEnum1;
}
struct SimpleStruct {
a : u32 : 32;
b : u32 : 32;
}
struct OtherSimpleStruct {
a : u32 : 32;
b : u32 : 32;
}
struct BitPackedStruct {
a : bool : 1;
b : u32 : 32;
c : u32 : 7;
}
struct SignedStruct {
a : i16 : 5;
b : u32 : 32;
c : i32 : 7;
d : u32 : 32;
}
struct AStruct {
value : u64 : 8;
}
struct BStruct {
value : u64 : 16;
}
struct CStruct {
value : u64 : 32;
}
struct TestIndexType48 {
@range(range)
value : u64 : 48;
}
struct TestIndexType32 {
@range(range)
value : u64 : 48;
}
archive SimpleResources {
object_resource: AStruct;
vector_resource: vector< AStruct >;
multivector_resource: multivector< 33, AStruct >;
raw_data_resource: raw_data;
@optional
optional_resource: raw_data;
}
archive OnlyOptional {
@optional
optional_resource: raw_data;
}
archive InnerArchive {
inner : AStruct;
}
archive OuterArchive {
outer1: AStruct;
outer2: AStruct;
inner: archive InnerArchive;
}
archive OutermostArchive {
outermost: AStruct;
outer: archive OuterArchive;
}
archive OuterWithOptional {
outer: AStruct;
@optional
archive_resource: archive InnerArchive;
}
} // namespace test_structures
namespace test_structures.backward_compatibility {
archive TestInstance {
instance_resource: .test_structures.SignedStruct;
}
archive TestVector {
vector_resource: vector< .test_structures.SignedStruct >;
}
archive TestMultivector {
multivector_resource: multivector< 33,
.test_structures.SimpleStruct,
.test_structures.SignedStruct >;
}
archive TestRawData {
raw_data_resource : raw_data;
}
} // namespace backward_compatibility