Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TObjString.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 12/11/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TObjString
13 \ingroup Base
14 
15 Collectable string class. This is a TObject containing a TString.
16 */
17 
18 #include "TObjString.h"
19 #include "TROOT.h"
20 
21 ClassImp(TObjString);
22 
23 ////////////////////////////////////////////////////////////////////////////////
24 /// TObjString destructor.
25 
26 TObjString::~TObjString()
27 {
28  // Required since we overload TObject::Hash.
29  ROOT::CallRecursiveRemoveIfNeeded(*this);
30 }
31 
32 ////////////////////////////////////////////////////////////////////////////////
33 /// String compare the argument with this object.
34 
35 Int_t TObjString::Compare(const TObject *obj) const
36 {
37  if (this == obj) return 0;
38  if (TObjString::Class() != obj->IsA()) return -1;
39  return fString.CompareTo(((TObjString*)obj)->fString);
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Return kTRUE if the argument has the same content as this object.
44 
45 Bool_t TObjString::IsEqual(const TObject *obj) const
46 {
47  if (this == obj) return kTRUE;
48  if (TObjString::Class() != obj->IsA()) return kFALSE;
49  return fString == ((TObjString*)obj)->fString;
50 }