////////////////////////////////////////////////////////////////////////
// $Id: CandUid.cxx,v 1.3 2003/03/13 23:54:10 gmieg Exp $
//
// CandUid.cxx
//
// CandUid is the unique ID object for CandBase derived objects.
//
// Author:  G. Irwin 3/2000
////////////////////////////////////////////////////////////////////////

#include <cassert>

#include "Candidate/CandUid.h"
#include "Candidate/CandBase.h"

ClassImp(CandUid)

//______________________________________________________________________
  CandUid::CandUid() :
  fArchUidInt(0)
, fUidInt(0)
{
}

//______________________________________________________________________
CandUid::CandUid(const CandUid &cu) :
  fArchUidInt(0)
, fUidInt(0)
{
   fUidInt = cu.GetUidInt();
   fArchUidInt = cu.GetArchUidInt();
}

//______________________________________________________________________
CandUid::CandUid(const CandBase &cb) :
  fArchUidInt(0)
, fUidInt(0)
{

   fUidInt = (UInt_t) &cb;            // Set to CandBase address for now
   fArchUidInt = fUidInt;
}

//______________________________________________________________________
CandUid::CandUid(const CandBase &cb, const CandBase &cba) :
  fArchUidInt(0)
, fUidInt(0)
{
   fUidInt = (UInt_t) &cb;
   fArchUidInt = cba.GetArchUidInt();
}

//______________________________________________________________________
CandUid::~CandUid()
{
}

//______________________________________________________________________
CandUid &CandUid::operator=(const CandUid &cu)
{
   assert(&cu != 0);
   if (this != &cu) fUidInt = cu.GetUidInt();
   return *this;
}

//______________________________________________________________________
Bool_t CandUid::operator==(const CandUid &cu) const
{
   assert(&cu != 0);
   return (GetUidInt() == cu.GetUidInt());
}

//______________________________________________________________________
Bool_t CandUid::operator!=(const CandUid &cu) const
{
   assert(&cu != 0);
   return !(*this == cu);
}

//______________________________________________________________________
Bool_t CandUid::IsCloneOf(const CandUid &cu) const
{
   return (GetArchUidInt() == cu.GetArchUidInt());
}
