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

group of spectrum management class More...

#include <DataGroupNode.h>

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

Public Member Functions

 DataGroupNode (Sample *sample, const char *name)
 constructor More...
 
virtual ~DataGroupNode ()
 destructor
 
void setId (int id)
 sets group id More...
 
int getId ()
 gets gropu id More...
 
void setName (const char *name)
 sets group name More...
 
const char * getName ()
 gets group name More...
 
void setGroupIndex (const int index)
 sets group index More...
 
int getGroupIndex ()
 gets group index More...
 
DataGroupNodegetParentGroup ()
 get parent spectrum group More...
 
DataGroupNodecreateChildGroup (const char *name)
 creates new child group object More...
 
void removeChildGroup (DataGroupNode *child)
 removes child group More...
 
unsigned int getNumberOfChildren ()
 gets the number of children More...
 
DataGroupNodegetChild (const unsigned int index)
 gets child group More...
 
void getDataSet (DataSet *dataSet)
 gets spectra that contains this group. (getSpectrum method cannot get spectra that belong to child group.) More...
 
void setAutoScanNumber (const bool autoScanNumber)
 sets the auto scan number flag More...
 
bool isAutoScanNumber ()
 gets the auto scan number flag More...
 
void setSpecXTitle (const char *title)
 sets spectrum x axis title More...
 
const char * getSpecXTitle ()
 gets spectrum x axis title More...
 
void setSpecYTitle (const char *title)
 sets spectrum y axis title More...
 
const char * getSpecYTitle ()
 gets spectrum y axis title More...
 
void setChromXTitle (const char *title)
 sets chromatogram x axis title More...
 
const char * getChromXTitle ()
 gets chromatogram x axis title More...
 
void setChromYTitle (const char *title)
 sets chromatogram y axis title More...
 
const char * getChromYTitle ()
 gets chromatogram y axis title More...
 
unsigned int getLevel ()
 gets group level More...
 
kome::core::PropertiesgetProperties ()
 gets properties More...
 
kome::core::PropertiesgetUserProperties ()
 gets user properties More...
 
virtual void sortSpectra ()
 sorts spectra in retention time order (override method)
 
virtual void insertSpectrum (Spectrum *spectrum, const int idx)
 adds spectrum to group (override method ) More...
 
virtual void insertChromatogram (Chromatogram *chrom, const int idx)
 adds chromatogram (override method) More...
 
- Public Member Functions inherited from kome::objects::DataSet
 DataSet ()
 constructor
 
 DataSet (DataGroupNode *group)
 constructor More...
 
virtual ~DataSet ()
 destructor
 
SamplegetSample ()
 gets sample More...
 
DataGroupNodegetGroup ()
 gets spectrum group More...
 
unsigned int getNumberOfSpectra ()
 gets the number of spectra More...
 
SpectrumgetSpectrum (const unsigned int index)
 gets the number of spectra More...
 
unsigned int getNumberOfChromatograms ()
 gets the number of chromatograms More...
 
ChromatogramgetChromatogram (const unsigned int index)
 gets chroamtogram More...
 
virtual void clearSpectra ()
 clears spectra
 
virtual void addSpectrum (Spectrum *spec)
 adds spectrum to group More...
 
virtual void removeSpectrum (Spectrum *spec)
 removes spectrum More...
 
virtual void clearChromatograms ()
 clears chromatograms
 
virtual void addChromatogram (Chromatogram *chrom)
 adds chromatogram More...
 
virtual void removeChromatogram (Chromatogram *chrom)
 removes chromatogram More...
 

Protected Member Functions

void setParentDataGroupNode (DataGroupNode *parent)
 sets parent spectrum group More...
 
void createDefaultChromatogram ()
 creates default chromatogram
 

Protected Attributes

DataGroupNodem_parent
 
std::string m_name
 
int m_index
 
short m_level
 
std::vector< DataGroupNode * > m_children
 
std::string m_specXTitle
 
std::string m_specYTitle
 
std::string m_chromXTitle
 
std::string m_chromYTitle
 
kome::core::Properties m_properties
 
kome::core::Properties m_userProperties
 
int m_groupId
 
bool m_autoScanNumber
 
- Protected Attributes inherited from kome::objects::DataSet
Samplem_sample
 
DataGroupNodem_group
 
std::vector< Spectrum * > m_spectra
 
std::vector< Chromatogram * > m_chroms
 

Additional Inherited Members

- Static Protected Member Functions inherited from kome::objects::DataSet
static bool lessSpectrum (Spectrum *spec0, Spectrum *spec1)
 compare to sort spectra More...
 

Detailed Description

group of spectrum management class

Definition at line 33 of file DataGroupNode.h.

Constructor & Destructor Documentation

kome::objects::DataGroupNode::DataGroupNode ( Sample sample,
const char *  name 
)

constructor

Parameters
[in]samplesample object that has this spectrum group
[in]namespectrum group name

Definition at line 40 of file DataGroupNode.cpp.

40  : DataSet( NULL ) {
41  // log
42  LOG_TRACE( FMT( "Creating spectrum group... (%s)", NVL( name, "" ) ) );
43 
44  // initialize
45  m_group = this;
46  m_sample = sample;
47  setName( name );
48  m_index = -1;
49  m_parent = NULL;
50  m_autoScanNumber = true;
51 
52  // axis title
53  m_specXTitle = DEFAULT_SPEC_X_TITLE;
54  m_specYTitle = DEFAULT_SPEC_Y_TITLE;
55  m_chromXTitle = DEFAULT_CHROM_X_TITLE;
56  m_chromYTitle = DEFAULT_CHROM_Y_TITLE;
57 
58  // level
59  m_level = 0;
60 
61  // issue group id
62  if( sample != NULL ){
63  m_groupId = sample->issueGroupId( sample );
64  }
65 }
void setName(const char *name)
sets group name
DataGroupNode * m_group
Definition: DataSet.h:57
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
#define NULL
Definition: CoreMacros.h:18
DataSet()
constructor
Definition: DataSet.cpp:33
int issueGroupId(Sample *sample)
to issue the group id
Definition: Sample.cpp:526

Here is the call graph for this function:

Member Function Documentation

DataGroupNode * kome::objects::DataGroupNode::createChildGroup ( const char *  name)

creates new child group object

Parameters
[in]namechild group name
Returns
the pointer to new child object

Definition at line 114 of file DataGroupNode.cpp.

114  {
115  // create child group object
116  DataGroupNode* child = new DataGroupNode( m_sample, name );
117  child->m_level = m_level + 1;
118  child->setParentDataGroupNode( this );
119 
120  // add object to the array
121  m_children.push_back( child );
122 
123  return child;
124 }
void setParentDataGroupNode(DataGroupNode *parent)
sets parent spectrum group
group of spectrum management class
Definition: DataGroupNode.h:33
DataGroupNode(Sample *sample, const char *name)
constructor
std::vector< DataGroupNode * > m_children
Definition: DataGroupNode.h:63

Here is the call graph for this function:

DataGroupNode * kome::objects::DataGroupNode::getChild ( const unsigned int  index)

gets child group

Parameters
[in]indexchild group index
Returns
the pointer to the child group. (If index is illegal number, this method returns NULL.)

Definition at line 149 of file DataGroupNode.cpp.

149  {
150  // check the index
151  if( index >= m_children.size() ) {
152  return NULL;
153  }
154  return m_children[ index ];
155 }
#define NULL
Definition: CoreMacros.h:18
std::vector< DataGroupNode * > m_children
Definition: DataGroupNode.h:63
const char * kome::objects::DataGroupNode::getChromXTitle ( )

gets chromatogram x axis title

Returns
chromatogram x axis title

Definition at line 216 of file DataGroupNode.cpp.

216  {
217  return m_chromXTitle.c_str();
218 }
const char * kome::objects::DataGroupNode::getChromYTitle ( )

gets chromatogram y axis title

Returns
chromatogram y axis title

Definition at line 226 of file DataGroupNode.cpp.

226  {
227  return m_chromYTitle.c_str();
228 }
void kome::objects::DataGroupNode::getDataSet ( DataSet dataSet)

gets spectra that contains this group. (getSpectrum method cannot get spectra that belong to child group.)

Parameters
[out]dataSetdata set object to store spectrum information

Definition at line 158 of file DataGroupNode.cpp.

158  {
159  // check parameter
160  if( dataSet == NULL ) {
161  return;
162  }
163 
164  // get chromatograms
165  for( unsigned int i = 0; i < m_chroms.size(); i++ ) {
166  dataSet->addChromatogram( m_chroms[ i ] );
167  }
168 
169  // get spectra
170  for( unsigned int i = 0; i < m_spectra.size(); i++ ) {
171  dataSet->addSpectrum( m_spectra[ i ] );
172  }
173 
174  // gets spectra that belong to child group
175  for( unsigned int i = 0; i < m_children.size(); i++ ) {
176  m_children[ i ]->getDataSet( dataSet );
177  }
178 }
virtual void addChromatogram(Chromatogram *chrom)
adds chromatogram
Definition: DataSet.cpp:217
#define NULL
Definition: CoreMacros.h:18
std::vector< DataGroupNode * > m_children
Definition: DataGroupNode.h:63
std::vector< Spectrum * > m_spectra
Definition: DataSet.h:60
std::vector< Chromatogram * > m_chroms
Definition: DataSet.h:63
virtual void addSpectrum(Spectrum *spec)
adds spectrum to group
Definition: DataSet.cpp:167

Here is the call graph for this function:

int kome::objects::DataGroupNode::getGroupIndex ( )

gets group index

Returns
group index

Definition at line 104 of file DataGroupNode.cpp.

104  {
105  return m_index;
106 }
int kome::objects::DataGroupNode::getId ( )

gets gropu id

Returns
group id

Definition at line 332 of file DataGroupNode.cpp.

332  {
333  return m_groupId;
334 }
unsigned int kome::objects::DataGroupNode::getLevel ( )

gets group level

Returns
group level

Definition at line 231 of file DataGroupNode.cpp.

231  {
232  return m_level;
233 }
const char * kome::objects::DataGroupNode::getName ( )

gets group name

Returns
group name

Definition at line 94 of file DataGroupNode.cpp.

94  {
95  return m_name.c_str();
96 }
unsigned int kome::objects::DataGroupNode::getNumberOfChildren ( )

gets the number of children

Returns
the number of children

Definition at line 144 of file DataGroupNode.cpp.

144  {
145  return m_children.size();
146 }
std::vector< DataGroupNode * > m_children
Definition: DataGroupNode.h:63
DataGroupNode * kome::objects::DataGroupNode::getParentGroup ( )

get parent spectrum group

Returns
parent spectrum group. (If this is root group, this method returns NULL.)

Definition at line 109 of file DataGroupNode.cpp.

109  {
110  return m_parent;
111 }
kome::core::Properties & kome::objects::DataGroupNode::getProperties ( )

gets properties

Returns
properties

Definition at line 236 of file DataGroupNode.cpp.

236  {
237  return m_properties;
238 }
kome::core::Properties m_properties
Definition: DataGroupNode.h:76
const char * kome::objects::DataGroupNode::getSpecXTitle ( )

gets spectrum x axis title

Returns
spectrum x axis title

Definition at line 196 of file DataGroupNode.cpp.

196  {
197  return m_specXTitle.c_str();
198 }
const char * kome::objects::DataGroupNode::getSpecYTitle ( )

gets spectrum y axis title

Returns
spectrum y axis title

Definition at line 206 of file DataGroupNode.cpp.

206  {
207  return m_specYTitle.c_str();
208 }
kome::core::Properties & kome::objects::DataGroupNode::getUserProperties ( )

gets user properties

Returns
properties

Definition at line 241 of file DataGroupNode.cpp.

241  {
242  return m_userProperties;
243 }
kome::core::Properties m_userProperties
Definition: DataGroupNode.h:79
void kome::objects::DataGroupNode::insertChromatogram ( Chromatogram chrom,
const int  idx 
)
virtual

adds chromatogram (override method)

Parameters
[in]chromchromatogram
[in]idxinsert position

Reimplemented from kome::objects::DataSet.

Definition at line 306 of file DataGroupNode.cpp.

306  {
307  // check the object
308  if( chrom == NULL ) {
309  return;
310  }
311 
312  // insert
313  m_chroms.insert( m_chroms.begin() + idx, chrom );
314  chrom->setGroup( this );
315 
316  // delete
317  for( int i = (int)m_chroms.size() - 1; i >= 0; i-- ) {
318  Chromatogram* tmp = m_chroms[ i ];
319  if( tmp->isAutoCreated() ) {
320  m_chroms.erase( m_chroms.begin() + i );
321  delete tmp;
322  }
323  }
324 }
void setGroup(DataGroupNode *group)
sets spectrum group
#define NULL
Definition: CoreMacros.h:18
bool isAutoCreated()
gets auto created flag value
chromatogram information management class
Definition: Chromatogram.h:33
std::vector< Chromatogram * > m_chroms
Definition: DataSet.h:63

Here is the call graph for this function:

void kome::objects::DataGroupNode::insertSpectrum ( Spectrum spectrum,
const int  idx 
)
virtual

adds spectrum to group (override method )

Parameters
[in]spectrumspectrum object to be added
[in]idxinsert position

Reimplemented from kome::objects::DataSet.

Definition at line 284 of file DataGroupNode.cpp.

284  {
285  // check the parameter
286  if( spectrum == NULL ) {
287  return;
288  }
289 
290  // set spectrum properties
291  int scanNum = (int)m_spectra.size();
292 
293  if( spectrum->getScanNumber() < 0 && m_autoScanNumber ) {
294  spectrum->setScanNumber( scanNum );
295  }
296  spectrum->setGroup( this );
297 
298  // insert spectrum
299  m_spectra.insert( m_spectra.begin() + idx, spectrum );
300 
301  // default chromatogram
303 }
void createDefaultChromatogram()
creates default chromatogram
int getScanNumber()
gets scan number
Definition: Spectrum.cpp:915
#define NULL
Definition: CoreMacros.h:18
std::vector< Spectrum * > m_spectra
Definition: DataSet.h:60
void setScanNumber(const int scan)
sets scan number
Definition: Spectrum.cpp:903
void setGroup(DataGroupNode *group)
sets spectrum group
Definition: Spectrum.cpp:893

Here is the call graph for this function:

bool kome::objects::DataGroupNode::isAutoScanNumber ( )

gets the auto scan number flag

Returns
auto scan number flag

Definition at line 186 of file DataGroupNode.cpp.

186  {
187  return m_autoScanNumber;
188 }
void kome::objects::DataGroupNode::removeChildGroup ( DataGroupNode child)

removes child group

Parameters
[in]childchild group to be removed.

Definition at line 127 of file DataGroupNode.cpp.

127  {
128  // index
129  int idx = -1;
130  for( int i = 0; i < (int)m_children.size() && idx < 0; i++ ) {
131  DataGroupNode* tmp = m_children[ i ];
132  if( tmp == child ) {
133  idx = i;
134  }
135  }
136 
137  // removee
138  if( idx >= 0 ) {
139  m_children.erase( m_children.begin() + idx );
140  }
141 }
group of spectrum management class
Definition: DataGroupNode.h:33
std::vector< DataGroupNode * > m_children
Definition: DataGroupNode.h:63
void kome::objects::DataGroupNode::setAutoScanNumber ( const bool  autoScanNumber)

sets the auto scan number flag

Parameters
[in]autoScanNumberauto scan number flag

Definition at line 181 of file DataGroupNode.cpp.

181  {
182  m_autoScanNumber = autoScanNumber;
183 }
void kome::objects::DataGroupNode::setChromXTitle ( const char *  title)

sets chromatogram x axis title

Parameters
[in]titlechromatogram x axis title

Definition at line 211 of file DataGroupNode.cpp.

211  {
212  m_chromXTitle = std::string( NVL( title, "" ) );
213 }
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
void kome::objects::DataGroupNode::setChromYTitle ( const char *  title)

sets chromatogram y axis title

Parameters
[in]titlechromatogram y axis title

Definition at line 221 of file DataGroupNode.cpp.

221  {
222  m_chromYTitle = std::string( NVL( title, "" ) );
223 }
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
void kome::objects::DataGroupNode::setGroupIndex ( const int  index)

sets group index

Parameters
[in]indexgroup index

Definition at line 99 of file DataGroupNode.cpp.

99  {
100  m_index = index;
101 }
void kome::objects::DataGroupNode::setId ( int  id)

sets group id

Parameters
[in]idgroup id

Definition at line 327 of file DataGroupNode.cpp.

327  {
328  m_groupId = id;
329 }
void kome::objects::DataGroupNode::setName ( const char *  name)

sets group name

Parameters
[in]namegroup name

Definition at line 89 of file DataGroupNode.cpp.

89  {
90  m_name = std::string( NVL( name, "" ) );
91 }
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
void kome::objects::DataGroupNode::setParentDataGroupNode ( DataGroupNode parent)
protected

sets parent spectrum group

Parameters
[in]parentparent spectrum group

Definition at line 246 of file DataGroupNode.cpp.

246  {
247  m_parent = parent;
248 }
void kome::objects::DataGroupNode::setSpecXTitle ( const char *  title)

sets spectrum x axis title

Parameters
[in]titlespectrum x axis title

Definition at line 191 of file DataGroupNode.cpp.

191  {
192  m_specXTitle = std::string( NVL( title, "" ) );
193 }
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99
void kome::objects::DataGroupNode::setSpecYTitle ( const char *  title)

sets spectrum y axis title

Parameters
[in]titlespectrum y axis title

Definition at line 201 of file DataGroupNode.cpp.

201  {
202  m_specYTitle = std::string( NVL( title, "" ) );
203 }
#define NVL(checkVal, replaceVal)
Definition: CoreMacros.h:99

Member Data Documentation

bool kome::objects::DataGroupNode::m_autoScanNumber
protected

auto scan number

Definition at line 85 of file DataGroupNode.h.

std::vector< DataGroupNode* > kome::objects::DataGroupNode::m_children
protected

the array of child groups

Definition at line 63 of file DataGroupNode.h.

std::string kome::objects::DataGroupNode::m_chromXTitle
protected

chromatogram x axis title

Definition at line 71 of file DataGroupNode.h.

std::string kome::objects::DataGroupNode::m_chromYTitle
protected

chromatogram y axis title

Definition at line 73 of file DataGroupNode.h.

int kome::objects::DataGroupNode::m_groupId
protected

group id

Definition at line 82 of file DataGroupNode.h.

int kome::objects::DataGroupNode::m_index
protected

group index

Definition at line 57 of file DataGroupNode.h.

short kome::objects::DataGroupNode::m_level
protected

level

Definition at line 60 of file DataGroupNode.h.

std::string kome::objects::DataGroupNode::m_name
protected

group name

Definition at line 54 of file DataGroupNode.h.

DataGroupNode* kome::objects::DataGroupNode::m_parent
protected

parent group

Definition at line 51 of file DataGroupNode.h.

kome::core::Properties kome::objects::DataGroupNode::m_properties
protected

properties

Definition at line 76 of file DataGroupNode.h.

std::string kome::objects::DataGroupNode::m_specXTitle
protected

spectrum x axis title

Definition at line 66 of file DataGroupNode.h.

std::string kome::objects::DataGroupNode::m_specYTitle
protected

spectrum y axis title

Definition at line 68 of file DataGroupNode.h.

kome::core::Properties kome::objects::DataGroupNode::m_userProperties
protected

user properties

Definition at line 79 of file DataGroupNode.h.


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