reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TransactionMap.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
5#include "rutil/Logger.hxx"
8
9using namespace resip;
10
11#define RESIPROCATE_SUBSYSTEM Subsystem::TRANSACTION
12
14{
15 //DebugLog (<< "Deleting TransactionMap: " << this << " " << mMap.size() << " entries");
16 while (!mMap.empty())
17 {
18 DebugLog (<< mMap.begin()->first << " -> " << mMap.begin()->second << ": " << *mMap.begin()->second);
19 delete mMap.begin()->second;
20 }
21}
22
24TransactionMap::find( const Data& tid ) const
25{
26 auto i = mMap.find(tid);
27 if (i != mMap.end())
28 {
29 return i->second;
30 }
31 else
32 {
33 return 0;
34 }
35}
36
37void
39{
40 auto i = mMap.find(tid);
41 if (i != mMap.end())
42 {
43 if (i->second != state)
44 {
45 // .bwc. ~TransactionState will remove itself from the map.
46 delete i->second;
47 //DebugLog (<< "Replacing TMAP[" << tid << "] = " << state << " : " << *state);
48 mMap[tid] = state;
49 }
50 }
51 else
52 {
53 //DebugLog (<< "Inserting TMAP[" << tid << "] = " << state << " : " << *state);
54 mMap[tid] = state;
55 }
56}
57
58void
60{
61 auto i = mMap.find(tid);
62 if (i != mMap.end())
63 {
64 // don't delete it here, the TransactionState deletes itself and removes
65 // itself from the map
66 //DebugLog (<< "Erasing " << tid << "(" << i->second << ")");
67 mMap.erase(i);
68 }
69 else
70 {
71 InfoLog (<< "Couldn't find " << tid << " to remove");
72 resip_assert(0);
73 }
74}
75
76int
78{
79 return (int)mMap.size();
80}
81
82
83
84/* ====================================================================
85 * The Vovida Software License, Version 1.0
86 *
87 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
88 *
89 * Redistribution and use in source and binary forms, with or without
90 * modification, are permitted provided that the following conditions
91 * are met:
92 *
93 * 1. Redistributions of source code must retain the above copyright
94 * notice, this list of conditions and the following disclaimer.
95 *
96 * 2. Redistributions in binary form must reproduce the above copyright
97 * notice, this list of conditions and the following disclaimer in
98 * the documentation and/or other materials provided with the
99 * distribution.
100 *
101 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
102 * and "Vovida Open Communication Application Library (VOCAL)" must
103 * not be used to endorse or promote products derived from this
104 * software without prior written permission. For written
105 * permission, please contact vocal@vovida.org.
106 *
107 * 4. Products derived from this software may not be called "VOCAL", nor
108 * may "VOCAL" appear in their name, without prior written
109 * permission of Vovida Networks, Inc.
110 *
111 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
112 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
113 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
114 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
115 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
116 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
117 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
118 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
119 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
120 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
121 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
122 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
123 * DAMAGE.
124 *
125 * ====================================================================
126 *
127 * This software consists of voluntary contributions made by Vovida
128 * Networks, Inc. and many individuals on behalf of Vovida Networks,
129 * Inc. For more information on Vovida Networks, Inc., please see
130 * <http://www.vovida.org/>.
131 *
132 */
#define DebugLog(args_)
Definition Logger.hxx:128
#define InfoLog(args_)
Definition Logger.hxx:131
#define resip_assert(x)
This file needs to work for both C and C++ code.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
void erase(const Data &transactionId)
void add(const Data &transactionId, TransactionState *state)
TransactionState * find(const Data &transactionId) const
dcm! – add UnusedChecking(_enum) below;