Move cds/intrusive/michael_list_base.h to cds/intrusive/details directory
authorkhizmax <libcds.dev@gmail.com>
Sat, 27 Sep 2014 15:03:06 +0000 (19:03 +0400)
committerkhizmax <libcds.dev@gmail.com>
Sat, 27 Sep 2014 15:03:06 +0000 (19:03 +0400)
cds/container/michael_list_base.h
cds/intrusive/details/michael_list_base.h [new file with mode: 0644]
cds/intrusive/michael_list_base.h [deleted file]
cds/intrusive/michael_list_impl.h
cds/intrusive/michael_list_nogc.h
cds/intrusive/michael_list_rcu.h
projects/Win/vc12/cds.vcxproj
projects/Win/vc12/cds.vcxproj.filters
tests/test-hdr/ordered_list/hdr_intrusive_michael.h

index 8f010f04d8e1f6cc14231624b4ab39b30385b34e..a6968f6cfd1be354b3282676707429cbc0b74003 100644 (file)
@@ -4,7 +4,7 @@
 #define __CDS_CONTAINER_MICHAEL_LIST_BASE_H
 
 #include <cds/container/base.h>
-#include <cds/intrusive/michael_list_base.h>
+#include <cds/intrusive/details/michael_list_base.h>
 #include <cds/urcu/options.h>
 
 namespace cds { namespace container {
diff --git a/cds/intrusive/details/michael_list_base.h b/cds/intrusive/details/michael_list_base.h
new file mode 100644 (file)
index 0000000..696b200
--- /dev/null
@@ -0,0 +1,263 @@
+//$$CDS-header$$
+
+#ifndef __CDS_INTRUSIVE_DETAILS_MICHAEL_LIST_BASE_H
+#define __CDS_INTRUSIVE_DETAILS_MICHAEL_LIST_BASE_H
+
+#include <type_traits>
+#include <cds/intrusive/details/base.h>
+#include <cds/opt/compare.h>
+#include <cds/cxx11_atomic.h>
+#include <cds/details/marked_ptr.h>
+#include <cds/ref.h>
+#include <cds/details/make_const_type.h>
+#include <cds/urcu/options.h>
+
+namespace cds { namespace intrusive {
+
+    /// MichaelList ordered list related definitions
+    /** @ingroup cds_intrusive_helper
+    */
+    namespace michael_list {
+        /// Michael's list node
+        /**
+            Template parameters:
+            - GC - garbage collector
+            - Tag - a tag used to distinguish between different implementation
+        */
+        template <class GC, typename Tag = opt::none>
+        struct node
+        {
+            typedef GC              gc  ;   ///< Garbage collector
+            typedef Tag             tag ;   ///< tag
+
+            typedef cds::details::marked_ptr<node, 1>   marked_ptr         ;   ///< marked pointer
+            typedef typename gc::template atomic_marked_ptr< marked_ptr>     atomic_marked_ptr   ;   ///< atomic marked pointer specific for GC
+
+            atomic_marked_ptr m_pNext ; ///< pointer to the next node in the container
+
+            CDS_CONSTEXPR node() CDS_NOEXCEPT
+                : m_pNext( nullptr )
+            {}
+        };
+
+        //@cond
+        template <typename GC, typename Node, typename MemoryModel>
+        struct node_cleaner {
+            void operator()( Node * p )
+            {
+                typedef typename Node::marked_ptr marked_ptr;
+                p->m_pNext.store( marked_ptr(), MemoryModel::memory_order_release );
+            }
+        };
+        //@endcond
+
+        //@cond
+        struct undefined_gc;
+        struct default_hook {
+            typedef undefined_gc    gc;
+            typedef opt::none       tag;
+        };
+        //@endcond
+
+        //@cond
+        template < typename HookType, typename... Options>
+        struct hook
+        {
+            typedef typename opt::make_options< default_hook, Options...>::type  options;
+            typedef typename options::gc    gc;
+            typedef typename options::tag   tag;
+            typedef node<gc, tag>   node_type;
+            typedef HookType        hook_type;
+        };
+        //@endcond
+
+        /// Base hook
+        /**
+            \p Options are:
+            - opt::gc - garbage collector used.
+            - opt::tag - tag
+        */
+        template < typename... Options >
+        struct base_hook: public hook< opt::base_hook_tag, Options... >
+        {};
+
+        /// Member hook
+        /**
+            \p MemberOffset defines offset in bytes of \ref node member into your structure.
+            Use \p offsetof macro to define \p MemberOffset
+
+            \p Options are:
+            - opt::gc - garbage collector used.
+            - opt::tag - tag
+        */
+        template < size_t MemberOffset, typename... Options >
+        struct member_hook: public hook< opt::member_hook_tag, Options... >
+        {
+            //@cond
+            static const size_t c_nMemberOffset = MemberOffset;
+            //@endcond
+        };
+
+        /// Traits hook
+        /**
+            \p NodeTraits defines type traits for node.
+            See \ref node_traits for \p NodeTraits interface description
+
+            \p Options are:
+            - opt::gc - garbage collector used.
+            - opt::tag - tag
+        */
+        template <typename NodeTraits, typename... Options >
+        struct traits_hook: public hook< opt::traits_hook_tag, Options... >
+        {
+            //@cond
+            typedef NodeTraits node_traits;
+            //@endcond
+        };
+
+        /// Check link
+        template <typename Node>
+        struct link_checker
+        {
+            //@cond
+            typedef Node node_type;
+            //@endcond
+
+            /// Checks if the link field of node \p pNode is \p nullptr
+            /**
+                An asserting is generated if \p pNode link field is not \p nullptr
+            */
+            static void is_empty( const node_type * pNode )
+            {
+                assert( pNode->m_pNext.load( atomics::memory_order_relaxed ) == nullptr );
+            }
+        };
+
+        //@cond
+        template <class GC, typename Node, opt::link_check_type LinkType >
+        struct link_checker_selector;
+
+        template <typename GC, typename Node>
+        struct link_checker_selector< GC, Node, opt::never_check_link >
+        {
+            typedef intrusive::opt::v::empty_link_checker<Node>  type;
+        };
+
+        template <typename GC, typename Node>
+        struct link_checker_selector< GC, Node, opt::debug_check_link >
+        {
+#       ifdef _DEBUG
+            typedef link_checker<Node>  type;
+#       else
+            typedef intrusive::opt::v::empty_link_checker<Node>  type;
+#       endif
+        };
+
+        template <typename GC, typename Node>
+        struct link_checker_selector< GC, Node, opt::always_check_link >
+        {
+            typedef link_checker<Node>  type;
+        };
+        //@endcond
+
+        /// Metafunction for selecting appropriate link checking policy
+        template < typename Node, opt::link_check_type LinkType >
+        struct get_link_checker
+        {
+            //@cond
+            typedef typename link_checker_selector< typename Node::gc, Node, LinkType>::type type;
+            //@endcond
+        };
+
+        /// Type traits for MichaelList class
+        struct type_traits
+        {
+            /// Hook used
+            /**
+                Possible values are: michael_list::base_hook, michael_list::member_hook, michael_list::traits_hook.
+            */
+            typedef base_hook<>       hook;
+
+            /// Key comparison functor
+            /**
+                No default functor is provided. If the option is not specified, the \p less is used.
+            */
+            typedef opt::none                       compare;
+
+            /// specifies binary predicate used for key compare.
+            /**
+                Default is \p std::less<T>.
+            */
+            typedef opt::none                       less;
+
+            /// back-off strategy used
+            /**
+                If the option is not specified, the cds::backoff::Default is used.
+            */
+            typedef cds::backoff::Default           back_off;
+
+            /// Disposer
+            /**
+                the functor used for dispose removed items. Default is opt::v::empty_disposer.
+            */
+            typedef opt::v::empty_disposer          disposer;
+
+            /// Item counter
+            /**
+                The type for item counting feature.
+                Default is no item counter (\ref atomicity::empty_item_counter)
+            */
+            typedef atomicity::empty_item_counter     item_counter;
+
+            /// Link fields checking feature
+            /**
+                Default is \ref opt::debug_check_link
+            */
+            static const opt::link_check_type link_checker = opt::debug_check_link;
+
+            /// C++ memory ordering model
+            /**
+                List of available memory ordering see opt::memory_model
+            */
+            typedef opt::v::relaxed_ordering        memory_model;
+
+            /// RCU deadlock checking policy (only for \ref cds_intrusive_MichaelList_rcu "RCU-based MichaelList")
+            /**
+                List of available options see opt::rcu_check_deadlock
+            */
+            typedef opt::v::rcu_throw_deadlock      rcu_check_deadlock;
+        };
+
+        /// Metafunction converting option list to traits
+        /**
+            This is a wrapper for <tt> cds::opt::make_options< type_traits, Options...> </tt>
+            \p Options list see \ref MichaelList.
+        */
+        template <typename... Options>
+        struct make_traits {
+#   ifdef CDS_DOXYGEN_INVOKED
+            typedef implementation_defined type ;   ///< Metafunction result
+#   else
+            typedef typename cds::opt::make_options<
+                typename cds::opt::find_type_traits< type_traits, Options... >::type
+                ,Options...
+            >::type   type;
+            //typedef typename cds::opt::make_options< type_traits, Options...>::type type  ;   ///< Result of metafunction
+#   endif
+        };
+
+    } // namespace michael_list
+
+    //@cond
+    // Forward declaration
+    template < class GC, typename T, class Traits = michael_list::type_traits >
+    class MichaelList;
+    //@endcond
+
+
+    /// Tag for selecting Michael list
+    //class michael_list_tag;
+
+}}   // namespace cds::intrusive
+
+#endif // #ifndef __CDS_INTRUSIVE_DETAILS_MICHAEL_LIST_BASE_H
diff --git a/cds/intrusive/michael_list_base.h b/cds/intrusive/michael_list_base.h
deleted file mode 100644 (file)
index 33861c6..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-//$$CDS-header$$
-
-#ifndef __CDS_INTRUSIVE_MICHAEL_LIST_BASE_H
-#define __CDS_INTRUSIVE_MICHAEL_LIST_BASE_H
-
-#include <type_traits>
-#include <cds/intrusive/details/base.h>
-#include <cds/opt/compare.h>
-#include <cds/cxx11_atomic.h>
-#include <cds/details/marked_ptr.h>
-#include <cds/ref.h>
-#include <cds/details/make_const_type.h>
-#include <cds/urcu/options.h>
-
-namespace cds { namespace intrusive {
-
-    /// MichaelList ordered list related definitions
-    /** @ingroup cds_intrusive_helper
-    */
-    namespace michael_list {
-        /// Michael's list node
-        /**
-            Template parameters:
-            - GC - garbage collector
-            - Tag - a tag used to distinguish between different implementation
-        */
-        template <class GC, typename Tag = opt::none>
-        struct node
-        {
-            typedef GC              gc  ;   ///< Garbage collector
-            typedef Tag             tag ;   ///< tag
-
-            typedef cds::details::marked_ptr<node, 1>   marked_ptr         ;   ///< marked pointer
-            typedef typename gc::template atomic_marked_ptr< marked_ptr>     atomic_marked_ptr   ;   ///< atomic marked pointer specific for GC
-
-            atomic_marked_ptr m_pNext ; ///< pointer to the next node in the container
-
-            CDS_CONSTEXPR node() CDS_NOEXCEPT
-                : m_pNext( nullptr )
-            {}
-        };
-
-        //@cond
-        template <typename GC, typename Node, typename MemoryModel>
-        struct node_cleaner {
-            void operator()( Node * p )
-            {
-                typedef typename Node::marked_ptr marked_ptr;
-                p->m_pNext.store( marked_ptr(), MemoryModel::memory_order_release );
-            }
-        };
-        //@endcond
-
-        //@cond
-        struct undefined_gc;
-        struct default_hook {
-            typedef undefined_gc    gc;
-            typedef opt::none       tag;
-        };
-        //@endcond
-
-        //@cond
-        template < typename HookType, typename... Options>
-        struct hook
-        {
-            typedef typename opt::make_options< default_hook, Options...>::type  options;
-            typedef typename options::gc    gc;
-            typedef typename options::tag   tag;
-            typedef node<gc, tag>   node_type;
-            typedef HookType        hook_type;
-        };
-        //@endcond
-
-        /// Base hook
-        /**
-            \p Options are:
-            - opt::gc - garbage collector used.
-            - opt::tag - tag
-        */
-        template < typename... Options >
-        struct base_hook: public hook< opt::base_hook_tag, Options... >
-        {};
-
-        /// Member hook
-        /**
-            \p MemberOffset defines offset in bytes of \ref node member into your structure.
-            Use \p offsetof macro to define \p MemberOffset
-
-            \p Options are:
-            - opt::gc - garbage collector used.
-            - opt::tag - tag
-        */
-        template < size_t MemberOffset, typename... Options >
-        struct member_hook: public hook< opt::member_hook_tag, Options... >
-        {
-            //@cond
-            static const size_t c_nMemberOffset = MemberOffset;
-            //@endcond
-        };
-
-        /// Traits hook
-        /**
-            \p NodeTraits defines type traits for node.
-            See \ref node_traits for \p NodeTraits interface description
-
-            \p Options are:
-            - opt::gc - garbage collector used.
-            - opt::tag - tag
-        */
-        template <typename NodeTraits, typename... Options >
-        struct traits_hook: public hook< opt::traits_hook_tag, Options... >
-        {
-            //@cond
-            typedef NodeTraits node_traits;
-            //@endcond
-        };
-
-        /// Check link
-        template <typename Node>
-        struct link_checker
-        {
-            //@cond
-            typedef Node node_type;
-            //@endcond
-
-            /// Checks if the link field of node \p pNode is \p nullptr
-            /**
-                An asserting is generated if \p pNode link field is not \p nullptr
-            */
-            static void is_empty( const node_type * pNode )
-            {
-                assert( pNode->m_pNext.load( atomics::memory_order_relaxed ) == nullptr );
-            }
-        };
-
-        //@cond
-        template <class GC, typename Node, opt::link_check_type LinkType >
-        struct link_checker_selector;
-
-        template <typename GC, typename Node>
-        struct link_checker_selector< GC, Node, opt::never_check_link >
-        {
-            typedef intrusive::opt::v::empty_link_checker<Node>  type;
-        };
-
-        template <typename GC, typename Node>
-        struct link_checker_selector< GC, Node, opt::debug_check_link >
-        {
-#       ifdef _DEBUG
-            typedef link_checker<Node>  type;
-#       else
-            typedef intrusive::opt::v::empty_link_checker<Node>  type;
-#       endif
-        };
-
-        template <typename GC, typename Node>
-        struct link_checker_selector< GC, Node, opt::always_check_link >
-        {
-            typedef link_checker<Node>  type;
-        };
-        //@endcond
-
-        /// Metafunction for selecting appropriate link checking policy
-        template < typename Node, opt::link_check_type LinkType >
-        struct get_link_checker
-        {
-            //@cond
-            typedef typename link_checker_selector< typename Node::gc, Node, LinkType>::type type;
-            //@endcond
-        };
-
-        /// Type traits for MichaelList class
-        struct type_traits
-        {
-            /// Hook used
-            /**
-                Possible values are: michael_list::base_hook, michael_list::member_hook, michael_list::traits_hook.
-            */
-            typedef base_hook<>       hook;
-
-            /// Key comparison functor
-            /**
-                No default functor is provided. If the option is not specified, the \p less is used.
-            */
-            typedef opt::none                       compare;
-
-            /// specifies binary predicate used for key compare.
-            /**
-                Default is \p std::less<T>.
-            */
-            typedef opt::none                       less;
-
-            /// back-off strategy used
-            /**
-                If the option is not specified, the cds::backoff::Default is used.
-            */
-            typedef cds::backoff::Default           back_off;
-
-            /// Disposer
-            /**
-                the functor used for dispose removed items. Default is opt::v::empty_disposer.
-            */
-            typedef opt::v::empty_disposer          disposer;
-
-            /// Item counter
-            /**
-                The type for item counting feature.
-                Default is no item counter (\ref atomicity::empty_item_counter)
-            */
-            typedef atomicity::empty_item_counter     item_counter;
-
-            /// Link fields checking feature
-            /**
-                Default is \ref opt::debug_check_link
-            */
-            static const opt::link_check_type link_checker = opt::debug_check_link;
-
-            /// C++ memory ordering model
-            /**
-                List of available memory ordering see opt::memory_model
-            */
-            typedef opt::v::relaxed_ordering        memory_model;
-
-            /// RCU deadlock checking policy (only for \ref cds_intrusive_MichaelList_rcu "RCU-based MichaelList")
-            /**
-                List of available options see opt::rcu_check_deadlock
-            */
-            typedef opt::v::rcu_throw_deadlock      rcu_check_deadlock;
-        };
-
-        /// Metafunction converting option list to traits
-        /**
-            This is a wrapper for <tt> cds::opt::make_options< type_traits, Options...> </tt>
-            \p Options list see \ref MichaelList.
-        */
-        template <typename... Options>
-        struct make_traits {
-#   ifdef CDS_DOXYGEN_INVOKED
-            typedef implementation_defined type ;   ///< Metafunction result
-#   else
-            typedef typename cds::opt::make_options<
-                typename cds::opt::find_type_traits< type_traits, Options... >::type
-                ,Options...
-            >::type   type;
-            //typedef typename cds::opt::make_options< type_traits, Options...>::type type  ;   ///< Result of metafunction
-#   endif
-        };
-
-    } // namespace michael_list
-
-    //@cond
-    // Forward declaration
-    template < class GC, typename T, class Traits = michael_list::type_traits >
-    class MichaelList;
-    //@endcond
-
-
-    /// Tag for selecting Michael list
-    //class michael_list_tag;
-
-}}   // namespace cds::intrusive
-
-#endif // #ifndef __CDS_INTRUSIVE_MICHAEL_LIST_BASE_H
index fa8e1cb0c1fc527a98681a40b81f81078b78ebaf..6521aa1c5336ac7fd997a2becc5fc13049e8724d 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef __CDS_INTRUSIVE_MICHAEL_LIST_IMPL_H
 #define __CDS_INTRUSIVE_MICHAEL_LIST_IMPL_H
 
-#include <cds/intrusive/michael_list_base.h>
+#include <cds/intrusive/details/michael_list_base.h>
 #include <cds/gc/guarded_ptr.h>
 
 namespace cds { namespace intrusive {
index d0d9d824e654e03718ad43911dc63a2a93cf901d..6f0ace51cfc0bf49aa04238bcb9eda3fe3d37a72 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef __CDS_INTRUSIVE_MICHAEL_LIST_NOGC_H
 #define __CDS_INTRUSIVE_MICHAEL_LIST_NOGC_H
 
-#include <cds/intrusive/michael_list_base.h>
+#include <cds/intrusive/details/michael_list_base.h>
 #include <cds/gc/nogc.h>
 
 namespace cds { namespace intrusive {
index 96e7f191b7b4a7f4c2e1fc72159e21b8df9f9af8..f57f81723cbfee4e780fe8ffe3a0979ec9ecdfae 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef __CDS_INTRUSIVE_MICHAEL_LIST_RCU_H
 #define __CDS_INTRUSIVE_MICHAEL_LIST_RCU_H
 
-#include <cds/intrusive/michael_list_base.h>
+#include <cds/intrusive/details/michael_list_base.h>
 #include <cds/urcu/details/check_deadlock.h>
 #include <cds/details/binary_functor_wrapper.h>
 #include <cds/urcu/exempt_ptr.h>
index 7448966acfa4f34e9c8ed04e06450ca8623ffedb..97ee2103096b69e64f3bf2b28cab0e91a82022c0 100644 (file)
     <ClInclude Include="..\..\..\cds\intrusive\details\dummy_node_holder.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\details\ellen_bintree_base.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\details\lazy_list_base.h" />\r
+    <ClInclude Include="..\..\..\cds\intrusive\details\michael_list_base.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\details\single_link_struct.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\ellen_bintree_hp.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\ellen_bintree_ptb.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\lazy_list_hrc.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\lazy_list_nogc.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\lazy_list_ptb.h" />\r
-    <ClInclude Include="..\..\..\cds\intrusive\michael_list_base.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\michael_list_hp.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\michael_list_hrc.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\michael_list_impl.h" />\r
index c366bc2c778cf768a81bd6f19cbc7f3fa828deb8..1e41f078bf3786bea171e802ff24a28c8a37a593 100644 (file)
     <ClInclude Include="..\..\..\cds\intrusive\lazy_list_ptb.h">\r
       <Filter>Header Files\cds\intrusive</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\..\cds\intrusive\michael_list_base.h">\r
-      <Filter>Header Files\cds\intrusive</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\..\cds\intrusive\michael_list_hp.h">\r
       <Filter>Header Files\cds\intrusive</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\cds\intrusive\impl\lazy_list.h">\r
       <Filter>Header Files\cds\intrusive\impl</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\cds\intrusive\details\michael_list_base.h">\r
+      <Filter>Header Files\cds\intrusive\details</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index b3a42da9fc6207023cd7eff5d8a883c832bf0f1c..e30e91bc0a28e0ceb300158c09532d413a59989b 100644 (file)
@@ -1,7 +1,7 @@
 //$$CDS-header$$
 
 #include "cppunit/cppunit_proxy.h"
-#include <cds/intrusive/michael_list_base.h>
+#include <cds/intrusive/details/michael_list_base.h>
 
 namespace ordlist {
     namespace ci = cds::intrusive;