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

data points management class More...

#include <PointsManager.h>

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

Public Member Functions

kome::core::XYDatagetXYData (Spectrum *spec)
 gets xy data of specified spectrum More...
 
kome::core::XYDatagetXYData (Chromatogram *chrom)
 gets xy data of specified chromatogram More...
 
void deleteXYData (Spectrum *spec)
 deletes xy data of specified spectrum More...
 
void deleteXYData (Chromatogram *chrom)
 deletes xy data of specified chromatogram More...
 
void addOperation (Spectrum *spec, XYDataOperation *operation)
 adds data operation to specified spectrum More...
 
void addOperation (Chromatogram *chrom, XYDataOperation *operation)
 adds data operatin to specified chromatogram More...
 
void addOperation (Sample *sample, XYDataOperation *operation)
 adds data operatin to specified sample More...
 
void removeOperation (Spectrum *spec, XYDataOperation *operation)
 removes data operation from specified spectrum More...
 
void removeOperation (Chromatogram *chrom, XYDataOperation *operation)
 removes data operation from specified chromtogram More...
 
void removeOperation (Sample *sample, XYDataOperation *operation)
 removes data operation from specified sample More...
 
void clearOperations (Spectrum *spec)
 clears data operation of specified spectrum More...
 
void clearOperations (Chromatogram *chrom)
 clears data operation of specified chromatogram More...
 
void clearOperations (Sample *sample)
 clears data operation of specified sample More...
 
unsigned int getNumberOfOperations (Spectrum *spec)
 gets the number of operations of specified spectrum More...
 
unsigned int getNumberOfOperations (Chromatogram *chrom)
 gets the number of operations of specified chromatogram More...
 
unsigned int getNumberOfOperations (Sample *sample)
 gets the number of operations of specified sample More...
 
XYDataOperationgetOperation (Spectrum *spec, const unsigned int index)
 gets operation of specified spectrum More...
 
XYDataOperationgetOperation (Chromatogram *chrom, const unsigned int index)
 gets operation of specified chromatogram More...
 
XYDataOperationgetOperation (Sample *sample, const unsigned int index)
 gets operation of specified sample More...
 

Static Public Member Functions

static PointsManagergetInstance ()
 get data points manager object (This is the only object.) More...
 
- Static Public Member Functions inherited from kome::objects::DataManager
static void openSample (Sample *sample)
 This method is called when a sample is opened. More...
 
static void closeSample (Sample *sample, const bool deleting)
 This method is called when a sample is closed. More...
 
static void openSpectrum (Spectrum *spec)
 This method is called when a spectrum is opened. More...
 
static void closeSpectrum (Spectrum *spec, const bool deleting)
 This method is called when a spectrum is closed. More...
 
static void openChromatogram (Chromatogram *chrom)
 This method is called when a chromaogram is opened. More...
 
static void closeChromatogram (Chromatogram *chrom, const bool deleting)
 This method is called when a chromatogram is closed. More...
 
static void openDataMap (DataMapInfo *dataMap)
 This method is called when a data map is opened. More...
 
static void closeDataMap (DataMapInfo *dataMap, const bool deleting)
 This method is called when a data map is closed. More...
 

Protected Member Functions

 PointsManager ()
 constructor
 
virtual ~PointsManager ()
 destructor
 
void deleteOperation (XYDataOperation *operation)
 deletes operation object More...
 
virtual void onCloseSample (Sample *sample, const bool deleting)
 This method is called when a sample is closed. (override method) More...
 
virtual void onCloseSpectrum (Spectrum *spec, const bool deleting)
 This method is called when a spectrum is closed. (override method) More...
 
virtual void onCloseChromatogram (Chromatogram *chrom, const bool deleting)
 This method is called when a chromatogram is closed. (override method) More...
 
- Protected Member Functions inherited from kome::objects::DefaultDataManager
 DefaultDataManager ()
 constructor
 
virtual ~DefaultDataManager ()
 destructor
 
virtual void onOpenSample (Sample *sample)
 This method is called when a sample is opened. (override method) More...
 
virtual void onOpenSpectrum (Spectrum *spec)
 This method is called when a spectrum is opened. (override method) More...
 
virtual void onOpenChromatogram (Chromatogram *chrom)
 This method is called when a chromatogram is opened. (override method) More...
 
virtual void onOpenDataMap (DataMapInfo *dataMap)
 This method is called when a data map is opened. (override method) More...
 
virtual void onCloseDataMap (DataMapInfo *dataMap, const bool deleting)
 This method is called when a data map is closed. (override method) More...
 
- Protected Member Functions inherited from kome::objects::DataManager
 DataManager ()
 constructor
 
virtual ~DataManager ()
 destructor
 

Static Protected Member Functions

static bool lessOperation (XYDataOperation *opt0, XYDataOperation *opt1)
 compare index of XYDataOperation to sort More...
 
- Static Protected Member Functions inherited from kome::objects::DataManager
static bool lessManager (DataManager *dm0, DataManager *dm1)
 conmapred data managers to sort More...
 
static void sortDataManagers ()
 sorts data managers
 

Protected Attributes

std::map< XYDataOperation *, int > m_countMap
 
std::map< Spectrum
*, kome::core::DataPoints
m_specPointsMap
 
std::map< Chromatogram
*, kome::core::DataPoints
m_chromPointsMap
 
std::map< Sample
*, kome::core::DataPoints
m_samplePointsMap
 
std::map< Spectrum
*, std::vector
< XYDataOperation * > > 
m_specOperationMap
 
std::map< Chromatogram
*, std::vector
< XYDataOperation * > > 
m_chromOperationMap
 
std::map< Sample
*, std::vector
< XYDataOperation * > > 
m_sampleOperationMap
 
- Protected Attributes inherited from kome::objects::DataManager
int m_order
 

Additional Inherited Members

- Static Protected Attributes inherited from kome::objects::DataManager
static std::vector< DataManager * > m_dataMgrs
 
static bool m_sorted = true
 

Detailed Description

data points management class

Definition at line 36 of file PointsManager.h.

Member Function Documentation

void kome::objects::PointsManager::addOperation ( Spectrum spec,
XYDataOperation operation 
)

adds data operation to specified spectrum

Parameters
[in]specspectrum
[in]operationdata operation object

Definition at line 108 of file PointsManager.cpp.

108  {
109  // check parameters
110  if( spec == NULL || operation == NULL ) {
111  return;
112  }
113 
114  // add count
115  if( m_countMap.find( operation ) == m_countMap.end() ) {
116  m_countMap[ operation ] = 1;
117  }
118  else {
119  int count = m_countMap[ operation ];
120  count++;
121  m_countMap[ operation ] = count;
122  }
123 
124  // add operation
125  m_specOperationMap[ spec ].push_back( operation );
126 
127  // sort
128  if( operation->getIndex() != -1 ){
129  std::sort( m_specOperationMap[spec].begin(), m_specOperationMap[spec].end(), lessOperation );
130  }
131 
132  // clear points
133  deleteXYData( spec );
134 }
std::map< Spectrum *, std::vector< XYDataOperation * > > m_specOperationMap
Definition: PointsManager.h:64
static bool lessOperation(XYDataOperation *opt0, XYDataOperation *opt1)
compare index of XYDataOperation to sort
#define NULL
Definition: CoreMacros.h:18
std::map< XYDataOperation *, int > m_countMap
Definition: PointsManager.h:52
void deleteXYData(Spectrum *spec)
deletes xy data of specified spectrum

Here is the call graph for this function:

void kome::objects::PointsManager::addOperation ( Chromatogram chrom,
XYDataOperation operation 
)

adds data operatin to specified chromatogram

Parameters
[in]chromchromatogram
[in]operationdata operation object

Definition at line 137 of file PointsManager.cpp.

137  {
138  // check parameters
139  if( chrom == NULL || operation == NULL ) {
140  return;
141  }
142 
143  // add count
144  if( m_countMap.find( operation ) == m_countMap.end() ) {
145  m_countMap[ operation ] = 1;
146  }
147  else {
148  int count = m_countMap[ operation ];
149  count++;
150  m_countMap[ operation ] = count;
151  }
152 
153  // add operation
154  m_chromOperationMap[ chrom ].push_back( operation );
155 
156  // sort
157  if( operation->getIndex() != -1 ){
158  std::sort( m_chromOperationMap[ chrom ].begin(), m_chromOperationMap[ chrom ].end(), lessOperation );
159  }
160  // clear points
161  deleteXYData( chrom );
162 }
static bool lessOperation(XYDataOperation *opt0, XYDataOperation *opt1)
compare index of XYDataOperation to sort
std::map< Chromatogram *, std::vector< XYDataOperation * > > m_chromOperationMap
Definition: PointsManager.h:67
#define NULL
Definition: CoreMacros.h:18
std::map< XYDataOperation *, int > m_countMap
Definition: PointsManager.h:52
void deleteXYData(Spectrum *spec)
deletes xy data of specified spectrum

Here is the call graph for this function:

void kome::objects::PointsManager::addOperation ( Sample sample,
XYDataOperation operation 
)

adds data operatin to specified sample

Parameters
[in]samplesample object
[in]operationdata operation object

Definition at line 165 of file PointsManager.cpp.

165  {
166  // check parameters
167  if( sample == NULL || operation == NULL ){
168  return;
169  }
170 
171  // add count
172  if( m_countMap.find( operation ) == m_countMap.end() ){
173  m_countMap[ operation] = 1;
174  }else{
175  int count = m_countMap[ operation ];
176  count++;
177  m_countMap[ operation ] = count;
178  }
179 
180  // add operation
181  m_sampleOperationMap[ sample ].push_back( operation );
182 
183  if( operation->getIndex() != -1 ){
184  std::sort( m_sampleOperationMap[ sample ].begin(), m_sampleOperationMap[ sample ].end(), lessOperation );
185  }
186 }
std::map< Sample *, std::vector< XYDataOperation * > > m_sampleOperationMap
Definition: PointsManager.h:70
static bool lessOperation(XYDataOperation *opt0, XYDataOperation *opt1)
compare index of XYDataOperation to sort
#define NULL
Definition: CoreMacros.h:18
std::map< XYDataOperation *, int > m_countMap
Definition: PointsManager.h:52

Here is the call graph for this function:

void kome::objects::PointsManager::clearOperations ( Spectrum spec)

clears data operation of specified spectrum

Parameters
[in]specspectrum

Definition at line 288 of file PointsManager.cpp.

288  {
289  // check the parameter
290  if( spec == NULL ) {
291  return;
292  }
293 
294  // operations
295  if( m_specOperationMap.find( spec ) == m_specOperationMap.end() ) {
296  return;
297  }
298  std::vector< XYDataOperation* >& operations = m_specOperationMap[ spec ];
299 
300  // delete operations
301  for( unsigned int i = 0; i < operations.size(); i++ ) {
302  deleteOperation( operations[ i ] );
303  }
304 
305  // erase
306  operations.clear();
307  m_specOperationMap.erase( spec );
308 }
std::map< Spectrum *, std::vector< XYDataOperation * > > m_specOperationMap
Definition: PointsManager.h:64
void deleteOperation(XYDataOperation *operation)
deletes operation object
#define NULL
Definition: CoreMacros.h:18

Here is the call graph for this function:

void kome::objects::PointsManager::clearOperations ( Chromatogram chrom)

clears data operation of specified chromatogram

Parameters
[in]chromchromatogram

Definition at line 311 of file PointsManager.cpp.

311  {
312  // check the parameter
313  if( chrom == NULL ) {
314  return;
315  }
316 
317  // operations
318  if( m_chromOperationMap.find( chrom ) == m_chromOperationMap.end() ) {
319  return;
320  }
321  std::vector< XYDataOperation* >& operations = m_chromOperationMap[ chrom ];
322 
323  // delete oprations
324  for( unsigned int i = 0; i < operations.size(); i++ ) {
325  deleteOperation( operations[ i ] );
326  }
327 
328  // erase
329  operations.clear();
330  m_chromOperationMap.erase( chrom );
331 }
void deleteOperation(XYDataOperation *operation)
deletes operation object
std::map< Chromatogram *, std::vector< XYDataOperation * > > m_chromOperationMap
Definition: PointsManager.h:67
#define NULL
Definition: CoreMacros.h:18

Here is the call graph for this function:

void kome::objects::PointsManager::clearOperations ( Sample sample)

clears data operation of specified sample

Parameters
[in]samplesample object

Definition at line 334 of file PointsManager.cpp.

334  {
335  // check the parameter
336  if( sample == NULL ){
337  return;
338  }
339 
340  //operations
341  if( m_sampleOperationMap.find( sample) == m_sampleOperationMap.end() ){
342  return;
343  }
344  std::vector< XYDataOperation* >& operations = m_sampleOperationMap[ sample ];
345 
346  // delete operations
347  for( unsigned int i=0; i < operations.size(); i++ ){
348  deleteOperation( operations[ i ] );
349  }
350 
351  // erase
352  operations.clear();
353  m_sampleOperationMap.erase( sample );
354 }
void deleteOperation(XYDataOperation *operation)
deletes operation object
std::map< Sample *, std::vector< XYDataOperation * > > m_sampleOperationMap
Definition: PointsManager.h:70
#define NULL
Definition: CoreMacros.h:18

Here is the call graph for this function:

void kome::objects::PointsManager::deleteOperation ( XYDataOperation operation)
protected

deletes operation object

Parameters
[in]operationoperation object to be deleted

Definition at line 459 of file PointsManager.cpp.

459  {
460  // check parameter
461  if( operation == NULL || m_countMap.find( operation ) == m_countMap.end() ) {
462  return;
463  }
464 
465  // get count
466  int count = m_countMap[ operation ];
467  count--;
468  if( count > 0 ) {
469  m_countMap[ operation ] = count;
470  }
471  else {
472  m_countMap.erase( operation );
473  delete operation;
474  }
475 }
#define NULL
Definition: CoreMacros.h:18
std::map< XYDataOperation *, int > m_countMap
Definition: PointsManager.h:52
void kome::objects::PointsManager::deleteXYData ( Spectrum spec)

deletes xy data of specified spectrum

Parameters
[in]specspectrum

Definition at line 77 of file PointsManager.cpp.

77  {
78  // check the map
79  if( m_specPointsMap.find( spec ) == m_specPointsMap.end() ) {
80  return;
81  }
82 
83  // clear
85  dps.clearPoints();
86 
87  // erase
88  m_specPointsMap.erase( spec );
89 }
data points data of profile management class
Definition: DataPoints.h:25
std::map< Spectrum *, kome::core::DataPoints > m_specPointsMap
Definition: PointsManager.h:55
void clearPoints()
clear all data points
Definition: XYData.cpp:137

Here is the call graph for this function:

void kome::objects::PointsManager::deleteXYData ( Chromatogram chrom)

deletes xy data of specified chromatogram

Parameters
[in]chromchromatogram

Definition at line 92 of file PointsManager.cpp.

92  {
93  // check the map
94  if( m_chromPointsMap.find( chrom ) == m_chromPointsMap.end() ) {
95  return;
96  }
97 
98  // clear
100  dps.clearPoints();
101 
102  // erase
103  m_chromPointsMap.erase( chrom );
104 }
data points data of profile management class
Definition: DataPoints.h:25
void clearPoints()
clear all data points
Definition: XYData.cpp:137
std::map< Chromatogram *, kome::core::DataPoints > m_chromPointsMap
Definition: PointsManager.h:58

Here is the call graph for this function:

static PointsManager & kome::objects::PointsManager::getInstance ( )
static

get data points manager object (This is the only object.)

Returns
data points manager object

Definition at line 573 of file PointsManager.cpp.

573  {
574  // create object (This is the only object.)
575  static PointsManager mgr;
576 
577  return mgr;
578 }
data points management class
Definition: PointsManager.h:36
unsigned int kome::objects::PointsManager::getNumberOfOperations ( Spectrum spec)

gets the number of operations of specified spectrum

Parameters
[in]specspectrum
Returns
the number of operations of specified spectrum

Definition at line 357 of file PointsManager.cpp.

357  {
358  // check the parameter
359  if( spec == NULL ) {
360  return 0;
361  }
362 
363  // get size
364  if( m_specOperationMap.find( spec ) == m_specOperationMap.end() ) {
365  return 0;
366  }
367  return m_specOperationMap[ spec ].size();
368 }
std::map< Spectrum *, std::vector< XYDataOperation * > > m_specOperationMap
Definition: PointsManager.h:64
#define NULL
Definition: CoreMacros.h:18
unsigned int kome::objects::PointsManager::getNumberOfOperations ( Chromatogram chrom)

gets the number of operations of specified chromatogram

Parameters
[in]chromchromatogram
Returns
the number of specified chromatogram

Definition at line 371 of file PointsManager.cpp.

371  {
372  // check the parameter
373  if( chrom == NULL ) {
374  return 0;
375  }
376 
377  // get size
378  if( m_chromOperationMap.find( chrom ) == m_chromOperationMap.end() ) {
379  return 0;
380  }
381  return m_chromOperationMap[ chrom ].size();
382 }
std::map< Chromatogram *, std::vector< XYDataOperation * > > m_chromOperationMap
Definition: PointsManager.h:67
#define NULL
Definition: CoreMacros.h:18
unsigned int kome::objects::PointsManager::getNumberOfOperations ( Sample sample)

gets the number of operations of specified sample

Parameters
[in]samplesample object
Returns
the number of specified sample

Definition at line 385 of file PointsManager.cpp.

385  {
386  // check the parameter
387  if( sample == NULL ){
388  return 0;
389  }
390 
391  // get size
392  if( m_sampleOperationMap.find( sample) == m_sampleOperationMap.end() ){
393  return 0;
394  }
395  return m_sampleOperationMap[ sample ].size();
396 }
std::map< Sample *, std::vector< XYDataOperation * > > m_sampleOperationMap
Definition: PointsManager.h:70
#define NULL
Definition: CoreMacros.h:18
XYDataOperation * kome::objects::PointsManager::getOperation ( Spectrum spec,
const unsigned int  index 
)

gets operation of specified spectrum

Parameters
[in]specspectrum
[in]indexoperation index
Returns
operation (If NULL, specified spectrum has no operations or the index is illegal.)

Definition at line 399 of file PointsManager.cpp.

399  {
400  // check the parameter
401  if( spec == NULL ) {
402  return NULL;
403  }
404 
405  // operations
406  if( m_specOperationMap.find( spec ) == m_specOperationMap.end() ) {
407  return NULL;
408  }
409  std::vector< XYDataOperation* >& operations = m_specOperationMap[ spec ];
410 
411  // check the index
412  if( index >= operations.size() ) {
413  return NULL;
414  }
415  return operations[ index ];
416 }
std::map< Spectrum *, std::vector< XYDataOperation * > > m_specOperationMap
Definition: PointsManager.h:64
#define NULL
Definition: CoreMacros.h:18
XYDataOperation * kome::objects::PointsManager::getOperation ( Chromatogram chrom,
const unsigned int  index 
)

gets operation of specified chromatogram

Parameters
[in]chromchromatogram
[in]indexchromatogram index
Returns
operation (If NULL, specified chromatogram has no operations or the index is illegal.)

Definition at line 419 of file PointsManager.cpp.

419  {
420  // check the parameter
421  if( chrom == NULL ) {
422  return NULL;
423  }
424 
425  // operations
426  if( m_chromOperationMap.find( chrom ) == m_chromOperationMap.end() ) {
427  return NULL;
428  }
429  std::vector< XYDataOperation* >& operations = m_chromOperationMap[ chrom ];
430 
431  // check the index
432  if( index >= operations.size() ) {
433  return NULL;
434  }
435  return operations[ index ];
436 }
std::map< Chromatogram *, std::vector< XYDataOperation * > > m_chromOperationMap
Definition: PointsManager.h:67
#define NULL
Definition: CoreMacros.h:18
XYDataOperation * kome::objects::PointsManager::getOperation ( Sample sample,
const unsigned int  index 
)

gets operation of specified sample

Parameters
[in]samplesample object
[in]indexsample index
Returns
operation (If NULL, specified sample has no operations or the index is illegal.)

Definition at line 439 of file PointsManager.cpp.

439  {
440  // check the parameter
441  if( sample == NULL ){
442  return NULL;
443  }
444 
445  // operations
446  if( m_sampleOperationMap.find( sample ) == m_sampleOperationMap.end() ){
447  return NULL;
448  }
449  std::vector< XYDataOperation* >& operations = m_sampleOperationMap[ sample ];
450 
451  // check the index
452  if( index >= operations.size() ){
453  return NULL;
454  }
455  return operations[ index ];
456 }
std::map< Sample *, std::vector< XYDataOperation * > > m_sampleOperationMap
Definition: PointsManager.h:70
#define NULL
Definition: CoreMacros.h:18
kome::core::XYData * kome::objects::PointsManager::getXYData ( Spectrum spec)

gets xy data of specified spectrum

Parameters
[in]specspectrum
Returns
xy data object of specifid spectrum

Definition at line 50 of file PointsManager.cpp.

50  {
51  // points
53 
54  // get points
55  if( dps.getLength() == 0 ) {
56  spec->getXYData( &dps, true );
57  }
58 
59  return &dps;
60 }
data points data of profile management class
Definition: DataPoints.h:25
std::map< Spectrum *, kome::core::DataPoints > m_specPointsMap
Definition: PointsManager.h:55
kome::core::XYData * getXYData()
gets xy data from data manager
Definition: Spectrum.cpp:279
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:

kome::core::XYData * kome::objects::PointsManager::getXYData ( Chromatogram chrom)

gets xy data of specified chromatogram

Parameters
[in]chromchromatogram
Returns
xy data object of specifide chromatogram

Definition at line 63 of file PointsManager.cpp.

63  {
64  // points
66 
67  // get points
68  if( dps.getLength() == 0 ) {
69  chrom->getXYData( &dps, true );
70  }
71 
72  return &dps;
73 }
data points data of profile management class
Definition: DataPoints.h:25
kome::core::XYData * getXYData()
gets xy data from data manager
std::map< Chromatogram *, kome::core::DataPoints > m_chromPointsMap
Definition: PointsManager.h:58
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:

static bool kome::objects::PointsManager::lessOperation ( XYDataOperation opt0,
XYDataOperation opt1 
)
staticprotected

compare index of XYDataOperation to sort

Parameters
[in]opt0XYDataOperation to be compared
[in]opt1XYDataOperation to compare
Returns
If opt0 sorts before opt1, this method returns true.

Definition at line 567 of file PointsManager.cpp.

567  {
568  return ( opt0->getIndex() < opt1->getIndex() );
569 }

Here is the call graph for this function:

void kome::objects::PointsManager::onCloseChromatogram ( Chromatogram chrom,
const bool  deleting 
)
protectedvirtual

This method is called when a chromatogram is closed. (override method)

Parameters
[in]chromchromatogram object to be closed
[in]deletingIf true, the specified object is being deleted now.

Reimplemented from kome::objects::DefaultDataManager.

Definition at line 562 of file PointsManager.cpp.

562  {
563  deleteXYData( chrom );
564 }
void deleteXYData(Spectrum *spec)
deletes xy data of specified spectrum

Here is the call graph for this function:

void kome::objects::PointsManager::onCloseSample ( Sample sample,
const bool  deleting 
)
protectedvirtual

This method is called when a sample is closed. (override method)

Parameters
[in]samplesample object to be closed
[in]deletingIf true, the specified object is being deleted now.

Reimplemented from kome::objects::DefaultDataManager.

Definition at line 478 of file PointsManager.cpp.

478  {
479  // get spectra
480  std::set< Spectrum* > specSet;
481  for( std::map< Spectrum*, kome::core::DataPoints >::iterator it = m_specPointsMap.begin();
482  it != m_specPointsMap.end(); it++ ) {
483  Spectrum* spec = (*it).first;
484  if( spec->getSample() == sample ) {
485  specSet.insert( spec );
486  }
487  }
488  for( std::map< Spectrum*, std::vector< XYDataOperation* > >::iterator it = m_specOperationMap.begin();
489  it != m_specOperationMap.end(); it++ ) {
490  Spectrum* spec = (*it).first;
491  if( spec->getSample() == sample ) {
492  specSet.insert( spec );
493  }
494  }
495 
496  // delete spectra
497  for( std::set< Spectrum* >::iterator it = specSet.begin(); it != specSet.end(); it++ ) {
498  // spectrum
499  Spectrum* spec = *it;
500 
501  // delete operation
502  if( m_specOperationMap.find( spec ) != m_specOperationMap.end() ) {
503  std::vector< XYDataOperation* >& operations = m_specOperationMap[ spec ];
504  for( unsigned int i = 0; i < operations.size(); i++ ) {
505  deleteOperation( operations[ i ] );
506  }
507 
508  m_specOperationMap.erase( spec );
509  }
510 
511  // delete points
512  if( m_specPointsMap.find( spec ) != m_specPointsMap.end() ) {
513  m_specPointsMap.erase( spec );
514  }
515  }
516 
517  // get chromatograms
518  std::set< Chromatogram* > chromSet;
519  for( std::map< Chromatogram*, kome::core::DataPoints >::iterator it = m_chromPointsMap.begin();
520  it != m_chromPointsMap.end(); it++ ) {
521  Chromatogram* chrom = (*it).first;
522  if( chrom->getSample() == sample ) {
523  chromSet.insert( chrom );
524  }
525  }
526  for( std::map< Chromatogram*, std::vector< XYDataOperation* > >::iterator it = m_chromOperationMap.begin();
527  it != m_chromOperationMap.end(); it++ ) {
528  Chromatogram* chrom = (*it).first;
529  if( chrom->getSample() == sample ) {
530  chromSet.insert( chrom );
531  }
532  }
533 
534  // delete chromatograms
535  for( std::set< Chromatogram* >::iterator it = chromSet.begin(); it != chromSet.end(); it++ ) {
536  // chromatogram
537  Chromatogram* chrom = *it;
538 
539  // delete operation
540  if( m_chromOperationMap.find( chrom ) != m_chromOperationMap.end() ) {
541  std::vector< XYDataOperation* >& operations = m_chromOperationMap[ chrom ];
542  for( unsigned int i = 0; i < operations.size(); i++ ) {
543  deleteOperation( operations[ i ] );
544  }
545 
546  m_chromOperationMap.erase( chrom );
547  }
548 
549  // delete points
550  if( m_chromPointsMap.find( chrom ) != m_chromPointsMap.end() ) {
551  m_chromPointsMap.erase( chrom );
552  }
553  }
554 }
Sample * getSample()
gets the sample that has this spectrum
Definition: Spectrum.cpp:108
Sample * getSample()
gets sample
std::map< Spectrum *, kome::core::DataPoints > m_specPointsMap
Definition: PointsManager.h:55
std::map< Spectrum *, std::vector< XYDataOperation * > > m_specOperationMap
Definition: PointsManager.h:64
void deleteOperation(XYDataOperation *operation)
deletes operation object
std::map< Chromatogram *, std::vector< XYDataOperation * > > m_chromOperationMap
Definition: PointsManager.h:67
spectrum information management class
Definition: Spectrum.h:30
std::map< Chromatogram *, kome::core::DataPoints > m_chromPointsMap
Definition: PointsManager.h:58
chromatogram information management class
Definition: Chromatogram.h:33

Here is the call graph for this function:

void kome::objects::PointsManager::onCloseSpectrum ( Spectrum spec,
const bool  deleting 
)
protectedvirtual

This method is called when a spectrum is closed. (override method)

Parameters
[in]specspectrum object to be opened
[in]deletingIf true, the specified object is being deleted now.

Reimplemented from kome::objects::DefaultDataManager.

Definition at line 557 of file PointsManager.cpp.

557  {
558  deleteXYData( spec );
559 }
void deleteXYData(Spectrum *spec)
deletes xy data of specified spectrum

Here is the call graph for this function:

void kome::objects::PointsManager::removeOperation ( Spectrum spec,
XYDataOperation operation 
)

removes data operation from specified spectrum

Parameters
[in]specspectrum
[in]operationdata operation object

Definition at line 189 of file PointsManager.cpp.

189  {
190  // check parameters
191  if( spec == NULL || operation == NULL ) {
192  return;
193  }
194 
195  // search
196  if( m_specOperationMap.find( spec ) == m_specOperationMap.end() ) {
197  return;
198  }
199  std::vector< XYDataOperation* >& operations = m_specOperationMap[ spec ];
200  int idx = -1;
201 
202  for( int i = 0; i < (int)operations.size() && idx < 0; i++ ) {
203  if( operations[ i ] == operation ) {
204  idx = i;
205  }
206  }
207  if( idx < 0 ) {
208  return;
209  }
210 
211  // remove operation
212  operations.erase( operations.begin() + idx );
213 
214  // sort
215  if( operations.size() == 0 ) {
216  m_specOperationMap.erase( spec );
217  }
218 
219  deleteOperation( operation );
220 }
std::map< Spectrum *, std::vector< XYDataOperation * > > m_specOperationMap
Definition: PointsManager.h:64
void deleteOperation(XYDataOperation *operation)
deletes operation object
#define NULL
Definition: CoreMacros.h:18

Here is the call graph for this function:

void kome::objects::PointsManager::removeOperation ( Chromatogram chrom,
XYDataOperation operation 
)

removes data operation from specified chromtogram

Parameters
[in]chromchromatogram
[in]operationdata operation object

Definition at line 223 of file PointsManager.cpp.

223  {
224  // check parameters
225  if( chrom == NULL || operation == NULL ) {
226  return;
227  }
228 
229  // search
230  if( m_chromOperationMap.find( chrom ) == m_chromOperationMap.end() ) {
231  return;
232  }
233  std::vector< XYDataOperation* >& operations = m_chromOperationMap[ chrom ];
234  int idx = -1;
235 
236  for( int i = 0; i < (int)operations.size() && idx < 0; i++ ) {
237  if( operations[ i ] == operation ) {
238  idx = i;
239  }
240  }
241  if( idx < 0 ) {
242  return;
243  }
244 
245  // remove operation
246  operations.erase( operations.begin() + idx );
247  if( operations.size() == 0 ) {
248  m_chromOperationMap.erase( chrom );
249  }
250 
251  deleteOperation( operation );
252 }
void deleteOperation(XYDataOperation *operation)
deletes operation object
std::map< Chromatogram *, std::vector< XYDataOperation * > > m_chromOperationMap
Definition: PointsManager.h:67
#define NULL
Definition: CoreMacros.h:18

Here is the call graph for this function:

void kome::objects::PointsManager::removeOperation ( Sample sample,
XYDataOperation operation 
)

removes data operation from specified sample

Parameters
[in]samplesample object
[in]operationdata operation object

Definition at line 255 of file PointsManager.cpp.

255  {
256  // check parameters
257  if( sample == NULL || operation == NULL ){
258  return;
259  }
260 
261  // search
262  if( m_sampleOperationMap.find( sample) == m_sampleOperationMap.end() ){
263  return;
264  }
265  std::vector< XYDataOperation* >& operations = m_sampleOperationMap[ sample ];
266  int idx = -1;
267 
268  for( int i=0; i < (int)operations.size() && idx < 0; i++ ){
269  if( operations[ i ] == operation ){
270  idx = i;
271  }
272  }
273  if( idx < 0 ){
274  return;
275  }
276 
277  // remove operation
278  operations.erase( operations.begin() + idx );
279  if( operations.size() == 0 ){
280  m_sampleOperationMap.erase( sample );
281  }
282 
283  deleteOperation( operation );
284 }
void deleteOperation(XYDataOperation *operation)
deletes operation object
std::map< Sample *, std::vector< XYDataOperation * > > m_sampleOperationMap
Definition: PointsManager.h:70
#define NULL
Definition: CoreMacros.h:18

Here is the call graph for this function:

Member Data Documentation

std::map< Chromatogram*, std::vector< XYDataOperation* > > kome::objects::PointsManager::m_chromOperationMap
protected

chromatogram operatin map

Definition at line 67 of file PointsManager.h.

std::map< Chromatogram*, kome::core::DataPoints > kome::objects::PointsManager::m_chromPointsMap
protected

chromatogram data map

Definition at line 58 of file PointsManager.h.

std::map< XYDataOperation*, int > kome::objects::PointsManager::m_countMap
protected

operation count map

Definition at line 52 of file PointsManager.h.

std::map< Sample*, std::vector< XYDataOperation* > > kome::objects::PointsManager::m_sampleOperationMap
protected

sample operation map

Definition at line 70 of file PointsManager.h.

std::map< Sample*, kome::core::DataPoints > kome::objects::PointsManager::m_samplePointsMap
protected

sample data map

Definition at line 61 of file PointsManager.h.

std::map< Spectrum*, std::vector< XYDataOperation* > > kome::objects::PointsManager::m_specOperationMap
protected

spectrum operation map

Definition at line 64 of file PointsManager.h.

std::map< Spectrum*, kome::core::DataPoints > kome::objects::PointsManager::m_specPointsMap
protected

spectrum data map

Definition at line 55 of file PointsManager.h.


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