473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

can map return the address of another map

I have foll classess:

1. Class Parse_Map{
GetAlgDetails(string file, map<string,string> &algname);
};

this class has a method GetAlgDetails which will parse an xml file and store the contents in a map.

2. I will be getting the details of the xml files at runtime .There can be several of these xml files. So for each xml file I need to have a unique map name. And these map has to be available to other class members.
So If i have a main code in which I have a class Populate.

Class Populate{
map<string, ptr> maptmp;
map<string, string> alg_list;

void populate(string xmlname){
map<string, string> alg_list;
Parse_Map obj;
obj.GetAlgDetails(xmlname, alg_list);
maptm[xmlname] = &alg_list;
}
};




3. Now I want to access each of the map created by populate from another file. how can i do it?
Dec 18 '07 #1
2 1376
gpraghuram
1,275 Expert 1GB
I have foll classess:

1. Class Parse_Map{
GetAlgDetails(string file, map<string,string> &algname);
};

this class has a method GetAlgDetails which will parse an xml file and store the contents in a map.

2. I will be getting the details of the xml files at runtime .There can be several of these xml files. So for each xml file I need to have a unique map name. And these map has to be available to other class members.
So If i have a main code in which I have a class Populate.

Class Populate{
map<string, ptr> maptmp;
map<string, string> alg_list;

void populate(string xmlname){
map<string, string> alg_list;
Parse_Map obj;
obj.GetAlgDetails(xmlname, alg_list);
maptm[xmlname] = &alg_list;
}
};




3. Now I want to access each of the map created by populate from another file. how can i do it?

Hi,
If u want to store a map inside another map then the declaration shuld be like this
Expand|Select|Wrap|Line Numbers
  1. //map<string, ptr> maptmp; instead of this
  2. //have like this
  3. map<string, map<string,string> > maptmp;
  4. map<string, string>  alg_list;
  5.  
  6.  
After populating one map push it to the maptmp map with the name as the index.
I think this will be a better approach instead of storing the address.

Thanks
Raghuram
Dec 18 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Is it really the map has to have an unique name or is the real requirement that you have a different Populate object for each xml file???
Dec 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Paul Bearden | last post by:
Greetings, I'm posting a form to a cgi application on another web site. The cgi returns a text message to the browser. How can I capture this text message and redirect based on the text. ...
14
by: Gama Franco | last post by:
Hi, I'm designing an interface for a shared library, and I would like to know if there is a standard about how to return an object to the user. I will use exceptions to report errors, so there...
8
by: Ravindranath Gummadidala | last post by:
Hi All: I am trying to understand the C function call mechanism. Please bear with me as I state what I know: "every invocation of a function causes a frame for that function to be pushed on...
23
by: Nascimento | last post by:
Hello, How to I do to return a string as a result of a function. I wrote the following function: char prt_tralha(int num) { int i; char tralha;
25
by: frizzle | last post by:
Hi there, I have a mySQL system with a news publishing part in it: Admins can create new items with text in it, and they have an option to create 'fulltexts', so you'd get "read more ..." on the...
10
by: Raj | last post by:
I need a VB function to return array of collections like Private Type Employee empname as string address as string salary as integer deptno as integer End Type dim employees() as Employee
13
by: markn | last post by:
Running some code through static analysis, I noticed that gcc will generate a warning if a function returns an aggregate, controlled with this flag (from the gcc manual): -Waggregate-return...
7
by: Big Moxy | last post by:
Can someone please advise me on how to implement this? The data entered by a user on form 1 on page1.php is posted to delete.php to remove that row from a table. After the SQL operation the user...
68
by: Jim Langston | last post by:
I remember there was a thread a while back that was talking about using the return value of a function as a reference where I had thought the reference would become invalidated because it was a...
10
by: Mikhail Kovalev | last post by:
Suppose I have something like this $resource = curl_init(); curl_setopt($resource, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($resource, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($resource,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.