libzypp 17.31.23
zypp::debug::TraceCAD< Tp > Struct Template Reference

A simple tracer for (copy) Construction, Assignment, and Destruction. More...

#include <base/Debug.h>

Inheritance diagram for zypp::debug::TraceCAD< Tp >:

Public Member Functions

 TraceCAD ()
 
 TraceCAD (const TraceCAD &rhs)
 
 TraceCAD (TraceCAD &&rhs)
 
TraceCADoperator= (const TraceCAD &rhs)
 
TraceCADoperator= (TraceCAD &&rhs)
 
virtual ~TraceCAD ()
 
void ping () const
 
- Public Member Functions inherited from zypp::base::ProvideNumericId< TraceCAD< Tp >, unsigned long >
unsigned long numericId () const
 

Static Public Member Functions

static unsigned long & _totalTraceCAD ()
 

Related Functions

(Note that these are not member functions.)

template<class Tp >
std::ostream & operator<< (std::ostream &str, const TraceCAD< Tp > &obj)
 Stream output.
 

Additional Inherited Members

- Public Types inherited from zypp::debug::TraceCADBase
enum  What {
  CTOR , COPYCTOR , MOVECTOR , ASSIGN ,
  MOVEASSIGN , DTOR , PING
}
 
- Public Attributes inherited from zypp::debug::TraceCADBase
std::string _ident
 
- Protected Member Functions inherited from zypp::base::ProvideNumericId< TraceCAD< Tp >, unsigned long >
 ProvideNumericId ()
 Default ctor.
 
 ProvideNumericId (const ProvideNumericId &)
 Copy ctor.
 
 ProvideNumericId (ProvideNumericId &&rhs)
 Move ctor.
 
 ProvideNumericId (const void *const)
 No-Id ctor (0).
 
ProvideNumericIdoperator= (const ProvideNumericId &)
 Assign.
 
ProvideNumericIdoperator= (ProvideNumericId &&rhs)
 Move Assign.
 
 ~ProvideNumericId ()
 Dtor.
 

Detailed Description

template<class Tp>
struct zypp::debug::TraceCAD< Tp >

A simple tracer for (copy) Construction, Assignment, and Destruction.

To trace class Foo, derive public from TraceCAD<Foo>. This tracer simply calls traceCAD in each traced method, and traceCAD simply drops a line in the log.

This tracer logs construction, copy construction, assignment, 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 class to indicate something. In case you overload traceCAD, do 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 also
Example.COW_debug.cc.

Definition at line 111 of file Debug.h.

Constructor & Destructor Documentation

◆ TraceCAD() [1/3]

template<class Tp >
zypp::debug::TraceCAD< Tp >::TraceCAD ( )
inline

Definition at line 118 of file Debug.h.

◆ TraceCAD() [2/3]

template<class Tp >
zypp::debug::TraceCAD< Tp >::TraceCAD ( const TraceCAD< Tp > &  rhs)
inline

Definition at line 123 of file Debug.h.

◆ TraceCAD() [3/3]

template<class Tp >
zypp::debug::TraceCAD< Tp >::TraceCAD ( TraceCAD< Tp > &&  rhs)
inline

Definition at line 127 of file Debug.h.

◆ ~TraceCAD()

template<class Tp >
virtual zypp::debug::TraceCAD< Tp >::~TraceCAD ( )
inlinevirtual

Definition at line 137 of file Debug.h.

Member Function Documentation

◆ _totalTraceCAD()

template<class Tp >
static unsigned long & zypp::debug::TraceCAD< Tp >::_totalTraceCAD ( )
inlinestatic

Definition at line 114 of file Debug.h.

◆ operator=() [1/2]

template<class Tp >
TraceCAD & zypp::debug::TraceCAD< Tp >::operator= ( const TraceCAD< Tp > &  rhs)
inline

Definition at line 131 of file Debug.h.

◆ operator=() [2/2]

template<class Tp >
TraceCAD & zypp::debug::TraceCAD< Tp >::operator= ( TraceCAD< Tp > &&  rhs)
inline

Definition at line 134 of file Debug.h.

◆ ping()

template<class Tp >
void zypp::debug::TraceCAD< Tp >::ping ( ) const
inline

Definition at line 141 of file Debug.h.

Friends And Related Function Documentation

◆ operator<<()

template<class Tp >
std::ostream & operator<< ( std::ostream &  str,
const TraceCAD< Tp > &  obj 
)
related

Stream output.

Definition at line 147 of file Debug.h.


The documentation for this struct was generated from the following file: