spectrum.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: spectrum.h,v 1.14 2003/08/26 08:04:45 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_NMR_SPECTRUM_H
00008 #define BALL_NMR_SPECTRUM_H
00009 
00010 #ifndef BALL_NMR_PEAKLIST_H
00011 # include<BALL/NMR/peakList.h>
00012 #endif
00013 
00014 #ifndef BALL_DATATYPE_REGULARDATA1D_H
00015 # include<BALL/DATATYPE/regularData1D.h>
00016 #endif
00017 
00018 #ifndef BALL_DATATYPE_REGULARDATA2D_H
00019 # include<BALL/DATATYPE/regularData2D.h>
00020 #endif
00021 
00022 #ifndef BALL_DATATYPE_REGULARDATA3D_H
00023 # include<BALL/DATATYPE/regularData3D.h>
00024 #endif
00025 
00026 
00027 namespace BALL 
00028 {
00035   template <typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>
00036   class Spectrum
00037   {
00038     public:
00039     
00043 
00044     typedef DataT DataType;
00046     typedef PositionT PositionType;
00048     typedef PeakT PeakType;
00050     typedef typename DataT::Iterator Iterator;
00052     typedef typename DataT::ConstIterator ConstIterator;
00054 
00058       // ?????
00059     Spectrum() {}
00060       // ?????
00061     virtual ~Spectrum() {}
00063 
00067 
00068     const DataType& getData() const;
00070     DataType& getData();
00072 
00073     virtual void clear();
00074     virtual double difference(const Spectrum<DataT, PeakT, PositionT>& spectrum) const;
00075 
00076     virtual void setSpacing(const PositionType& spacing);
00077     virtual PositionType getSpacing() const;
00078     
00079     protected:
00080     DataType  data_;
00081     PositionType  spacing_;
00082     PositionType  min_;
00083     PositionType  max_;
00084   };
00085 
00089   template <typename DataT, typename PeakT, typename PositionT>
00090   void Spectrum<DataT, PeakT, PositionT>::clear()
00091   {
00092     // ?????
00093   }
00094 
00097   template <typename DataT, typename PeakT, typename PositionT>
00098   double Spectrum<DataT, PeakT, PositionT>::difference(const Spectrum<DataT, PeakT, PositionT>& /* spectrum */) const
00099   {
00100     // ?????
00101     return 0.0;
00102   }
00103 
00106   template <typename DataT, typename PeakT, typename PositionT>
00107   typename Spectrum<DataT, PeakT, PositionT>::PositionType Spectrum<DataT, PeakT, PositionT>::getSpacing() const
00108   {
00109     return spacing_;
00110   }
00111 
00114   template <typename DataT, typename PeakT, typename PositionT>
00115   void Spectrum<DataT, PeakT, PositionT>::setSpacing(const typename Spectrum<DataT, PeakT, PositionT>::PositionType& spacing)
00116   {
00117     spacing_ = spacing;
00118   }
00119 
00123   template <typename DataT, typename PeakT, typename PositionT>
00124   double operator - (const Spectrum<DataT, PeakT, PositionT>& s1, const Spectrum<DataT, PeakT, PositionT>& s2)
00125   {
00126     return s1.difference(s2);
00127   }
00128 
00133 
00134   typedef Spectrum<RegularData1D, Peak1D> Spectrum1D;
00135 
00137   typedef Spectrum<RegularData1D, Peak2D> Spectrum2D;
00138 
00140   typedef Spectrum<RegularData1D, Peak3D> Spectrum3D;
00142   
00143 } // namespace BALL
00144 
00145 #endif // BALL_NMR_SPECTRUM_H