|
reSIProcate/DialogUsageManager
9680
|
00001 #include "resip/dum/DestroyUsage.hxx" 00002 #include "rutil/Logger.hxx" 00003 #include "resip/dum/BaseUsage.hxx" 00004 #include "resip/dum/DialogSet.hxx" 00005 #include "resip/dum/Dialog.hxx" 00006 #include "rutil/WinLeakCheck.hxx" 00007 #include <cassert> 00008 00009 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM 00010 00011 using namespace resip; 00012 00013 DestroyUsage::DestroyUsage(BaseUsageHandle target) 00014 :mHandle(target), 00015 mDialogSet(0), 00016 mDialog(0) 00017 {} 00018 00019 DestroyUsage::DestroyUsage(DialogSet* dialogSet) 00020 :mHandle(), 00021 mDialogSet(dialogSet), 00022 mDialog(0) 00023 {} 00024 00025 DestroyUsage::DestroyUsage(Dialog* dialog) 00026 :mHandle(), 00027 mDialogSet(0), 00028 mDialog(dialog) 00029 {} 00030 00031 DestroyUsage::DestroyUsage(const DestroyUsage& other) : 00032 mHandle(other.mHandle), 00033 mDialogSet(other.mDialogSet), 00034 mDialog(other.mDialog) 00035 {} 00036 00037 DestroyUsage::~DestroyUsage() 00038 {} 00039 00040 Message* 00041 DestroyUsage::clone() const 00042 { 00043 return new DestroyUsage(*this); 00044 } 00045 00046 EncodeStream& 00047 DestroyUsage::encodeBrief(EncodeStream& strm) const 00048 { 00049 if (mDialogSet) 00050 { 00051 static Data d("DestroyDialogSet"); 00052 strm << d << " " << mDialogSet->getId(); 00053 } 00054 else if (mDialog) 00055 { 00056 static Data d("DestroyDialog"); 00057 strm << d << " " << mDialog->getId(); 00058 } 00059 else 00060 { 00061 static Data d("DestroyUsage"); 00062 strm << d << " " << *mHandle; 00063 } 00064 00065 return strm; 00066 } 00067 00068 EncodeStream& 00069 DestroyUsage::encode(EncodeStream& strm) const 00070 { 00071 return strm << brief(); 00072 } 00073 00074 void 00075 DestroyUsage::destroy() 00076 { 00077 if (mDialogSet) 00078 { 00079 delete mDialogSet; 00080 } 00081 else if (mDialog) 00082 { 00083 delete mDialog; 00084 } 00085 else if (mHandle.isValid()) 00086 { 00087 delete mHandle.get(); 00088 } 00089 } 00090 00091 /* ==================================================================== 00092 * The Vovida Software License, Version 1.0 00093 * 00094 * Redistribution and use in source and binary forms, with or without 00095 * modification, are permitted provided that the following conditions 00096 * are met: 00097 * 00098 * 1. Redistributions of source code must retain the above copyright 00099 * notice, this list of conditions and the following disclaimer. 00100 * 00101 * 2. Redistributions in binary form must reproduce the above copyright 00102 * notice, this list of conditions and the following disclaimer in 00103 * the documentation and/or other materials provided with the 00104 * distribution. 00105 * 00106 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00107 * and "Vovida Open Communication Application Library (VOCAL)" must 00108 * not be used to endorse or promote products derived from this 00109 * software without prior written permission. For written 00110 * permission, please contact vocal@vovida.org. 00111 * 00112 * 4. Products derived from this software may not be called "VOCAL", nor 00113 * may "VOCAL" appear in their name, without prior written 00114 * permission of Vovida Networks, Inc. 00115 * 00116 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00117 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00118 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00119 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00120 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00121 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00122 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00123 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00124 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00125 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00126 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00127 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00128 * DAMAGE. 00129 * 00130 * ==================================================================== 00131 * 00132 * This software consists of voluntary contributions made by Vovida 00133 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00134 * Inc. For more information on Vovida Networks, Inc., please see 00135 * <http://www.vovida.org/>. 00136 * 00137 */
1.7.5.1