00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #pragma once
00012 #include "ippdme/ippdme.h"
00013
00014
00015 #include <boost/shared_ptr.hpp>
00016 #include <boost/intrusive_ptr.hpp>
00017
00019 class IPPDME_EXT_CLASS ippObject
00020 {
00021 public:
00023 ippObject();
00024
00026 virtual ~ippObject();
00027
00028 private:
00029 int _refs;
00030 friend inline void intrusive_ptr_release(ippObject* pThis)
00031 {
00032 if(--pThis->_refs == 0 ) {
00033 delete pThis;
00034 }
00035 }
00036 friend inline void intrusive_ptr_add_ref(ippObject* pThis)
00037 {
00038 pThis->_refs++;
00039 }
00040 friend inline void intrusive_ptr_release(const ippObject* pThis)
00041 {
00042 if(--const_cast<ippObject*>(pThis)->_refs == 0 ) {
00043 delete const_cast<ippObject*>(pThis);
00044 }
00045 }
00046 friend inline void intrusive_ptr_add_ref(const ippObject* pThis)
00047 {
00048 const_cast<ippObject*>(pThis)->_refs++;
00049
00050 }
00051 };
00052
00053
00054 #define IPP_DECLARE_SMARTPOINTER(className) \
00055 typedef IPPDME_EXT_CLASS boost::intrusive_ptr<className> className##Ptr; \
00056 typedef IPPDME_EXT_CLASS boost::intrusive_ptr<const className> className##ConstPtr;
00057
00058
00059