//*CMZ :  2.23/12 26/01/2000  09.41.50  by  Rene Brun
//*CMZ :  2.23/11 05/01/2000  23.47.43  by  Rene Brun
//*CMZ :  1.03/09 07/12/97  13.13.34  by  Fons Rademakers
//*-- Author :    Rene Brun   26/12/94

//*KEEP,CopyRight,T=C.
/*************************************************************************
 * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
 * Authors: Rene Brun and Fons Rademakers.                               *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/AA_LICENSE.                      *
 * For the list of contributors see $ROOTSYS/AA_CREDITS.                 *
 *************************************************************************/
//*KEND.

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TNamed                                                               //
//                                                                      //
// The TNamed class is the base class for all named ROOT classes        //
// A TNamed contains the essential elements (name, title)               //
// to identify a derived object in containers, directories and files.   //
// Most member functions defined in this base class are in general      //
// overridden by the derived classes.                                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include <iostream.h>

//*KEEP,Strlen.
#include "Strlen.h"
//*KEEP,TNamed.
#include "TNamed.h"
//*KEEP,TClass.
#include "TClass.h"
//*KEEP,TROOT.
#include "TROOT.h"
//*KEEP,TVirtualPad.
#include "TVirtualPad.h"
//*KEEP,Bytes.
#include "Bytes.h"
//*KEND.


ClassImp(TNamed)


//______________________________________________________________________________
 TNamed::TNamed(const TNamed &named)
{
   // TNamed copy ctor.

   fName = named.fName;
   fTitle = named.fTitle;
}

//______________________________________________________________________________
TNamed& TNamed::operator=(const TNamed& rhs)
{
   // TNamed assignment operator.

   if (this != &rhs) {
      TObject::operator=(rhs);
      fName  = rhs.fName;
      fTitle = rhs.fTitle;
   }
   return *this;
}

//______________________________________________________________________________
 Int_t TNamed::Compare(TObject *obj)
{
   // Compare two TNamed objects. Returns 0 when equal, -1 when this is
   // smaller and +1 when bigger (like strcmp).

   if (this == obj) return 0;
   return fName.CompareTo(obj->GetName());
}

//______________________________________________________________________________
 void TNamed::Copy(TObject &obj)
{
   // Copy this to obj.

   TObject::Copy(obj);
   ((TNamed&)obj).fName  = fName;
   ((TNamed&)obj).fTitle = fTitle;
}

//______________________________________________________________________________
 void TNamed::FillBuffer(char *&buffer)
{
   // Encode TNamed into output buffer.

   fName.FillBuffer(buffer);
   fTitle.FillBuffer(buffer);
}

//______________________________________________________________________________
 void TNamed::ls(Option_t *)
{
   // List TNamed name and title.

   IndentLevel();
   cout <<"OBJ: " << IsA()->GetName() << "t" << GetName() << "t" << GetTitle() << " : "
        << Int_t(TestBit(kCanDelete)) << endl;
}

//______________________________________________________________________________
 void TNamed::Print(Option_t *)
{
   // Print TNamed name and title.

   cout <<"OBJ: " << IsA()->GetName() << "t" << GetName() << "t" << GetTitle() << endl;
}

//______________________________________________________________________________
 void TNamed::SetName(const char *name)
{
   // Change (i.e. set) the name of the TNamed.

   fName = name;
   if (gPad && TestBit(kObjInCanvas)) gPad->Modified();
}

//______________________________________________________________________________
 void TNamed::SetObject(const char *name, const char *title)
{
   // Change (i.e. set) all the TNamed parameters (name and title).

   fName  = name;
   fTitle = title;
   if (gPad && TestBit(kObjInCanvas)) gPad->Modified();
}

//______________________________________________________________________________
 void TNamed::SetTitle(const char *title)
{
   // Change (i.e. set) the title of the TNamed.

   fTitle = title;
   if (gPad && TestBit(kObjInCanvas)) gPad->Modified();
}

//______________________________________________________________________________
 Int_t TNamed::Sizeof() const
{
   // Return size of the TNamed part of the TObject.

   Int_t nbytes = fName.Sizeof() + fTitle.Sizeof();
   return nbytes;
}


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.