PosXrayFileMgr.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma once
  2. #include "afx.h"
  3. #include "stdafx.h"
  4. #include "OTSFileSys.h"
  5. #include "OTSHelper.h"
  6. #include "PosXray.h"
  7. #include "OTSPeak.h"
  8. #include "XRayDataDB.h"
  9. #include "ElementChemistryDB.h"
  10. #include "PosXrayInfoDB.h"
  11. #include "DBStoreFile.h"
  12. namespace OTSMODEL {
  13. using namespace OTSDATA;
  14. using namespace OTSSQLITE;
  15. class __declspec(dllexport) CPosXrayFileMgr : public CDBStoreFile
  16. {
  17. public:
  18. CPosXrayFileMgr(CString fileName);
  19. virtual ~CPosXrayFileMgr();
  20. virtual void Close() override
  21. {
  22. m_datastorePtr.reset();
  23. }
  24. //Create
  25. BOOL CreateXrayFile();
  26. // Load/Save
  27. BOOL Load(int fldId,CString a_strPathName = _T(""), BOOL a_bClear = TRUE);
  28. BOOL Save();
  29. // file pathname
  30. CString GetPathName() { return m_strPathName; }
  31. //x-ray
  32. CPosXrayList& GetPosXrayList() { return m_listPosXray; }
  33. void SetPosXrayList(CPosXrayList& a_listPosXray, BOOL a_bClear);
  34. //if has element chemistry
  35. BOOL GetIfHasElement() { return m_bHasElement; }
  36. void SetHasElement(BOOL a_bHasElement) { m_bHasElement = a_bHasElement; }
  37. // check if a xray containing any element of the elements list
  38. static BOOL IsXrayContainElements(CPosXrayPtr a_pXray, CElementsList& a_listElements, BOOL& a_bResult);
  39. // get peaks list of a x-ray
  40. static BOOL GetPeaksList(CPosXrayPtr a_pXray, COTSPeakList& a_listPeaks);
  41. CElementChemistryDBPtr GetElementChemistryDB();
  42. CXRayDataDBPtr GetXrayDataDB();
  43. CPosXrayInfoDBPtr GetXrayInfoDB();
  44. protected:
  45. BOOL GetXrayList(int fldId);
  46. BOOL SaveXrayList();
  47. // save posXrayList
  48. BOOL SaveXrayInfoList();
  49. BOOL GetXrayInfoList(CPosXrayList& a_listXra,int fldId);
  50. BOOL GetXrayData(const long a_nXrayId, const long a_nFieldId, CPosXrayPtr a_pPosXray);
  51. BOOL GetElementChemistry(const long a_nXrayId, const long a_nFieldId, const long a_nElementSize, CElementChemistriesList& a_listElementChemistry);
  52. // cleanup
  53. void Cleanup();
  54. // initialization
  55. void Init();
  56. // duplication
  57. void Duplicate(const CPosXrayFileMgr& a_oSource);
  58. // file pathname
  59. CString m_strPathName;
  60. // X-ray list
  61. CPosXrayList m_listPosXray;
  62. // if has element chemistry
  63. BOOL m_bHasElement;
  64. //database
  65. CXRayDataDBPtr m_pXrayDataDB;
  66. CElementChemistryDBPtr m_pElementChemistryDB;
  67. CPosXrayInfoDBPtr m_pXrayInfoDB;
  68. };
  69. typedef std::shared_ptr<CPosXrayFileMgr> __declspec(dllexport) CPosXrayFileMgrPtr;
  70. }