Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

RawDataPoint1D.h (Maintainer: Marc Sturm)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework 
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Marc Sturm $
00025 // --------------------------------------------------------------------------
00026 
00027 #ifndef OPENMS_KERNEL_RAWDATAPOINT1D_H
00028 #define OPENMS_KERNEL_RAWDATAPOINT1D_H
00029 
00030 #include <OpenMS/CONCEPT/Types.h>
00031 #include <OpenMS/DATASTRUCTURES/DPosition.h>
00032 
00033 #include <ostream>
00034 #include <functional>
00035 
00036 namespace OpenMS
00037 {
00038 
00047   class RawDataPoint1D  
00048   {
00049    public:
00050     
00054 
00055     enum { DIMENSION = 1 };
00057     typedef Real IntensityType;
00059     typedef DPosition<1> PositionType;
00061     typedef DoubleReal CoordinateType;
00063 
00067 
00068     inline RawDataPoint1D() 
00069       : position_(), 
00070         intensity_(0) 
00071     {
00072     }
00074     inline RawDataPoint1D(const RawDataPoint1D& p) 
00075       : position_(p.position_),
00076         intensity_(p.intensity_)
00077     {
00078     }
00087     ~RawDataPoint1D()
00088     {
00089     }
00091     
00096 
00097     inline IntensityType getIntensity() const { return intensity_; }
00099     inline void setIntensity(IntensityType intensity) { intensity_ = intensity; }
00100 
00102     inline CoordinateType getMZ() const
00103     {
00104       return position_[0];
00105     }
00107     inline void setMZ(CoordinateType mz)
00108     {
00109       position_[0] = mz;
00110     }
00111 
00113     inline CoordinateType getPos() const
00114     {
00115       return position_[0];
00116     }
00118     inline void setPos(CoordinateType pos)
00119     {
00120       position_[0] = pos;
00121     }
00122 
00124     inline PositionType const & getPosition() const
00125     {
00126       return position_;
00127     }
00129     inline PositionType & getPosition()
00130     {
00131       return position_;
00132     }
00134     inline void setPosition(PositionType const& position)
00135     {
00136       position_ = position;
00137     }
00139 
00141     inline RawDataPoint1D& operator = (const RawDataPoint1D& rhs)
00142     {
00143       if (this==&rhs) return *this;
00144     
00145       intensity_ = rhs.intensity_;
00146       position_ = rhs.position_;
00147   
00148       return *this;
00149     }
00150     
00152     inline bool operator == (const RawDataPoint1D& rhs) const
00153     {
00154       return  intensity_ == rhs.intensity_ && position_ == rhs.position_ ;
00155     }
00156 
00158     inline bool operator != (const RawDataPoint1D& rhs) const
00159     {
00160       return !( operator==(rhs) );
00161     }
00162 
00163                   
00170 
00172     struct IntensityLess
00173       : std::binary_function < RawDataPoint1D, RawDataPoint1D, bool >
00174     {
00175       inline bool operator () ( RawDataPoint1D const & left, RawDataPoint1D const & right ) const
00176       {
00177         return ( left.getIntensity() < right.getIntensity() );
00178       }
00179       inline bool operator () ( RawDataPoint1D const & left, IntensityType const & right ) const
00180       {
00181         return ( left.getIntensity() < right );
00182       }
00183       inline bool operator () ( IntensityType const & left, RawDataPoint1D const & right ) const
00184       {
00185         return ( left< right.getIntensity() );
00186       }
00187       inline bool operator () ( IntensityType const & left, IntensityType const & right ) const
00188       {
00189         return ( left < right );
00190       }
00191     };
00192 
00194     struct PositionLess
00195       : public std::binary_function <RawDataPoint1D, RawDataPoint1D, bool>
00196     {
00197       inline bool operator () (const RawDataPoint1D& a, const RawDataPoint1D& b) const
00198       {
00199         return (a.getMZ() < b.getMZ());
00200       }
00201     
00203       inline bool operator () ( RawDataPoint1D const & left, CoordinateType right ) const throw()
00204       {
00205         return (left.getMZ() < right );
00206       }
00207       
00209       inline bool operator () ( CoordinateType left, RawDataPoint1D const & right ) const throw()
00210       {
00211         return (left < right.getMZ() );
00212       }
00213 
00220       inline bool operator () ( CoordinateType left, CoordinateType right ) const throw()
00221       {
00222         return (left < right );
00223       }
00224     };
00225     
00227     
00228     protected:
00230     PositionType  position_;
00232     IntensityType intensity_;
00233   };
00234 
00236   std::ostream& operator << (std::ostream& os, const RawDataPoint1D& point);
00237 
00238 } // namespace OpenMS
00239 
00240 #endif // OPENMS_KERNEL_RAWDATAPOINT1D_H

Generated Tue Apr 1 15:36:37 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1