Renamed get_result typedef to raw_ptr
authorkhizmax <libcds.dev@gmail.com>
Sun, 24 May 2015 08:12:45 +0000 (11:12 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 24 May 2015 08:12:45 +0000 (11:12 +0300)
Doc fixed

15 files changed:
cds/container/lazy_kvlist_rcu.h
cds/container/lazy_list_rcu.h
cds/container/michael_kvlist_rcu.h
cds/container/michael_list_rcu.h
cds/container/michael_map_rcu.h
cds/container/michael_set_rcu.h
cds/intrusive/lazy_list_rcu.h
cds/intrusive/michael_list_rcu.h
cds/intrusive/michael_set_rcu.h
cds/intrusive/striped_set/resizing_policy.h
cds/urcu/raw_ptr.h
change.log
tests/test-hdr/map/hdr_map.h
tests/test-hdr/set/hdr_intrusive_set.h
tests/test-hdr/set/hdr_set.h

index 625a2218636c87d84e47b2590b2b45cc68323d03..c805ac02beabef4c3de8baf63570eb19306e62d3 100644 (file)
@@ -125,7 +125,7 @@ namespace cds { namespace container {
             cds::urcu::details::conventional_exempt_pair_cast<node_type, value_type>
         >;
         /// Type of \p get() member function return value
-        typedef value_type * get_result;
+        typedef value_type * raw_ptr;
 
     protected:
         //@cond
index 0441885af33b898b9c9a597f30d99cf68787a360..67f9b2921a964a97052309798a5cc41f2d4fea15 100644 (file)
@@ -131,7 +131,7 @@ namespace cds { namespace container {
     public:
         using exempt_ptr = cds::urcu::exempt_ptr< gc, node_type, value_type, typename maker::intrusive_traits::disposer >; ///< pointer to extracted node
         /// Type of \p get() member function return value
-        typedef value_type * get_result;
+        typedef value_type * raw_ptr;
 
     private:
         //@cond
index 5dc7a07cd9eea419ea456df74b84da53684b00d2..6c4f61b8be612dc54307ac0df5203ad6a34b9cc1 100644 (file)
@@ -132,6 +132,7 @@ namespace cds { namespace container {
         >;
 
     private:
+        //@cond
         struct raw_ptr_converter
         {
             value_type * operator()( node_type * p ) const
@@ -149,12 +150,11 @@ namespace cds { namespace container {
                 return n.m_Data;
             }
         };
+        //@endcond
 
     public:
         /// Result of \p get(), \p get_with() functions - pointer to the node found
         typedef cds::urcu::raw_ptr_adaptor< value_type, typename base_class::raw_ptr, raw_ptr_converter > raw_ptr;
-        /// Type of \p get() member function return value
-        typedef raw_ptr get_result;
 
     protected:
         //@cond
index 768646583a407e853d12d091a02371017be987a8..31baa2eef7779fb2bd62a9fff1589c6afe1fc799 100644 (file)
@@ -139,6 +139,7 @@ namespace cds { namespace container {
         using exempt_ptr = cds::urcu::exempt_ptr< gc, node_type, value_type, typename maker::intrusive_traits::disposer >; ///< pointer to extracted node
 
     private:
+        //@cond
         struct raw_ptr_converter
         {
             value_type * operator()( node_type * p ) const
@@ -156,12 +157,11 @@ namespace cds { namespace container {
                 return n.m_Value;
             }
         };
+        //@endcond
 
     public:
         /// Result of \p get(), \p get_with() functions - pointer to the node found
         typedef cds::urcu::raw_ptr_adaptor< value_type, typename base_class::raw_ptr, raw_ptr_converter > raw_ptr;
-        /// Type of \p get() member function return value
-        typedef raw_ptr get_result;
 
     private:
         //@cond
index 4225aa39c583a8fffc8fb2c6d230d7e53798978d..8bbb220875334b74f517b33657cc1b760cf5c0ab 100644 (file)
@@ -75,7 +75,7 @@ namespace cds { namespace container {
         /// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
         static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
         /// Type of \p get() member function return value
-        typedef typename bucket_type::get_result get_result;
+        typedef typename bucket_type::raw_ptr raw_ptr;
 
         //@cond
         typedef cds::container::michael_map::implementation_tag implementation_tag;
@@ -676,7 +676,7 @@ namespace cds { namespace container {
             typedef cds::container::MichaelHashMap< your_template_parameters > hash_map;
             hash_map theMap;
             // ...
-            typename hash_map::get_result gp;
+            typename hash_map::raw_ptr gp;
             {
                 // Lock RCU
                 hash_map::rcu_lock lock;
@@ -692,7 +692,7 @@ namespace cds { namespace container {
             \endcode
         */
         template <typename K>
-        get_result get( K const& key )
+        raw_ptr get( K const& key )
         {
             return bucket( key ).get( key );
         }
@@ -707,7 +707,7 @@ namespace cds { namespace container {
             \p pred must imply the same element order as the comparator used for building the map.
         */
         template <typename K, typename Less>
-        get_result get_with( K const& key, Less pred )
+        raw_ptr get_with( K const& key, Less pred )
         {
             return bucket( key ).get_with( key, pred );
         }
index 027619993a86b52430f763771cab241941e1ba06..501d43933df5e8280f66110c899a513d640687f9 100644 (file)
@@ -123,7 +123,7 @@ namespace cds { namespace container {
 
         typedef typename bucket_type::rcu_lock   rcu_lock;   ///< RCU scoped lock
         typedef typename bucket_type::exempt_ptr exempt_ptr; ///< pointer to extracted node
-        typedef typename bucket_type::get_result get_result; ///< Return type of \p get() member function and its derivatives
+        typedef typename bucket_type::raw_ptr    raw_ptr;    ///< Return type of \p get() member function and its derivatives
         /// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
         static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
 
@@ -617,7 +617,7 @@ namespace cds { namespace container {
             \code
             typedef cds::container::MichaelHashSet< your_template_parameters > hash_set;
             hash_set theSet;
-            typename hash_set::get_result gp;
+            typename hash_set::raw_ptr gp;
             // ...
             {
                 // Lock RCU
@@ -634,7 +634,7 @@ namespace cds { namespace container {
             \endcode
         */
         template <typename Q>
-        get_result get( Q const& key )
+        raw_ptr get( Q const& key )
         {
             return bucket( key ).get( key );
         }
@@ -649,7 +649,7 @@ namespace cds { namespace container {
             \p pred must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        get_result get_with( Q const& key, Less pred )
+        raw_ptr get_with( Q const& key, Less pred )
         {
             return bucket( key ).get_with( key, pred );
         }
index bb9655d0d2ab65c1127e7cd963e4e33052434b04..908659a34e57ef0bb38dd219fede8b256a2b2fd5 100644 (file)
@@ -233,7 +233,7 @@ namespace cds { namespace intrusive {
         /// pointer to extracted node
         using exempt_ptr = cds::urcu::exempt_ptr< gc, value_type, value_type, clear_and_dispose, void >;
         /// Type of \p get() member function return value
-        typedef value_type * get_result;
+        typedef value_type * raw_ptr;
 
     protected:
         //@cond
index 000a1b8dfef402d5d3adacd5e41a72dfa2fba5d7..5843367df8c785eba16c7d53b8303d0a035e90cc 100644 (file)
@@ -236,8 +236,6 @@ namespace cds { namespace intrusive {
     public:
         /// Result of \p get(), \p get_with() functions - pointer to the node found
         typedef cds::urcu::raw_ptr< gc, value_type, raw_ptr_disposer > raw_ptr;
-        /// Type of \p get() member function return value
-        typedef raw_ptr get_result;
 
     protected:
         //@cond
index 5aff39dd4713b5d29f3270a549f698f448d0e090..a93e0fe3f1257b1515b311481d78af1d004bfc54 100644 (file)
@@ -89,9 +89,9 @@ namespace cds { namespace intrusive {
         /// Bucket table allocator
         typedef cds::details::Allocator< bucket_type, typename traits::allocator >  bucket_table_allocator;
 
-        typedef typename bucket_type::rcu_lock         rcu_lock;   ///< RCU scoped lock
-        typedef typename bucket_type::exempt_ptr       exempt_ptr; ///< pointer to extracted node
-        typedef typename bucket_type::get_result       get_result; ///< Return type of \p get() member function and its derivatives
+        typedef typename bucket_type::rcu_lock    rcu_lock;   ///< RCU scoped lock
+        typedef typename bucket_type::exempt_ptr  exempt_ptr; ///< pointer to extracted node
+        typedef typename bucket_type::raw_ptr     raw_ptr;    ///< Return type of \p get() member function and its derivatives
         /// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
         static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
 
@@ -557,7 +557,7 @@ namespace cds { namespace intrusive {
             hash_set theSet;
             // ...
             // Result of get() call
-            typename hash_set::get_result ptr;
+            typename hash_set::raw_ptr ptr;
             {
                 // Lock RCU
                 hash_set::rcu_lock lock;
@@ -573,7 +573,7 @@ namespace cds { namespace intrusive {
             \endcode
         */
         template <typename Q>
-        get_result get( Q const& key )
+        raw_ptr get( Q const& key )
         {
             return bucket( key ).get( key );
         }
@@ -588,7 +588,7 @@ namespace cds { namespace intrusive {
             \p pred must imply the same element order as the comparator used for building the set.
         */
         template <typename Q, typename Less>
-        get_result get_with( Q const& key, Less pred )
+        raw_ptr get_with( Q const& key, Less pred )
         {
             return bucket( key ).get_with( key, pred );
         }
index 43cb3f3c86f242d46f04b46c06e4ab7132e5edc2..654a8e70058e62a8e155d6f8bd79b6310ef6bb66 100644 (file)
@@ -84,6 +84,14 @@ namespace cds { namespace intrusive { namespace striped_set {
         {}
     };
 
+    /// Rational load factor resizing policy
+    /** @ingroup cds_striped_resizing_policy
+        When total item count in a container exceeds
+        <tt>container.bucket_count() * Numerator / Denominator</tt>
+        then resizing is needed.
+
+        This policy is stateless: \p Numerator and \p Denominator specifies in compile time as template arguments
+    */
     template <size_t Numerator, size_t Denominator = 1>
     struct rational_load_factor_resizing
     {
@@ -105,6 +113,14 @@ namespace cds { namespace intrusive { namespace striped_set {
         {}
     };
 
+    /// Rational load factor resizing policy
+    /** @ingroup cds_striped_resizing_policy
+        When total item count in a container exceeds
+        <tt>container.bucket_count() * Numerator / Denominator</tt>
+        then resizing is needed.
+
+        This policy is stateful: \p Numerator and \p Denominator specifies in construction time.
+    */
     template <size_t Denominator>
     struct rational_load_factor_resizing<0, Denominator>
     {
index c4d0f1c1342f187ee0035b4581edad30b56a880e..58c166463891becb8193fbbfaf9d0235c1abe0d6 100644 (file)
@@ -30,26 +30,26 @@ namespace cds { namespace urcu {
         Template arguments:
         - \p RCU - one of \ref cds_urcu_gc "RCU type"
         - \p ValueType - type of values stored in container
-        - \p ReclaimedEnumerator - implemntation-defined for each type of container
+        - \p ReclaimedEnumerator - implementation-defined for each type of container
 
         Example: let \p Container is an RCU container
-        \code
-        Container c;
-        // ...
-        // Find a key
-        typename Container::raw_ptr pRaw;
-
-        // RCU locked section
-        {
-            typename Container::rcu_lock l;
-            pRaw = c.get( key );
-            if ( pRaw ) {
-                // Deal with pRaw
+        @code
+            Container c;
+            // ...
+            // Find a key
+            typename Container::raw_ptr pRaw;
+
+            // RCU locked section
+            {
+                typename Container::rcu_lock l;
+                pRaw = c.get( key );
+                if ( pRaw ) {
+                    // Deal with pRaw
+                }
             }
-        }
-        // Release outside RCU-lock
-        pRaw.release();
-        \endcode
+            // Release outside RCU-lock
+            pRaw.release();
+        @endcode
     */
     template <
         class RCU,
@@ -60,7 +60,7 @@ namespace cds { namespace urcu {
     {
     public:
         typedef RCU rcu;    ///< RCU type - one of <tt>cds::urcu::gc< ... ></tt>
-        typedef ValueType   value_type; ///< Value type pointed by \p raw_ptr
+        typedef ValueType   value_type; ///< Value type pointed by \p %raw_ptr
         typedef ReclaimedEnumerator reclaimed_enumerator; ///< implementation-defined, for internal use only
 
     private:
@@ -86,7 +86,7 @@ namespace cds { namespace urcu {
         /// Copy ctor is prohibited
         raw_ptr( raw_ptr const& ) = delete;
 
-        ///@cond
+        //@cond
         // Only for internal use
         raw_ptr( value_type * p, reclaimed_enumerator&& e )
             : m_ptr( p )
@@ -170,7 +170,7 @@ namespace cds { namespace urcu {
     };
 
     //@cond
-    /// Adapter \p raw_ptr for non-intrusive containers based on intrusive counterpart
+    // Adapter of \p raw_ptr for non-intrusive containers based on intrusive counterpart
     template <
         typename ValueType,
         typename RawPtr,
@@ -185,33 +185,33 @@ namespace cds { namespace urcu {
         typedef Converter   converter_type;
 
     public:
-        /// Constructs an empty raw pointer
+        // Constructs an empty raw pointer
         raw_ptr_adaptor()
             : intrusive_raw_ptr()
         {}
 
-        /// Move ctor
+        // Move ctor
         raw_ptr_adaptor( intrusive_raw_ptr&& p )
             : intrusive_raw_ptr( std::move(p))
         {}
 
-        /// Move ctor
+        // Move ctor
         raw_ptr_adaptor( raw_ptr_adaptor&& p )
             : intrusive_raw_ptr( std::move(p))
         {}
 
-        /// Copy ctor is prohibited
+        // Copy ctor is prohibited
         raw_ptr_adaptor( raw_ptr_adaptor const& ) = delete;
 
-        /// Releases the raw pointer
+        // Releases the raw pointer
         ~raw_ptr_adaptor()
         {
             release();
         }
 
     public:
-        /// Move assignment operator
-        /**
+        // Move assignment operator
+        /*
             This operator may be called only inside RCU-lock.
             The \p this should be empty.
 
@@ -223,41 +223,41 @@ namespace cds { namespace urcu {
             return *this;
         }
 
-        /// Copy assignment is prohibited
+        // Copy assignment is prohibited
         raw_ptr_adaptor& operator=( raw_ptr_adaptor const& ) = delete;
 
-        /// Returns a pointer to stored value
+        // Returns a pointer to stored value
         value_type * operator ->() const CDS_NOEXCEPT
         {
             return converter_type()( intrusive_raw_ptr::operator->());
         }
 
-        /// Returns a reference to stored value
+        // Returns a reference to stored value
         value_type& operator *()
         {
             return converter_type()( intrusive_raw_ptr::operator*());
         }
 
-        /// Returns a reference to stored value
+        // Returns a reference to stored value
         value_type const& operator *() const
         {
             return converter_type()( intrusive_raw_ptr::operator*());
         }
 
-        /// Checks if the \p %raw_ptr is \p nullptr
+        // Checks if the \p %raw_ptr is \p nullptr
         bool empty() const CDS_NOEXCEPT
         {
             return intrusive_raw_ptr::empty();
         }
 
-        /// Checks if the \p %raw_ptr is not empty
+        // Checks if the \p %raw_ptr is not empty
         explicit operator bool() const CDS_NOEXCEPT
         {
             return !empty();
         }
 
-        /// Releases the \p %raw_ptr object
-        /**
+        // Releases the \p %raw_ptr object
+        /*
             This function may be called only outside RCU section.
             After \p %release() the object can be reused.
         */
@@ -271,4 +271,3 @@ namespace cds { namespace urcu {
 }} // namespace cds::urcu
 
 #endif // #ifndef CDSLIB_URCU_RAW_PTR_H
-
index 8009c30515ab401196f740c960d55f0d12bb7b3e..7960a2d2658bf5d15266cb381780e805414fd2c3 100644 (file)
@@ -6,6 +6,8 @@
       variants for MichaelList RCU-based specialization: extract() does not
       require RCU locking, get() now returns special wrapper object of type raw_ptr,
       see doc.
+      Thus, semantics of extract()/get() of all RCU-based set and maps based on 
+      MichaelList (MichaelSet/Map, SplitListSet/Map) has been changed too.
     - cds::lock namespace is renamed to cds::sync. All classes defined in cds::lock namespace 
       are moved to cds::sync with new names (for example, cds::lock::SpinLock is renamed to
       cds::sync::spin_lock). cds::lock namespace and its contents is deprecated, it is kept 
index d8986ee29423ef73fb0b74556ad3b251b5e2c210..fc6872aef523495eae1cd4d91e9123d4be95df5d 100644 (file)
@@ -357,7 +357,7 @@ namespace map {
                 typedef typename Map::rcu_lock rcu_lock;
                 typedef typename Map::value_type value_type;
                 typename Map::exempt_ptr ep;
-                typename Map::get_result gp;
+                typename Map::raw_ptr gp;
 
                 static size_t const nLimit = 100;
                 int arr[nLimit];
index 199551c97f5932998a48229a1036effecbc9c97a..861d1fe19369b6f6f0fe8c19bcad22366a023d24 100644 (file)
@@ -1107,7 +1107,7 @@ namespace set {
             typedef typename Set::rcu_lock      rcu_lock;
 
             typename Set::exempt_ptr ep;
-            typename Set::get_result gp;
+            typename Set::raw_ptr gp;
 
             {
                 static size_t const nLimit = 1024;
index 47d07ec48f6a1aaaca91c04fe94a79daf3e7c990..2d23869b694777ac69d7a3fb52cfac925ad930c9 100644 (file)
@@ -506,7 +506,7 @@ namespace set {
                 typedef typename Set::rcu_lock rcu_lock;
                 typedef typename Set::value_type value_type;
                 typename Set::exempt_ptr ep;
-                typename Set::get_result gp;
+                typename Set::raw_ptr gp;
 
                 static size_t const nLimit = 100;
                 int arr[nLimit];