46 #ifndef COMMONCPP_POINTER_H_
47 #define COMMONCPP_POINTER_H_
49 #ifndef COMMONCPP_CONFIG_H_
50 #include <commoncpp/config.h>
68 inline void ptrDetach(
void) {
69 if(ptrCount && --(*ptrCount)==0) {
78 inline explicit Pointer(T* ptr = NULL) : ptrObject(ptr) {
79 ptrCount =
new unsigned;
84 ptrObject = ref.ptrObject;
85 ptrCount = ref.ptrCount;
96 ptrObject = ref.ptrObject;
97 ptrCount = ref.ptrCount;
103 inline T& operator*()
const
106 inline T* getObject()
const
109 inline T* operator->()
const
112 inline bool operator!()
const
113 {
return (*ptrCount == 1);}
115 inline int operator++()
const
116 {
return ++(*ptrCount);}
118 inline int operator--()
const {
123 return --(*ptrCount);
Used to create and manage referece counted pointers.