Changeset 979 in Sophya for trunk/SophyaLib/SkyMap/localmap.cc


Ignore:
Timestamp:
Apr 28, 2000, 4:09:46 PM (25 years ago)
Author:
ansari
Message:

modifs constructeurs copie et operateur =

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyMap/localmap.cc

    r908 r979  
    6565//++
    6666template<class T>
    67 LocalMap<T>::LocalMap()
     67LocalMap<T>::LocalMap() :  pixels_()
    6868//
    6969//     
     
    7171{
    7272  InitNul();
    73   pixels_.Reset();
     73  //  pixels_.Reset();
    7474}
    7575
     
    148148}
    149149
     150////////////////////////// methodes de copie/share
     151
     152template<class T>
     153void LocalMap<T>::CloneOrShare(const LocalMap<T>& a)
     154{
     155      recopierVariablesSimples(a);     
     156      pixels_.CloneOrShare(a.pixels_);
     157}
     158
     159template<class T>
     160LocalMap<T>& LocalMap<T>::CopyElt(const LocalMap<T>& a)
     161{
     162  if (NbPixels() < 1)
     163    throw RangeCheckError("LocalMap<T>::CopyElt(const LocalMap<T>& )  - Not Allocated Array ! ");
     164  if (NbPixels() != a.NbPixels())
     165    throw(SzMismatchError("LocalMap<T>::CopyElt(const LocalMap<T>&) SizeMismatch")) ;
     166      recopierVariablesSimples(a);     
     167  int k;
     168  for (k=0; k< nPix_; k++) pixels_(k) = a.pixels_(k);
     169  return(*this);
     170
     171}
     172
    150173template<class T>
    151174LocalMap<T>& LocalMap<T>::Set(const LocalMap<T>& a)
     
    153176  if (this != &a)
    154177    {
    155       recopierVariablesSimples(a);     
    156       pixels_.CloneOrShare(a.pixels_);
     178      if (a.NbPixels() < 1)
     179        throw RangeCheckError("LocalMap<T>::Set(a ) - Array a not allocated ! ");
     180      if (NbPixels() < 1) CloneOrShare(a);
     181      else CopyElt(a);
    157182      if (mInfo_) delete mInfo_;
    158183      mInfo_ = NULL;
Note: See TracChangeset for help on using the changeset viewer.