12 #ifndef ZYPP_BASE_REFERENCECOUNTED_H
13 #define ZYPP_BASE_REFERENCECOUNTED_H
87 {
if( ptr_r ) ptr_r->
ref(); }
93 {
if( ptr_r ) ptr_r->
unref(); }
97 virtual std::ostream &
dumpOn( std::ostream & str )
const;
127 {
return obj.
dumpOn( str ); }
136 #define IMPL_PTR_TYPE(NAME) \
137 void intrusive_ptr_add_ref( const NAME * ptr_r ) \
138 { zypp::base::ReferenceCounted::add_ref( ptr_r ); } \
139 void intrusive_ptr_release( const NAME * ptr_r ) \
140 { zypp::base::ReferenceCounted::release( ptr_r ); }
143 #endif // ZYPP_BASE_REFERENCECOUNTED_H
virtual void ref_to(unsigned) const
Trigger derived classes after refCount was increased.
void ref() const
Add a reference.
void intrusive_ptr_add_ref(const ReferenceCounted *ptr_r)
virtual ~ReferenceCounted()
Dtor.
static void release(const ReferenceCounted *ptr_r)
Called by zypp::intrusive_ptr to add a reference.
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
void intrusive_ptr_release(const ReferenceCounted *ptr_r)
unsigned _counter
The reference counter.
Base class for reference counted objects.
ReferenceCounted & operator=(const ReferenceCounted &)
Assignment.
void unref() const
Release a reference.
virtual void unref_to(unsigned) const
Trigger derived classes after refCount was decreased.
void unrefException() const
Throws Exception on unref.
unsigned refCount() const
Return reference counter value.
ReferenceCounted()
Default ctor.
static void add_ref(const ReferenceCounted *ptr_r)
Called by zypp::intrusive_ptr to add a reference.
friend std::ostream & operator<<(std::ostream &str, const ReferenceCounted &obj)
Stream output via dumpOn.
std::ostream & operator<<(std::ostream &str, const ReferenceCounted &obj)