reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
KeyValueStore.hxx
Go to the documentation of this file.
1#if !defined(KeyValueStore_hxx)
2#define KeyValueStore_hxx
3
4#include <vector>
5#include "rutil/Data.hxx"
6#include "rutil/compat.hxx"
7
8namespace resip
9{
10class KeyValueStoreKeyAllocator;
11
13{
14public:
15 typedef unsigned long Key;
17 {
18 public:
19 KeyValueStoreKeyAllocator() : mNextKey(1) { }
20 KeyValueStore::Key allocateNewKey() { return mNextKey++; }
21 private:
22 friend class KeyValueStore;
23 KeyValueStore::Key mNextKey;
24 };
25
28 virtual ~KeyValueStore();
29
31
32 void setDataValue(Key key, const Data& value);
33 const Data& getDataValue(Key key) const;
34 Data& getDataValue(Key key);
35
36 void setBoolValue(Key key, bool value) { mKeyValueStore[key].boolValue = value; }
37 const bool& getBoolValue(Key key) const { return mKeyValueStore[key].boolValue; }
38 bool& getBoolValue(Key key) { return mKeyValueStore[key].boolValue; }
39
40 void setCharValue(Key key, char value) { mKeyValueStore[key].charValue = value; }
41 const char& getCharValue(Key key) const { return mKeyValueStore[key].charValue; }
42 char& getCharValue(Key key) { return mKeyValueStore[key].charValue; }
43
44 void setShortValue(Key key, short value) { mKeyValueStore[key].shortValue = value; }
45 const short& getShortValue(Key key) const { return mKeyValueStore[key].shortValue; }
46 short& getShortValue(Key key) { return mKeyValueStore[key].shortValue; }
47
48 void setUShortValue(Key key, unsigned short value) { mKeyValueStore[key].ushortValue = value; }
49 const unsigned short& getUShortValue(Key key) const { return mKeyValueStore[key].ushortValue; }
50 unsigned short& getUShortValue(Key key) { return mKeyValueStore[key].ushortValue; }
51
52 void setIntValue(Key key, int value) { mKeyValueStore[key].intValue = value; }
53 const int& getIntValue(Key key) const { return mKeyValueStore[key].intValue; }
54 int& getIntValue(Key key) { return mKeyValueStore[key].intValue; }
55
56 void setUIntValue(Key key, unsigned int value) { mKeyValueStore[key].uintValue = value; }
57 const unsigned int& getUIntValue(Key key) const { return mKeyValueStore[key].uintValue; }
58 unsigned int& getUIntValue(Key key) { return mKeyValueStore[key].uintValue; }
59
60 void setUInt64Value(Key key, uint64_t value) { mKeyValueStore[key].uint64Value = value; }
61 const uint64_t& getUInt64Value(Key key) const { return mKeyValueStore[key].uint64Value; }
62 uint64_t& getUInt64Value(Key key) { return mKeyValueStore[key].uint64Value; }
63
64protected:
65 struct Value
66 {
68 union
69 {
73 unsigned short ushortValue;
75 unsigned int uintValue;
77 };
78 };
79 typedef std::vector<Value> KeyValueStoreContainer;
82
83private:
84 friend EncodeStream& operator<<(EncodeStream& strm, const KeyValueStore& store);
85};
86
88
89}
90
91#endif
92
93/* ====================================================================
94 * The Vovida Software License, Version 1.0
95 *
96 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
97 *
98 * Redistribution and use in source and binary forms, with or without
99 * modification, are permitted provided that the following conditions
100 * are met:
101 *
102 * 1. Redistributions of source code must retain the above copyright
103 * notice, this list of conditions and the following disclaimer.
104 *
105 * 2. Redistributions in binary form must reproduce the above copyright
106 * notice, this list of conditions and the following disclaimer in
107 * the documentation and/or other materials provided with the
108 * distribution.
109 *
110 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
111 * and "Vovida Open Communication Application Library (VOCAL)" must
112 * not be used to endorse or promote products derived from this
113 * software without prior written permission. For written
114 * permission, please contact vocal@vovida.org.
115 *
116 * 4. Products derived from this software may not be called "VOCAL", nor
117 * may "VOCAL" appear in their name, without prior written
118 * permission of Vovida Networks, Inc.
119 *
120 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
121 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
122 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
123 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
124 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
125 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
126 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
127 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
128 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
129 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
130 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
131 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
132 * DAMAGE.
133 *
134 * ====================================================================
135 *
136 * This software consists of voluntary contributions made by Vovida
137 * Networks, Inc. and many individuals on behalf of Vovida Networks,
138 * Inc. For more information on Vovida Networks, Inc., please see
139 * <http://www.vovida.org/>.
140 *
141 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
void setBoolValue(Key key, bool value)
void setUShortValue(Key key, unsigned short value)
short & getShortValue(Key key)
int & getIntValue(Key key)
char & getCharValue(Key key)
uint64_t & getUInt64Value(Key key)
void setCharValue(Key key, char value)
const bool & getBoolValue(Key key) const
const short & getShortValue(Key key) const
const uint64_t & getUInt64Value(Key key) const
KeyValueStoreKeyAllocator mKeyAllocator
KeyValueStoreContainer mKeyValueStore
unsigned short & getUShortValue(Key key)
const char & getCharValue(Key key) const
bool & getBoolValue(Key key)
void setShortValue(Key key, short value)
std::vector< Value > KeyValueStoreContainer
void setIntValue(Key key, int value)
void setDataValue(Key key, const Data &value)
unsigned int & getUIntValue(Key key)
friend EncodeStream & operator<<(EncodeStream &strm, const KeyValueStore &store)
const Data & getDataValue(Key key) const
void setUInt64Value(Key key, uint64_t value)
const unsigned int & getUIntValue(Key key) const
const unsigned short & getUShortValue(Key key) const
const int & getIntValue(Key key) const
void setUIntValue(Key key, unsigned int value)
This file is used to handle compatibility fixes/tweaks so reSIProcate can function on multiple platfo...
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
void list()
Definition userAdmin.cxx:66