How to write out TMap objects?

From: meb@gorby.dataventures.com
Date: Wed Jul 01 1998 - 01:18:51 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET