BALL
1.4.2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
BALL
NMR
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
19
# include <
BALL/CONCEPT/property.h
>
20
#endif
21
22
#include <iostream>
23
24
namespace
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
53
Peak
();
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
129
Position
position_
;
130
Position
width_
;
131
float
intensity_
;
132
const
Atom
*
atom_
;
133
};
134
135
template
<
typename
PositionType>
136
Peak<PositionType>::Peak
()
137
:
PropertyManager
(),
138
position_(),
139
width_(),
140
intensity_(0),
141
atom_(0)
142
{
143
}
144
145
template
<
typename
PositionType>
146
Peak<PositionType>::~Peak
()
147
{
148
}
149
150
template
<
typename
PositionType>
151
Peak<PositionType>::Peak
(
const
Peak<PositionType>
& peak)
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>
161
BALL_INLINE
162
const
typename
Peak<PositionType>::Position
&
Peak<PositionType>::getPosition
()
const
163
{
164
return
position_;
165
}
166
167
template
<
typename
PositionType>
168
BALL_INLINE
169
const
typename
Peak<PositionType>::Position
&
Peak<PositionType>::getWidth
()
const
170
{
171
return
width_;
172
}
173
174
template
<
typename
PositionType>
175
BALL_INLINE
176
void
Peak<PositionType>::setPosition
(
const
typename
Peak<PositionType>::Position
& position)
177
{
178
position_ = position;
179
}
180
181
template
<
typename
PositionType>
182
BALL_INLINE
183
void
Peak<PositionType>::setWidth
(
const
typename
Peak<PositionType>::Position
& width)
184
{
185
width_ = width;
186
}
187
188
template
<
typename
PositionType>
189
BALL_INLINE
190
float
Peak<PositionType>::getIntensity
()
const
191
{
192
return
intensity_;
193
}
194
195
template
<
typename
PositionType>
196
BALL_INLINE
197
void
Peak<PositionType>::setIntensity
(
float
intensity)
198
{
199
intensity_ = intensity;
200
}
201
202
template
<
typename
PositionType>
203
BALL_INLINE
204
const
Atom
*
Peak<PositionType>::getAtom
()
const
205
{
206
return
atom_;
207
}
208
209
template
<
typename
PositionType>
210
BALL_INLINE
211
void
Peak<PositionType>::setAtom
(
const
Atom
* atom)
212
{
213
atom_ = atom;
214
}
215
216
template
<
typename
PositionType>
217
void
Peak<PositionType>::operator =
(
const
Peak<PositionType>
& peak)
218
{
219
position_ = peak.
position_
;
220
width_ = peak.
width_
;
221
intensity_ = peak.
intensity_
;
222
atom_ = peak.
atom_
;
223
}
224
225
template
<
typename
PositionType>
226
bool
Peak<PositionType>::operator ==
(
const
Peak<PositionType>
& peak)
const
227
{
228
return
((position_ == peak.
position_
)
229
&& (width_ == peak.
width_
)
230
&& (intensity_ == peak.
intensity_
)
231
&& (atom_ == peak.
atom_
));
232
}
233
234
template
<
typename
PositionType>
235
bool
Peak<PositionType>::operator <
(
const
Peak<PositionType>
& peak)
const
236
{
237
return
(position_ < peak.
position_
);
238
}
239
240
template
<
typename
PositionType>
241
bool
Peak<PositionType>::operator >
(
const
Peak<PositionType>
& peak)
const
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
261
typedef
Peak<float>
Peak1D
;
262
typedef
Peak<Vector2>
Peak2D
;
263
typedef
Peak<Vector3>
Peak3D
;
265
266
267
}
// namespace BALL
268
269
#endif // BALL_NMR_PEAK_H
Generated by
1.8.3.1