Git Product home page Git Product logo

yas's Introduction

Build Status Build status

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

  • 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

yas's People

Contributors

nixman avatar pmed avatar ahartmetz avatar aumuell avatar daldegam avatar ml1nk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.