PartSizeFile.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #pragma once
  2. #include "PartSizeItem.h"
  3. namespace OTSMODEL {
  4. // particle size file mark
  5. const int PART_SIZE_FILE_MARK = 'P' + 'A' + 'R' + 'T' + 'S' + 'I' + 'Z' + 'E';
  6. // particle size file version
  7. const CString PART_SIZE_FILE_VERSION = _T("1.1.1");
  8. // particle size file extension
  9. const CString PART_SIZE_FILE_EXT = _T(".psf");
  10. const CString PART_SIZE_FILE_FILTER = _T("Particle Size Files (*.psf)|*.psf||");
  11. // part size components
  12. typedef enum class __declspec(dllexport) PART_SIZE_ITEMS
  13. {
  14. INVALID = -1,
  15. MIN = 0,
  16. NAME = 0,
  17. MAX = 0
  18. } PART_SIZE_ITEMS;
  19. typedef __declspec(dllexport) std::vector<double> CPartSizeList;
  20. class __declspec(dllexport) CPartSizeFile :public xmls::ISlo
  21. {
  22. public:
  23. CPartSizeFile(); // constructor
  24. CPartSizeFile(const CPartSizeFile&); // copy constructor
  25. CPartSizeFile(CPartSizeFile*); // copy constructor
  26. CPartSizeFile& operator=(const CPartSizeFile&); // =operator
  27. BOOL operator==(const CPartSizeFile&); // ==operator
  28. virtual ~CPartSizeFile(); // destructor
  29. // serialization
  30. void Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode);
  31. // name
  32. CString GetName() { return m_strName; }
  33. void SetName(CString a_strName) { m_strName = a_strName; }
  34. // version
  35. CString GetVersion() { return m_strVersion; }
  36. void SetVersion(CString a_strVersion) { m_strVersion = a_strVersion; }
  37. // double parts
  38. CPartSizeList GetSizes() { return m_listSizes; }
  39. void SetSizes(CPartSizeList& a_listPartSize, BOOL a_bClear = TRUE);
  40. // part size list
  41. CPartSizeItemList& GetPartSizeList() { return m_listPartSize; }
  42. void SetPartSizeList(CPartSizeItemList& a_listPartSize, BOOL a_bClear = TRUE);
  43. CPartSizeItemPtr GetPartSizeByIndex(int a_nIndex);
  44. CPartSizeItemPtr GetPartSizeByName(CString a_strPartSizeName);
  45. BOOL ChangDoubleToItem();
  46. protected:
  47. // cleanup
  48. void Cleanup();
  49. // initialization
  50. void Init();
  51. // duplication
  52. void Duplicate(const CPartSizeFile& a_oSource);
  53. // name
  54. CString m_strName;
  55. // version
  56. CString m_strVersion;
  57. // double parts
  58. CPartSizeList m_listSizes;
  59. // part size list
  60. CPartSizeItemList m_listPartSize;
  61. };
  62. typedef std::shared_ptr<CPartSizeFile> CPartSizeFilePtr;
  63. typedef std::vector<CPartSizeFilePtr> CPartSizeFileList;
  64. }