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

peaks information class More...

#include <Peaks.h>

Inheritance diagram for kome::objects::Peaks:
Inheritance graph
[legend]
Collaboration diagram for kome::objects::Peaks:
Collaboration graph
[legend]

Public Member Functions

 Peaks ()
 constructor
 
 Peaks (const Peaks &peaks)
 copy constructor More...
 
virtual ~Peaks ()
 destructor
 
Peaksoperator= (const Peaks &other)
 substitution operator More...
 
int issueId (PeakElement *peakElement)
 to issue the peak id More...
 
PeakElementgetPeakById (int id)
 gets peak element by peak id More...
 
void clearCharge ()
 clears charge
 
void addCharge (const short charge)
 adds charge More...
 
unsigned int getNumberOfCharges ()
 gets the number of charges More...
 
short getCharge (const unsigned int index)
 gets charge More...
 
void setPrecursor (const double precursor)
 sets precursor More...
 
double getPrecursor ()
 gets precursor More...
 
void calcArea ()
 calculates area
 
void setDataPoints (kome::core::XYData &xyData)
 sets data points More...
 
PeakElementcreatePeak (const double x, const double y)
 creates peak More...
 
PeakElementgetPeak (const unsigned int index)
 gets peak More...
 
void sort ()
 sorts peaks
 
- Public Member Functions inherited from kome::core::XYData
 XYData ()
 constructor
 
virtual ~XYData ()
 destructor
 
double getMinX ()
 gets minimum x More...
 
double getMaxX ()
 gets maximum x More...
 
double getMinY ()
 gets minimum y More...
 
double getMaxY ()
 gets maximum y More...
 
void clearPoints ()
 clear all data points
 
void addPoint (const double x, const double y)
 adds point More...
 
void insertPoint (const unsigned int index, const double x, const double y)
 insertts point More...
 
void updatePoint (const unsigned int index, const double x, const double y)
 updates points More...
 
void deletePoint (const unsigned int index)
 delete point More...
 
unsigned int getLength ()
 gets the number of points @return the number of points
 
double getX (const unsigned int index)
 gets x coordinate More...
 
double getY (const unsigned int index)
 gets y coordinate More...
 
void reserve (const unsigned int num)
 reserves enough contiguous memory of array More...
 
unsigned long getVersion ()
 gets the version More...
 
int searchIndex (const double x)
 searches index of specified x value. More...
 
int getNearestIndex (const double x)
 gets nearest index More...
 
void filter (const double absY=0.0, const double relY=0.0)
 executes filter More...
 
void getPoints (std::vector< Point< double > > &points, const bool ySort, const bool desc)
 gets points array More...
 
bool importData (boost::function< int(void *, int) > readFun)
 imports data More...
 
bool exportData (boost::function< int(void *, int) > writeFun)
 exports data More...
 

Protected Member Functions

void arrangePeaks ()
 arrange peaks
 
virtual bool onLoadData (boost::function< int(void *, int) > readFun)
 loads data from file (override method) More...
 
virtual bool onSaveData (boost::function< int(void *, int) > writeFun)
 saves data to file (override method) More...
 
virtual void onClearPoints ()
 This method is called by clearPoints method. (override method)
 
virtual void onAddPoint (const double x, const double y)
 This method is called by addPoint method. (override method) More...
 
virtual void onInsertPoint (const unsigned int index, const double x, const double y)
 This method is called by insertPoint method. (override method) More...
 
virtual void onDeletePoint (const unsigned int index)
 This method is called by deletePoint method. (override method) More...
 
virtual unsigned int onGetLength ()
 this method is called by getLength method (override method) More...
 
virtual double onGetX (const unsigned int index)
 This method is called by getX method. (override method) More...
 
virtual double onGetY (const unsigned int index)
 This method is called by getY method. (override method) More...
 
virtual void onReserve (const unsigned int num)
 This method is called by reserve method. (override method) More...
 
- Protected Member Functions inherited from kome::core::XYData
void updateRange ()
 updates range
 

Static Protected Member Functions

static bool lessPeakX (PeakElement *p0, PeakElement *p1)
 compares to sort peaks by x coordinate More...
 
static bool lessPeakY (PeakElement *p0, PeakElement *p1)
 compares to sort peaks by y coordinate More...
 

Protected Attributes

std::vector< PeakElement * > m_peaks
 
std::string m_title
 
std::vector< short > m_charges
 
double m_precursor
 
std::string m_dataFile
 
- Protected Attributes inherited from kome::core::XYData
bool m_updated
 
double m_minX
 
double m_maxX
 
double m_minY
 
double m_maxY
 
unsigned long m_version
 

Additional Inherited Members

- Static Protected Attributes inherited from kome::core::XYData
static unsigned long m_currentVersion = 0
 version More...
 

Detailed Description

peaks information class

Definition at line 35 of file Peaks.h.

Constructor & Destructor Documentation

kome::objects::Peaks::Peaks ( const Peaks peaks)

copy constructor

Parameters
[in]peakscopy source

Definition at line 45 of file Peaks.cpp.

45  : kome::core::XYData( peaks ) {
46  // initialize
47  m_title = peaks.m_title;
48  m_precursor = peaks.m_precursor;
49  for( unsigned int i = 0; i < peaks.m_charges.size(); i++ ) {
50  m_charges.push_back( peaks.m_charges[ i ] );
51  }
52 
53 // @date 2011.03.03 <Mod> M.Aihara ->
54 // soft cache DataPoints
55 #ifdef DATAPOINTS_SOFT_CACHE_TBB
56  if(peaks.m_dps){
57  m_dps = new kome::core::DataPoints( kome::core::DataPoints::FLOAT );
58  *m_dps = *(peaks.m_dps);
59  }else{
60  m_dps = NULL;
61  }
62 #endif // DATAPOINTS_SOFT_CACHE_TBB
63 // <Mod> M.Aihara <-
64 
65  m_title = peaks.m_title;
66  m_charges = peaks.m_charges;
67  m_precursor = peaks.m_precursor;
68  m_dataFile = peaks.m_dataFile;
69 
70  // copy peaks
71  if( peaks.m_peaks.size() == 0 ) {
72  return;
73  }
74 
75  m_peaks.reserve( peaks.m_peaks.size() );
76  for( unsigned int i = 0; i < peaks.m_peaks.size(); i++ ) {
77  // source peak
78  PeakElement* src = peaks.m_peaks[ i ];
79 
80  // copy peak
81  PeakElement* peak = new PeakElement( this );
82  m_peaks.push_back( peak );
83 
84  peak->setX( src->getX() );
85  peak->setY( src->getY() );
86  peak->setLeft( src->getLeftX(), src->getLeftY() );
87  peak->setRight( src->getRightX(), src->getRightY() );
88  peak->setApex( src->getApexX(), src->getApexY() );
89  }
90 }
abstraction class of two dimention coordinate data
Definition: XYData.h:34
void setX(const double x)
sets x element value
Definition: PeakElement.cpp:88
data points data of profile management class
Definition: DataPoints.h:25
void setRight(const double x, const double y)
sets peak right
std::string m_dataFile
Definition: Peaks.h:79
double getRightX()
gets x element of peak right
double getRightY()
gets y elemtn of peak right
std::vector< short > m_charges
Definition: Peaks.h:73
#define NULL
Definition: CoreMacros.h:18
std::string m_title
Definition: Peaks.h:70
double getLeftX()
gets x element of peak left
double getApexX()
gets x element of peak apex
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
double m_precursor
Definition: Peaks.h:76
double getY()
gets y element value
double getApexY()
gets y element of peak apex
void setApex(const double x, const double y)
sets peak apex
void setLeft(const double x, const double y)
sets peak left
double getX()
gets x element value
void setY(const double y)
sets y element value
double getLeftY()
gets y element of peak left

Here is the call graph for this function:

Member Function Documentation

void kome::objects::Peaks::addCharge ( const short  charge)

adds charge

Parameters
[in]chargecharge

Definition at line 157 of file Peaks.cpp.

157  {
158  m_charges.push_back( charge );
159 }
std::vector< short > m_charges
Definition: Peaks.h:73
PeakElement * kome::objects::Peaks::createPeak ( const double  x,
const double  y 
)

creates peak

Parameters
[in]xx element of peak
[in]yy element of peak
Returns
new peak object

Definition at line 353 of file Peaks.cpp.

353  {
354  // add peak
355  PeakElement* peak = new PeakElement( this, x, y );
356  m_peaks.push_back( peak );
357 
358  // length
359  unsigned int len = m_peaks.size();
360 
361  // set range
362  if( x < m_minX || len == 0 ) {
363  m_minX = x;
364  }
365  if( x > m_maxX || len == 0 ) {
366  m_maxX = x;
367  }
368  if( y < m_minY || len == 0 ) {
369  m_minY = y;
370  }
371  if( y > m_maxY || len == 0 ) {
372  m_maxY = y;
373  }
374 
375  m_updated = true;
376 
377  return peak;
378 }
double m_maxY
Definition: XYData.h:62
double m_maxX
Definition: XYData.h:56
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
double m_minY
Definition: XYData.h:59
double m_minX
Definition: XYData.h:53
short kome::objects::Peaks::getCharge ( const unsigned int  index)

gets charge

Parameters
[in]indexcharge index
Returns
charge

Definition at line 167 of file Peaks.cpp.

167  {
168  // check index
169  if( index >= m_charges.size() ) {
170  LOG_WARN(
171  FMT(
172  "Charge index must be less than the number of charges. [%d/%d] ",
173  index,
174  m_charges.size()
175  )
176  );
177  return 0;
178  }
179 
180  return m_charges[ index ];
181 }
std::vector< short > m_charges
Definition: Peaks.h:73
unsigned int kome::objects::Peaks::getNumberOfCharges ( )

gets the number of charges

Returns
the number of charges

Definition at line 162 of file Peaks.cpp.

162  {
163  return m_charges.size();
164 }
std::vector< short > m_charges
Definition: Peaks.h:73
PeakElement * kome::objects::Peaks::getPeak ( const unsigned int  index)

gets peak

Parameters
[in]indexpeak index
Returns
peak object (If NULL, the index is illegal.

Definition at line 381 of file Peaks.cpp.

381  {
382  if( index >= m_peaks.size() ) {
383  return NULL;
384  }
385  double x = getX( index );
386  return m_peaks[ index ];
387 }
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
#define NULL
Definition: CoreMacros.h:18
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67

Here is the call graph for this function:

PeakElement * kome::objects::Peaks::getPeakById ( int  id)

gets peak element by peak id

Parameters
[in]idpeak id
Returns
peak element objects

Definition at line 587 of file Peaks.cpp.

587  {
588  arrangePeaks();
589 
590  for( unsigned int i=0; i < m_peaks.size(); i++ ){
591  if( m_peaks[i]->getId() == id ){
592  return m_peaks[i];
593  }
594  }
595  return NULL;
596 }
#define NULL
Definition: CoreMacros.h:18
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
void arrangePeaks()
arrange peaks
Definition: Peaks.cpp:403

Here is the call graph for this function:

double kome::objects::Peaks::getPrecursor ( )

gets precursor

Returns
precursor

Definition at line 189 of file Peaks.cpp.

189  {
190  return m_precursor;
191 }
double m_precursor
Definition: Peaks.h:76
int kome::objects::Peaks::issueId ( PeakElement peakElement)

to issue the peak id

Parameters
[in]peakElementpeak element objects
Returns
peak id

Definition at line 579 of file Peaks.cpp.

579  {
580  if( peakElement != NULL && peakElement->getId() > 0 ){
581  return peakElement->getId()+1;
582  }
583  return 0;
584 }
#define NULL
Definition: CoreMacros.h:18
int getId()
gets peak ID

Here is the call graph for this function:

static bool kome::objects::Peaks::lessPeakX ( PeakElement p0,
PeakElement p1 
)
staticprotected

compares to sort peaks by x coordinate

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

Definition at line 569 of file Peaks.cpp.

569  {
570  return ( p0->getX() < p1->getX() );
571 }
double getX()
gets x element value

Here is the call graph for this function:

static bool kome::objects::Peaks::lessPeakY ( PeakElement p0,
PeakElement p1 
)
staticprotected

compares to sort peaks by y coordinate

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

Definition at line 574 of file Peaks.cpp.

574  {
575  return ( p0->getY() > p1->getY() );
576 }
double getY()
gets y element value

Here is the call graph for this function:

void kome::objects::Peaks::onAddPoint ( const double  x,
const double  y 
)
protectedvirtual

This method is called by addPoint method. (override method)

Parameters
[in]xx coordinate of point to be added
[in]yy coordinate of point to be added

Implements kome::core::XYData.

Definition at line 525 of file Peaks.cpp.

525  {
526  createPeak( x, y );
527 }
PeakElement * createPeak(const double x, const double y)
creates peak
Definition: Peaks.cpp:353

Here is the call graph for this function:

void kome::objects::Peaks::onDeletePoint ( const unsigned int  index)
protectedvirtual

This method is called by deletePoint method. (override method)

Parameters
[in]indexpoint index

Implements kome::core::XYData.

Definition at line 540 of file Peaks.cpp.

540  {
541  delete m_peaks[ index ];
542  m_peaks.erase( m_peaks.begin() + index );
543 }
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
unsigned int kome::objects::Peaks::onGetLength ( )
protectedvirtual

this method is called by getLength method (override method)

Returns
the number of points

Implements kome::core::XYData.

Definition at line 546 of file Peaks.cpp.

546  {
547  arrangePeaks();
548  return m_peaks.size();
549 }
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
void arrangePeaks()
arrange peaks
Definition: Peaks.cpp:403

Here is the call graph for this function:

double kome::objects::Peaks::onGetX ( const unsigned int  index)
protectedvirtual

This method is called by getX method. (override method)

Parameters
[in]indexthe index of point
Returns
x coordinate

Implements kome::core::XYData.

Definition at line 552 of file Peaks.cpp.

552  {
553  arrangePeaks();
554  return m_peaks[ index ]->getX();
555 }
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
void arrangePeaks()
arrange peaks
Definition: Peaks.cpp:403

Here is the call graph for this function:

double kome::objects::Peaks::onGetY ( const unsigned int  index)
protectedvirtual

This method is called by getY method. (override method)

Parameters
[in]indexthe index of point
Returns
y coordiante

Implements kome::core::XYData.

Definition at line 558 of file Peaks.cpp.

558  {
559  arrangePeaks();
560  return m_peaks[ index ]->getY();
561 }
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
void arrangePeaks()
arrange peaks
Definition: Peaks.cpp:403

Here is the call graph for this function:

void kome::objects::Peaks::onInsertPoint ( const unsigned int  index,
const double  x,
const double  y 
)
protectedvirtual

This method is called by insertPoint method. (override method)

Parameters
[in]indexinsert position
[in]xx coordinate of point
[in]yy coordinate of point

Implements kome::core::XYData.

Definition at line 530 of file Peaks.cpp.

530  {
531  // index
532  int idx = std::min( (int)index, (int)m_peaks.size() );
533 
534  // insert
535  PeakElement* peak = new PeakElement( this, x, y );
536  m_peaks.insert( m_peaks.begin() + idx, peak );
537 }
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
bool kome::objects::Peaks::onLoadData ( boost::function< int(void *, int) >  readFun)
protectedvirtual

loads data from file (override method)

Parameters
[in]readFunread function
Returns
If true, it succeeded to load the data.

Reimplemented from kome::core::XYData.

Definition at line 429 of file Peaks.cpp.

429  {
430  // length
431  unsigned long len = 0;
432  readFun( &len, sizeof( len ) );
433 
434  // read data
435  if( len > 0 ) {
436  double* arr = new double[ len * 10 ];
437  readFun( arr, sizeof( double ) * len * 10 );
438 
439  int* charges = new int[ len ];
440  readFun( charges, sizeof( int ) * len );
441 
442  m_peaks.reserve( len );
443  for( unsigned int i = 0; i < len; i++ ) {
444  int idx = i * 10;
445  double x = arr[ idx + 0 ];
446  double y = arr[ idx + 1 ];
447  double lx = arr[ idx + 2 ];
448  double ly = arr[ idx + 3 ];
449  double rx = arr[ idx + 4 ];
450  double ry = arr[ idx + 5 ];
451  double ax = arr[ idx + 6 ];
452  double ay = arr[ idx + 7 ];
453  double ar = arr[ idx + 8 ];
454  double wi = arr[ idx + 9 ];
455  int c = charges[ i ];
456 
457  PeakElement* peak = new PeakElement( this, x, y );
458  peak->setLeft( lx, ly );
459  peak->setRight( rx, ry );
460  peak->setApex( ax, ay );
461  peak->setArea( ar );
462  peak->setFwhm( wi );
463  peak->setCharge( c );
464 
465  m_peaks.push_back( peak );
466  }
467 
468  delete[] arr;
469  delete[] charges;
470  }
471 
472  return true;
473 }
void setRight(const double x, const double y)
sets peak right
void setArea(const double area)
sets area
void setFwhm(const double fwhm)
sets the FWHM
void setCharge(const int charge)
sets the charge state
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
void setApex(const double x, const double y)
sets peak apex
void setLeft(const double x, const double y)
sets peak left

Here is the call graph for this function:

void kome::objects::Peaks::onReserve ( const unsigned int  num)
protectedvirtual

This method is called by reserve method. (override method)

Parameters
[in]numof points to be reserved

Implements kome::core::XYData.

Definition at line 564 of file Peaks.cpp.

564  {
565  m_peaks.reserve( num );
566 }
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
bool kome::objects::Peaks::onSaveData ( boost::function< int(void *, int) >  writeFun)
protectedvirtual

saves data to file (override method)

Parameters
[in]writeFunwrite function
Returns
If true, it succeeded to save the data

Reimplemented from kome::core::XYData.

Definition at line 476 of file Peaks.cpp.

476  {
477  // length
478  unsigned long len = m_peaks.size();
479  writeFun( &len, sizeof( len ) );
480 
481  // write data
482  if( len > 0 ) {
483  double* arr = new double[ len * 10 ];
484 
485  for( unsigned int i = 0; i < len; i++ ) {
486  // peak
487  PeakElement* peak = m_peaks[ i ];
488 
489  // array
490  int idx = i * 10;
491  arr[ idx + 0 ] = peak->getX();
492  arr[ idx + 1 ] = peak->getY();
493  arr[ idx + 2 ] = peak->getLeftX();
494  arr[ idx + 3 ] = peak->getLeftY();
495  arr[ idx + 4 ] = peak->getRightX();
496  arr[ idx + 5 ] = peak->getRightY();
497  arr[ idx + 6 ] = ( peak->hasApex() ? peak->getApexX() : -1.0 );
498  arr[ idx + 7 ] = ( peak->hasApex() ? peak->getApexY() : -1.0 );
499  arr[ idx + 8 ] = ( peak->hasArea() ? peak->getArea() : -1.0 );
500  arr[ idx + 9 ] = ( peak->hasFwhm() ? peak->getFwhm() : -1.0 );
501  }
502 
503  writeFun( arr, sizeof( double ) * len * 10 );
504 
505  delete[] arr;
506 
507  // charges
508  int* charges = new int[ len ];
509  for( unsigned int i = 0; i < len; i++ ) {
510  // peak
511  PeakElement* peak = m_peaks[ i ];
512 
513  charges[ i ] = peak->getCharge();
514  }
515 
516  writeFun( charges, sizeof( int ) * len );
517 
518  delete[] charges;
519  }
520 
521  return true;
522 }
double getArea()
gets peak area
bool hasFwhm()
judges whether this peak has FWHM value of not
double getRightX()
gets x element of peak right
double getRightY()
gets y elemtn of peak right
double getLeftX()
gets x element of peak left
double getApexX()
gets x element of peak apex
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
double getY()
gets y element value
double getApexY()
gets y element of peak apex
bool hasApex()
judges whether this peak has apex information or not.
double getX()
gets x element value
bool hasArea()
judges whether this peak has area value or not
double getFwhm()
gets the FWHM
int getCharge()
gets the charge state
double getLeftY()
gets y element of peak left

Here is the call graph for this function:

Peaks & kome::objects::Peaks::operator= ( const Peaks other)

substitution operator

Parameters
[in]othersource peaks object
Returns
copied peaks object

Definition at line 118 of file Peaks.cpp.

118  {
119  // initialize
120  m_title = other.m_title;
121  m_precursor = other.m_precursor;
122  for( unsigned int i = 0; i < other.m_charges.size(); i++ ) {
123  m_charges.push_back( other.m_charges[ i ] );
124  }
125 
126  // clear points
127  clearPoints();
128  // copy peaks
129  if( other.m_peaks.size() == 0 ) {
130  return *this;
131  }
132 
133  // add peaks
134  reserve( other.m_peaks.size() );
135  for( unsigned int i = 0; i < other.m_peaks.size(); i++ ) {
136  // source peak
137  PeakElement* src = other.m_peaks[ i ];
138 
139  // copy peak
140  PeakElement* peak = createPeak( src->getX(), src->getY() );
141 
142  peak->setLeft( src->getLeftX(), src->getLeftY() );
143  peak->setRight( src->getRightX(), src->getRightY() );
144  peak->setApex( src->getApexX(), src->getApexY() );
145  peak->setArea( src->getArea() );
146  }
147 
148  return *this;
149 }
double getArea()
gets peak area
void setRight(const double x, const double y)
sets peak right
void clearPoints()
clear all data points
Definition: XYData.cpp:137
void setArea(const double area)
sets area
double getRightX()
gets x element of peak right
double getRightY()
gets y elemtn of peak right
std::vector< short > m_charges
Definition: Peaks.h:73
std::string m_title
Definition: Peaks.h:70
double getLeftX()
gets x element of peak left
double getApexX()
gets x element of peak apex
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
double m_precursor
Definition: Peaks.h:76
void reserve(const unsigned int num)
reserves enough contiguous memory of array
Definition: XYData.cpp:262
double getY()
gets y element value
double getApexY()
gets y element of peak apex
void setApex(const double x, const double y)
sets peak apex
void setLeft(const double x, const double y)
sets peak left
double getX()
gets x element value
PeakElement * createPeak(const double x, const double y)
creates peak
Definition: Peaks.cpp:353
double getLeftY()
gets y element of peak left

Here is the call graph for this function:

void kome::objects::Peaks::setDataPoints ( kome::core::XYData xyData)

sets data points

Parameters
[in]xyDatadata points

Definition at line 301 of file Peaks.cpp.

301  {
302 
303  // manager
305 
306  // init area
307  for( unsigned int i = 0; i < m_peaks.size(); i++ ) {
308  m_peaks[ i ]->setArea( -1.0 );
309  }
310 
311  // delete previous data
312  if( !m_dataFile.empty() ) {
313  std::string oldDataPath = getpath( msppMgr.getTmpDir(), m_dataFile.c_str() );
314 
315  if( fileexists( oldDataPath.c_str() ) ) {
316  removefile( oldDataPath.c_str() );
317  }
318  }
319 
320  // data file path
321  static int tmpDirCnt = 0;
322 
323  std::string dir = getpath( "peaks_data", FMT( "%02x", tmpDirCnt ).c_str() );
324  tmpDirCnt = ( tmpDirCnt + 1 ) % 0x100;
325 
326  std::string tmpFileName = msppMgr.getTmpFileName( "profile_data", ".xyd", dir.c_str() );
327  m_dataFile = getpath( dir.c_str(), tmpFileName.c_str() );
328  std::string tmpFilePath = getpath( msppMgr.getTmpDir(), m_dataFile.c_str() );
329 
330  // open file
331  FILE* fp = fileopen( tmpFilePath.c_str(), "wb" );
332  if( fp == NULL ) {
333  m_dataFile.clear();
334  return;
335  }
336 
337  // copy data
338  kome::core::DataPoints dps( kome::core::DataPoints::FLOAT );
339  for( unsigned int i = 0; i < xyData.getLength(); i++ ) {
340  dps.addPoint( xyData.getX( i ), xyData.getY( i ) );
341  }
342 
343  // save data
344  kome::core::FileAccessor acc( fp );
345  dps.exportData( boost::bind( &kome::core::FileAccessor::write, &acc, _1, _2 ) );
346 
347  fclose( fp );
348 }
static MsppManager & getInstance()
gets MsppManager object (This is the only object.)
file accessor class
Definition: FileAccessor.h:26
data points data of profile management class
Definition: DataPoints.h:25
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
Mass++ manager class.
Definition: MsppManager.h:28
std::string m_dataFile
Definition: Peaks.h:79
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
bool fileexists(const char *path)
judge whether file exists
const char * getTmpDir()
gets temporary file directory name
#define NULL
Definition: CoreMacros.h:18
FILE * fileopen(const char *path, const char *mode)
opens file
std::vector< PeakElement * > m_peaks
Definition: Peaks.h:67
virtual int write(void *addr, int size)
writes data (override method)
bool removefile(const char *path)
removes file
std::string getTmpFileName(const char *prefix, const char *suffix, const char *dir=NULL)
gets temporary file name
std::string getpath(const char *dir, const char *file)
get file path
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216

Here is the call graph for this function:

void kome::objects::Peaks::setPrecursor ( const double  precursor)

sets precursor

Parameters
[in]precursorprecursor

Definition at line 184 of file Peaks.cpp.

184  {
185  m_precursor = precursor;
186 }
double m_precursor
Definition: Peaks.h:76

Member Data Documentation

std::vector< short > kome::objects::Peaks::m_charges
protected

charge array

Definition at line 73 of file Peaks.h.

std::string kome::objects::Peaks::m_dataFile
protected

data file

Definition at line 79 of file Peaks.h.

std::vector< PeakElement* > kome::objects::Peaks::m_peaks
protected

the array of peak elements

Definition at line 67 of file Peaks.h.

double kome::objects::Peaks::m_precursor
protected

precursor

Definition at line 76 of file Peaks.h.

std::string kome::objects::Peaks::m_title
protected

peak title

Definition at line 70 of file Peaks.h.


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