File indexing completed on 2025-01-18 09:39:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef BOOST_LOG_DETAIL_VALUE_REF_VISITATION_HPP_INCLUDED_
0018 #define BOOST_LOG_DETAIL_VALUE_REF_VISITATION_HPP_INCLUDED_
0019
0020 #include <boost/mpl/at.hpp>
0021 #include <boost/mpl/begin.hpp>
0022 #include <boost/mpl/end.hpp>
0023 #include <boost/mpl/advance.hpp>
0024 #include <boost/mpl/erase.hpp>
0025 #include <boost/mpl/size.hpp>
0026 #include <boost/preprocessor/arithmetic/inc.hpp>
0027 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0028 #include <boost/preprocessor/iteration/iterate.hpp>
0029 #include <boost/log/detail/config.hpp>
0030 #include <boost/log/detail/header.hpp>
0031
0032 #ifndef BOOST_LOG_VALUE_REF_VISITATION_UNROLL_COUNT
0033 #define BOOST_LOG_VALUE_REF_VISITATION_UNROLL_COUNT 8
0034 #endif
0035
0036 namespace boost {
0037
0038 BOOST_LOG_OPEN_NAMESPACE
0039
0040 namespace aux {
0041
0042 template< typename SequenceT, typename VisitorT, unsigned int SizeV = mpl::size< SequenceT >::value >
0043 struct apply_visitor_dispatch
0044 {
0045 typedef typename VisitorT::result_type result_type;
0046
0047 static BOOST_FORCEINLINE result_type call(const void* p, unsigned int type_index, VisitorT& visitor)
0048 {
0049 typedef typename mpl::begin< SequenceT >::type begin_type;
0050 typedef typename mpl::advance_c< begin_type, SizeV / 2u >::type middle_type;
0051 if (type_index < (SizeV / 2u))
0052 {
0053 typedef typename mpl::erase< SequenceT, middle_type, typename mpl::end< SequenceT >::type >::type new_sequence;
0054 typedef apply_visitor_dispatch< new_sequence, VisitorT > new_dispatch;
0055 return new_dispatch::call(p, type_index, visitor);
0056 }
0057 else
0058 {
0059 typedef typename mpl::erase< SequenceT, begin_type, middle_type >::type new_sequence;
0060 typedef apply_visitor_dispatch< new_sequence, VisitorT > new_dispatch;
0061 return new_dispatch::call(p, type_index - (SizeV / 2u), visitor);
0062 }
0063 }
0064 };
0065
0066 #define BOOST_LOG_AUX_CASE_ENTRY(z, i, data)\
0067 case i: return visitor(*static_cast< typename mpl::at_c< SequenceT, i >::type const* >(p));
0068
0069 #define BOOST_PP_FILENAME_1 <boost/log/detail/value_ref_visitation.hpp>
0070 #define BOOST_PP_ITERATION_LIMITS (1, BOOST_PP_INC(BOOST_LOG_VALUE_REF_VISITATION_VTABLE_SIZE))
0071 #include BOOST_PP_ITERATE()
0072
0073 #undef BOOST_LOG_AUX_CASE_ENTRY
0074
0075 }
0076
0077 BOOST_LOG_CLOSE_NAMESPACE
0078
0079 }
0080
0081 #include <boost/log/detail/footer.hpp>
0082
0083 #endif
0084
0085 #ifdef BOOST_PP_IS_ITERATING
0086
0087 #define BOOST_LOG_AUX_SWITCH_SIZE BOOST_PP_ITERATION()
0088
0089 template< typename SequenceT, typename VisitorT >
0090 struct apply_visitor_dispatch< SequenceT, VisitorT, BOOST_LOG_AUX_SWITCH_SIZE >
0091 {
0092 typedef typename VisitorT::result_type result_type;
0093
0094 static BOOST_FORCEINLINE result_type call(const void* p, unsigned int type_index, VisitorT& visitor)
0095 {
0096 switch (type_index)
0097 {
0098 BOOST_PP_REPEAT_FROM_TO(1, BOOST_LOG_AUX_SWITCH_SIZE, BOOST_LOG_AUX_CASE_ENTRY, ~)
0099 default:
0100 return visitor(*static_cast< typename mpl::at_c< SequenceT, 0 >::type const* >(p));
0101 }
0102 }
0103 };
0104
0105 #undef BOOST_LOG_AUX_SWITCH_SIZE
0106
0107 #endif