Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

DSpectrum Class Template Reference
[Kernel]

#include <OpenMS/KERNEL/DSpectrum.h>

Inheritance diagram for DSpectrum:

MetaInfoInterface RangeManager< ContainerT::value_type::DIMENSION > MSSpectrum

List of all members.


Detailed Description

template<typename ContainerT = DPeakArray<Peak1D>>
class OpenMS::DSpectrum< ContainerT >

Representation of a D-dimensional spectrum.

The peak data itself is stored in a container class, which can be a DPeakArray or a STL container like std::list or std::vector.

Some meta information about the spectrum (ms-level, precursor peak, ...) is also stored. If you want to store more meta information see the MSSpectrum and MSExperiment classes.

The interface to the container is wrapped for convenience. Only members and types contained in both std::list and std::vector are available.

Additionally an interface for the minimum and maximum position, and the minimum and maximum intensity of the peaks is provided by RangeManager.

Type definitions



enum  { DIMENSION = PeakType::DIMENSION }
 Dimensionality of the peaks. More...
typedef ContainerT ContainerType
 Peak container type.
typedef ContainerType::value_type PeakType
 Peak type.
typedef PeakType::CoordinateType CoordinateType
 Coordinate type.
typedef
Internal::PrecursorPeak
< DIMENSION > 
PrecursorPeakType
 Precursor peak type.
typedef RangeManager< DIMENSION > RangeManagerType
 Rangemanger type.
class DSpectrum

Public Types

STL-compliance type definitions of the container interface


typedef ContainerType::iterator iterator
typedef
ContainerType::const_iterator 
const_iterator
typedef
ContainerType::reverse_iterator 
reverse_iterator
typedef
ContainerType::const_reverse_iterator 
const_reverse_iterator
typedef ContainerType::value_type value_type
typedef ContainerType::reference reference
typedef
ContainerType::const_reference 
const_reference
typedef ContainerType::pointer pointer
typedef
ContainerType::difference_type 
difference_type
typedef ContainerType::size_type size_type
Type definitions of the container interface


typedef ContainerType::iterator Iterator
 Mutable iterator.
typedef
ContainerType::const_iterator 
ConstIterator
 Non-mutable iterator.
typedef
ContainerType::reverse_iterator 
ReverseIterator
 Mutable reverse iterator.
typedef
ContainerType::const_reverse_iterator 
ConstReverseIterator
 Non-mutable reverse iterator.

Public Member Functions

DSpectrumoperator= (const DSpectrum &rhs)
 Assignment operator.
template<template< typename, typename > class ContainerT2, typename AllocT>
DSpectrumoperator= (const DSpectrum< ContainerT2< PeakType, AllocT > > &rhs)
 Assignment operator for different allocator.
bool operator== (const DSpectrum &rhs) const
 Equality operator.
bool operator!= (const DSpectrum &rhs) const
 Equality operator.
virtual void updateRanges ()
 Updates minimum and maximum position/intensity.
Constructors and Destructor


 DSpectrum ()
 Default constructor.
 DSpectrum (const typename ContainerType::AllocType &alloc)
 constructor with custom allocator
 DSpectrum (const DSpectrum &rhs)
 Copy constructor.
template<template< typename, typename > class ContainerT2, typename AllocT2>
 DSpectrum (const DSpectrum< ContainerT2< PeakType, AllocT2 > > &rhs)
 Copy constructor for different allocator.
template<template< typename, typename > class ContainerT2, typename AllocT2, typename AllocT>
 DSpectrum (const DSpectrum< ContainerT2< PeakType, AllocT2 > > &rhs, const AllocT &alloc)
 Copy constructor for different (but unique) allocator.
 ~DSpectrum ()
 Destructor.
Wrappers of container accessors


const ContainerTypegetContainer () const
 Non-mutable access to the peak container.
ContainerTypegetContainer ()
 Mutable access to the peak container.
void setContainer (const ContainerType &container)
 Mutable access to the peak container.
ConstIterator begin () const
 Returns the const begin iterator of the container.
ConstIterator end () const
 Returns the const end iterator of the container.
Iterator begin ()
 Returns the begin iterator of the container.
Iterator end ()
 Returns the end iterator of the container.
reference operator[] (size_type n)
 returns the element with index n
const_reference operator[] (size_type n) const
 returns the element with index n
size_type max_size () const
 returns the maxium size possbile (the number of peaks)
UInt size () const
 returns the size (the number of peaks)
bool empty () const
 Returns if the container is empty.
void swap (ContainerType &rhs)
 Swaps two containers.
bool operator< (const DSpectrum &rhs)
 Comparison of container sizes.
bool operator> (const DSpectrum &rhs)
 Comparison of container sizes.
bool operator<= (const DSpectrum &rhs)
 Comparison of container sizes.
bool operator>= (const DSpectrum &rhs)
 Comparison of container sizes.
ReverseIterator rbegin ()
 See STL documentation.
ConstReverseIterator rbegin () const
 See STL documentation.
ReverseIterator rend ()
 See STL documentation.
ConstReverseIterator rend () const
 See STL documentation.
Iterator insert (Iterator loc, const value_type &val)
 Inserts an element.
void insert (iterator loc, size_type num, const value_type &val)
 Inserts an element several times.
template<class InputIterator>
void insert (iterator loc, InputIterator start, InputIterator end)
 Inserts a range of elements.
Iterator erase (iterator loc)
 Erases an element.
Iterator erase (iterator start, iterator end)
 Erases a range of elements.
value_typefront ()
 Returns the first element.
const value_typefront () const
 Returns the first element.
value_typeback ()
 Returns the last element.
const value_typeback () const
 Returns the last element.
void pop_back ()
 Removes the last element.
void push_back (const value_type &val)
 Inserts an element at the end.
void assign (size_type num, const value_type &val)
 Fills the container with serval copies of a value.
template<class InputIterator>
void assign (InputIterator start, InputIterator end)
 Fills the container with a range of values.
void clear ()
 Removes all elements.
void resize (size_type num, const value_type &val=value_type())
 Resizes the container to size num. Uses val to fill up if it is shorter than num.
Accessors for meta information


const PrecursorPeakTypegetPrecursorPeak () const
 const accessor for the precorsor peak
PrecursorPeakTypegetPrecursorPeak ()
 accessor for the precorsor peak
void setPrecursorPeak (const PrecursorPeakType &peak)
 sets the precursor peak
CoordinateType getRT () const
 returns the absolute retention time (unit is seconds)
void setRT (CoordinateType rt)
UInt getMSLevel () const
 Returns the MS level.
void setMSLevel (UInt ms_level)
 Sets the MS level.
String getName () const
 Returns the name.
void setName (const String &name)
 Sets the name.
Searching a peak or peak range
UInt findNearest (CoordinateType mz) const throw (Exception::Precondition)
 Binary search for the peak nearest to a specific m/z.
Iterator MZBegin (CoordinateType mz)
 Binary search for peak range begin.
Iterator MZEnd (CoordinateType mz)
 Binary search for peak range end (returns the past-the-end iterator).
ConstIterator MZBegin (CoordinateType mz) const
 Binary search for peak range begin.
ConstIterator MZEnd (CoordinateType mz) const
 Binary search for peak range end (returns the past-the-end iterator).

Protected Attributes

ContainerType container_
 The container with all the peak data.
PrecursorPeakType precursor_peak_
 Precursor information.
CoordinateType retention_time_
 retention time
UInt ms_level_
 MS level.
String name_
 Name.


Member Typedef Documentation

typedef ContainerT ContainerType

Peak container type.

typedef ContainerType::value_type PeakType

Peak type.

Reimplemented in MSSpectrum.

typedef PeakType::CoordinateType CoordinateType

Coordinate type.

typedef Internal::PrecursorPeak<DIMENSION> PrecursorPeakType

Precursor peak type.

typedef RangeManager<DIMENSION> RangeManagerType

Rangemanger type.

typedef ContainerType::iterator iterator

typedef ContainerType::const_iterator const_iterator

typedef ContainerType::reverse_iterator reverse_iterator

typedef ContainerType::const_reverse_iterator const_reverse_iterator

typedef ContainerType::value_type value_type

typedef ContainerType::reference reference

typedef ContainerType::const_reference const_reference

typedef ContainerType::pointer pointer

typedef ContainerType::difference_type difference_type

typedef ContainerType::size_type size_type

typedef ContainerType::iterator Iterator

Mutable iterator.

typedef ContainerType::const_iterator ConstIterator

Non-mutable iterator.

typedef ContainerType::reverse_iterator ReverseIterator

Mutable reverse iterator.

typedef ContainerType::const_reverse_iterator ConstReverseIterator

Non-mutable reverse iterator.


Member Enumeration Documentation

anonymous enum

Dimensionality of the peaks.

Enumerator:
DIMENSION 


Constructor & Destructor Documentation

DSpectrum (  )  [inline]

Default constructor.

DSpectrum ( const typename ContainerType::AllocType &  alloc  )  [inline]

constructor with custom allocator

DSpectrum ( const DSpectrum< ContainerT > &  rhs  )  [inline]

Copy constructor.

DSpectrum ( const DSpectrum< ContainerT2< PeakType, AllocT2 > > &  rhs  )  [inline]

Copy constructor for different allocator.

DSpectrum ( const DSpectrum< ContainerT2< PeakType, AllocT2 > > &  rhs,
const AllocT &  alloc 
) [inline]

Copy constructor for different (but unique) allocator.

~DSpectrum (  )  [inline]

Destructor.


Member Function Documentation

DSpectrum& operator= ( const DSpectrum< ContainerT > &  rhs  )  [inline]

Assignment operator.

DSpectrum& operator= ( const DSpectrum< ContainerT2< PeakType, AllocT > > &  rhs  )  [inline]

Assignment operator for different allocator.

bool operator== ( const DSpectrum< ContainerT > &  rhs  )  const [inline]

Equality operator.

bool operator!= ( const DSpectrum< ContainerT > &  rhs  )  const [inline]

Equality operator.

const ContainerType& getContainer (  )  const [inline]

Non-mutable access to the peak container.

ContainerType& getContainer (  )  [inline]

Mutable access to the peak container.

void setContainer ( const ContainerType container  )  [inline]

Mutable access to the peak container.

ConstIterator begin (  )  const [inline]

Returns the const begin iterator of the container.

ConstIterator end (  )  const [inline]

Returns the const end iterator of the container.

Iterator begin (  )  [inline]

Returns the begin iterator of the container.

Iterator end (  )  [inline]

Returns the end iterator of the container.

reference operator[] ( size_type  n  )  [inline]

returns the element with index n

const_reference operator[] ( size_type  n  )  const [inline]

returns the element with index n

size_type max_size (  )  const [inline]

returns the maxium size possbile (the number of peaks)

UInt size (  )  const [inline]

returns the size (the number of peaks)

bool empty (  )  const [inline]

Returns if the container is empty.

void swap ( ContainerType rhs  )  [inline]

Swaps two containers.

bool operator< ( const DSpectrum< ContainerT > &  rhs  )  [inline]

Comparison of container sizes.

bool operator> ( const DSpectrum< ContainerT > &  rhs  )  [inline]

Comparison of container sizes.

bool operator<= ( const DSpectrum< ContainerT > &  rhs  )  [inline]

Comparison of container sizes.

bool operator>= ( const DSpectrum< ContainerT > &  rhs  )  [inline]

Comparison of container sizes.

ReverseIterator rbegin (  )  [inline]

See STL documentation.

ConstReverseIterator rbegin (  )  const [inline]

See STL documentation.

ReverseIterator rend (  )  [inline]

See STL documentation.

ConstReverseIterator rend (  )  const [inline]

See STL documentation.

Iterator insert ( Iterator  loc,
const value_type val 
) [inline]

Inserts an element.

void insert ( iterator  loc,
size_type  num,
const value_type val 
) [inline]

Inserts an element several times.

void insert ( iterator  loc,
InputIterator  start,
InputIterator  end 
) [inline]

Inserts a range of elements.

Iterator erase ( iterator  loc  )  [inline]

Erases an element.

Iterator erase ( iterator  start,
iterator  end 
) [inline]

Erases a range of elements.

value_type& front (  )  [inline]

Returns the first element.

const value_type& front (  )  const [inline]

Returns the first element.

value_type& back (  )  [inline]

Returns the last element.

const value_type& back (  )  const [inline]

Returns the last element.

void pop_back (  )  [inline]

Removes the last element.

void push_back ( const value_type val  )  [inline]

Inserts an element at the end.

void assign ( size_type  num,
const value_type val 
) [inline]

Fills the container with serval copies of a value.

void assign ( InputIterator  start,
InputIterator  end 
) [inline]

Fills the container with a range of values.

void clear (  )  [inline]

Removes all elements.

void resize ( size_type  num,
const value_type val = value_type() 
) [inline]

Resizes the container to size num. Uses val to fill up if it is shorter than num.

virtual void updateRanges (  )  [inline, virtual]

Updates minimum and maximum position/intensity.

This method is usually implemented by calling clearRanges() and updateRanges_() or updateRanges1D_().

Implements RangeManager< ContainerT::value_type::DIMENSION >.

const PrecursorPeakType& getPrecursorPeak (  )  const [inline]

const accessor for the precorsor peak

PrecursorPeakType& getPrecursorPeak (  )  [inline]

accessor for the precorsor peak

void setPrecursorPeak ( const PrecursorPeakType peak  )  [inline]

sets the precursor peak

CoordinateType getRT (  )  const [inline]

returns the absolute retention time (unit is seconds)

void setRT ( CoordinateType  rt  )  [inline]

Sets the retention time and the start/stop time of the gradient. The latter two are needed for calculating the normalized retention time

UInt getMSLevel (  )  const [inline]

Returns the MS level.

For survey scans this is 1, for MS/MS scans 2, ...

void setMSLevel ( UInt  ms_level  )  [inline]

Sets the MS level.

String getName (  )  const [inline]

Returns the name.

void setName ( const String name  )  [inline]

Sets the name.

UInt findNearest ( CoordinateType  mz  )  const throw (Exception::Precondition) [inline]

Binary search for the peak nearest to a specific m/z.

Parameters:
mz The searched for mass-to-charge ratio searched
Returns:
Returns the index of the peak. If the spectrum is empty, a Precondition exception is thrown.
Note:
Make sure the spectrum is sorted with respect to m/z ratio! Otherwise the result is undefined.

Iterator MZBegin ( CoordinateType  mz  )  [inline]

Binary search for peak range begin.

Note:
Make sure the spectrum is sorted with respect to m/z ratio! Otherwise the result is undefined.

Iterator MZEnd ( CoordinateType  mz  )  [inline]

Binary search for peak range end (returns the past-the-end iterator).

Note:
Make sure the spectrum is sorted with respect to m/z ratio. Otherwise the result is undefined.

ConstIterator MZBegin ( CoordinateType  mz  )  const [inline]

Binary search for peak range begin.

Note:
Make sure the spectrum is sorted with respect to m/z ratio! Otherwise the result is undefined.

ConstIterator MZEnd ( CoordinateType  mz  )  const [inline]

Binary search for peak range end (returns the past-the-end iterator).

Note:
Make sure the spectrum is sorted with respect to m/z ratio. Otherwise the result is undefined.


Friends And Related Function Documentation

friend class DSpectrum [friend]


Member Data Documentation

ContainerType container_ [protected]

The container with all the peak data.

PrecursorPeakType precursor_peak_ [protected]

Precursor information.

CoordinateType retention_time_ [protected]

retention time

UInt ms_level_ [protected]

MS level.

String name_ [protected]

Name.


The documentation for this class was generated from the following file:
Generated Tue Apr 1 15:36:45 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1