Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
DataMapManager.cpp
Go to the documentation of this file.
1 
12 #include "stdafx.h"
13 #include "DataMapManager.h"
14 
15 #include <list>
16 #include <math.h>
17 
18 
19 using namespace kome::objects; // @date 2011/06/16 <Add> OKADA
20 
21 
22 #include <crtdbg.h>
23 #ifdef _DEBUG
24  #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
25  #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
26 #endif // _DEBUG
27 
28 
29 
30 // constructor
32 }
33 
34 // destructor
36  for( std::map< kome::objects::DataGroupNode*, kome::objects::DataMapInfo* >::iterator it = m_dataMap.begin();
37  it != m_dataMap.end(); it++ ) {
38  delete (*it).second;
39  }
40  m_dataMap.clear();
41 }
42 
43 
44 std::map< kome::objects::DataGroupNode*, kome::objects::DataMapInfo* > DataMapManager::getDataMap(){
45  return m_dataMap;
46 }
47 
48 
49 void DataMapManager::setDataMap2( std::map< kome::objects::DataGroupNode*, kome::objects::DataMapInfo* > dataMap ){
50  m_dataMap = dataMap;
51  return;
52 }
53 
54 // on close sample
55 void DataMapManager::onCloseSample( kome::objects::Sample* sample, const bool deleting ) {
56  // add to array
57  std::vector< kome::objects::DataGroupNode* > groups;
58  for( std::map< kome::objects::DataGroupNode*, kome::objects::DataMapInfo* >::iterator it = m_dataMap.begin();
59  it != m_dataMap.end(); it++ ) {
60  kome::objects::DataGroupNode* group = (*it).first;
61  if( group->getSample() == sample ) {
62  groups.push_back( group );
63  }
64  }
65 
66  // delete
67  for( unsigned int i = 0; i < groups.size(); i++ ) {
68  kome::objects::DataGroupNode* group = groups[ i ];
69  delete m_dataMap[ group ];
70  m_dataMap.erase( group );
71  }
72 }
73 
74 // get instance
76  // create object (This is the only object.)
77  static DataMapManager mgr;
78 
79  return mgr;
80 }
group of spectrum management class
Definition: DataGroupNode.h:33
virtual void onCloseSample(kome::objects::Sample *sample, const bool deleting)
This method is called when a sample is closed. (override method)
sample information management class
Definition: Sample.h:34
std::map< kome::objects::DataGroupNode *, kome::objects::DataMapInfo * > m_dataMap
void setDataMap2(std::map< kome::objects::DataGroupNode *, kome::objects::DataMapInfo * > dataMap)
sets the map of data map
class to draw profile
static DataMapManager & getInstance()
gets instance. (This is the only object.)
virtual ~DataMapManager()
destructor
interfaces of DataMapManager class
std::map< kome::objects::DataGroupNode *, kome::objects::DataMapInfo * > getDataMap()
gets the map of data map.
Sample * getSample()
gets sample
Definition: DataSet.cpp:49