forked from heremaps/flatdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinary_layout.cpp
33 lines (26 loc) · 888 Bytes
/
binary_layout.cpp
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
/**
* Copyright (c) 2017 HERE Europe B.V.
* See the LICENSE file in the root of this project for license details.
*/
#include "binary_layout.hpp"
#include <flatdata/MemoryResourceStorage.h>
int
main( int, const char** )
{
std::shared_ptr< flatdata::MemoryResourceStorage > storage
= flatdata::MemoryResourceStorage::create( );
auto builder = binary_layout::BinaryLayoutBuilder::open( storage );
flatdata::Vector< binary_layout::UnalignedStructure > alignment_example( 2 );
auto struct_0 = alignment_example[ 0 ];
struct_0.f0 = 0xF;
struct_0.f1 = 0;
struct_0.f2 = 0x07;
auto struct_1 = alignment_example[ 1 ];
struct_1.f0 = 0;
struct_1.f1 = 0xFFFF;
struct_1.f2 = 0x0;
builder.set_alignment_example( alignment_example );
std::cout << storage->hexdump( true );
std::cout << storage->bindump( false );
return 0;
}