46 #ifndef COMMONCPP_POINTER_H_
47 #define COMMONCPP_POINTER_H_
49 #ifndef COMMONCPP_CONFIG_H_
50 #include <commoncpp/config.h>
70 if(ptrCount && --(*ptrCount)==0) {
79 explicit Pointer(T* ptr = NULL) : ptrObject(ptr)
81 ptrCount =
new unsigned;
87 ptrObject = ref.ptrObject;
88 ptrCount = ref.ptrCount;
100 ptrObject = ref.ptrObject;
101 ptrCount = ref.ptrCount;
107 inline T& operator*()
const
108 {
return *ptrObject;};
110 inline T* getObject()
const
113 inline T* operator->()
const
116 inline bool operator!()
const
117 {
return (*ptrCount == 1);};
119 inline int operator++()
const
120 {
return ++(*ptrCount);};
122 int operator--()
const
128 return --(*ptrCount);
Used to create and manage referece counted pointers.