12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #pragma once
- #include "OTSBrukerImpl_const.h"
- #include "PosXray.h"
- using namespace OTSDATA;
- namespace OTSController {
-
- enum class SPXLineType
- {
- NONE = 0,
- NAME,
- CHANNELS,
- CHANNEL_COUNT,
- CALIB_ABS,
- CALIB_LIN,
- SIGMA_ABS,
- SIGMA_LIN,
- };
- struct SPXLine
- {
- SPXLine(LPCSTR a_sLine, const SPXLineType a_nLineType = SPXLineType::NONE)
- {
- m_sLineString = a_sLine;
- m_nLineType = a_nLineType;
- }
- std::string m_sLineString;
- SPXLineType m_nLineType;
- };
- class __declspec(dllexport) CBrukerSPXFileMgr
- {
- public:
- CBrukerSPXFileMgr() { Init(); }
- ~CBrukerSPXFileMgr() {}
- BOOL LoadSpectrumHeader(LPCTSTR a_sFilePathName);
- BOOL SaveSpectrumHeader(LPCTSTR a_sFilePathName);
- BOOL SetSpectrumHeader(RTSpectrumHeaderRec* m_pSpectrumHeader);
- BOOL ExportXrayPoints(LPCTSTR a_sPath, LPCTSTR a_sSpectrumName, const std::vector<CPosXray*>& a_xrayPoints);
- BOOL ExportXrayPoints(LPCTSTR a_sPath, LPCTSTR a_sSpectrumName, const CPosXraysList& a_xrayPoints);
- //BOOL ExportXrayPoint(LPCTSTR a_sFilePathName, LPCTSTR a_sSpectrumName, CPosXray* a_pXrayPoint);
- BOOL ExportXrayPoint(const char* a_sFilePathName, const char* a_sSpectrumName, CPosXray* a_pXrayPoint);
- static void InitSpectrumHeader(RTSpectrumHeaderRec* a_pHeader);
- static bool InitSpectrumBuffer(char* a_pBuffer, CPosXray* a_pXrayPoint);
- protected:
- void Init();
-
- protected:
- RTSpectrumHeaderRec m_spectrumHeader;
- static std::vector<SPXLine> m_vSpxFileLines;
- // string conventions
- int CharToWChar(const char* a_psSource, wchar_t* a_psTarget)
- {
- size_t iRet = 0;
- size_t nLen = strlen(a_psSource) + 1;
- mbstowcs_s(&iRet, a_psTarget, nLen, a_psSource, nLen);
- return (int)iRet;
- }
- int WCharToChar(const wchar_t* a_psSource, char* a_psTarget)
- {
- size_t iRet = 0;
- size_t nLen = wcslen(a_psSource) * 2 + 2;
- wcstombs_s(&iRet, a_psTarget, nLen, a_psSource, nLen);
- return (int)iRet;
- }
- CString CharToString(const char* a_psSource)
- {
- size_t nLen = strlen(a_psSource) + 1;
- wchar_t* psDest = new wchar_t[nLen];
- CString sRet(_T(""));
- if (CharToWChar(a_psSource, psDest) > 0)
- {
- sRet = psDest;
- }
- delete[] psDest;
- return sRet;
- }
- };
- }
|