00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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 }
00239
00240 #endif // OPENMS_KERNEL_RAWDATAPOINT1D_H