Changeset 2619 in Sophya for trunk/SophyaLib/HiStats/histerr.cc


Ignore:
Timestamp:
Sep 15, 2004, 5:36:54 PM (21 years ago)
Author:
cmv
Message:

correc bug HistoErr::operator=() + remise en forme createur/destructeur Histos cmv 15/9/04

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/histerr.cc

    r2615 r2619  
    4444HistoErr::~HistoErr(void)
    4545{
    46  if(mNData) {delete [] mNData; mNData=NULL;}
    47 }
     46 Delete();
     47}
     48
    4849/********* Methode *********/
    4950/*! Allocation du tableau mNData */
     
    5657
    5758/********* Methode *********/
     59/*! Delete des tableaux */
     60void HistoErr::Delete(void)
     61{
     62 Histo::Delete();
     63 if(mNData) {delete [] mNData; mNData=NULL;}
     64}
     65
     66/********* Methode *********/
    5867/*!
    5968  Remise a zero
     
    6170void HistoErr::Zero(void)
    6271{
    63  if(mNData != NULL) memset(mNData,0,mBins*sizeof(uint_4));
    6472 Histo::Zero();
     73 if(mNData) memset(mNData,0,mBins*sizeof(uint_4));
    6574}
    6675
     
    172181}
    173182
     183/********* Methode *********/
     184/*!
     185  Operateur egal HistoErr = HistoErr
     186*/
     187HistoErr& HistoErr::operator = (const HistoErr& h)
     188{
     189  if(this==&h) return *this;
     190  Delete();
     191  if(h.mBins<=0) return *this;
     192
     193  // Copy the "Histo" part
     194  (Histo)(*this) = Histo::operator=(h);
     195  // Copy the "entries by bin" table
     196  allocate_mNData(h.mBins);
     197  memcpy(mNData,h.mNData,mBins*sizeof(uint_4));
     198
     199  return *this;
     200}
     201
    174202///////////////////////////////////////////////////////////
    175203// --------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.