LogFiles.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __LOG__FILE__HH
  2. #define __LOG__FILE__HH
  3. #include <string>
  4. #include <fstream>
  5. #include <mutex>
  6. using namespace std;
  7. class CLogFile
  8. {
  9. public:
  10. CLogFile();
  11. ~CLogFile();
  12. void open(const char *_Filename, bool binary = false);
  13. void write(const char *_Str, streamsize _Count);
  14. void close();
  15. inline bool is_open() const { return m_file.is_open(); };
  16. void write_double(double val);
  17. void write_int(int val);
  18. public:
  19. fstream m_file;
  20. public:
  21. std::mutex m_lock;
  22. };
  23. class CLogFiles
  24. {
  25. public:
  26. CLogFiles();
  27. ~CLogFiles();
  28. void set_config(bool binary = true, bool value = true, bool points = true)
  29. {
  30. m_bBinary = binary;
  31. m_bValue = value;
  32. m_bPoints = points;
  33. }
  34. void new_project(const char * path);
  35. void close_project();
  36. private:
  37. bool m_bBinary;
  38. bool m_bValue;
  39. bool m_bPoints;
  40. public:
  41. CLogFile m_logLaserBinary1;
  42. CLogFile m_logLaserValue1;
  43. CLogFile m_logPoints1;
  44. CLogFile m_logLaserBinary2;
  45. CLogFile m_logLaserValue2;
  46. CLogFile m_logPoints2;
  47. public:
  48. static const string m_strFileNameLoglaserBinary1;
  49. static const string m_strFileNameLoglaserValue1;
  50. static const string m_strFileNameLogPoints1;
  51. static const string m_strFileNameLoglaserBinary2;
  52. static const string m_strFileNameLoglaserValue2;
  53. static const string m_strFileNameLogPoints2;
  54. };
  55. #endif