/usr/include/BALL/NMR/peak.h is in libball1.4-dev 1.4.1+20111206-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | // -*- 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;
/** Generic Peak Class.
Each peak contains a pointer to an associated atom
(in the case of NMR: the atom that causes this peak).
\par
\ingroup Spectra
*/
template <typename PositionType>
class Peak
: public PropertyManager
{
public:
/** @name Typedefs
*/
//@{
// Type describing the coordinates and width of the peak in all its dimensions
typedef PositionType Position;
//@}
/** @name Constructors and Destructors
*/
//@{
/** Default Constructor
*/
Peak();
/** Copy Constructor
*/
Peak(const Peak& peak);
/** Destructor
*/
virtual ~Peak();
//@}
/** @name Accessors
*/
//@{
/** Return the peak position.
*/
const Position& getPosition() const;
/** Return the peak width.
*/
const Position& getWidth() const;
/** Return the peak intensity (amplitude).
*/
float getIntensity() const;
/** Set the peak position.
*/
void setPosition(const Position& position);
/** Set the peak width
*/
void setWidth(const Position& width);
/** Set the peak height
*/
void setIntensity(float intensity);
/** Return the atom pointer.
*/
const Atom* getAtom() const;
/** Set the atom pointer.
*/
void setAtom(const Atom* atom);
//@}
/** @name Assignment
*/
//@{
/** Assignment Operator
*/
void operator = (const Peak& peak);
//@}
/** @name Predicates
*/
//@{
/** Equality operator
*/
bool operator == (const Peak<PositionType>& peak) const;
/** Lesser than operator
*/
bool operator < (const Peak<PositionType>& peak) const;
/** Greater than operator
*/
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_);
}
/** Output operator
*/
template <typename PositionType>
std::ostream& operator << (std::ostream& os, const Peak<PositionType>& peak)
{
return (os << "[ peak @ " << peak.getPosition()
<< ": intensity = " << peak.getIntensity()
<< ", width = " << peak.getWidth()
<< "] ");
}
/** @name Convenience typedefs
\ingroup Spectra
*/
//@{
typedef Peak<float> Peak1D;
typedef Peak<Vector2> Peak2D;
typedef Peak<Vector3> Peak3D;
//@}
} // namespace BALL
#endif // BALL_NMR_PEAK_H
|