Loading...
Searching...
No Matches
peak.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: peak.h,v 1.18 2003/08/26 08:04:45 oliver Exp $
//
#ifndef BALL_NMR_PEAK_H
#define BALL_NMR_PEAK_H
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_MATHS_VECTOR2_H
# include <BALL/MATHS/vector2.h>
#endif
#ifndef BALL_CONCEPT_PROPERTY_H
# include <BALL/CONCEPT/property.h>
#endif
#include <iostream>
namespace BALL
{
class Atom;
template <typename PositionType>
class Peak
: public PropertyManager
{
public:
// Type describing the coordinates and width of the peak in all its dimensions
typedef PositionType Position;
Peak();
Peak(const Peak& peak);
virtual ~Peak();
const Position& getPosition() const;
const Position& getWidth() const;
float getIntensity() const;
void setPosition(const Position& position);
void setWidth(const Position& width);
void setIntensity(float intensity);
const Atom* getAtom() const;
void setAtom(const Atom* atom);
void operator = (const Peak& peak);
bool operator == (const Peak<PositionType>& peak) const;
bool operator < (const Peak<PositionType>& peak) const;
bool operator > (const Peak<PositionType>& peak) const;
protected:
Position position_;
Position width_;
float intensity_;
const Atom* atom_;
};
template <typename PositionType>
Peak<PositionType>::Peak()
: PropertyManager(),
position_(),
width_(),
intensity_(0),
atom_(0)
{
}
template <typename PositionType>
Peak<PositionType>::~Peak()
{
}
template <typename PositionType>
Peak<PositionType>::Peak(const Peak<PositionType>& peak)
: PropertyManager(peak),
position_(peak.position_),
width_(peak.width_),
intensity_(peak.intensity_),
atom_(peak.atom_)
{
}
template <typename PositionType>
BALL_INLINE
const typename Peak<PositionType>::Position& Peak<PositionType>::getPosition() const
{
return position_;
}
template <typename PositionType>
BALL_INLINE
const typename Peak<PositionType>::Position& Peak<PositionType>::getWidth() const
{
return width_;
}
template <typename PositionType>
BALL_INLINE
void Peak<PositionType>::setPosition(const typename Peak<PositionType>::Position& position)
{
position_ = position;
}
template <typename PositionType>
BALL_INLINE
void Peak<PositionType>::setWidth(const typename Peak<PositionType>::Position& width)
{
width_ = width;
}
template <typename PositionType>
BALL_INLINE
float Peak<PositionType>::getIntensity() const
{
return intensity_;
}
template <typename PositionType>
BALL_INLINE
void Peak<PositionType>::setIntensity(float intensity)
{
intensity_ = intensity;
}
template <typename PositionType>
BALL_INLINE
const Atom* Peak<PositionType>::getAtom() const
{
return atom_;
}
template <typename PositionType>
BALL_INLINE
void Peak<PositionType>::setAtom(const Atom* atom)
{
atom_ = atom;
}
template <typename PositionType>
void Peak<PositionType>::operator = (const Peak<PositionType>& peak)
{
position_ = peak.position_;
width_ = peak.width_;
intensity_ = peak.intensity_;
atom_ = peak.atom_;
}
template <typename PositionType>
bool Peak<PositionType>::operator == (const Peak<PositionType>& peak) const
{
return ((position_ == peak.position_)
&& (width_ == peak.width_)
&& (intensity_ == peak.intensity_)
&& (atom_ == peak.atom_));
}
template <typename PositionType>
bool Peak<PositionType>::operator < (const Peak<PositionType>& peak) const
{
return (position_ < peak.position_);
}
template <typename PositionType>
bool Peak<PositionType>::operator > (const Peak<PositionType>& peak) const
{
return (position_ > peak.position_);
}
template <typename PositionType>
std::ostream& operator << (std::ostream& os, const Peak<PositionType>& peak)
{
return (os << "[ peak @ " << peak.getPosition()
<< ": intensity = " << peak.getIntensity()
<< ", width = " << peak.getWidth()
<< "] ");
}
typedef Peak<float> Peak1D;
typedef Peak<Vector2> Peak2D;
typedef Peak<Vector3> Peak3D;
} // namespace BALL
#endif // BALL_NMR_PEAK_H
BALL::Atom
Definition atom.h:90
BALL::Peak
Definition peak.h:37
BALL::Peak::operator<
bool operator<(const Peak< PositionType > &peak) const
Definition peak.h:235
BALL::Peak< float >::position_
Position position_
Definition peak.h:129
BALL::Peak::operator==
bool operator==(const Peak< PositionType > &peak) const
Definition peak.h:226
BALL::Peak::Peak
Peak()
Definition peak.h:136
BALL::Peak::Peak
Peak(const Peak &peak)
Definition peak.h:151
BALL::Peak::getWidth
const Position & getWidth() const
Definition peak.h:169
BALL::Peak::~Peak
virtual ~Peak()
Definition peak.h:146
BALL::Peak::operator>
bool operator>(const Peak< PositionType > &peak) const
Definition peak.h:241
BALL::Peak::setIntensity
void setIntensity(float intensity)
Definition peak.h:197
BALL::Peak::getAtom
const Atom * getAtom() const
Definition peak.h:204
BALL::Peak< float >::intensity_
float intensity_
Definition peak.h:131
BALL::Peak::getPosition
const Position & getPosition() const
Definition peak.h:162
BALL::Peak::getIntensity
float getIntensity() const
Definition peak.h:190
BALL::Peak::setWidth
void setWidth(const Position &width)
Definition peak.h:183
BALL::Peak::setAtom
void setAtom(const Atom *atom)
Definition peak.h:211
BALL::Peak::setPosition
void setPosition(const Position &position)
Definition peak.h:176
BALL::Peak< float >::width_
Position width_
Definition peak.h:130
BALL::Peak::operator=
void operator=(const Peak &peak)
Definition peak.h:217
BALL::Peak::Position
PositionType Position
Definition peak.h:44
BALL::Peak< float >::atom_
const Atom * atom_
Definition peak.h:132
BALL::PropertyManager::PropertyManager
BALL_INLINE PropertyManager()
Default constructor.
BALL_INLINE
#define BALL_INLINE
Definition debug.h:15
BALL::operator<<
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
BALL
Definition constants.h:13
BALL::Peak3D
Peak< Vector3 > Peak3D
Definition peak.h:263
BALL::Peak1D
Peak< float > Peak1D
Definition peak.h:261
BALL::Peak2D
Peak< Vector2 > Peak2D
Definition peak.h:262
property.h
vector2.h
vector3.h