rename cds::gc::hzp namespace to cds::gc::hp
authorkhizmax <khizmax@gmail.com>
Fri, 14 Nov 2014 15:52:01 +0000 (18:52 +0300)
committerkhizmax <khizmax@gmail.com>
Fri, 14 Nov 2014 15:52:01 +0000 (18:52 +0300)
cds/gc/dhp.h
cds/gc/hp/details/hp_alloc.h
cds/gc/hp/details/hp_fwd.h
cds/gc/hp/details/hp_inline.h
cds/gc/hp/details/hp_retired.h
cds/gc/hp/details/hp_type.h
cds/gc/hp/hp.h
cds/gc/hp/hp_decl.h
src/hp_const.h
src/hp_gc.cpp
tests/cppunit/test_main.cpp

index fe3ff4b61d8a43b9e5d0493e756ec13baaca970f..c854b91aabf1b2aa1ab63315984a368c09aa8487 100644 (file)
@@ -7,8 +7,10 @@
 #include <cds/gc/dhp/dhp_impl.h>
 #include <cds/details/lib.h>
 
+//@cond
 namespace cds { namespace gc {
     typedef PTB DHP;
 }} // namespace cds::gc
+//@endcond
 
 #endif // #ifndef __CDS_GC_DHP_H
index 637d03440663ee247afd3e025b15ec3b44a389af..b706850f2ec6b1eb0b2fedc65af1a47615fe292e 100644 (file)
@@ -10,7 +10,7 @@
 
 //@cond
 namespace cds {
-    namespace gc { namespace hzp {
+    namespace gc { namespace hp {
     /// Hazard Pointer schema implementation details
     namespace details {
 
@@ -317,7 +317,7 @@ namespace cds {
             //@endcond
         };
 
-    }}} // namespace gc::hzp::details
+    }}} // namespace gc::hp::details
 }   // namespace cds
 //@endcond
 
index 4cd723c552231ed66a56b3e8beb55248cc6b1d23..9b7fcbdf9ce9a24bba8cafc36fc7dbfa874628ea 100644 (file)
@@ -4,7 +4,7 @@
 #define __CDS_GC_HP_DETAILS_HP_FWD_H
 
 namespace cds {
-    namespace gc { namespace hzp {
+    namespace gc { namespace hp {
 
         // forward declarations
         class GarbageCollector;
index ec0bf1032d25c5ccd67b9de9d7db3cb3d9e8d0cf..741d7340b913cac5b7a7e13dfaca649e426b8353 100644 (file)
@@ -4,22 +4,22 @@
 #define __CDS_GC_HP_DETAILS_HP_INLINE_H
 
 namespace cds {
-    namespace gc{ namespace hzp { namespace details {
+    namespace gc{ namespace hp { namespace details {
 
         /************************************************************************/
         /* INLINES                                                              */
         /************************************************************************/
-        inline retired_vector::retired_vector( const cds::gc::hzp::GarbageCollector& HzpMgr )
+        inline retired_vector::retired_vector( const cds::gc::hp::GarbageCollector& HzpMgr )
             : m_arr( HzpMgr.getMaxRetiredPtrCount() ),
             m_nSize(0)
         {}
 
-        inline HPRec::HPRec( const cds::gc::hzp::GarbageCollector& HzpMgr )
+        inline HPRec::HPRec( const cds::gc::hp::GarbageCollector& HzpMgr )
             : m_hzp( HzpMgr.getHazardPointerCount() ),
             m_arrRetired( HzpMgr )
         {}
 
-    } } }    // namespace gc::hzp::details
+    } } }    // namespace gc::hp::details
 }    // namespace cds
 
 
index 740e141d37e3b2594d30b3863436e360e6b090e8..ec0bacdb7990dafdecdc8537df1d8449020b8bad 100644 (file)
@@ -9,7 +9,7 @@
 #include <cds/details/bounded_array.h>
 
 namespace cds {
-    namespace gc{ namespace hzp { namespace details {
+    namespace gc{ namespace hp { namespace details {
 
         /// Retired pointer
         typedef cds::gc::details::retired_ptr   retired_ptr;
@@ -34,13 +34,13 @@ namespace cds {
             typedef    retired_vector_impl::iterator    iterator;
 
             /// Constructor
-            retired_vector( const cds::gc::hzp::GarbageCollector& HzpMgr )    ;    // inline
+            retired_vector( const cds::gc::hp::GarbageCollector& HzpMgr );    // inline
             ~retired_vector()
             {}
 
             /// Vector capacity.
             /**
-                The capacity is constant for any thread. It is defined by cds::gc::hzp::GarbageCollector.
+                The capacity is constant for any thread. It is defined by cds::gc::hp::GarbageCollector.
             */
             size_t capacity() const     { return m_arr.capacity(); }
 
@@ -80,7 +80,7 @@ namespace cds {
             }
         };
 
-    } } }    // namespace gc::hzp::details
+    } } }    // namespace gc::hp::details
 }    // namespace cds
 
 #endif // #ifndef __CDS_GC_HP_DETAILS_HP_RETIRED_H
index 2188a2a33b41d6c60cfab16a8dc118c9f783eba8..853f5e1ad451388e74633a7c8b66380079e0037e 100644 (file)
@@ -7,7 +7,7 @@
 
 namespace cds {
     namespace gc {
-        namespace hzp {
+        namespace hp {
 
             /// Hazard pointer
             typedef void *    hazard_pointer;
index 6300178d7046722abcab740d952e1f164a2e3533..30df8116937638d5eda0b0687084112f43645ca3 100644 (file)
@@ -12,8 +12,8 @@
 
 #if CDS_COMPILER == CDS_COMPILER_MSVC
 #   pragma warning(push)
-    // warning C4251: 'cds::gc::hzp::GarbageCollector::m_pListHead' : class 'cds::cxx11_atomic::atomic<T>'
-    // needs to have dll-interface to be used by clients of class 'cds::gc::hzp::GarbageCollector'
+    // warning C4251: 'cds::gc::hp::GarbageCollector::m_pListHead' : class 'cds::cxx11_atomic::atomic<T>'
+    // needs to have dll-interface to be used by clients of class 'cds::gc::hp::GarbageCollector'
 #   pragma warning(disable: 4251)
 #endif
 
@@ -89,7 +89,7 @@ namespace cds {
         - [2004] Andrei Alexandrescy, Maged Michael "Lock-free Data Structures with Hazard Pointers"
 
 
-        The cds::gc::hzp namespace and its members are internal representation of Hazard Pointer GC and should not be used directly.
+        The cds::gc::hp namespace and its members are internal representation of Hazard Pointer GC and should not be used directly.
         Use cds::gc::HP class in your code.
 
         Hazard Pointer garbage collector is a singleton. The main user-level part of Hazard Pointer schema is
@@ -97,7 +97,7 @@ namespace cds {
         by contructing cds::gc::HP object in beginning of your main().
         See cds::gc::HP class for explanation.
     */
-    namespace hzp {
+    namespace hp {
 
         namespace details {
             /// Hazard pointer record of the thread
@@ -110,7 +110,7 @@ namespace cds {
                 retired_vector            m_arrRetired ; ///< Retired pointer array
 
                 /// Ctor
-                HPRec( const cds::gc::hzp::GarbageCollector& HzpMgr ) ;    // inline
+                HPRec( const cds::gc::hp::GarbageCollector& HzpMgr );    // inline
                 ~HPRec()
                 {}
 
@@ -193,7 +193,7 @@ namespace cds {
                 event_counter  m_DeferredNode            ;    ///< Count of objects that cannot be deleted in Scan phase because of a hazard_pointer guards it
             };
 
-            /// Internal list of cds::gc::hzp::details::HPRec
+            /// Internal list of cds::gc::hp::details::HPRec
             struct hplist_node: public details::HPRec
             {
                 hplist_node *                       m_pNextNode ; ///< next hazard ptr record in list
@@ -609,7 +609,7 @@ namespace cds {
 
         /// Auto-managed array of hazard pointers
         /**
-            This class is wrapper around cds::gc::hzp::details::HPArray class.
+            This class is wrapper around cds::gc::hp::details::HPArray class.
             \p Count is the size of HP array
         */
         template <size_t Count>
@@ -642,7 +642,7 @@ namespace cds {
             ThreadGC&    getGC() const { return m_mgr; }
         };
 
-    }   // namespace hzp
+    }   // namespace hp
 }}  // namespace cds::gc
 
 // Inlines
index cc846ecdba617691cc2a44d414e7668f86d85e04..44ef1d3909a9ec1b2c199fe55c1c1803a1f222c6 100644 (file)
@@ -27,7 +27,7 @@ namespace cds { namespace gc {
     {
     public:
         /// Native guarded pointer type
-        typedef gc::hzp::hazard_pointer guarded_pointer;
+        typedef gc::hp::hazard_pointer guarded_pointer;
 
         /// Atomic reference
         /**
@@ -48,9 +48,9 @@ namespace cds { namespace gc {
         template <typename T> using atomic_type = atomics::atomic<T>;
 
         /// Thread GC implementation for internal usage
-        typedef hzp::ThreadGC   thread_gc_impl;
+        typedef hp::ThreadGC   thread_gc_impl;
 
-        /// Wrapper for hzp::ThreadGC class
+        /// Wrapper for hp::ThreadGC class
         /**
             @headerfile cds/gc/hp.h
             This class performs automatically attaching/detaching Hazard Pointer GC
@@ -86,12 +86,12 @@ namespace cds { namespace gc {
         /// Hazard Pointer guard
         /**
             @headerfile cds/gc/hp.h
-            This class is a wrapper for hzp::AutoHPGuard.
+            This class is a wrapper for hp::AutoHPGuard.
         */
-        class Guard: public hzp::AutoHPGuard
+        class Guard : public hp::AutoHPGuard
         {
             //@cond
-            typedef hzp::AutoHPGuard base_class;
+            typedef hp::AutoHPGuard base_class;
             //@endcond
 
         public:
@@ -206,14 +206,14 @@ namespace cds { namespace gc {
         /// Array of Hazard Pointer guards
         /**
             @headerfile cds/gc/hp.h
-            This class is a wrapper for hzp::AutoHPArray template.
+            This class is a wrapper for hp::AutoHPArray template.
             Template parameter \p Count defines the size of HP array.
         */
         template <size_t Count>
-        class GuardArray: public hzp::AutoHPArray<Count>
+        class GuardArray : public hp::AutoHPArray<Count>
         {
             //@cond
-            typedef hzp::AutoHPArray<Count> base_class;
+            typedef hp::AutoHPArray<Count> base_class;
             //@endcond
         public:
             /// Rebind array for other size \p Count2
@@ -333,7 +333,7 @@ namespace cds { namespace gc {
         };
 
     public:
-        /// Initializes hzp::GarbageCollector singleton
+        /// Initializes hp::GarbageCollector singleton
         /**
             The constructor initializes GC singleton with passed parameters.
             If GC instance is not exist then the function creates the instance.
@@ -351,10 +351,10 @@ namespace cds { namespace gc {
             size_t nHazardPtrCount = 0,     ///< Hazard pointer count per thread
             size_t nMaxThreadCount = 0,     ///< Max count of simultaneous working thread in your application
             size_t nMaxRetiredPtrCount = 0, ///< Capacity of the array of retired objects for the thread
-            hzp::scan_type nScanType = hzp::inplace   ///< Scan type (see \ref hzp::scan_type enum)
+            hp::scan_type nScanType = hp::inplace   ///< Scan type (see \ref hp::scan_type enum)
         )
         {
-            hzp::GarbageCollector::Construct(
+            hp::GarbageCollector::Construct(
                 nHazardPtrCount,
                 nMaxThreadCount,
                 nMaxRetiredPtrCount,
@@ -364,11 +364,11 @@ namespace cds { namespace gc {
 
         /// Terminates GC singleton
         /**
-            The destructor calls \code hzp::GarbageCollector::Destruct( true ) \endcode
+            The destructor calls \code hp::GarbageCollector::Destruct( true ) \endcode
         */
         ~HP()
         {
-            hzp::GarbageCollector::Destruct( true );
+            hp::GarbageCollector::Destruct( true );
         }
 
         /// Checks if count of hazard pointer is no less than \p nCountNeeded
@@ -379,7 +379,7 @@ namespace cds { namespace gc {
         */
         static bool check_available_guards( size_t nCountNeeded, bool bRaiseException = true )
         {
-            if ( hzp::GarbageCollector::instance().getHazardPointerCount() < nCountNeeded ) {
+            if ( hp::GarbageCollector::instance().getHazardPointerCount() < nCountNeeded ) {
                 if ( bRaiseException )
                     throw std::overflow_error( "Too few hazard pointers" );
                 return false;
@@ -390,19 +390,19 @@ namespace cds { namespace gc {
         /// Returns max Hazard Pointer count
         size_t max_hazard_count() const
         {
-            return hzp::GarbageCollector::instance().getHazardPointerCount();
+            return hp::GarbageCollector::instance().getHazardPointerCount();
         }
 
         /// Returns max count of thread
         size_t max_thread_count() const
         {
-            return hzp::GarbageCollector::instance().getMaxThreadCount();
+            return hp::GarbageCollector::instance().getMaxThreadCount();
         }
 
         /// Returns capacity of retired pointer array
         size_t retired_array_capacity() const
         {
-            return hzp::GarbageCollector::instance().getMaxRetiredPtrCount();
+            return hp::GarbageCollector::instance().getMaxRetiredPtrCount();
         }
 
         /// Retire pointer \p p with function \p pFunc
@@ -467,23 +467,23 @@ namespace cds { namespace gc {
         static void retire( T * p ) ;   // inline in hp_impl.h
 
         /// Get current scan strategy
-        hzp::scan_type getScanType() const
+        hp::scan_type getScanType() const
         {
-            return hzp::GarbageCollector::instance().getScanType();
+            return hp::GarbageCollector::instance().getScanType();
         }
 
         /// Set current scan strategy
         void setScanType(
-            hzp::scan_type nScanType     ///< new scan strategy
+            hp::scan_type nScanType     ///< new scan strategy
         )
         {
-            hzp::GarbageCollector::instance().setScanType( nScanType );
+            hp::GarbageCollector::instance().setScanType( nScanType );
         }
 
         /// Checks if Hazard Pointer GC is constructed and may be used
         static bool isUsed()
         {
-            return hzp::GarbageCollector::isUsed();
+            return hp::GarbageCollector::isUsed();
         }
 
 
index 71359d95f4960552daca81d86784c94d4831e529..279b43f6f02ce63e740636b24d1d5cac13fd5b3a 100644 (file)
@@ -17,13 +17,13 @@ namespace cds { namespace gc {
 
     //---------------------------------------------------------------
     // Hazard Pointers reclamation schema constants
-    namespace hzp {
+    namespace hp {
         // Max number of threads expected
         static const size_t c_nMaxThreadCount     = 100;
 
         // Number of Hazard Pointers per thread
         static const size_t c_nHazardPointerPerThread = 8;
-    } // namespace hzp
+    } // namespace hp
 
 } /* namespace gc */ }    /* namespace cds */
 
index 5bfbee4f3b8d1f7a667f46dc5c7fa38d436c490d..eb868c2a37878f7e70556ee0d70aaab5264ce17e 100644 (file)
@@ -17,7 +17,7 @@
 #define    CDS_HAZARDPTR_STATISTIC( _x )    if ( m_bStatEnabled ) { _x; }
 
 namespace cds { namespace gc {
-    namespace hzp {
+    namespace hp {
 
         /// Max array size of retired pointers
         static const size_t c_nMaxRetireNodeCount = c_nHazardPointerPerThread * c_nMaxThreadCount * 2;
@@ -360,5 +360,5 @@ namespace cds { namespace gc {
         }
 
 
-    } //namespace hzp
+    } //namespace hp
 }} // namespace cds::gc
index 452c05036c647bbc7dc01c5affe3a7bc8e2d2753..485f95c1e6f2155c84b6e045cf067652d391d861 100644 (file)
@@ -51,7 +51,7 @@
 #endif
 
 
-std::ostream& operator << (std::ostream& s, const cds::gc::hzp::GarbageCollector::InternalState& stat)
+std::ostream& operator << (std::ostream& s, const cds::gc::hp::GarbageCollector::InternalState& stat)
 {
     s << "\nHZP GC internal state:"
         << "\n\t\tHP record allocated=" << stat.nHPRecAllocated
@@ -118,8 +118,8 @@ namespace CppUnitMini
   {
       if ( m_bPrintGCState ) {
           {
-              cds::gc::hzp::GarbageCollector::InternalState stat;
-              std::cout << cds::gc::hzp::GarbageCollector::instance().getInternalState( stat ) << std::endl;
+              cds::gc::hp::GarbageCollector::InternalState stat;
+              std::cout << cds::gc::hp::GarbageCollector::instance().getInternalState( stat ) << std::endl;
           }
       }
   }
@@ -363,18 +363,18 @@ int main(int argc, char** argv)
         CppUnitMini::TestCfg& cfg = CppUnitMini::TestCase::m_Cfg.get( "General" );
         std::string strHZPScanStrategy = cfg.get( "HZP_scan_strategy", std::string("classic") );
         if ( strHZPScanStrategy == "inplace" )
-            hzpGC.setScanType( cds::gc::hzp::inplace );
+            hzpGC.setScanType( cds::gc::hp::inplace );
         else if ( strHZPScanStrategy == "classic" )
-            hzpGC.setScanType( cds::gc::hzp::classic );
+            hzpGC.setScanType( cds::gc::hp::classic );
         else {
             std::cout << "Error value of HZP_scan_strategy in General section of test config\n";
         }
 
         switch (hzpGC.getScanType()) {
-        case cds::gc::hzp::inplace:
+        case cds::gc::hp::inplace:
             std::cout << "Use in-place scan strategy for Hazard Pointer memory reclamation algorithm\n";
             break;
-        case cds::gc::hzp::classic:
+        case cds::gc::hp::classic:
             std::cout << "Use classic scan strategy for Hazard Pointer memory reclamation algorithm\n";
             break;
         default:
@@ -388,8 +388,8 @@ int main(int argc, char** argv)
       }
 
       if ( CppUnitMini::TestCase::m_bPrintGCState ) {
-        cds::gc::hzp::GarbageCollector::InternalState stat;
-        cds::gc::hzp::GarbageCollector::instance().getInternalState( stat );
+        cds::gc::hp::GarbageCollector::InternalState stat;
+        cds::gc::hp::GarbageCollector::instance().getInternalState( stat );
 
         std::cout << "HP constants:"
             << "\n\tHP count per thread=" << stat.nHPCount