HandleId.h

Go to the documentation of this file.
00001 //==================================================================================================
00002 //
00003 // File: HandleId.h
00004 //
00005 // Created:
00006 //
00007 // Author: Øyvind Hjelle <oyvind.hjelle@math.sintef.no>
00008 //
00009 // Revision: $Id: HandleId.h,v 1.2 2006/07/26 12:08:44 oyvindhj Exp $
00010 //
00011 // Description:
00012 //
00013 //==================================================================================================
00014 // Copyright (C) 2000-2003 SINTEF Applied Mathematics.  All rights reserved.
00015 //
00016 // This file may be distributed under the terms of the Q Public License
00017 // as defined by Trolltech AS of Norway and appearing in the file
00018 // LICENSE.QPL included in the packaging of this file.
00019 // 
00020 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00021 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00022 //
00023 //==================================================================================================
00024 
00025 
00026 #ifndef _HANDLEID_H_
00027 #define _HANDLEID_H_
00028 
00029 
00030 #include <stddef.h>
00031 
00032 
00033 //--------------------------------------------------------------------------------------------------
00034 // HandleId class
00035 //--------------------------------------------------------------------------------------------------
00036 
00041 class HandleId {
00042 
00043 protected:
00044   int     refcount;       // reference count
00045   char    dynamic_object; // '1': explicit call to new created the object
00046 
00047 public:
00048   HandleId ();
00049   virtual ~HandleId () {};
00050 
00051   bool isReferenced () const { return refcount != 0; }
00052   int  getNoRefs    () const { return refcount; }
00053   bool dynamicObj   () const { return dynamic_object == '1'; }
00054 
00055   void  increment () { refcount++; }
00056   void  decrement () { refcount--; }
00057 
00058   void* operator new (size_t t);
00059   void* operator new (size_t t,int, const char * file, int line);
00060 
00061   void  operator delete (void* v);
00062 
00063 };
00064  
00065 #endif

Generated on Wed Nov 17 17:44:27 2010 for TTL by  doxygen 1.6.1