Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/log/detail/value_ref_visitation.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /* | |
2 * Copyright Andrey Semashev 2007 - 2013. | |
3 * Distributed under the Boost Software License, Version 1.0. | |
4 * (See accompanying file LICENSE_1_0.txt or copy at | |
5 * http://www.boost.org/LICENSE_1_0.txt) | |
6 */ | |
7 /*! | |
8 * \file value_ref_visitation.hpp | |
9 * \author Andrey Semashev | |
10 * \date 28.07.2012 | |
11 * | |
12 * \brief This header is the Boost.Log library implementation, see the library documentation | |
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. In this file | |
14 * internal configuration macros are defined. | |
15 */ | |
16 | |
17 #ifndef BOOST_LOG_DETAIL_VALUE_REF_VISITATION_HPP_INCLUDED_ | |
18 #define BOOST_LOG_DETAIL_VALUE_REF_VISITATION_HPP_INCLUDED_ | |
19 | |
20 #include <boost/mpl/at.hpp> | |
21 #include <boost/mpl/begin.hpp> | |
22 #include <boost/mpl/end.hpp> | |
23 #include <boost/mpl/advance.hpp> | |
24 #include <boost/mpl/erase.hpp> | |
25 #include <boost/mpl/size.hpp> | |
26 #include <boost/preprocessor/arithmetic/inc.hpp> | |
27 #include <boost/preprocessor/repetition/repeat_from_to.hpp> | |
28 #include <boost/preprocessor/iteration/iterate.hpp> | |
29 #include <boost/log/detail/config.hpp> | |
30 #include <boost/log/detail/header.hpp> | |
31 | |
32 #ifndef BOOST_LOG_VALUE_REF_VISITATION_UNROLL_COUNT | |
33 #define BOOST_LOG_VALUE_REF_VISITATION_UNROLL_COUNT 8 | |
34 #endif | |
35 | |
36 namespace boost { | |
37 | |
38 BOOST_LOG_OPEN_NAMESPACE | |
39 | |
40 namespace aux { | |
41 | |
42 template< typename SequenceT, typename VisitorT, unsigned int SizeV = mpl::size< SequenceT >::value > | |
43 struct apply_visitor_dispatch | |
44 { | |
45 typedef typename VisitorT::result_type result_type; | |
46 | |
47 static BOOST_FORCEINLINE result_type call(const void* p, unsigned int type_index, VisitorT& visitor) | |
48 { | |
49 typedef typename mpl::begin< SequenceT >::type begin_type; | |
50 typedef typename mpl::advance_c< begin_type, SizeV / 2u >::type middle_type; | |
51 if (type_index < (SizeV / 2u)) | |
52 { | |
53 typedef typename mpl::erase< SequenceT, middle_type, typename mpl::end< SequenceT >::type >::type new_sequence; | |
54 typedef apply_visitor_dispatch< new_sequence, VisitorT > new_dispatch; | |
55 return new_dispatch::call(p, type_index, visitor); | |
56 } | |
57 else | |
58 { | |
59 typedef typename mpl::erase< SequenceT, begin_type, middle_type >::type new_sequence; | |
60 typedef apply_visitor_dispatch< new_sequence, VisitorT > new_dispatch; | |
61 return new_dispatch::call(p, type_index - (SizeV / 2u), visitor); | |
62 } | |
63 } | |
64 }; | |
65 | |
66 #define BOOST_LOG_AUX_CASE_ENTRY(z, i, data)\ | |
67 case i: return visitor(*static_cast< typename mpl::at_c< SequenceT, i >::type const* >(p)); | |
68 | |
69 #define BOOST_PP_FILENAME_1 <boost/log/detail/value_ref_visitation.hpp> | |
70 #define BOOST_PP_ITERATION_LIMITS (1, BOOST_PP_INC(BOOST_LOG_VALUE_REF_VISITATION_VTABLE_SIZE)) | |
71 #include BOOST_PP_ITERATE() | |
72 | |
73 #undef BOOST_LOG_AUX_CASE_ENTRY | |
74 | |
75 } // namespace aux | |
76 | |
77 BOOST_LOG_CLOSE_NAMESPACE // namespace log | |
78 | |
79 } // namespace boost | |
80 | |
81 #include <boost/log/detail/footer.hpp> | |
82 | |
83 #endif // BOOST_LOG_DETAIL_VALUE_REF_VISITATION_HPP_INCLUDED_ | |
84 | |
85 #ifdef BOOST_PP_IS_ITERATING | |
86 | |
87 #define BOOST_LOG_AUX_SWITCH_SIZE BOOST_PP_ITERATION() | |
88 | |
89 template< typename SequenceT, typename VisitorT > | |
90 struct apply_visitor_dispatch< SequenceT, VisitorT, BOOST_LOG_AUX_SWITCH_SIZE > | |
91 { | |
92 typedef typename VisitorT::result_type result_type; | |
93 | |
94 static BOOST_FORCEINLINE result_type call(const void* p, unsigned int type_index, VisitorT& visitor) | |
95 { | |
96 switch (type_index) | |
97 { | |
98 BOOST_PP_REPEAT_FROM_TO(1, BOOST_LOG_AUX_SWITCH_SIZE, BOOST_LOG_AUX_CASE_ENTRY, ~) | |
99 default: | |
100 return visitor(*static_cast< typename mpl::at_c< SequenceT, 0 >::type const* >(p)); | |
101 } | |
102 } | |
103 }; | |
104 | |
105 #undef BOOST_LOG_AUX_SWITCH_SIZE | |
106 | |
107 #endif // BOOST_PP_IS_ITERATING |