Skip to content

Latest commit

 

History

History
152 lines (135 loc) · 9.62 KB

README.md

File metadata and controls

152 lines (135 loc) · 9.62 KB

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