123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #pragma once
- #include "afx.h"
- #include "stdafx.h"
- #include "OTSFileSys.h"
- #include "OTSHelper.h"
- #include "PosXray.h"
- #include "OTSPeak.h"
- #include "XRayDataDB.h"
- #include "ElementChemistryDB.h"
- #include "PosXrayInfoDB.h"
- #include "DBStoreFile.h"
- namespace OTSMODEL {
- using namespace OTSDATA;
- using namespace OTSSQLITE;
- class __declspec(dllexport) CPosXrayFileMgr : public CDBStoreFile
- {
- public:
- CPosXrayFileMgr(CString fileName);
- virtual ~CPosXrayFileMgr();
- virtual void Close() override
- {
- m_datastorePtr.reset();
- }
- //Create
- BOOL CreateXrayFile();
- // Load/Save
- BOOL Load(int fldId,CString a_strPathName = _T(""), BOOL a_bClear = TRUE);
- BOOL Save();
- // file pathname
- CString GetPathName() { return m_strPathName; }
- //x-ray
- CPosXrayList& GetPosXrayList() { return m_listPosXray; }
- void SetPosXrayList(CPosXrayList& a_listPosXray, BOOL a_bClear);
- //if has element chemistry
- BOOL GetIfHasElement() { return m_bHasElement; }
- void SetHasElement(BOOL a_bHasElement) { m_bHasElement = a_bHasElement; }
-
- // check if a xray containing any element of the elements list
- static BOOL IsXrayContainElements(CPosXrayPtr a_pXray, CElementsList& a_listElements, BOOL& a_bResult);
- // get peaks list of a x-ray
- static BOOL GetPeaksList(CPosXrayPtr a_pXray, COTSPeakList& a_listPeaks);
- CElementChemistryDBPtr GetElementChemistryDB();
-
- CXRayDataDBPtr GetXrayDataDB();
- CPosXrayInfoDBPtr GetXrayInfoDB();
-
- protected:
- BOOL GetXrayList(int fldId);
- BOOL SaveXrayList();
- // save posXrayList
- BOOL SaveXrayInfoList();
- BOOL GetXrayInfoList(CPosXrayList& a_listXra,int fldId);
- BOOL GetXrayData(const long a_nXrayId, const long a_nFieldId, CPosXrayPtr a_pPosXray);
- BOOL GetElementChemistry(const long a_nXrayId, const long a_nFieldId, const long a_nElementSize, CElementChemistriesList& a_listElementChemistry);
-
- // cleanup
- void Cleanup();
- // initialization
- void Init();
- // duplication
- void Duplicate(const CPosXrayFileMgr& a_oSource);
- // file pathname
- CString m_strPathName;
- // X-ray list
- CPosXrayList m_listPosXray;
- // if has element chemistry
- BOOL m_bHasElement;
- //database
- CXRayDataDBPtr m_pXrayDataDB;
- CElementChemistryDBPtr m_pElementChemistryDB;
- CPosXrayInfoDBPtr m_pXrayInfoDB;
- };
- typedef std::shared_ptr<CPosXrayFileMgr> __declspec(dllexport) CPosXrayFileMgrPtr;
- }
|