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


Ignore:
Timestamp:
Feb 23, 2001, 12:26:48 PM (25 years ago)
Author:
lemeur
Message:

surcharge d'operateurs =, +=, *= etc...

File:
1 edited

Legend:

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

    r1308 r1419  
    101101      recopierVariablesSimples(a);     
    102102      pixels_.CloneOrShare(a.pixels_);
     103      if (mInfo_) {delete mInfo_; mInfo_ = NULL;}
     104      if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_));
     105}
     106template<class T>
     107void LocalMap<T>::Share(const LocalMap<T>& a)
     108{
     109      recopierVariablesSimples(a);     
     110      pixels_.Share(a.pixels_);
     111      if (mInfo_) {delete mInfo_; mInfo_ = NULL;}
     112      if (a.mInfo_) mInfo_ = new DVList(*(a.mInfo_));
    103113}
    104114
     
    556566}
    557567
     568//   ...... Operations de calcul  ......
     569
     570
     571//! Fill a LocalMap with a constant value \b a
     572template <class T>
     573LocalMap<T>& LocalMap<T>::SetT(T a)
     574{
     575  if (NbPixels() < 1)
     576    throw RangeCheckError("LocalMap<T>::SetT(T )  - LocalMap not dimensionned ! ");
     577  pixels_ = a;
     578  return (*this);
     579}
     580
     581/*! Add a constant value \b x to a LocalMap */
     582template <class T>
     583LocalMap<T>& LocalMap<T>::Add(T a)
     584 {
     585  if (NbPixels()< 1)
     586    throw RangeCheckError("LocalMap<T>::Add(T )  - LocalMap not dimensionned ! ");
     587  pixels_ += a;
     588  return (*this);
     589}
     590
     591/*! Substract a constant value \b a to a LocalMap */
     592template <class T>
     593LocalMap<T>& LocalMap<T>::Sub(T a)
     594{
     595  if (NbPixels()< 1)
     596    throw RangeCheckError("LocalMap<T>::Sub(T )  - LocalMap not dimensionned ! ");
     597  pixels_ -= a;
     598  return (*this);
     599}
     600
     601/*! multiply a LocalMap by a constant value \b a */
     602template <class T>
     603LocalMap<T>& LocalMap<T>::Mul(T a)
     604{
     605  if (NbPixels()< 1)
     606    throw RangeCheckError("LocalMap<T>::Mul(T )  - LocalMap not dimensionned ! ");
     607  pixels_ *= a;
     608  return (*this);
     609}
     610
     611/*! divide a LocalMap by a constant value \b a */
     612template <class T>
     613LocalMap<T>& LocalMap<T>::Div(T a)
     614{
     615  if (NbPixels()< 1)
     616    throw RangeCheckError("LocalMap<T>::Div(T )  - LocalMap not dimensionned ! ");
     617  pixels_ /= a;
     618  return (*this);
     619}
     620
     621//  >>>> Operations avec 2nd membre de type LocalMap
     622//! Add two LocalMap
     623
     624template <class T>
     625LocalMap<T>& LocalMap<T>::AddElt(const LocalMap<T>& a)
     626{
     627  if (nSzX_ != a.nSzX_ || nSzY_ != a.nSzY_)
     628    {
     629    throw(SzMismatchError("LocalMap<T>::AddElt(const LocalMap<T>&) SizeMismatch")) ;
     630    }
     631  pixels_ += a.pixels_;
     632  return (*this);
     633}
     634
     635//! Substract two LocalMap
     636template <class T>
     637LocalMap<T>& LocalMap<T>::SubElt(const LocalMap<T>& a)
     638{
     639  if (nSzX_ != a.nSzX_ || nSzY_ != a.nSzY_)
     640    {
     641    throw(SzMismatchError("LocalMap<T>::AddElt(const LocalMap<T>&) SizeMismatch")) ;
     642    }
     643  pixels_ -= a.pixels_;
     644  return (*this);
     645}
     646
     647//! Multiply two LocalMap (elements by elements)
     648template <class T>
     649LocalMap<T>& LocalMap<T>::MulElt(const LocalMap<T>& a)
     650{
     651  if (nSzX_ != a.nSzX_ || nSzY_ != a.nSzY_)
     652    {
     653    throw(SzMismatchError("LocalMap<T>::AddElt(const LocalMap<T>&) SizeMismatch")) ;
     654    }
     655  pixels_ *= a.pixels_;
     656  return (*this);
     657}
     658
     659
     660
     661
    558662
    559663//++
Note: See TracChangeset for help on using the changeset viewer.