Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ippObject.h

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I.
00010 //
00011 #pragma once
00012 #include "ippdme/ippdme.h"
00013 
00014 // we use the boost library for implementing share pointers
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 

Generated on Wed Nov 8 00:19:58 2006 for IPPDME by  doxygen 1.4.1