annotate DEPENDENCIES/generic/include/boost/intrusive/any_hook.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 c530137014c0
children
rev   line source
Chris@16 1 /////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2006-2013
Chris@16 4 //
Chris@16 5 // Distributed under the Boost Software License, Version 1.0.
Chris@16 6 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 //
Chris@16 9 // See http://www.boost.org/libs/intrusive for documentation.
Chris@16 10 //
Chris@16 11 /////////////////////////////////////////////////////////////////////////////
Chris@16 12
Chris@16 13 #ifndef BOOST_INTRUSIVE_ANY_HOOK_HPP
Chris@16 14 #define BOOST_INTRUSIVE_ANY_HOOK_HPP
Chris@16 15
Chris@16 16 #include <boost/intrusive/detail/config_begin.hpp>
Chris@16 17 #include <boost/intrusive/intrusive_fwd.hpp>
Chris@16 18 #include <boost/intrusive/detail/any_node_and_algorithms.hpp>
Chris@16 19 #include <boost/intrusive/options.hpp>
Chris@16 20 #include <boost/intrusive/detail/generic_hook.hpp>
Chris@101 21 #include <boost/intrusive/detail/mpl.hpp>
Chris@101 22 #include <boost/intrusive/pointer_rebind.hpp>
Chris@101 23
Chris@101 24 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@101 25 # pragma once
Chris@101 26 #endif
Chris@16 27
Chris@16 28 namespace boost {
Chris@16 29 namespace intrusive {
Chris@16 30
Chris@16 31 //! Helper metafunction to define a \c \c any_base_hook that yields to the same
Chris@16 32 //! type when the same options (either explicitly or implicitly) are used.
Chris@16 33 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 34 template<class ...Options>
Chris@16 35 #else
Chris@16 36 template<class O1 = void, class O2 = void, class O3 = void>
Chris@16 37 #endif
Chris@16 38 struct make_any_base_hook
Chris@16 39 {
Chris@16 40 /// @cond
Chris@16 41 typedef typename pack_options
Chris@16 42 < hook_defaults,
Chris@16 43 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 44 O1, O2, O3
Chris@16 45 #else
Chris@16 46 Options...
Chris@16 47 #endif
Chris@16 48 >::type packed_options;
Chris@16 49
Chris@16 50 typedef generic_hook
Chris@101 51 < any_algorithms<typename packed_options::void_pointer>
Chris@16 52 , typename packed_options::tag
Chris@16 53 , packed_options::link_mode
Chris@16 54 , AnyBaseHookId
Chris@16 55 > implementation_defined;
Chris@16 56 /// @endcond
Chris@16 57 typedef implementation_defined type;
Chris@16 58 };
Chris@16 59
Chris@16 60 //! Derive a class from this hook in order to store objects of that class
Chris@16 61 //! in an intrusive container.
Chris@16 62 //!
Chris@16 63 //! The hook admits the following options: \c tag<>, \c void_pointer<> and
Chris@16 64 //! \c link_mode<>.
Chris@16 65 //!
Chris@16 66 //! \c tag<> defines a tag to identify the node.
Chris@16 67 //! The same tag value can be used in different classes, but if a class is
Chris@16 68 //! derived from more than one \c any_base_hook, then each \c any_base_hook needs its
Chris@16 69 //! unique tag.
Chris@16 70 //!
Chris@16 71 //! \c link_mode<> will specify the linking mode of the hook (\c normal_link, \c safe_link).
Chris@16 72 //!
Chris@16 73 //! \c void_pointer<> is the pointer type that will be used internally in the hook
Chris@101 74 //! and the container configured to use this hook.
Chris@16 75 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 76 template<class ...Options>
Chris@16 77 #else
Chris@16 78 template<class O1, class O2, class O3>
Chris@16 79 #endif
Chris@16 80 class any_base_hook
Chris@16 81 : public make_any_base_hook
Chris@16 82 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 83 <O1, O2, O3>
Chris@16 84 #else
Chris@16 85 <Options...>
Chris@16 86 #endif
Chris@16 87 ::type
Chris@16 88 {
Chris@16 89 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
Chris@16 90 public:
Chris@16 91 //! <b>Effects</b>: If link_mode is or \c safe_link
Chris@16 92 //! initializes the node to an unlinked state.
Chris@16 93 //!
Chris@16 94 //! <b>Throws</b>: Nothing.
Chris@16 95 any_base_hook();
Chris@16 96
Chris@16 97 //! <b>Effects</b>: If link_mode is or \c safe_link
Chris@16 98 //! initializes the node to an unlinked state. The argument is ignored.
Chris@16 99 //!
Chris@16 100 //! <b>Throws</b>: Nothing.
Chris@16 101 //!
Chris@16 102 //! <b>Rationale</b>: Providing a copy-constructor
Chris@16 103 //! makes classes using the hook STL-compliant without forcing the
Chris@16 104 //! user to do some additional work. \c swap can be used to emulate
Chris@16 105 //! move-semantics.
Chris@16 106 any_base_hook(const any_base_hook& );
Chris@16 107
Chris@16 108 //! <b>Effects</b>: Empty function. The argument is ignored.
Chris@16 109 //!
Chris@16 110 //! <b>Throws</b>: Nothing.
Chris@16 111 //!
Chris@16 112 //! <b>Rationale</b>: Providing an assignment operator
Chris@16 113 //! makes classes using the hook STL-compliant without forcing the
Chris@16 114 //! user to do some additional work. \c swap can be used to emulate
Chris@16 115 //! move-semantics.
Chris@16 116 any_base_hook& operator=(const any_base_hook& );
Chris@16 117
Chris@16 118 //! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
Chris@16 119 //! nothing (ie. no code is generated). If link_mode is \c safe_link and the
Chris@16 120 //! object is stored in a container an assertion is raised.
Chris@16 121 //!
Chris@16 122 //! <b>Throws</b>: Nothing.
Chris@16 123 ~any_base_hook();
Chris@16 124
Chris@16 125 //! <b>Precondition</b>: link_mode must be \c safe_link.
Chris@16 126 //!
Chris@16 127 //! <b>Returns</b>: true, if the node belongs to a container, false
Chris@16 128 //! otherwise. This function can be used to test whether \c container::iterator_to
Chris@16 129 //! will return a valid iterator.
Chris@16 130 //!
Chris@16 131 //! <b>Complexity</b>: Constant
Chris@16 132 bool is_linked() const;
Chris@16 133 #endif
Chris@16 134 };
Chris@16 135
Chris@16 136 //! Helper metafunction to define a \c \c any_member_hook that yields to the same
Chris@16 137 //! type when the same options (either explicitly or implicitly) are used.
Chris@16 138 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 139 template<class ...Options>
Chris@16 140 #else
Chris@16 141 template<class O1 = void, class O2 = void, class O3 = void>
Chris@16 142 #endif
Chris@16 143 struct make_any_member_hook
Chris@16 144 {
Chris@16 145 /// @cond
Chris@16 146 typedef typename pack_options
Chris@16 147 < hook_defaults,
Chris@16 148 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 149 O1, O2, O3
Chris@16 150 #else
Chris@16 151 Options...
Chris@16 152 #endif
Chris@16 153 >::type packed_options;
Chris@16 154
Chris@16 155 typedef generic_hook
Chris@101 156 < any_algorithms<typename packed_options::void_pointer>
Chris@16 157 , member_tag
Chris@16 158 , packed_options::link_mode
Chris@16 159 , NoBaseHookId
Chris@16 160 > implementation_defined;
Chris@16 161 /// @endcond
Chris@16 162 typedef implementation_defined type;
Chris@16 163 };
Chris@16 164
Chris@16 165 //! Store this hook in a class to be inserted
Chris@16 166 //! in an intrusive container.
Chris@16 167 //!
Chris@16 168 //! The hook admits the following options: \c void_pointer<> and
Chris@16 169 //! \c link_mode<>.
Chris@16 170 //!
Chris@16 171 //! \c link_mode<> will specify the linking mode of the hook (\c normal_link or \c safe_link).
Chris@16 172 //!
Chris@16 173 //! \c void_pointer<> is the pointer type that will be used internally in the hook
Chris@101 174 //! and the container configured to use this hook.
Chris@16 175 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 176 template<class ...Options>
Chris@16 177 #else
Chris@16 178 template<class O1, class O2, class O3>
Chris@16 179 #endif
Chris@16 180 class any_member_hook
Chris@16 181 : public make_any_member_hook
Chris@16 182 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
Chris@16 183 <O1, O2, O3>
Chris@16 184 #else
Chris@16 185 <Options...>
Chris@16 186 #endif
Chris@16 187 ::type
Chris@16 188 {
Chris@16 189 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
Chris@16 190 public:
Chris@16 191 //! <b>Effects</b>: If link_mode is or \c safe_link
Chris@16 192 //! initializes the node to an unlinked state.
Chris@16 193 //!
Chris@16 194 //! <b>Throws</b>: Nothing.
Chris@16 195 any_member_hook();
Chris@16 196
Chris@16 197 //! <b>Effects</b>: If link_mode is or \c safe_link
Chris@16 198 //! initializes the node to an unlinked state. The argument is ignored.
Chris@16 199 //!
Chris@16 200 //! <b>Throws</b>: Nothing.
Chris@16 201 //!
Chris@16 202 //! <b>Rationale</b>: Providing a copy-constructor
Chris@16 203 //! makes classes using the hook STL-compliant without forcing the
Chris@16 204 //! user to do some additional work. \c swap can be used to emulate
Chris@16 205 //! move-semantics.
Chris@16 206 any_member_hook(const any_member_hook& );
Chris@16 207
Chris@16 208 //! <b>Effects</b>: Empty function. The argument is ignored.
Chris@16 209 //!
Chris@16 210 //! <b>Throws</b>: Nothing.
Chris@16 211 //!
Chris@16 212 //! <b>Rationale</b>: Providing an assignment operator
Chris@16 213 //! makes classes using the hook STL-compliant without forcing the
Chris@16 214 //! user to do some additional work. \c swap can be used to emulate
Chris@16 215 //! move-semantics.
Chris@16 216 any_member_hook& operator=(const any_member_hook& );
Chris@16 217
Chris@16 218 //! <b>Effects</b>: If link_mode is \c normal_link, the destructor does
Chris@16 219 //! nothing (ie. no code is generated). If link_mode is \c safe_link and the
Chris@16 220 //! object is stored in a container an assertion is raised.
Chris@16 221 //!
Chris@16 222 //! <b>Throws</b>: Nothing.
Chris@16 223 ~any_member_hook();
Chris@16 224
Chris@16 225 //! <b>Precondition</b>: link_mode must be \c safe_link.
Chris@16 226 //!
Chris@16 227 //! <b>Returns</b>: true, if the node belongs to a container, false
Chris@16 228 //! otherwise. This function can be used to test whether \c container::iterator_to
Chris@16 229 //! will return a valid iterator.
Chris@16 230 //!
Chris@16 231 //! <b>Complexity</b>: Constant
Chris@16 232 bool is_linked() const;
Chris@16 233 #endif
Chris@16 234 };
Chris@16 235
Chris@16 236 /// @cond
Chris@16 237
Chris@16 238 namespace detail{
Chris@16 239
Chris@101 240 BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(old_proto_value_traits_base_hook, hooktags::is_base_hook)
Chris@16 241
Chris@16 242 //!This option setter specifies that the container
Chris@16 243 //!must use the specified base hook
Chris@101 244 template<class BasicHook, template <class> class NodeTraits>
Chris@16 245 struct any_to_some_hook
Chris@16 246 {
Chris@101 247 typedef typename BasicHook::template pack<empty>::proto_value_traits old_proto_value_traits;
Chris@16 248
Chris@16 249 template<class Base>
Chris@16 250 struct pack : public Base
Chris@16 251 {
Chris@101 252 struct proto_value_traits
Chris@16 253 {
Chris@101 254 //proto_value_traits::hooktags::is_base_hook is used by get_value_traits
Chris@101 255 //to detect base hooks, so mark it in case BasicHook has it.
Chris@101 256 struct hooktags
Chris@101 257 {
Chris@101 258 static const bool is_base_hook = old_proto_value_traits_base_hook_bool_is_true
Chris@101 259 <old_proto_value_traits>::value;
Chris@101 260 };
Chris@101 261
Chris@101 262 typedef old_proto_value_traits basic_hook_t;
Chris@16 263 static const bool is_any_hook = true;
Chris@101 264
Chris@101 265 template<class VoidPtr>
Chris@101 266 struct node_traits_from_voidptr
Chris@101 267 { typedef NodeTraits<VoidPtr> type; };
Chris@16 268 };
Chris@16 269 };
Chris@16 270 };
Chris@16 271
Chris@16 272 } //namespace detail{
Chris@16 273
Chris@16 274 /// @endcond
Chris@16 275
Chris@16 276 //!This option setter specifies that
Chris@16 277 //!any hook should behave as an slist hook
Chris@101 278 template<class BasicHook>
Chris@16 279 struct any_to_slist_hook
Chris@16 280 /// @cond
Chris@101 281 : public detail::any_to_some_hook<BasicHook, any_slist_node_traits>
Chris@16 282 /// @endcond
Chris@16 283 {};
Chris@16 284
Chris@16 285 //!This option setter specifies that
Chris@16 286 //!any hook should behave as an list hook
Chris@101 287 template<class BasicHook>
Chris@16 288 struct any_to_list_hook
Chris@16 289 /// @cond
Chris@101 290 : public detail::any_to_some_hook<BasicHook, any_list_node_traits>
Chris@16 291 /// @endcond
Chris@16 292 {};
Chris@16 293
Chris@16 294 //!This option setter specifies that
Chris@16 295 //!any hook should behave as a set hook
Chris@101 296 template<class BasicHook>
Chris@16 297 struct any_to_set_hook
Chris@16 298 /// @cond
Chris@101 299 : public detail::any_to_some_hook<BasicHook, any_rbtree_node_traits>
Chris@16 300 /// @endcond
Chris@16 301 {};
Chris@16 302
Chris@16 303 //!This option setter specifies that
Chris@16 304 //!any hook should behave as an avl_set hook
Chris@101 305 template<class BasicHook>
Chris@16 306 struct any_to_avl_set_hook
Chris@16 307 /// @cond
Chris@101 308 : public detail::any_to_some_hook<BasicHook, any_avltree_node_traits>
Chris@16 309 /// @endcond
Chris@16 310 {};
Chris@16 311
Chris@16 312 //!This option setter specifies that any
Chris@16 313 //!hook should behave as a bs_set hook
Chris@101 314 template<class BasicHook>
Chris@16 315 struct any_to_bs_set_hook
Chris@16 316 /// @cond
Chris@101 317 : public detail::any_to_some_hook<BasicHook, any_tree_node_traits>
Chris@16 318 /// @endcond
Chris@16 319 {};
Chris@16 320
Chris@16 321 //!This option setter specifies that any hook
Chris@16 322 //!should behave as an unordered set hook
Chris@101 323 template<class BasicHook>
Chris@16 324 struct any_to_unordered_set_hook
Chris@16 325 /// @cond
Chris@101 326 : public detail::any_to_some_hook<BasicHook, any_unordered_node_traits>
Chris@16 327 /// @endcond
Chris@16 328 {};
Chris@16 329
Chris@16 330
Chris@16 331 } //namespace intrusive
Chris@16 332 } //namespace boost
Chris@16 333
Chris@16 334 #include <boost/intrusive/detail/config_end.hpp>
Chris@16 335
Chris@16 336 #endif //BOOST_INTRUSIVE_ANY_HOOK_HPP