Loading...
Searching...
No Matches
peakList.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: peakList.h,v 1.17 2003/08/26 08:04:45 oliver Exp $
//
#ifndef BALL_NMR_PEAKLIST_H
#define BALL_NMR_PEAKLIST_H
#ifndef BALL_NMR_PEAK_H
# include<BALL/NMR/peak.h>
#endif
namespace BALL
{
template <typename PT>
class PeakList
: public std::list<PT>
{
public:
BALL_CREATE(PeakList<PT>)
typedef typename PT::Position Position;
typedef PT PeakType;
typedef typename std::list<PT>::iterator Iterator;
typedef typename std::list<PT>::const_iterator ConstIterator;
PeakList()
{
}
PeakList(const PeakList& peak_list)
: std::list<PT>(peak_list)
{
}
virtual ~PeakList()
{
}
void scale(float x)
{
Iterator it = std::list<PT>::begin();
for (; it != std::list<PT>::end(); ++it)
{
it->setIntensity(it->getIntensity() * x);
}
}
float getMaxIntensity() const
{
ConstIterator it = std::list<PT>::begin();
float max = -std::numeric_limits<float>::max();
for (; it != std::list<PT>::end(); ++it)
{
max = std::max(max, it->getIntensity());
}
return max;
}
float getMinIntensity() const
{
ConstIterator it = std::list<PT>::begin();
float min = std::numeric_limits<float>::max();
for (; it != std::list<PT>::end(); ++it)
{
min = std::min(min, it->getIntensity());
}
return min;
}
};
typedef PeakList<Peak<float> > PeakList1D;
typedef PeakList<Peak<Vector2> > PeakList2D;
typedef PeakList<Peak<Vector3> > PeakList3D;
} // namespace BALL
#endif // BALL_NMR_PEAKLIST_H
BALL::PeakList
Definition peakList.h:24
BALL::PeakList::ConstIterator
std::list< PT >::const_iterator ConstIterator
Definition peakList.h:43
BALL::PeakList::getMaxIntensity
float getMaxIntensity() const
Definition peakList.h:89
BALL::PeakList::PeakType
PT PeakType
The peak type.
Definition peakList.h:37
BALL::PeakList::Position
PT::Position Position
The peak position type.
Definition peakList.h:34
BALL::PeakList::~PeakList
virtual ~PeakList()
Definition peakList.h:65
BALL::PeakList::PeakList
PeakList()
Definition peakList.h:52
BALL::PeakList::scale
void scale(float x)
Definition peakList.h:77
BALL::PeakList::Iterator
std::list< PT >::iterator Iterator
Definition peakList.h:40
BALL::PeakList::PeakList
PeakList(const PeakList &peak_list)
Definition peakList.h:58
BALL::PeakList::getMinIntensity
float getMinIntensity() const
Definition peakList.h:104
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL
Definition constants.h:13
BALL::PeakList1D
PeakList< Peak< float > > PeakList1D
1D peak list
Definition peakList.h:125
BALL::PeakList3D
PeakList< Peak< Vector3 > > PeakList3D
3D peak list
Definition peakList.h:131
BALL::PeakList2D
PeakList< Peak< Vector2 > > PeakList2D
2D peak list
Definition peakList.h:128
std
STL namespace.
peak.h