47 #ifndef COMMONCPP_POINTER_H_
48 #define COMMONCPP_POINTER_H_
50 #ifndef COMMONCPP_CONFIG_H_
51 #include <commoncpp/config.h>
71 if(ptrCount && --(*ptrCount)==0) {
80 explicit Pointer(T* ptr = NULL) : ptrObject(ptr)
82 ptrCount =
new unsigned;
88 ptrObject = ref.ptrObject;
89 ptrCount = ref.ptrCount;
101 ptrObject = ref.ptrObject;
102 ptrCount = ref.ptrCount;
108 inline T& operator*()
const
109 {
return *ptrObject;};
111 inline T* getObject()
const
114 inline T* operator->()
const
117 inline bool operator!()
const
118 {
return (*ptrCount == 1);};
120 inline int operator++()
const
121 {
return ++(*ptrCount);};
123 int operator--()
const
129 return --(*ptrCount);
Used to create and manage referece counted pointers.