-
November 4th, 2015, 06:06 AM
#1
Issue in nested stl maps
Hello,
In the following code, I am trying to to sPolicyRule to cIpAddressPolicyRulesInfo which gets added..But somehow the outer class(or map) doesnot get updated i.e the class CPCRF::m_mIMSI2ApnPolicyRuleInfo
Code:
map<string, APN2PolicyRules>::iterator iTer = CPCRF::m_mIMSI2ApnPolicyRuleInfo.find(sImsi);
APN2PolicyRules cApn2PolicyRulesInfo = iTer->second;
APN2PolicyRules::iterator iTerApn = cApn2PolicyRulesInfo.find(sApn);
IPAddressPolicyRulesInfo cIpAddressPolicyRulesInfo = iTerApn->second;
PolicyRuleInfo sPolicyRule(stQoSInfo, stTFT);
cIpAddressPolicyRulesInfo.addPolicycyRule(sDedicatedBearerId, sPolicyRule);
Iam in hurry so any help clues are much appreciated.
When i gdb policyRules has two map elements, but the main class has only one..
(gdb) p cIpAddressPolicyRulesInfo
$3 = {sIpAddress = {<CIPAType> = {_vptr.CIPAType = 0xa4885a8},
m_bIsNull = false, m_nA = 10 '\n', m_nB = 4 '\004', m_nC = 1 '\001',
m_nD = 10 '\n'}, policyRules = std::map with 2 elements = {[
"PolicyRule_Voice_C"] = {stBearerQoS = {nQCI = 5, nMaxUlBitRate = 31,
nMaxDlBitRate = 31, nGuarUlBitRate = 31, nGuarDlBitRate = 31,
nPriorityLevel = 15, bPreEmptionCapabilityEnabled = false,
bPreEmptionVulnerabilityEnabled = true, bQoSModified = false},
stTFTInfo = {static IPV4CompLen = 9 '\t', static PiNhCompLen = 2 '\002',
static SinglePortCompLen = 3 '\003',
static PortRangeCompLen = 5 '\005',
static TypeOfServiceCompLen = 3 '\003',
static FilterHdrLen = 3 '\003', nTFTLen = 0, eOpCode = 145520760,
bEBit = false, nNumPktFilters = 0 '\000',
mFilterId2TFTFilters = std::map with 0 elements,
vTFTParams = std::vector of length 0, capacity 0}}, ["ded1"] = {
stBearerQoS = {nQCI = 1, nMaxUlBitRate = 31, nMaxDlBitRate = 31,
nGuarUlBitRate = 31, nGuarDlBitRate = 31, nPriorityLevel = 15,
bPreEmptionCapabilityEnabled = false,
bPreEmptionVulnerabilityEnabled = true, bQoSModified = false},
stTFTInfo = {static IPV4CompLen = 9 '\t', static PiNhCompLen = 2 '\002',
static SinglePortCompLen = 3 '\003',
static PortRangeCompLen = 5 '\005',
static TypeOfServiceCompLen = 3 '\003',
static FilterHdrLen = 3 '\003', nTFTLen = 12,
eOpCode = TFTInfo::CreateNewTFT, bEBit = false,
nNumPktFilters = 1 '\001',
mFilterId2TFTFilters = std::map with 1 elements = {[0 '\000'] = {
eDirection = TFTInfo:IR_BI, nEvaluation = 0 '\000',
nFilterLen = 9 '\t',
mFilterCompId2TFTComponents = std::map with 1 elements = {
[16] = std::vector of length 8, capacity 8 = {192 '\300',
168 '\250', 21 '\025', 29 '\035', 255 '\377', 255 '\377',
255 '\377', 0 '\000'}}}},
vTFTParams = std::vector of length 0, capacity 0}}}}
(gdb) p CPCRF::m_mIMSI2ApnPolicyRuleInfo
$2 = std::map with 1 elements = {
["111110000000002"] = std::map with 1 elements = {
["ims"] = {sIpAddress = {<CIPAType> = {_vptr.CIPAType = 0xa4885a8},
m_bIsNull = false, m_nA = 10 '\n', m_nB = 4 '\004', m_nC = 1 '\001',
m_nD = 10 '\n'}, policyRules = std::map with 1 elements = {[
"PolicyRule_Voice_C"] = {stBearerQoS = {nQCI = 5, nMaxUlBitRate = 31,
nMaxDlBitRate = 31, nGuarUlBitRate = 31, nGuarDlBitRate = 31,
nPriorityLevel = 15, bPreEmptionCapabilityEnabled = false,
bPreEmptionVulnerabilityEnabled = true, bQoSModified = false},
stTFTInfo = {static IPV4CompLen = 9 '\t',
static PiNhCompLen = 2 '\002',
static SinglePortCompLen = 3 '\003',
static PortRangeCompLen = 5 '\005',
static TypeOfServiceCompLen = 3 '\003',
static FilterHdrLen = 3 '\003', nTFTLen = 0, eOpCode = 145520760,
bEBit = false, nNumPktFilters = 0 '\000',
mFilterId2TFTFilters = std::map with 0 elements,
vTFTParams = std::vector of length 0, capacity 0}}}}
thanks a lot in advance for the help
~p
-
November 4th, 2015, 07:53 AM
#2
Re: Issue in nested stl maps
Please format you code to make it readable.
Code:
APN2PolicyRules cApn2PolicyRulesInfo = iTer->second;
This creates a copy. The copy is not in the map, so anything you do with the copy will not affect the elements in the map.
If you want to update the element in the map, use a reference instead of making a copy.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
November 4th, 2015, 08:04 AM
#3
Re: Issue in nested stl maps
Thanks a lot Drmmr for the quick reply. I also was checking this and found this, and now tested with fix it is working..
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|