Giter VIP home page Giter VIP logo

micro-cdr's Introduction

eProsima microCDR

eProsima microCDR is a C library implementing the CDR standard serialization methods. This library is focused on embedded and resource-limited systems.

microCDR uses a static buffer, is always aligned, and allow to serialize and deserialize in both, big endianness and little endianness. For more information about the API of microCDR check ...?

Usage examples

This is a code example showing the serialization and deserialization of a string. As microCDR uses a static buffer, that means the user has to provide a defined buffer and its size during the MicroBuffer creation.

    #include <microcdr/microcdr.h>
    #include <stdio.h>

    #define BUFFER_LENGTH 256

    int main(int argc, char** args)
    {
        // Data buffer
        uint8_t buffer[BUFFER_LENGTH];

        // Structs for handle the buffer.
        MicroBuffer writer;
        MicroBuffer reader;

        // Initialize the MicroBuffers for working with an user-managed buffer.
        init_micro_buffer(&writer, buffer, BUFFER_LENGTH);
        init_micro_buffer(&reader, buffer, BUFFER_LENGTH);

        // Serialize data
        char input[16] = "Hello microCDR!"; //16 characters
        serialize_array_char(&writer, input, 16);

        // Deserialize data
        char output[16];
        deserialize_array_char(&reader, output, 16);

        printf("Input: %s\n", input);
        printf("Output: %s\n", output);

        return 0;
    }

Note: to change the default endianness of functions without the endian tag, use the endianness member of the Microbuffer structure.

Supported types

The types supported in microCDR are presented in the following table. For each of them exists a serialization and a deserialization function.

Type Endianness
bool
char
uint8
int16
int16 endianness
uint16
uint16 endianness
int32
int32 endianness
uint32
uint32 endianness
int64
int64 endianness
uint64
uint64 endianness
float
float endianness
double
double endianness
bool array
char array
uint8 array
int16 array
int16 array endianness
uint16 array
uint16 array endianness
int32 array
int32 array endianness
uint32 array
uint32 array endianness
int64 array
int64 array endianness
uint64 array
uint64 array endianness
float array
float array endianness
double array
double array endianness

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.