#include<iostream> #include<bits/stdc++.h> using namespace std; struct CtxThrottlingContainer { string pci; string status; CtxThrottlingContainer() { pci = ""; status = ""; } }; struct CtxThrottlingData { map <int, list<CtxThrottlingContainer> > PendingThrottlingTriggerMap; map <string, string> m_ApplicableThrtlProfileMap; }; map<string,CtxThrottlingData> g_SessionLvlThrottlingMap; void New_Insertation() { CtxThrottlingData ctx; #if 0 CtxThrottlingContainer c1; c1.pci = "pci"; c1.status = "status"; list<CtxThrottlingContainer> l1; l1.push_back(c1); ctx.PendingThrottlingTriggerMap.insert(make_pair(123, l1)); ctx.m_ApplicableThrtlProfileMap.insert(make_pair("maths", "second")); #endif g_SessionLvlThrottlingMap["total_key"] = ctx; } int main() { map<string,CtxThrottlingData>::iterator itr = g_SessionLvlThrottlingMap.find("maths"); if(itr == g_SessionLvlThrottlingMap.end()) { New_Insertation(); } itr = g_SessionLvlThrottlingMap.find("total_key"); if(itr == g_SessionLvlThrottlingMap.end()) { New_Insertation(); } else { cout<<"g_SessionLvlThrottlingMap Key value is : "<<itr->first<<endl; map<int, list<CtxThrottlingContainer> > ::iterator itr2 = itr->second.PendingThrottlingTriggerMap.begin(); list<CtxThrottlingContainer>::iterator it4 = itr2->second.begin(); map <string, string> ::iterator itr3 = itr->second.m_ApplicableThrtlProfileMap.begin(); cout<<"PendingThrottlingTriggerMap key is : "<<itr2->first<<endl; //if(it4 != itr2->second.end()); if(itr2->second.empty()) { if((it4->pci != "") && (it4->status != "")) { cout<<"PendingThrottlingTriggerMap list is : "<<it4->pci<<endl; cout<<"PendingThrottlingTriggerMap list is : "<<it4->status<<endl; } } itr3 = itr->second.m_ApplicableThrtlProfileMap.find("maths"); if(itr3 != itr->second.m_ApplicableThrtlProfileMap.end()) { cout<<"m_ApplicableThrtlProfileMap 1st : "<<itr3->first<<endl; cout<<"m_ApplicableThrtlProfileMap 2nd : "<<itr3->second<<endl; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)