Re: TNamed() without a name

From: Thiemo Nagel <thiemo.nagel_at_ph.tum.de>
Date: Tue, 13 Apr 2010 20:48:47 +0200


Dear Axel,

Axel Naumann wrote:
> I discussed with Fons, it's a pretty common issue. We could put the
> random string generator into TString. Could you suggest a function?

I'm not sure whether we need a random string, I can't think of an application where a unique string wouldn't be sufficient.

I've attached a prototype of a TUniqueString class with a static counter protected by a TMutex. To prevent collisions of strings originating from different ROOT instances, a TUUID is prepended.

(The whole thing could be integrated into TString easily, but I'm not sure, whether it would a problem if TString depended on TMutex.)

What do you think?

Funnily, the implementation crashes CINT (ROOT 5.26/00b) when running as a script, but works well when running compiled. (I haven't tested against the trunk.)

Cheers!

Thiemo

-- 
+-----------------------------------+--------------------------+
| Dipl.-Phys. Thiemo Nagel          |                          |
| Technische Universitaet Muenchen  | Room    PH1 3276         |
| Physik-Department E18             |                          |
| James-Franck-Strasse              | Phone  +49 89 289-12379  |
| D-85747 Garching                  | Fax    +49 89 289-12570  |
+-----------------------------------+--------------------------+


Received on Tue Apr 13 2010 - 20:48:53 CEST

This archive was generated by hypermail 2.2.0 : Tue Apr 13 2010 - 23:50:02 CEST