Reading Binary Data with Style: A Serialization Framework for C++17 - Tony Wasserka - CppCon 2019

preview_player
Показать описание



Reading structured data from a file or network stream remains cumbersome and error-prone in C++, especially when data validation is required. Existing approaches require too much boilerplate, aren't always portable, and may be restricted to specific data sources. Despite these limitations, there have been few alternatives in the past.

This talk introduces blobify, an experimental serialization framework for C++17 designed to convert user-defined structs to binary data blobs and vice-versa. Contrary to similar frameworks, blobify largely automates the process, and it includes an embedded domain specific language to handle data validation.

I will describe blobify's API design and usage, explain how it works under the hood, and provide an outlook at what the Reflection TS has in store for future improvements.


Tony Wasserka
Consultant
Berlin, Germany

Low-level anything: Tony is a consultant and long-term C++ enthusiast who has worked on the console emulator projects Dolphin (GameCube/Wii), PPSSPP (PSP), and Mikage (3DS) since 2010. More recently, he has worked on Vulkan graphics drivers for PowerVR graphics processors. His main interest is exploring C++'s zero-cost abstraction capabilities and applying them to create better software for resource-constrained environments.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Blobify is cool, unfortunately I won't be able to use it, as my code base is a fork of ScummVM, and uses ScummVM's file reading functions.

TheMonyarm
Автор

This approach seems very similar to using boost::spirit::x3 for parsing binary data. It also has a simila declarative syntax like the python examples and comes with binary parsers already included. Great talk though.

zahramo
Автор

I've been working on embedded software with C++ for two years and this library is something VERY useful and I'd certainly benefit from it. Unfortunately, our systems don't have enough resources to support exceptions :(.

arthur.passos
Автор

The bad thing with exceptions isn't necessarily that they're very resource intensive, or all the hidden cruft they generate, but it's simply a bad error handling model. It's very hard to reason what goes on, it creates hidden return paths that are invisible to even the most sophisticated tools (you basically have to run it to know what really happens), and this leads to badly handled error scenarios.
Also, it's often abused for regular control flow, which _really_ muddies the water and very successfully turns even the simplest algorithms into an unreadable mess.

brynyard
Автор

Using the word "annotations" with the python construct example is really misleading. In pythons annotations are a well defined part of the language. Nice talk thou :)

kiffeeify