Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / base / Debug.h
index fb724b9..e19d94f 100644 (file)
@@ -10,7 +10,6 @@
  *
  * Debuging tools which should not be used in released code.
 */
-#ifndef ZYPP_NDEBUG
 #warning ZYPP_BASE_DEBUG_H included
 #ifndef ZYPP_BASE_DEBUG_H
 #define ZYPP_BASE_DEBUG_H
@@ -66,7 +65,7 @@ namespace zypp
     */
     struct TraceCADBase
     {
-      enum What { CTOR, COPYCTOR, MOVECTOR, ASSIGN, MOVEASSIGN, DTOR, PING };
+      enum What { CTOR, COPYCTOR, ASSIGN, DTOR, PING };
       std::string _ident;
     };
 
@@ -75,13 +74,11 @@ namespace zypp
     {
       switch( obj )
         {
-        case TraceCADBase::CTOR:       return str << "CTOR";
-        case TraceCADBase::COPYCTOR:   return str << "COPYCTOR";
-        case TraceCADBase::MOVECTOR:   return str << "MOVECTOR";
-        case TraceCADBase::ASSIGN:     return str << "ASSIGN";
-        case TraceCADBase::MOVEASSIGN: return str << "MOVEASSIGN";
-        case TraceCADBase::DTOR:       return str << "DTOR";
-        case TraceCADBase::PING:       return str << "PING";
+        case TraceCADBase::CTOR:     return str << "CTOR";
+        case TraceCADBase::COPYCTOR: return str << "COPYCTOR";
+        case TraceCADBase::ASSIGN:   return str << "ASSIGN";
+        case TraceCADBase::DTOR:     return str << "DTOR";
+        case TraceCADBase::PING:     return str << "PING";
         }
       return str;
     }
@@ -92,23 +89,23 @@ namespace zypp
      * traced method, and traceCAD simply drops a line in the log.
      *
      * This tracer logs construction, copy construction, assignment,
-     * destruction and ping.
+     * destruction and _PING.
      *
      * assignment: In case the traced class defines an operator=
      * it must be altered to call TraceCAD::operator=, otherwise it
      * won't be triggered.
      *
-     * ping: Completely up to you. Call ping somewhere in the traced
+     * _PING: Completely up to you. Call _PING somewhere in the traced
      * class to indicate something. In case you overload traceCAD, do
-     * whatever is appropriate on ping. It's just an offer to perform
+     * whatever is appropriate on _PING. It's just an offer to perform
      * logging or actions here, and not in the traced code.
      *
      * But traceCAD may be overloaded to produce more stats.
      *
      * \see \c Example.COW_debug.cc.
      */
-    template<class Tp>
-      struct TraceCAD : public base::ProvideNumericId<TraceCAD<Tp>, unsigned long>
+    template<class _Tp>
+      struct TraceCAD : public base::ProvideNumericId<TraceCAD<_Tp>, unsigned long>
                       , public TraceCADBase
       {
         static unsigned long & _totalTraceCAD()
@@ -124,51 +121,42 @@ namespace zypp
         { ++_totalTraceCAD();
           traceCAD( COPYCTOR, *this, rhs ); }
 
-        TraceCAD( TraceCAD && rhs )
-        { ++_totalTraceCAD();
-         traceCAD( MOVECTOR, *this, rhs ); }
-
         TraceCAD & operator=( const TraceCAD & rhs )
         { traceCAD( ASSIGN, *this, rhs ); return *this; }
 
-        TraceCAD & operator=( TraceCAD && rhs )
-        { traceCAD( MOVEASSIGN, *this, rhs ); return *this; }
-
         virtual ~TraceCAD()
         { --_totalTraceCAD();
           traceCAD( DTOR, *this, *this ); }
 
-        void ping() const
+        void _PING() const
         { traceCAD( PING, *this, *this ); }
       };
 
     /** \relates TraceCAD Stream output. */
-    template<class Tp>
-      inline std::ostream & operator<<( std::ostream & str, const TraceCAD<Tp> & obj )
+    template<class _Tp>
+      inline std::ostream & operator<<( std::ostream & str, const TraceCAD<_Tp> & obj )
       { return str << "(ID " << obj.numericId() << ", TOTAL " << obj._totalTraceCAD()
                    << ") [" << &obj << "] "; }
 
     /** Drop a log line about the traced method. Overload to
      * fit your needs.
     */
-    template<class Tp>
+    template<class _Tp>
       void traceCAD( TraceCADBase::What what_r,
-                     const TraceCAD<Tp> & self_r,
-                     const TraceCAD<Tp> & rhs_r )
+                     const TraceCAD<_Tp> & self_r,
+                     const TraceCAD<_Tp> & rhs_r )
       {
         switch( what_r )
           {
           case TraceCADBase::CTOR:
           case TraceCADBase::PING:
           case TraceCADBase::DTOR:
-            L_DBG("DEBUG") << what_r << self_r << " (" << self_r._ident << ")" << std::endl;
+            _DBG("DEBUG") << what_r << self_r << " (" << self_r._ident << ")" << std::endl;
             break;
 
           case TraceCADBase::COPYCTOR:
-          case TraceCADBase::MOVECTOR:
           case TraceCADBase::ASSIGN:
-          case TraceCADBase::MOVEASSIGN:
-            L_DBG("DEBUG") << what_r << self_r << "( " << rhs_r << ")" << " (" << self_r._ident << ")" << std::endl;
+            _DBG("DEBUG") << what_r << self_r << "( " << rhs_r << ")" << " (" << self_r._ident << ")" << std::endl;
             break;
           }
       }
@@ -182,4 +170,3 @@ namespace zypp
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
 #endif // ZYPP_BASE_DEBUG_H
-#endif // ZYPP_NDEBUG