BALL 1.5.0
peak.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: peak.h,v 1.18 2003/08/26 08:04:45 oliver Exp $
5//
6
7#ifndef BALL_NMR_PEAK_H
8#define BALL_NMR_PEAK_H
9
10#ifndef BALL_MATHS_VECTOR3_H
11# include <BALL/MATHS/vector3.h>
12#endif
13
14#ifndef BALL_MATHS_VECTOR2_H
15# include <BALL/MATHS/vector2.h>
16#endif
17
18#ifndef BALL_CONCEPT_PROPERTY_H
20#endif
21
22#include <iostream>
23
24namespace BALL
25{
26 class Atom;
27
34 template <typename PositionType>
35 class Peak
36 : public PropertyManager
37 {
38 public:
39
43 // Type describing the coordinates and width of the peak in all its dimensions
44 typedef PositionType Position;
46
50
54
57 Peak(const Peak& peak);
58
61 virtual ~Peak();
62
64
67
70 const Position& getPosition() const;
71
74 const Position& getWidth() const;
75
78 float getIntensity() const;
79
82 void setPosition(const Position& position);
83
86 void setWidth(const Position& width);
87
90 void setIntensity(float intensity);
91
94 const Atom* getAtom() const;
95
98 void setAtom(const Atom* atom);
99
101
104
107 void operator = (const Peak& peak);
108
110
113
116 bool operator == (const Peak<PositionType>& peak) const;
117
120 bool operator < (const Peak<PositionType>& peak) const;
121
124 bool operator > (const Peak<PositionType>& peak) const;
126
127 protected:
128
132 const Atom* atom_;
133 };
134
135 template <typename PositionType>
137 : PropertyManager(),
138 position_(),
139 width_(),
140 intensity_(0),
141 atom_(0)
142 {
143 }
144
145 template <typename PositionType>
147 {
148 }
149
150 template <typename PositionType>
152 : PropertyManager(peak),
153 position_(peak.position_),
154 width_(peak.width_),
155 intensity_(peak.intensity_),
156 atom_(peak.atom_)
157 {
158 }
159
160 template <typename PositionType>
163 {
164 return position_;
165 }
166
167 template <typename PositionType>
170 {
171 return width_;
172 }
173
174 template <typename PositionType>
177 {
178 position_ = position;
179 }
180
181 template <typename PositionType>
184 {
185 width_ = width;
186 }
187
188 template <typename PositionType>
191 {
192 return intensity_;
193 }
194
195 template <typename PositionType>
198 {
199 intensity_ = intensity;
200 }
201
202 template <typename PositionType>
205 {
206 return atom_;
207 }
208
209 template <typename PositionType>
212 {
213 atom_ = atom;
214 }
215
216 template <typename PositionType>
218 {
219 position_ = peak.position_;
220 width_ = peak.width_;
221 intensity_ = peak.intensity_;
222 atom_ = peak.atom_;
223 }
224
225 template <typename PositionType>
227 {
228 return ((position_ == peak.position_)
229 && (width_ == peak.width_)
230 && (intensity_ == peak.intensity_)
231 && (atom_ == peak.atom_));
232 }
233
234 template <typename PositionType>
236 {
237 return (position_ < peak.position_);
238 }
239
240 template <typename PositionType>
242 {
243 return (position_ > peak.position_);
244 }
245
248 template <typename PositionType>
249 std::ostream& operator << (std::ostream& os, const Peak<PositionType>& peak)
250 {
251 return (os << "[ peak @ " << peak.getPosition()
252 << ": intensity = " << peak.getIntensity()
253 << ", width = " << peak.getWidth()
254 << "] ");
255 }
256
265
266
267} // namespace BALL
268
269#endif // BALL_NMR_PEAK_H
#define BALL_INLINE
Definition: debug.h:15
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
Definition: constants.h:13
Peak< Vector3 > Peak3D
Definition: peak.h:263
Peak< float > Peak1D
Definition: peak.h:261
Peak< Vector2 > Peak2D
Definition: peak.h:262
char Atom[5]
Definition: PDBdefs.h:257
bool operator<(const Peak< PositionType > &peak) const
Definition: peak.h:235
Position position_
Definition: peak.h:129
bool operator==(const Peak< PositionType > &peak) const
Definition: peak.h:226
Peak()
Definition: peak.h:136
Peak(const Peak &peak)
Definition: peak.h:151
const Position & getWidth() const
Definition: peak.h:169
virtual ~Peak()
Definition: peak.h:146
bool operator>(const Peak< PositionType > &peak) const
Definition: peak.h:241
void setIntensity(float intensity)
Definition: peak.h:197
const Atom * getAtom() const
Definition: peak.h:204
float intensity_
Definition: peak.h:131
const Position & getPosition() const
Definition: peak.h:162
float getIntensity() const
Definition: peak.h:190
void setWidth(const Position &width)
Definition: peak.h:183
void setAtom(const Atom *atom)
Definition: peak.h:211
void setPosition(const Position &position)
Definition: peak.h:176
Position width_
Definition: peak.h:130
void operator=(const Peak &peak)
Definition: peak.h:217
PositionType Position
Definition: peak.h:44
const Atom * atom_
Definition: peak.h:132