Go to the documentation of this file.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
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_KERNEL_CHROMATOGRAMPEAK_H
00036 #define OPENMS_KERNEL_CHROMATOGRAMPEAK_H
00037
00038 #include <OpenMS/CONCEPT/Types.h>
00039 #include <OpenMS/DATASTRUCTURES/DPosition.h>
00040
00041 #include <ostream>
00042 #include <functional>
00043
00044 namespace OpenMS
00045 {
00046
00055 class OPENMS_DLLAPI ChromatogramPeak
00056 {
00057 public:
00062
00063 enum {DIMENSION = 1};
00065 typedef DoubleReal IntensityType;
00067 typedef DPosition<1> PositionType;
00069 typedef DoubleReal CoordinateType;
00071
00076
00077 inline ChromatogramPeak() :
00078 position_(),
00079 intensity_(0)
00080 {}
00081
00083 inline ChromatogramPeak(const ChromatogramPeak & p) :
00084 position_(p.position_),
00085 intensity_(p.intensity_)
00086 {}
00087
00096 ~ChromatogramPeak()
00097 {}
00099
00104
00106 inline IntensityType getIntensity() const { return intensity_; }
00108 inline void setIntensity(IntensityType intensity) { intensity_ = intensity; }
00109
00111 inline CoordinateType getRT() const
00112 {
00113 return position_[0];
00114 }
00115
00117 inline void setRT(CoordinateType rt)
00118 {
00119 position_[0] = rt;
00120 }
00121
00123 inline CoordinateType getPos() const
00124 {
00125 return position_[0];
00126 }
00127
00129 inline void setPos(CoordinateType pos)
00130 {
00131 position_[0] = pos;
00132 }
00133
00135 inline CoordinateType getMZ() const
00136 {
00137 return position_[0];
00138 }
00139
00141 inline void setMZ(CoordinateType rt)
00142 {
00143 position_[0] = rt;
00144 }
00145
00147 inline PositionType const & getPosition() const
00148 {
00149 return position_;
00150 }
00151
00153 inline PositionType & getPosition()
00154 {
00155 return position_;
00156 }
00157
00159 inline void setPosition(PositionType const & position)
00160 {
00161 position_ = position;
00162 }
00163
00165
00167 inline ChromatogramPeak & operator=(const ChromatogramPeak & rhs)
00168 {
00169 if (this == &rhs) return *this;
00170
00171 intensity_ = rhs.intensity_;
00172 position_ = rhs.position_;
00173
00174 return *this;
00175 }
00176
00178 inline bool operator==(const ChromatogramPeak & rhs) const
00179 {
00180 return intensity_ == rhs.intensity_ && position_ == rhs.position_;
00181 }
00182
00184 inline bool operator!=(const ChromatogramPeak & rhs) const
00185 {
00186 return !(operator==(rhs));
00187 }
00188
00196
00197 struct IntensityLess :
00198 std::binary_function<ChromatogramPeak, ChromatogramPeak, bool>
00199 {
00200 inline bool operator()(ChromatogramPeak const & left, ChromatogramPeak const & right) const
00201 {
00202 return left.getIntensity() < right.getIntensity();
00203 }
00204
00205 inline bool operator()(ChromatogramPeak const & left, IntensityType right) const
00206 {
00207 return left.getIntensity() < right;
00208 }
00209
00210 inline bool operator()(IntensityType left, ChromatogramPeak const & right) const
00211 {
00212 return left < right.getIntensity();
00213 }
00214
00215 inline bool operator()(IntensityType left, IntensityType right) const
00216 {
00217 return left < right;
00218 }
00219
00220 };
00221
00223 struct RTLess :
00224 public std::binary_function<ChromatogramPeak, ChromatogramPeak, bool>
00225 {
00226 inline bool operator()(const ChromatogramPeak & left, const ChromatogramPeak & right) const
00227 {
00228 return left.getRT() < right.getPos();
00229 }
00230
00231 inline bool operator()(ChromatogramPeak const & left, CoordinateType right) const
00232 {
00233 return left.getRT() < right;
00234 }
00235
00236 inline bool operator()(CoordinateType left, ChromatogramPeak const & right) const
00237 {
00238 return left < right.getRT();
00239 }
00240
00241 inline bool operator()(CoordinateType left, CoordinateType right) const
00242 {
00243 return left < right;
00244 }
00245
00246 };
00247
00249 struct PositionLess :
00250 public std::binary_function<ChromatogramPeak, ChromatogramPeak, bool>
00251 {
00252 inline bool operator()(const ChromatogramPeak & left, const ChromatogramPeak & right) const
00253 {
00254 return left.getPosition() < right.getPosition();
00255 }
00256
00257 inline bool operator()(const ChromatogramPeak & left, const PositionType & right) const
00258 {
00259 return left.getPosition() < right;
00260 }
00261
00262 inline bool operator()(const PositionType & left, const ChromatogramPeak & right) const
00263 {
00264 return left < right.getPosition();
00265 }
00266
00267 inline bool operator()(const PositionType & left, const PositionType & right) const
00268 {
00269 return left < right;
00270 }
00271 };
00273 protected:
00275 PositionType position_;
00277 IntensityType intensity_;
00278 };
00279
00281 OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const ChromatogramPeak & point);
00282
00283 }
00284
00285 #endif // OPENMS_KERNEL_CHROMATOGRAMPEAK_H