How to write out TMap objects?

meb@gorby.dataventures.com
Tue, 30 Jun 1998 17:18:51 -0600 (MDT)


This might seem to be a really silly question. I am a new root user,
having very little experience with OO programming. After reading all
the documentation I can get my hands on, I find I need help.

I have no difficulty creating a TMap object (map), and filling it with
a small set of (key, value) pairs. For testing, the "key" and "value"
objects are TObjString's. After opening a new file, I invoke the
method map->Write(). A listing of the directory shows I saved a
TObjString and not a TMap. What went wrong?

root [0] TMap map(10)
root [1] map.Add(new TObjString("Mike"), new TObjString("Beddo"))
root [2] map
(class TMap)542047224
root [3] TFile db("test.root", "recreate")
root [4] map->Write("a_map")
root [5] .ls()
TFile** test.root
TFile* test.root
KEY: TObjString a_map;1 Collectable string class
root [6] .q

- Mike Beddo