Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
kome::objects::Peaks2DArray Class Reference

2-dimentional peaks array More...

#include <Peaks2DArray.h>

Inheritance diagram for kome::objects::Peaks2DArray:
Inheritance graph
[legend]

Public Member Functions

 Peaks2DArray ()
 constructor
 
virtual ~Peaks2DArray ()
 destructor
 
int issueId (Peak2DElement *peak2dElement)
 to issue the peak2d id More...
 
Peak2DElementgetPeakById (int id)
 gets peak element by peak2d id More...
 
unsigned int getNumberOfPeaks ()
 gets the number of peaks More...
 
Peak2DElementgetPeak (const unsigned int idx)
 gets peak element More...
 
int searchPeak (Peak2DElement *peak)
 searches peak More...
 
void sortByRt (const bool desc)
 sorts peaks by RT More...
 
void sortByMz (const bool desc)
 sorts peaks by m/z More...
 
void sortByIntensity (const bool desc)
 sorts peaks by intensity param desc descending order flag
 

Static Protected Member Functions

static bool lessRt (Peak2DElement *p0, Peak2DElement *p1, bool desc)
 compares peaks to sort by RT More...
 
static bool lessMz (Peak2DElement *p0, Peak2DElement *p1, bool desc)
 compares peaks to sort by m/z More...
 
static bool lessIntensity (Peak2DElement *p0, Peak2DElement *p1, bool desc)
 compares peaks to sort by intensity More...
 

Protected Attributes

std::vector< Peak2DElement * > m_peaks
 

Detailed Description

2-dimentional peaks array

Definition at line 28 of file Peaks2DArray.h.

Member Function Documentation

unsigned int kome::objects::Peaks2DArray::getNumberOfPeaks ( )

gets the number of peaks

Returns
the number of peaks

Definition at line 40 of file Peaks2DArray.cpp.

40  {
41  return m_peaks.size();
42 }
std::vector< Peak2DElement * > m_peaks
Definition: Peaks2DArray.h:44
Peak2DElement * kome::objects::Peaks2DArray::getPeak ( const unsigned int  idx)

gets peak element

Parameters
[in]idxpeak index
Returns
peak elment (If NULL, the index is illegal.)

Definition at line 45 of file Peaks2DArray.cpp.

45  {
46  if( idx >= m_peaks.size() ) {
47  return NULL;
48  }
49  return m_peaks[ idx ];
50 }
#define NULL
Definition: CoreMacros.h:18
std::vector< Peak2DElement * > m_peaks
Definition: Peaks2DArray.h:44
Peak2DElement * kome::objects::Peaks2DArray::getPeakById ( int  id)

gets peak element by peak2d id

Parameters
[in]idpeak2d id
Returns
peak2d element objects

Definition at line 125 of file Peaks2DArray.cpp.

125  {
126  for( unsigned int i=0; i < m_peaks.size(); i++ ){
127  if( m_peaks[i]->getId() == id ){
128  return m_peaks[i];
129  }
130  }
131  return NULL;
132 }
#define NULL
Definition: CoreMacros.h:18
std::vector< Peak2DElement * > m_peaks
Definition: Peaks2DArray.h:44
int kome::objects::Peaks2DArray::issueId ( Peak2DElement peak2dElement)

to issue the peak2d id

Parameters
[in]peak2dElementpeak element objects
Returns
peak2d id

Definition at line 117 of file Peaks2DArray.cpp.

117  {
118  if( peak2dElement != NULL && peak2dElement->getId() > 0 ){
119  return peak2dElement->getId()+1;
120  }
121  return 0;
122 }
#define NULL
Definition: CoreMacros.h:18
int getId()
gets peak2d id

Here is the call graph for this function:

static bool kome::objects::Peaks2DArray::lessIntensity ( Peak2DElement p0,
Peak2DElement p1,
bool  desc 
)
staticprotected

compares peaks to sort by intensity

Parameters
[in]p0peak object to be compared
[in]p1peak object to compare
[in]descdescenfing order flag
Returns
If true, p0 sorts before p1.

Definition at line 108 of file Peaks2DArray.cpp.

108  {
109  if( desc ) {
110  return ( p0->getIntensity() > p1->getIntensity() );
111  }
112  return ( p0->getIntensity() < p1->getIntensity() );
113 }
double getIntensity()
gets intensity

Here is the call graph for this function:

static bool kome::objects::Peaks2DArray::lessMz ( Peak2DElement p0,
Peak2DElement p1,
bool  desc 
)
staticprotected

compares peaks to sort by m/z

Parameters
[in]p0peak object to be compared
[in]p1peak object to compare
[in]descdescenfing order flag
Returns
If true, p0 sorts before p1.

Definition at line 100 of file Peaks2DArray.cpp.

100  {
101  if( desc ) {
102  return ( p0->getMz() > p1->getMz() );
103  }
104  return ( p0->getMz() < p1->getMz() );
105 }

Here is the call graph for this function:

static bool kome::objects::Peaks2DArray::lessRt ( Peak2DElement p0,
Peak2DElement p1,
bool  desc 
)
staticprotected

compares peaks to sort by RT

Parameters
[in]p0peak object to be compared
[in]p1peak object to compare
[in]descdescending order flag
Returns
If true, p0 sorts before p1.

Definition at line 92 of file Peaks2DArray.cpp.

92  {
93  if( desc ) {
94  return ( p0->getRt() > p1->getRt() );
95  }
96  return ( p0->getRt() < p1->getRt() );
97 }

Here is the call graph for this function:

int kome::objects::Peaks2DArray::searchPeak ( Peak2DElement peak)

searches peak

Parameters
[in]peakpeak object to be searched
Returns
peak index (If specified peak is not found, this method returns negative number.)

Definition at line 53 of file Peaks2DArray.cpp.

53  {
54  int idx = -1;
55  for( unsigned int i = 0; i < m_peaks.size() && idx < 0; i++ ) {
56  if( peak == m_peaks[ i ] ) {
57  idx = (int)i;
58  }
59  }
60 
61  return idx;
62 }
std::vector< Peak2DElement * > m_peaks
Definition: Peaks2DArray.h:44
void kome::objects::Peaks2DArray::sortByMz ( const bool  desc)

sorts peaks by m/z

Parameters
[in]descdescending order flag

Definition at line 74 of file Peaks2DArray.cpp.

74  {
75  std::sort(
76  m_peaks.begin(),
77  m_peaks.end(),
78  boost::bind( lessMz, _1, _2, desc )
79  );
80 }
static bool lessMz(Peak2DElement *p0, Peak2DElement *p1, bool desc)
compares peaks to sort by m/z
std::vector< Peak2DElement * > m_peaks
Definition: Peaks2DArray.h:44

Here is the call graph for this function:

void kome::objects::Peaks2DArray::sortByRt ( const bool  desc)

sorts peaks by RT

Parameters
[in]descdescending order flag

Definition at line 65 of file Peaks2DArray.cpp.

65  {
66  std::sort(
67  m_peaks.begin(),
68  m_peaks.end(),
69  boost::bind( lessRt, _1, _2, desc )
70  );
71 }
static bool lessRt(Peak2DElement *p0, Peak2DElement *p1, bool desc)
compares peaks to sort by RT
std::vector< Peak2DElement * > m_peaks
Definition: Peaks2DArray.h:44

Here is the call graph for this function:

Member Data Documentation

std::vector< Peak2DElement* > kome::objects::Peaks2DArray::m_peaks
protected

peaks array

Definition at line 44 of file Peaks2DArray.h.


The documentation for this class was generated from the following files: