00001 #ifndef IONFLUX_TOOLS_MANAGEDOBJECT 00002 #define IONFLUX_TOOLS_MANAGEDOBJECT 00003 /* ========================================================================== 00004 * Ionflux Tools 00005 * Copyright (c) 2005 Joern P. Meier 00006 * mail@ionflux.org 00007 * -------------------------------------------------------------------------- 00008 * ManagedObject.hpp Managed object. 00009 * ========================================================================== 00010 * 00011 * This file is part of Ionflux Tools. 00012 * 00013 * Ionflux Tools is free software; you can redistribute it and/or modify it 00014 * under the terms of the GNU General Public License as published by the 00015 * Free Software Foundation; either version 2 of the License, or (at your 00016 * option) any later version. 00017 * 00018 * Ionflux Tools is distributed in the hope that it will be useful, but 00019 * WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 * General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License along 00024 * with Ionflux Tools; if not, write to the Free Software Foundation, Inc., 00025 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 * 00027 * ========================================================================== */ 00028 00029 #include <string> 00030 #include <iostream> 00031 #include "ionflux/Object.hpp" 00032 00033 namespace Ionflux 00034 { 00035 00036 namespace Tools 00037 { 00038 00046 00047 class ManagedObjectClassInfo 00048 : public ClassInfo 00049 { 00050 public: 00052 ManagedObjectClassInfo(); 00054 virtual ~ManagedObjectClassInfo() { }; 00055 }; 00056 00080 class ManagedObject 00081 : public Ionflux::Tools::Object 00082 { 00083 private: 00084 00085 protected: 00087 bool managed; 00089 unsigned int refCount; 00090 00091 public: 00093 static const ManagedObjectClassInfo managedObjectClassInfo; 00095 static const ClassInfo* CLASS_INFO; 00096 00101 ManagedObject(); 00102 00107 virtual ~ManagedObject(); 00108 00129 virtual bool setManaged(bool newManage); 00130 00138 virtual bool isManaged(); 00139 00150 virtual unsigned int ref(); 00151 00158 virtual unsigned int unref(); 00159 00166 virtual unsigned int getRefCount(); 00167 }; 00168 00170 00171 } 00172 00173 } 00174 00178 #endif