imstorage_manager.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #pragma once
  2. #include <string>
  3. #include <opencv2\opencv.hpp>
  4. #include <windows.h>
  5. #include <queue>
  6. //using namespace cv;
  7. using namespace std;
  8. //namespace graft_cv
  9. //{
  10. typedef struct
  11. {
  12. string img_name;
  13. cv::Mat image;
  14. } ImgParam;
  15. //typedef struct
  16. //{
  17. // string pcd_name;
  18. // pcl::PointCloud<pcl::PointXYZ>::Ptr pcd;
  19. //} PcdParam;
  20. typedef struct
  21. {
  22. int nIndex;
  23. queue<ImgParam>* imgQ;
  24. } ThreadParamSave;
  25. //typedef struct
  26. //{
  27. // int nIndex;
  28. // queue<PcdParam>* pcdQ;
  29. //
  30. //} ThreadParamSavePcd;
  31. typedef struct
  32. {
  33. string folder;
  34. int store_days;
  35. bool* state;
  36. } ThreadParamClean;
  37. int WINAPI TheadFuncClearn(LPVOID lpParam);
  38. int WINAPI TheadFuncSave(LPVOID lpParam);
  39. //int WINAPI TheadFuncSavePcd(LPVOID lpParam);
  40. void getFiles( string path, vector<string>& files, time_t clean_time);
  41. class CImStoreManager{
  42. public:
  43. CImStoreManager();
  44. ~CImStoreManager();
  45. // return 0--ok, 1--failed(not exists)
  46. int setStoreDir(string& folder);
  47. void getStoreDir(string& folder);
  48. void setStoreDays(int days);
  49. //saveImage() return 0--ok, 1 -- invalid image or folder
  50. int saveImage(cv::Mat&img,string name_id);
  51. void restart_start_worker();
  52. //int saveBinPly(pcl::PointCloud<pcl::PointXYZ>::Ptr pcd, string name_id);
  53. protected:
  54. int m_storeDays;
  55. string m_storeDir;
  56. bool is_valid_folder();
  57. HANDLE m_workHandle;
  58. HANDLE m_workHandleSave;
  59. //HANDLE m_workHandleSavePcd;
  60. queue<ImgParam> m_images;
  61. //queue<PcdParam> m_pcds;
  62. };
  63. //};