Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
XYDataOperation.cpp
Go to the documentation of this file.
1 
11 #include "stdafx.h"
12 #include "XYDataOperation.h"
13 
14 
15 using namespace kome::objects;
16 
17 
18 #include <crtdbg.h>
19 #ifdef _DEBUG
20  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
21  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
22 #endif // _DEBUG
23 
24 
25 
26 // constructor
28  m_index = -1;
29 }
30 
31 // destructor
33 }
34 
35 // set name
36 void XYDataOperation::setName( const char* name ) {
37  m_name = NVL( name, "" );
38 }
39 
40 // get name
41 const char* XYDataOperation::getName() {
42  return m_name.c_str();
43 }
44 
45 // set index
46 void XYDataOperation::setIndex( int index ){
47  m_index = index;
48 }
49 
50 // get index
52  return m_index;
53 }
54 
55 // update spectrum
57  kome::core::XYData& src,
58  kome::core::XYData& dst,
59  Spectrum& spec
60 ) {
61  // copy
63  pt.reserve( src.getLength() );
64  for( unsigned int i = 0; i < src.getLength(); i++ ) {
65  pt.addPoint( src.getX( i ), src.getY( i ) );
66  }
67 
68  // clear
69  dst.clearPoints();
70 
71  // update
72  onUpdate( pt, dst, spec );
73 }
74 
75 // update chromatogram
77  kome::core::XYData& src,
78  kome::core::XYData& dst,
79  Chromatogram& chrom
80 ) {
81  // copy
83  pt.reserve( src.getLength() );
84  for( unsigned int i = 0; i < src.getLength(); i++ ) {
85  pt.addPoint( src.getX( i ), src.getY( i ) );
86  }
87 
88  // clear
89  dst.clearPoints();
90 
91  // update
92  onUpdate( pt, dst, chrom );
93 }
94 
95 // update
97  kome::core::XYData& src,
98  kome::core::XYData& dst,
99  Sample& sample
100 ){
101  // copy
103  pt.reserve( src.getLength() );
104  for( unsigned int i = 0; i < src.getLength(); i++ ) {
105  pt.addPoint( src.getX( i ), src.getY( i ) );
106  }
107 
108  // clear
109  dst.clearPoints();
110 
111  // update
112  onUpdate( pt, dst, sample );
113 }
abstraction class of two dimention coordinate data
Definition: XYData.h:34
data points data of profile management class
Definition: DataPoints.h:25
double getX(const unsigned int index)
gets x coordinate
Definition: XYData.cpp:224
virtual ~XYDataOperation()
destructor
sample information management class
Definition: Sample.h:34
void clearPoints()
clear all data points
Definition: XYData.cpp:137
double getY(const unsigned int index)
gets y coordinate
Definition: XYData.cpp:243
void update(kome::core::XYData &src, kome::core::XYData &dst, Chromatogram &chrom)
updates xy data
void setName(const char *name)
sets name
interfaces of XYDataOperation class
virtual void onUpdate(kome::core::XYData &src, kome::core::XYData &dst, kome::objects::Chromatogram &chrom)=0
This method is called by update method. (abstract method)
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
void reserve(const unsigned int num)
reserves enough contiguous memory of array
Definition: XYData.cpp:262
spectrum information management class
Definition: Spectrum.h:30
void setIndex(int index)
set index
void addPoint(const double x, const double y)
adds point
Definition: XYData.cpp:149
chromatogram information management class
Definition: Chromatogram.h:33
const char * getName()
gets name
unsigned int getLength()
gets the number of points @return the number of points
Definition: XYData.cpp:216