BALL 1.5.0
peakList.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4// $Id: peakList.h,v 1.17 2003/08/26 08:04:45 oliver Exp $
5//
6
7#ifndef BALL_NMR_PEAKLIST_H
8#define BALL_NMR_PEAKLIST_H
9
10#ifndef BALL_NMR_PEAK_H
11# include<BALL/NMR/peak.h>
12#endif
13
14namespace BALL
15{
16
21 template <typename PT>
23 : public std::list<PT>
24 {
25 public:
26
28
29
32
33
34 typedef typename PT::Position Position;
35
37 typedef PT PeakType;
38
40 typedef typename std::list<PT>::iterator Iterator;
41
43 typedef typename std::list<PT>::const_iterator ConstIterator;
45
49
53 {
54 }
55
58 PeakList(const PeakList& peak_list)
59 : std::list<PT>(peak_list)
60 {
61 }
62
65 virtual ~PeakList()
66 {
67 }
68
70
74
77 void scale(float x)
78 {
79 Iterator it = std::list<PT>::begin();
80 for (; it != std::list<PT>::end(); ++it)
81 {
82 it->setIntensity(it->getIntensity() * x);
83 }
84 }
85
89 float getMaxIntensity() const
90 {
91 ConstIterator it = std::list<PT>::begin();
93 for (; it != std::list<PT>::end(); ++it)
94 {
95 max = std::max(max, it->getIntensity());
96 }
97
98 return max;
99 }
100
104 float getMinIntensity() const
105 {
106 ConstIterator it = std::list<PT>::begin();
108 for (; it != std::list<PT>::end(); ++it)
109 {
110 min = std::min(min, it->getIntensity());
111 }
112
113 return min;
114 }
115
117 };
118
123
126
129
132
134
135} // namespace BALL
136
137#endif // BALL_NMR_PEAKLIST_H
#define BALL_CREATE(name)
Definition: create.h:62
STL namespace.
Definition: constants.h:13
PeakList< Peak< float > > PeakList1D
1D peak list
Definition: peakList.h:125
PeakList< Peak< Vector3 > > PeakList3D
3D peak list
Definition: peakList.h:131
PeakList< Peak< Vector2 > > PeakList2D
2D peak list
Definition: peakList.h:128
T max(const T &a, const T &b)
Definition: MATHS/common.h:75
T min(const T &a, const T &b)
Definition: MATHS/common.h:102
std::list< PT >::const_iterator ConstIterator
Definition: peakList.h:43
float getMaxIntensity() const
Definition: peakList.h:89
PT PeakType
The peak type.
Definition: peakList.h:37
PT::Position Position
The peak position type.
Definition: peakList.h:34
virtual ~PeakList()
Definition: peakList.h:65
void scale(float x)
Definition: peakList.h:77
std::list< PT >::iterator Iterator
Definition: peakList.h:40
PeakList(const PeakList &peak_list)
Definition: peakList.h:58
float getMinIntensity() const
Definition: peakList.h:104