Giter VIP home page Giter VIP logo

libendian's Introduction

LibEndian

A cross platform C++ library to get rid with of binary serialization issues. This library can serialize in buffer the most common types.

Dependencies

Supported Types

All the types are from stdint.h.

Type Size (in bytes) Read Write
uint8_t UINT8_SIZE : 1 GET_UINT8 SET_UINT8
int8_t INT8_SIZE : 1 GET_INT8 SET_INT8
uint16_t UINT16_SIZE : 2 GET_UINT16 SET_UINT16
int16_t INT16_SIZE : 2 GET_INT16 SET_INT16
uint32_t UINT32_SIZE : 4 GET_UINT32 SET_UINT32
int32_t INT32_SIZE : 4 GET_INT32 SET_INT32
uint48_t UINT48_SIZE : 6 GET_UINT48 SET_UINT48
int48_t INT48_SIZE : 6 GET_INT48 SET_INT48
uint64_t UINT64_SIZE : 8 GET_UINT64 SET_UINT64
int64_t INT64_SIZE : 8 GET_INT64 SET_INT64
float FLOAT32_SIZE : 4 GET_FLOAT32 SET_FLOAT32
double FLOAT64_SIZE : 8 GET_FLOAT64 SET_FLOAT64

Build with CMake

The CMake can build the library either as a static or a shared library. It can also generate a doxygen website.

git clone https://github.com/OlivierLDff/LibEndian
cd LibEndian && mkdir build && cd build
cmake -DLIBENDIAN_USE_NAMESPACE=ON -DLIBENDIAN_BUILD_DOC=ON ..
make -j16

Input

  • LIBENDIAN_TARGET : Name of the library target. Default : "LibEndian"
  • LIBENDIAN_PROJECT : Name of the project. Default : "LibEndian"
  • LIBENDIAN_BUILD_SHARED : Build shared library [ON OFF]. Default: OFF.
  • LIBENDIAN_BUILD_STATIC : Build static library [ON OFF]. Default: ON.
  • LIBENDIAN_USE_NAMESPACE : If the library compile with a namespace [ON OFF]. Default: ON.
  • LIBENDIAN_NAMESPACE : Namespace for the library. Only relevant if LIBENDIAN_USE_NAMESPACE is ON. Default: "Endn".
  • LIBENDIAN_BUILD_DOC : Build the LibEndian Doc [ON OFF]. Default: OFF.

Dependencies

Output

  • LIBENDIAN_TARGET : Output target to link to.
  • LIBENDIAN_VERSION : Current version of the library

Integration with CMake project

The main goal of this CMake project is to big included into another CMake project.

SET( LIBENDIAN_TARGET LibEndian )
SET( LIBENDIAN_PROJECT LibEndian )
SET( LIBENDIAN_BUILD_SHARED OFF )
SET( LIBENDIAN_BUILD_STATIC ON )
SET( LIBENDIAN_BUILD_DOC OFF )
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/path/to/LibEndian ${CMAKE_CURRENT_BINARY_DIR}/LibEndian_Build)

It is also possible to download the repository with the scripts inside cmake/. folder Simply call BuildLibEndian.cmake.

You will need:

  • DownloadProject.cmake
  • DownloadProject.CMakeLists.cmake.in
  • BuildLibEndian.cmake
SET( LIBENDIAN_TARGET LibEndian )
SET( LIBENDIAN_PROJECT LibEndian )
SET( LIBENDIAN_BUILD_SHARED OFF )
SET( LIBENDIAN_BUILD_STATIC ON )
SET( LIBENDIAN_BUILD_DOC OFF )
SET( LIBENDIAN_USE_NAMESPACE ON )
SET( LIBENDIAN_REPOSITORY "https://github.com/OlivierLDff/LibEndian.git" )
SET( LIBENDIAN_TAG v1.0.2 )
INCLUDE(path/to/BuildLibEndian.cmake)

Revisions

  • 1.0.0 : Initial work
    • 1.0.1 : Fix CMakeLists status
    • 1.0.2 : Fix CMakeLists file name

libendian's People

Contributors

olivierldff avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

lzhice

libendian's Issues

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.