messagepack implementation for embedded systems (mbed / arduino)

Dependents:   hello_message_pack

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers transform.hpp Source File

transform.hpp

00001 # /* **************************************************************************
00002 #  *                                                                          *
00003 #  *     (C) Copyright Paul Mensonides 2002.
00004 #  *     Distributed under the Boost Software License, Version 1.0. (See
00005 #  *     accompanying file LICENSE_1_0.txt or copy at
00006 #  *     http://www.boost.org/LICENSE_1_0.txt)
00007 #  *                                                                          *
00008 #  ************************************************************************** */
00009 #
00010 # /* See http://www.boost.org for most recent version. */
00011 #
00012 # ifndef MSGPACK_PREPROCESSOR_SEQ_TRANSFORM_HPP
00013 # define MSGPACK_PREPROCESSOR_SEQ_TRANSFORM_HPP
00014 #
00015 # include <msgpack/preprocessor/config/config.hpp>
00016 # include <msgpack/preprocessor/seq/fold_left.hpp>
00017 # include <msgpack/preprocessor/seq/seq.hpp>
00018 # include <msgpack/preprocessor/tuple/elem.hpp>
00019 # include <msgpack/preprocessor/tuple/rem.hpp>
00020 #
00021 # /* MSGPACK_PP_SEQ_TRANSFORM */
00022 #
00023 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
00024 #    define MSGPACK_PP_SEQ_TRANSFORM(op, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT(MSGPACK_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
00025 # else
00026 #    define MSGPACK_PP_SEQ_TRANSFORM(op, data, seq) MSGPACK_PP_SEQ_TRANSFORM_I(op, data, seq)
00027 #    define MSGPACK_PP_SEQ_TRANSFORM_I(op, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT(MSGPACK_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
00028 # endif
00029 #
00030 # if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_STRICT()
00031 #    define MSGPACK_PP_SEQ_TRANSFORM_O(s, state, elem) MSGPACK_PP_SEQ_TRANSFORM_O_IM(s, MSGPACK_PP_TUPLE_REM_3 state, elem)
00032 #    define MSGPACK_PP_SEQ_TRANSFORM_O_IM(s, im, elem) MSGPACK_PP_SEQ_TRANSFORM_O_I(s, im, elem)
00033 # else
00034 #    define MSGPACK_PP_SEQ_TRANSFORM_O(s, state, elem) MSGPACK_PP_SEQ_TRANSFORM_O_I(s, MSGPACK_PP_TUPLE_ELEM(3, 0, state), MSGPACK_PP_TUPLE_ELEM(3, 1, state), MSGPACK_PP_TUPLE_ELEM(3, 2, state), elem)
00035 # endif
00036 #
00037 # define MSGPACK_PP_SEQ_TRANSFORM_O_I(s, op, data, res, elem) (op, data, res (op(s, data, elem)))
00038 #
00039 # /* MSGPACK_PP_SEQ_TRANSFORM_S */
00040 #
00041 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
00042 #    define MSGPACK_PP_SEQ_TRANSFORM_S(s, op, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT_ ## s(MSGPACK_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
00043 # else
00044 #    define MSGPACK_PP_SEQ_TRANSFORM_S(s, op, data, seq) MSGPACK_PP_SEQ_TRANSFORM_S_I(s, op, data, seq)
00045 #    define MSGPACK_PP_SEQ_TRANSFORM_S_I(s, op, data, seq) MSGPACK_PP_SEQ_TAIL(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_SEQ_FOLD_LEFT_ ## s(MSGPACK_PP_SEQ_TRANSFORM_O, (op, data, (nil)), seq)))
00046 # endif
00047 #
00048 # endif