Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/intrusive/detail/get_value_traits.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga  2014-2014
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // See http://www.boost.org/libs/intrusive for documentation.
0010 //
0011 /////////////////////////////////////////////////////////////////////////////
0012 
0013 #ifndef BOOST_INTRUSIVE_DETAIL_GET_VALUE_TRAITS_HPP
0014 #define BOOST_INTRUSIVE_DETAIL_GET_VALUE_TRAITS_HPP
0015 
0016 #ifndef BOOST_CONFIG_HPP
0017 #  include <boost/config.hpp>
0018 #endif
0019 
0020 #if defined(BOOST_HAS_PRAGMA_ONCE)
0021 #  pragma once
0022 #endif
0023 
0024 #include <boost/intrusive/detail/config_begin.hpp>
0025 #include <boost/intrusive/detail/mpl.hpp>
0026 #include <boost/intrusive/detail/hook_traits.hpp>
0027 
0028 namespace boost {
0029 namespace intrusive {
0030 
0031 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0032 
0033 template<class SupposedValueTraits>
0034 struct is_default_hook_tag
0035 {  static const bool value = false;  };
0036 
0037 namespace detail{
0038 
0039 template <class T, class BaseHook>
0040 struct concrete_hook_base_value_traits
0041 {
0042    typedef typename BaseHook::hooktags tags;
0043    typedef bhtraits
0044       < T
0045       , typename tags::node_traits
0046       , tags::link_mode
0047       , typename tags::tag
0048       , tags::type> type;
0049 };
0050 
0051 template <class BaseHook>
0052 struct concrete_hook_base_value_traits<void, BaseHook>
0053 {
0054    typedef typename BaseHook::hooktags type;
0055 };
0056 
0057 template <class T, class AnyToSomeHook_ProtoValueTraits>
0058 struct any_hook_base_value_traits
0059 {
0060    //AnyToSomeHook value_traits derive from a generic_hook
0061    //The generic_hook is configured with any_node_traits
0062    //and AnyToSomeHook::value_traits with the correct
0063    //node traits for the container, so use node_traits
0064    //from AnyToSomeHook_ProtoValueTraits and the rest of
0065    //elements from the hooktags member of the generic_hook
0066 
0067    typedef typename AnyToSomeHook_ProtoValueTraits::basic_hook_t     basic_hook_t;
0068    typedef typename pointer_rebind
0069       < typename basic_hook_t::hooktags::node_traits::node_ptr
0070       , void>::type                                                  void_pointer;
0071    typedef typename AnyToSomeHook_ProtoValueTraits::template
0072       node_traits_from_voidptr<void_pointer>::type                   node_traits;
0073 
0074    typedef bhtraits
0075       < T
0076       , node_traits
0077       , basic_hook_t::hooktags::link_mode
0078       , typename basic_hook_t::hooktags::tag
0079       , basic_hook_t::hooktags::type
0080       > type;
0081 };
0082 
0083 template <class AnyToSomeHook_ProtoValueTraits>
0084 struct any_hook_base_value_traits<void, AnyToSomeHook_ProtoValueTraits>
0085 {
0086    typedef typename AnyToSomeHook_ProtoValueTraits::basic_hook_t     basic_hook_t;
0087    typedef typename pointer_rebind
0088       < typename basic_hook_t::hooktags::node_traits::node_ptr
0089       , void>::type                                                  void_pointer;
0090 
0091    struct type
0092    {
0093       typedef typename AnyToSomeHook_ProtoValueTraits::template
0094          node_traits_from_voidptr<void_pointer>::type                node_traits;
0095    };
0096 };
0097 
0098 template<class MemberHook>
0099 struct get_member_value_traits
0100 {
0101    typedef typename MemberHook::member_value_traits type;
0102 };
0103 
0104 BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
0105 BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, hooktags::is_base_hook)
0106 
0107 template <class T>
0108 struct internal_member_value_traits
0109 {
0110    template <class U> static yes_type test(...);
0111    template <class U> static no_type test(typename U::member_value_traits* = 0);
0112    static const bool value = sizeof(test<T>(0)) == sizeof(no_type);
0113 };
0114 
0115 template<class SupposedValueTraits, class T, bool = is_default_hook_tag<SupposedValueTraits>::value>
0116 struct supposed_value_traits;
0117 
0118 template<class T, class BaseHook, bool = internal_any_hook_bool_is_true<BaseHook>::value>
0119 struct get_base_value_traits;
0120 
0121 template<class SupposedValueTraits, class T, bool = internal_base_hook_bool_is_true<SupposedValueTraits>::value>
0122 struct supposed_base_value_traits;
0123 
0124 template<class SupposedValueTraits, bool = internal_member_value_traits<SupposedValueTraits>::value>
0125 struct supposed_member_value_traits;
0126 
0127 template<class SupposedValueTraits, bool = internal_any_hook_bool_is_true<SupposedValueTraits>::value>
0128 struct any_or_concrete_value_traits;
0129 
0130 //Base any hook
0131 template<class T, class BaseHook>
0132 struct get_base_value_traits<T, BaseHook, true>
0133    : any_hook_base_value_traits<T, BaseHook>
0134 {};
0135 
0136 //Non-any base hook
0137 template<class T, class BaseHook>
0138 struct get_base_value_traits<T, BaseHook, false>
0139    : concrete_hook_base_value_traits<T, BaseHook>
0140 {};
0141 
0142 //...It's a default hook
0143 template<class SupposedValueTraits, class T>
0144 struct supposed_value_traits<SupposedValueTraits, T, true>
0145 {  typedef typename SupposedValueTraits::template apply<T>::type type;  };
0146 
0147 //...Not  a default hook
0148 template<class SupposedValueTraits, class T>
0149 struct supposed_value_traits<SupposedValueTraits, T, false>
0150 {  typedef SupposedValueTraits type;   };
0151 
0152 //...It's a base hook
0153 template<class BaseHook, class T>
0154 struct supposed_base_value_traits<BaseHook, T, true>
0155    : get_base_value_traits<T, BaseHook>
0156 {};
0157 
0158 //...Not a base hook, try if it's a member or value_traits
0159 template<class SupposedValueTraits, class T>
0160 struct supposed_base_value_traits<SupposedValueTraits, T, false>
0161    : supposed_member_value_traits<SupposedValueTraits>
0162 {};
0163 
0164 //...It's a member hook
0165 template<class MemberHook>
0166 struct supposed_member_value_traits<MemberHook, true>
0167    : get_member_value_traits<MemberHook>
0168 {};
0169 
0170 //...Not a member hook
0171 template<class SupposedValueTraits>
0172 struct supposed_member_value_traits<SupposedValueTraits, false>
0173    : any_or_concrete_value_traits<SupposedValueTraits>
0174 {};
0175 
0176 template<class AnyToSomeHook_ProtoValueTraits>
0177 struct any_or_concrete_value_traits<AnyToSomeHook_ProtoValueTraits, true>
0178 {
0179    //A hook node (non-base, e.g.: member or other value traits
0180    typedef typename AnyToSomeHook_ProtoValueTraits::basic_hook_t        basic_hook_t;
0181    typedef typename pointer_rebind
0182       <typename basic_hook_t::node_ptr, void>::type                     void_pointer;
0183    typedef typename AnyToSomeHook_ProtoValueTraits::template
0184       node_traits_from_voidptr<void_pointer>::type                      any_node_traits;
0185 
0186    struct type : basic_hook_t
0187    {
0188       typedef any_node_traits node_traits;
0189    };
0190 };
0191 
0192 template<class SupposedValueTraits>
0193 struct any_or_concrete_value_traits<SupposedValueTraits, false>
0194 {
0195    typedef SupposedValueTraits type;
0196 };
0197 
0198 ////////////////////////////////////////
0199 //  get_value_traits / get_node_traits
0200 ////////////////////////////////////////
0201 
0202 template<class T, class SupposedValueTraits>
0203 struct get_value_traits
0204    : supposed_base_value_traits<typename supposed_value_traits<SupposedValueTraits, T>::type, T>
0205 {};
0206 
0207 template<class SupposedValueTraits>
0208 struct get_node_traits
0209 {
0210    typedef typename get_value_traits<void, SupposedValueTraits>::type::node_traits type;
0211 };
0212 
0213 }  //namespace detail{
0214 
0215 #endif   //BOOST_INTRUSIVE_DOXYGEN_INVOKED
0216 
0217 }  //namespace intrusive {
0218 }  //namespace boost {
0219 
0220 #include <boost/intrusive/detail/config_end.hpp>
0221 
0222 #endif   //#ifndef BOOST_INTRUSIVE_DETAIL_GET_VALUE_TRAITS_HPP