Hashtable Memory Dump?

O

Otto Barnes

Hello all,

I have written a hashtable class that holds a dyanically allocated array
of structs which holds data about a visualization model. This data is
parsed via xerces from XML into this hashtable. This method works well
for small < 100K files, but I'm looking to handle 3MB files. To speed
things up, I think it would be nice to dump the hashtable to a file so
that I may undump it into memory next time the program is run. I have
no clue how to do this other than writing it out via iostream which
would give me an equivilent of flat XML file and require a ton of
processing. I would like to do something simular to SGI's OpenGL
Performer PFB format. Any thoughts?

Thanks,
-Otto Barnes
 
M

Mike Wahler

Otto Barnes said:
Hello all,

I have written a hashtable class that holds a dyanically allocated array
of structs which holds data about a visualization model. This data is
parsed via xerces from XML into this hashtable. This method works well
for small < 100K files, but I'm looking to handle 3MB files. To speed
things up, I think it would be nice to dump the hashtable to a file so
that I may undump it into memory next time the program is run. I have
no clue how to do this other than writing it out via iostream which
would give me an equivilent of flat XML file and require a ton of
processing. I would like to do something simular to SGI's OpenGL
Performer PFB format. Any thoughts?

If you want to serialize your data, the only facility
available for that in standard C++ is via iostreams.

You can write your data in any format you like (prefer
text if you want the data to be portable among platforms).
I don't see what the problem is. If you want to store the
data as text, create an inserter and an extractor for your
class. If you want to store the data 'raw', use
'std::eek:fstream::write()', and read it back with
'std::ifstream::read().'

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top