• Stars
    star
    722
  • Rank 60,279 (Top 2 %)
  • Language
    C++
  • Created about 12 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Yet Another Serialization

CI

YAS

Yet Another Serialization

-Time

  • YAS is created as a replacement of boost.serialization because of its insufficient speed of serialization (benchmark 1, benchmark 2)
  • YAS is header only library
  • YAS does not depend on third-party libraries or boost
  • YAS require C++11 support
  • YAS binary archives is endian independent

Supported the following types of archives:

  • binary
  • text
  • json (not fully comply)

Supported the following compilers:

  • GCC : 4.8.5, ... - 32/64 bit
  • MinGW: 4.8.5, ... - 32/64 bit
  • Clang: 3.5, ... - 32/64 bit
  • Intel: (untested)
  • MSVC : 2017(in c++14 mode), ... - 32/64 bit
  • Emscripten: 1.38 (clang version 6.0.1)

Samples

The easiest way to save and load some object or vars is to use the yas::save() and yas::load() functions like this:

#include <yas/serialize.hpp>
#include <yas/std_types.hpp>

int main() {
    int a = 3, aa{};
    short b = 4, bb{};
    float c = 3.14, cc{};
    
    constexpr std::size_t flags = 
         yas::mem // IO type
        |yas::json; // IO format
    
    auto buf = yas::save<flags>(
        YAS_OBJECT("myobject", a, b, c)
    );
    
    // buf = {"a":3,"b":4,"c":3.14}
    
    yas::load<flags>(buf,
        YAS_OBJECT_NVP("myobject"
            ,("a", aa)
            ,("b", bb)
            ,("c", cc)
        )
    );
    // a == aa && b == bb && c == cc;
}

The IO type can be one of yas::mem or yas::file. The IO format can be one of yas::binary or yas::text or yas::json.

The YAS_OBJECT()/YAS_OBJECT_NVP()/YAS_OBJECT_STRUCT()/YAS_OBJECT_STRUCT_NVP() macro are declared here, example use is here.

More examples you can see here.

TODO:

  • protobuf/messagepack support
  • limits
  • objects versioning

Support the project

You can support the YAS project by donating:

  • BTC: 12rjx6prAxwJ1Aep6HuM54At9wDvSCDbSJ
  • ETH: 0x62719DDEc96C513699a276107622C73F6cAcec47

Serialization for the following types is supported:

Projects using YAS

  • Ufochain: a mimblewimble implementation of crypto currency using X17r algorithm
  • Kvant: Kvant - is an original project using the consensus of MimbleWimble, due to which maximum anonymity and security were achieved
  • zkPoD-lib: zkPoD-lib is the underlying core library for zkPoD system. It fully implements PoD (proof of delivery) protocol and also provides a CLI interface together with Golang bindings
  • Litecash: Litecash is the next generation scalable, confidential cryptocurrency based on an elegant and innovative Mimblewimble protocol
  • K3: K3 is a programming language for building large-scale data systems
  • vistle: Software Environment for High-Performance Simulation and Parallel Visualization
  • LGraph: Live Graph infrastructure for Synthesis and Simulation
  • Beam: BEAM is a next generation scalable, confidential cryptocurrency based on an elegant and innovative Mimblewimble protocol
  • libfon9: C++11 Cross-platform infrastructure for Order Management System
  • iris-crypt: Store Node.js modules encrypted in a package file
  • cppan: Class members annotations for C++
  • GeekSys company: GeekSys is using YAS to serialize features from images

More Repositories

1

mingw-builds-binaries

MinGW-W64 compiler binaries
1,950
star
2

mingw-builds

Scripts for building the 32 and 64-bit MinGW-W64 compilers for Windows
Shell
258
star
3

binapi

Binance API C++ implementation
C++
206
star
4

flatjson

The extremely fast zero allocation and zero copying JSON parser
C++
24
star
5

csprot

C++14 compile time literal-string encoder, which decodes a strings at run-time
C++
8
star
6

yal

Yet Another Logger
C++
8
star
7

aescrypt

AES crypt/decrypt using OpenSSL
C++
6
star
8

named-args

C++11 tiny implementation of the concept of named function arguments with zero runtime overhead
C++
6
star
9

enum-gen

'enum's and 'enum class'es metainfo preprocessor generator
C++
5
star
10

std-signals

C++11 managed signals and slots callback implementation
C++
4
star
11

sha1

sha1 summ calculator
C++
3
star
12

contract

Library to support contract programming in C++11
C++
3
star
13

cmdargs

C++17 library to work with command-line args and config files
C++
3
star
14

blockchain

Blockchain for fun :)
C++
3
star
15

nanolog

C++20 Nano logging library with std::format
C++
3
star
16

config-ctor

C++ preprocessor type constuctor for processing structured (JSON) configuration files
C++
3
star
17

mingw-env

The development environment based on the MinGW-W64 project
Shell
2
star
18

throw

C++ exceptions helpers
C++
2
star
19

fqueue

Persistent file queue of buffers
C++
2
star
20

static_if

C++14 static_if() alternative implementation from D language
C++
1
star
21

switch

switch()-like statement whose cases can be strings and integrals
C++
1
star
22

singleapplication

C++ single-application guard
C++
1
star
23

passgen

Password generator uses common passphrase and URL of the site
Shell
1
star
24

nixman.github.io

letters
HTML
1
star
25

transparent-proxy

Transparent proxy using boost.asio
C++
1
star
26

impl-container

Container of implementations with getter by key and verifying the uniqueness of stored implementations
C++
1
star
27

torrent-creator

torrent files creator using libtorrent-rasterbar
C++
1
star
28

any

extended 'any' implementation for C++11
C++
1
star
29

lazy-init

Lazy initialization of objects
C++
1
star