00001 /* 00002 * WOscLib, an object oriented OSC library. 00003 * Copyright (C) 2005 Uli Clemens Franke, Weiss Engineering LTD, Switzerland. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * For details see lgpl.txt 00020 * 00021 * Weiss Engineering LTD. 00022 * Florastrass 42 00023 * 8610 Uster 00024 * Switzerland 00025 * 00026 * uli.franke@weiss.ch 00027 */ 00028 00029 /** WOscNetReturn source file. 00030 * \file 00031 * 00032 * $Author: cls-nebadje $ ( \ref _UcfWOscLib ) 00033 * $Date: 2006-03-20 19:41:37 $ 00034 * $Revision: 1.2 $ 00035 * 00036 * Copyright (c) Weiss Engineering Ltd 00037 * 00038 */ 00039 #include "WOscNetReturn.h" 00040 00041 00042 /** Constructor. 00043 * Resets the parent counter (no parents yet). 00044 * 00045 */ 00046 WOscNetReturn::WOscNetReturn(){ 00047 m_numUsers = 0; 00048 } 00049 00050 /** An owner (user) of this object increases the parent counter 00051 * to request an ongoing existence. 00052 * To unregister call WOscNetReturn::removeParent() . 00053 * 00054 * \see 00055 * WOscNetReturn::removeParent() 00056 */ 00057 void WOscNetReturn::AddParent(){ 00058 m_numUsers++; 00059 } 00060 /** An owner (user) of this object decreases the parent counter 00061 * to announce, that it isn't interested in this object anymore. 00062 * If the parent counter reaches zero, the object destructs itself. 00063 * 00064 * \see 00065 * WOscNetReturn::addParent() 00066 */ 00067 void WOscNetReturn::RemoveParent(){ 00068 m_numUsers--; 00069 if ( m_numUsers <= 0 ) 00070 delete this; 00071 } 00072 00073 /** Destructor. 00074 * 00075 */ 00076 WOscNetReturn::~WOscNetReturn(){ 00077 } 00078