/[resiprocate]/main/resip/dum/DestroyUsage.cxx
ViewVC logotype

Contents of /main/resip/dum/DestroyUsage.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8161 - (show annotations) (download)
Fri Jul 25 20:54:42 2008 UTC (11 years, 4 months ago) by jmatthewsr
File MIME type: text/plain
File size: 3888 byte(s)
Stream performance enhancements for encoding objects.  New encoding code should use 'EncodeStream','resipCerr' and 'resipCout' for encoding any resip objects.  Merge from b-jmatthewsr-streamperf2 -r 8137:8160.  
1 #include "resip/dum/DestroyUsage.hxx"
2 #include "rutil/Logger.hxx"
3 #include "resip/dum/BaseUsage.hxx"
4 #include "resip/dum/DialogSet.hxx"
5 #include "resip/dum/Dialog.hxx"
6 #include "rutil/WinLeakCheck.hxx"
7 #include <cassert>
8
9 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
10
11 using namespace resip;
12
13 DestroyUsage::DestroyUsage(BaseUsageHandle target)
14 :mHandle(target),
15 mDialogSet(0),
16 mDialog(0)
17 {}
18
19 DestroyUsage::DestroyUsage(DialogSet* dialogSet)
20 :mHandle(),
21 mDialogSet(dialogSet),
22 mDialog(0)
23 {}
24
25 DestroyUsage::DestroyUsage(Dialog* dialog)
26 :mHandle(),
27 mDialogSet(0),
28 mDialog(dialog)
29 {}
30
31 DestroyUsage::DestroyUsage(const DestroyUsage& other) :
32 mHandle(other.mHandle),
33 mDialogSet(other.mDialogSet),
34 mDialog(other.mDialog)
35 {}
36
37 DestroyUsage::~DestroyUsage()
38 {}
39
40 Message*
41 DestroyUsage::clone() const
42 {
43 return new DestroyUsage(*this);
44 }
45
46 EncodeStream&
47 DestroyUsage::encodeBrief(EncodeStream& strm) const
48 {
49 if (mDialogSet)
50 {
51 static Data d("DestroyDialogSet");
52 strm << d << " " << mDialogSet->getId();
53 }
54 else if (mDialog)
55 {
56 static Data d("DestroyDialog");
57 strm << d << " " << mDialog->getId();
58 }
59 else
60 {
61 static Data d("DestroyUsage");
62 strm << d << " " << *mHandle;
63 }
64
65 return strm;
66 }
67
68 EncodeStream&
69 DestroyUsage::encode(EncodeStream& strm) const
70 {
71 return strm << brief();
72 }
73
74 void
75 DestroyUsage::destroy()
76 {
77 if (mDialogSet)
78 {
79 delete mDialogSet;
80 }
81 else if (mDialog)
82 {
83 delete mDialog;
84 }
85 else if (mHandle.isValid())
86 {
87 delete mHandle.get();
88 }
89 }
90
91 /* ====================================================================
92 * The Vovida Software License, Version 1.0
93 *
94 * Redistribution and use in source and binary forms, with or without
95 * modification, are permitted provided that the following conditions
96 * are met:
97 *
98 * 1. Redistributions of source code must retain the above copyright
99 * notice, this list of conditions and the following disclaimer.
100 *
101 * 2. Redistributions in binary form must reproduce the above copyright
102 * notice, this list of conditions and the following disclaimer in
103 * the documentation and/or other materials provided with the
104 * distribution.
105 *
106 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
107 * and "Vovida Open Communication Application Library (VOCAL)" must
108 * not be used to endorse or promote products derived from this
109 * software without prior written permission. For written
110 * permission, please contact vocal@vovida.org.
111 *
112 * 4. Products derived from this software may not be called "VOCAL", nor
113 * may "VOCAL" appear in their name, without prior written
114 * permission of Vovida Networks, Inc.
115 *
116 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
117 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
119 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
120 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
121 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
122 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
123 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
124 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
125 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
126 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
127 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
128 * DAMAGE.
129 *
130 * ====================================================================
131 *
132 * This software consists of voluntary contributions made by Vovida
133 * Networks, Inc. and many individuals on behalf of Vovida Networks,
134 * Inc. For more information on Vovida Networks, Inc., please see
135 * <http://www.vovida.org/>.
136 *
137 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27