annotate DEPENDENCIES/generic/include/boost/msm/back/args.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright 2008 Christophe Henry
Chris@16 2 // henry UNDERSCORE christophe AT hotmail DOT com
Chris@16 3 // This is an extended version of the state machine available in the boost::mpl library
Chris@16 4 // Distributed under the same license as the original.
Chris@16 5 // Copyright for the original version:
Chris@16 6 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
Chris@16 7 // under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at
Chris@16 9 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10
Chris@16 11 #ifndef BOOST_MSM_BACK_ARGS_H
Chris@16 12 #define BOOST_MSM_BACK_ARGS_H
Chris@16 13
Chris@16 14 #include <boost/preprocessor/repetition/enum_params.hpp>
Chris@16 15 #include <boost/preprocessor/arithmetic/sub.hpp>
Chris@16 16 #include <boost/preprocessor/punctuation/comma_if.hpp>
Chris@16 17 #include <boost/preprocessor/control/expr_if.hpp>
Chris@16 18 #include <boost/preprocessor/punctuation/comma.hpp>
Chris@16 19 #include <boost/preprocessor/arithmetic/add.hpp>
Chris@16 20 #include <boost/preprocessor/cat.hpp>
Chris@16 21 #include <boost/preprocessor/comparison/less.hpp>
Chris@16 22 #include <boost/preprocessor/arithmetic/dec.hpp>
Chris@16 23 #include <boost/function.hpp>
Chris@16 24
Chris@16 25 #ifndef BOOST_MSM_VISITOR_ARG_SIZE
Chris@16 26 #define BOOST_MSM_VISITOR_ARG_SIZE 2 // default max number of arguments
Chris@16 27 #endif
Chris@16 28
Chris@16 29 namespace boost { namespace msm { namespace back
Chris@16 30 {
Chris@16 31 struct no_args {};
Chris@16 32 #define MSM_ARGS_TYPEDEF_SUB(z, n, unused) typedef ARG ## n argument ## n ;
Chris@16 33 #define MSM_ARGS_PRINT(z, n, data) data
Chris@16 34 #define MSM_ARGS_NONE_PRINT(z, n, data) class data ## n = no_args \
Chris@16 35 BOOST_PP_COMMA_IF( BOOST_PP_LESS(n, BOOST_PP_DEC(BOOST_MSM_VISITOR_ARG_SIZE) ) )
Chris@16 36
Chris@16 37 #define MSM_VISITOR_MAIN_ARGS(n) \
Chris@16 38 template <class RES, \
Chris@16 39 BOOST_PP_REPEAT(BOOST_MSM_VISITOR_ARG_SIZE, MSM_ARGS_NONE_PRINT, ARG)> \
Chris@16 40 struct args \
Chris@16 41 { \
Chris@16 42 typedef ::boost::function<RES(BOOST_PP_ENUM_PARAMS(n, ARG))> type; \
Chris@16 43 enum {args_number=n}; \
Chris@16 44 BOOST_PP_REPEAT(n, MSM_ARGS_TYPEDEF_SUB, ~ ) \
Chris@16 45 };
Chris@16 46
Chris@16 47 #define MSM_VISITOR_ARGS(z, n, unused) \
Chris@16 48 template <class RES BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class ARG)> \
Chris@16 49 struct args<RES, \
Chris@16 50 BOOST_PP_ENUM_PARAMS(n,ARG) \
Chris@16 51 BOOST_PP_COMMA_IF(n) \
Chris@16 52 BOOST_PP_ENUM(BOOST_PP_SUB(BOOST_MSM_VISITOR_ARG_SIZE,n), MSM_ARGS_PRINT, no_args) \
Chris@16 53 > \
Chris@16 54 { \
Chris@16 55 typedef ::boost::function<RES(BOOST_PP_ENUM_PARAMS(n, ARG))> type; \
Chris@16 56 enum {args_number=n}; \
Chris@16 57 BOOST_PP_REPEAT(n, MSM_ARGS_TYPEDEF_SUB, ~ ) \
Chris@16 58 };
Chris@16 59 MSM_VISITOR_MAIN_ARGS(BOOST_MSM_VISITOR_ARG_SIZE)
Chris@16 60 BOOST_PP_REPEAT(BOOST_MSM_VISITOR_ARG_SIZE, MSM_VISITOR_ARGS, ~)
Chris@16 61
Chris@16 62 #undef MSM_VISITOR_ARGS
Chris@16 63 #undef MSM_ARGS_PRINT
Chris@16 64
Chris@16 65 }}}
Chris@16 66
Chris@16 67 #endif //BOOST_MSM_BACK_ARGS_H
Chris@16 68