1 #ifndef SIMPLESMARTPTR_H
2 #define SIMPLESMARTPTR_H
4 #include "zipios++/zipios-config.h"
14 template<
class Type >
17 Type *operator-> ()
const {
return _p ; }
19 Type &operator* ()
const {
return *_p ; }
24 : _p( src.get() ) { ref() ; }
55 bool operator== (
const Type *p )
const {
return _p == p ; }
56 bool operator!= (
const Type *p )
const {
return _p != p ; }
59 bool operator! ()
const {
return ! _p ; }
62 operator void*()
const {
return _p ? (
void *)(-1) : (
void *)(0) ; }
64 Type *
get()
const {
return _p ; }
72 void ref(
const T2 *ptr ) {
if ( ptr ) ptr->ref() ; }
74 void ref()
const {
if ( _p ) _p->ref() ; }
75 unsigned int unref()
const {
98 template<
class Type >
134 void ref()
const { ++_ref_count ; }
137 unsigned int unref()
const {
return --_ref_count ; }
140 unsigned int getReferenceCount()
const {
return _ref_count; }
143 mutable unsigned short _ref_count ;