Move cds/intrusive/node_traits.h to cds/intrusive/details directory
authorkhizmax <libcds.dev@gmail.com>
Sat, 27 Sep 2014 15:12:50 +0000 (19:12 +0400)
committerkhizmax <libcds.dev@gmail.com>
Sat, 27 Sep 2014 15:12:50 +0000 (19:12 +0400)
cds/intrusive/details/base.h
cds/intrusive/details/node_traits.h [new file with mode: 0644]
cds/intrusive/node_traits.h [deleted file]
projects/Win/vc12/cds.vcxproj
projects/Win/vc12/cds.vcxproj.filters

index 0845569c533b29e38bbeb18067bb01abb1bd756b..68c1449c1f84b40e6a928a3dbc8708991a9248e2 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef __CDS_INTRUSIVE_DETAILS_BASE_H
 #define __CDS_INTRUSIVE_DETAILS_BASE_H
 
-#include <cds/intrusive/node_traits.h>
+#include <cds/intrusive/details/node_traits.h>
 #include <cds/details/allocator.h>
 #include <cds/algo/backoff_strategy.h>
 
diff --git a/cds/intrusive/details/node_traits.h b/cds/intrusive/details/node_traits.h
new file mode 100644 (file)
index 0000000..0bccc64
--- /dev/null
@@ -0,0 +1,166 @@
+//$$CDS-header$$
+
+#ifndef __CDS_INTRUSIVE_DETAILS_NODE_TRAITS_H
+#define __CDS_INTRUSIVE_DETAILS_NODE_TRAITS_H
+
+#include <cds/intrusive/options.h>
+
+namespace cds { namespace intrusive {
+
+#ifdef CDS_DOXYGEN_INVOKED
+    /// Container's node traits
+    /** @ingroup cds_intrusive_helper
+        This traits is intended for converting between type \p T of value stored in the intrusive container
+        and container's node type \p NodeType.
+
+        There are separate specializations for each \p Hook type.
+    */
+    template <typename T, typename NodeType, typename Hook>
+    struct node_traits
+    {
+        typedef T        value_type ;  ///< Value type
+        typedef NodeType node_type  ;  ///< Node type
+
+        /// Convert value reference to node pointer
+        static node_type * to_node_ptr( value_type& v );
+
+        /// Convert value pointer to node pointer
+        static node_type * to_node_ptr( value_type * v );
+
+        /// Convert value reference to node pointer (const version)
+        static const node_type * to_node_ptr( value_type const& v );
+
+        /// Convert value pointer to node pointer (const version)
+        static const node_type * to_node_ptr( value_type const * v );
+
+        /// Convert node refernce to value pointer
+        static value_type * to_value_ptr( node_type&  n );
+
+        /// Convert node pointer to value pointer
+        static value_type * to_value_ptr( node_type *  n );
+
+        /// Convert node reference to value pointer (const version)
+        static const value_type * to_value_ptr( node_type const & n );
+
+        /// Convert node pointer to value pointer (const version)
+        static const value_type * to_value_ptr( node_type const * n );
+    };
+
+#else
+    template <typename T, typename NodeType, class Hook, typename HookType>
+    struct node_traits;
+#endif
+
+    //@cond
+    template <typename T, typename NodeType, class Hook>
+    struct node_traits<T, NodeType, Hook, opt::base_hook_tag>
+    {
+        typedef T        value_type;
+        typedef NodeType node_type;
+
+        static node_type * to_node_ptr( value_type& v )
+        {
+            return static_cast<node_type *>( &v );
+        }
+        static node_type * to_node_ptr( value_type * v )
+        {
+            return v ? static_cast<node_type *>(v) : nullptr;
+        }
+        static const node_type * to_node_ptr( const value_type& v )
+        {
+            return static_cast<const node_type *>( &v );
+        }
+        static const node_type * to_node_ptr( const value_type * v )
+        {
+            return v ? static_cast<const node_type *>(v) : nullptr;
+        }
+        static value_type * to_value_ptr( node_type&  n )
+        {
+            return static_cast<value_type *>( &n );
+        }
+        static value_type * to_value_ptr( node_type *  n )
+        {
+            return n ? static_cast<value_type *>(n) : nullptr;
+        }
+        static const value_type * to_value_ptr( const node_type& n )
+        {
+            return static_cast<const value_type *>( &n );
+        }
+        static const value_type * to_value_ptr( const node_type * n )
+        {
+            return n ? static_cast<const value_type *>(n) : nullptr;
+        }
+    };
+
+    template <typename T, typename NodeType, class Hook>
+    struct node_traits<T, NodeType, Hook, opt::member_hook_tag>
+    {
+        typedef T        value_type;
+        typedef NodeType node_type;
+
+        static node_type * to_node_ptr( value_type& v )
+        {
+            return reinterpret_cast<node_type *>( reinterpret_cast<char *>(&v) + Hook::c_nMemberOffset );
+        }
+        static node_type * to_node_ptr( value_type * v )
+        {
+            return v ? to_node_ptr( *v ) : nullptr;
+        }
+        static const node_type * to_node_ptr( const value_type& v )
+        {
+            return reinterpret_cast<const node_type *>( reinterpret_cast<const char *>(&v) + Hook::c_nMemberOffset );
+        }
+        static const node_type * to_node_ptr( const value_type * v )
+        {
+            return v ? to_node_ptr( *v ) : nullptr;
+        }
+        static value_type * to_value_ptr( node_type& n )
+        {
+            return reinterpret_cast<value_type *>( reinterpret_cast<char *>(&n) - Hook::c_nMemberOffset );
+        }
+        static value_type * to_value_ptr( node_type * n )
+        {
+            return n ? to_value_ptr( *n ) : nullptr;
+        }
+        static const value_type * to_value_ptr( const node_type& n )
+        {
+            return reinterpret_cast<const value_type *>( reinterpret_cast<const char *>(&n) - Hook::c_nMemberOffset );
+        }
+        static const value_type * to_value_ptr( const node_type * n )
+        {
+            return n ? to_value_ptr( *n ) : nullptr;
+        }
+    };
+
+    template <typename T, typename NodeType, class Hook>
+    struct node_traits<T, NodeType, Hook, opt::traits_hook_tag>: public Hook::node_traits
+    {};
+    //@endcond
+
+    /// Node traits selector metafunction
+    /** @ingroup cds_intrusive_helper
+        The metafunction selects appropriate \ref node_traits specialization based on value type \p T, node type \p NodeType, and hook type \p Hook.
+    */
+    template <typename T, typename NodeType, class Hook>
+    struct get_node_traits
+    {
+        //@cond
+        typedef node_traits<T, NodeType, Hook, typename Hook::hook_type> type;
+        //@endcond
+    };
+
+    //@cond
+    /// Functor converting container's node type to value type
+    template <class Container>
+    struct node_to_value {
+        typename Container::value_type * operator()( typename Container::node_type * p )
+        {
+            typedef typename Container::node_traits node_traits;
+            return node_traits::to_value_ptr( p );
+        }
+    };
+    //@endcond
+
+}} // namespace cds::intrusuve
+
+#endif  // #ifndef __CDS_INTRUSIVE_DETAILS_NODE_TRAITS_H
diff --git a/cds/intrusive/node_traits.h b/cds/intrusive/node_traits.h
deleted file mode 100644 (file)
index 0f2c8c6..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-//$$CDS-header$$
-
-#ifndef __CDS_INTRUSIVE_NODE_TRAITS_H
-#define __CDS_INTRUSIVE_NODE_TRAITS_H
-
-#include <cds/intrusive/options.h>
-
-namespace cds { namespace intrusive {
-
-#ifdef CDS_DOXYGEN_INVOKED
-    /// Container's node traits
-    /** @ingroup cds_intrusive_helper
-        This traits is intended for converting between type \p T of value stored in the intrusive container
-        and container's node type \p NodeType.
-
-        There are separate specializations for each \p Hook type.
-    */
-    template <typename T, typename NodeType, typename Hook>
-    struct node_traits
-    {
-        typedef T        value_type ;  ///< Value type
-        typedef NodeType node_type  ;  ///< Node type
-
-        /// Convert value reference to node pointer
-        static node_type * to_node_ptr( value_type& v );
-
-        /// Convert value pointer to node pointer
-        static node_type * to_node_ptr( value_type * v );
-
-        /// Convert value reference to node pointer (const version)
-        static const node_type * to_node_ptr( value_type const& v );
-
-        /// Convert value pointer to node pointer (const version)
-        static const node_type * to_node_ptr( value_type const * v );
-
-        /// Convert node refernce to value pointer
-        static value_type * to_value_ptr( node_type&  n );
-
-        /// Convert node pointer to value pointer
-        static value_type * to_value_ptr( node_type *  n );
-
-        /// Convert node reference to value pointer (const version)
-        static const value_type * to_value_ptr( node_type const & n );
-
-        /// Convert node pointer to value pointer (const version)
-        static const value_type * to_value_ptr( node_type const * n );
-    };
-
-#else
-    template <typename T, typename NodeType, class Hook, typename HookType>
-    struct node_traits;
-#endif
-
-    //@cond
-    template <typename T, typename NodeType, class Hook>
-    struct node_traits<T, NodeType, Hook, opt::base_hook_tag>
-    {
-        typedef T        value_type;
-        typedef NodeType node_type;
-
-        static node_type * to_node_ptr( value_type& v )
-        {
-            return static_cast<node_type *>( &v );
-        }
-        static node_type * to_node_ptr( value_type * v )
-        {
-            return v ? static_cast<node_type *>(v) : nullptr;
-        }
-        static const node_type * to_node_ptr( const value_type& v )
-        {
-            return static_cast<const node_type *>( &v );
-        }
-        static const node_type * to_node_ptr( const value_type * v )
-        {
-            return v ? static_cast<const node_type *>(v) : nullptr;
-        }
-        static value_type * to_value_ptr( node_type&  n )
-        {
-            return static_cast<value_type *>( &n );
-        }
-        static value_type * to_value_ptr( node_type *  n )
-        {
-            return n ? static_cast<value_type *>(n) : nullptr;
-        }
-        static const value_type * to_value_ptr( const node_type& n )
-        {
-            return static_cast<const value_type *>( &n );
-        }
-        static const value_type * to_value_ptr( const node_type * n )
-        {
-            return n ? static_cast<const value_type *>(n) : nullptr;
-        }
-    };
-
-    template <typename T, typename NodeType, class Hook>
-    struct node_traits<T, NodeType, Hook, opt::member_hook_tag>
-    {
-        typedef T        value_type;
-        typedef NodeType node_type;
-
-        static node_type * to_node_ptr( value_type& v )
-        {
-            return reinterpret_cast<node_type *>( reinterpret_cast<char *>(&v) + Hook::c_nMemberOffset );
-        }
-        static node_type * to_node_ptr( value_type * v )
-        {
-            return v ? to_node_ptr( *v ) : nullptr;
-        }
-        static const node_type * to_node_ptr( const value_type& v )
-        {
-            return reinterpret_cast<const node_type *>( reinterpret_cast<const char *>(&v) + Hook::c_nMemberOffset );
-        }
-        static const node_type * to_node_ptr( const value_type * v )
-        {
-            return v ? to_node_ptr( *v ) : nullptr;
-        }
-        static value_type * to_value_ptr( node_type& n )
-        {
-            return reinterpret_cast<value_type *>( reinterpret_cast<char *>(&n) - Hook::c_nMemberOffset );
-        }
-        static value_type * to_value_ptr( node_type * n )
-        {
-            return n ? to_value_ptr( *n ) : nullptr;
-        }
-        static const value_type * to_value_ptr( const node_type& n )
-        {
-            return reinterpret_cast<const value_type *>( reinterpret_cast<const char *>(&n) - Hook::c_nMemberOffset );
-        }
-        static const value_type * to_value_ptr( const node_type * n )
-        {
-            return n ? to_value_ptr( *n ) : nullptr;
-        }
-    };
-
-    template <typename T, typename NodeType, class Hook>
-    struct node_traits<T, NodeType, Hook, opt::traits_hook_tag>: public Hook::node_traits
-    {};
-    //@endcond
-
-    /// Node traits selector metafunction
-    /** @ingroup cds_intrusive_helper
-        The metafunction selects appropriate \ref node_traits specialization based on value type \p T, node type \p NodeType, and hook type \p Hook.
-    */
-    template <typename T, typename NodeType, class Hook>
-    struct get_node_traits
-    {
-        //@cond
-        typedef node_traits<T, NodeType, Hook, typename Hook::hook_type> type;
-        //@endcond
-    };
-
-    //@cond
-    /// Functor converting container's node type to value type
-    template <class Container>
-    struct node_to_value {
-        typename Container::value_type * operator()( typename Container::node_type * p )
-        {
-            typedef typename Container::node_traits node_traits;
-            return node_traits::to_value_ptr( p );
-        }
-    };
-    //@endcond
-
-}} // namespace cds::intrusuve
-
-#endif  // #ifndef __CDS_INTRUSIVE_NODE_TRAITS_H
index c564cb4c4ff548fb1b1b249627b14337821982fb..207785a0bb7a77ebdce86896a166eec2bedf2821 100644 (file)
     <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\michael_set_base.h" />\r
+    <ClInclude Include="..\..\..\cds\intrusive\details\node_traits.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\michael_list_rcu.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\michael_set_rcu.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\mspriority_queue.h" />\r
-    <ClInclude Include="..\..\..\cds\intrusive\node_traits.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\options.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\skip_list_base.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\skip_list_hp.h" />\r
index 4cb12974310acf0d7d698b41d6d829ccd74d35ff..0a381360b167c28ea984539f1160ba1c2b55fdf0 100644 (file)
     <ClInclude Include="..\..\..\cds\intrusive\michael_list_rcu.h">\r
       <Filter>Header Files\cds\intrusive</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\..\cds\intrusive\node_traits.h">\r
-      <Filter>Header Files\cds\intrusive</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\..\cds\intrusive\options.h">\r
       <Filter>Header Files\cds\intrusive</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\cds\intrusive\details\michael_set_base.h">\r
       <Filter>Header Files\cds\intrusive\details</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\cds\intrusive\details\node_traits.h">\r
+      <Filter>Header Files\cds\intrusive\details</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file