load_raw.h 921 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef __LOAD_BIN_
  2. #define __LOAD_BIN_
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <sys/stat.h>
  6. #include <sys/types.h>
  7. #include <string.h>
  8. #include <fcntl.h>
  9. #include <sys/socket.h>
  10. #include <netinet/in.h>
  11. #include <arpa/inet.h>
  12. #include <unistd.h>
  13. #include <dirent.h>
  14. #include "common_tool.h"
  15. #include <log.h>
  16. using namespace std;
  17. #define FILEBUFFER_LENGTH 4096 //4k
  18. #define EMPTY_STR ""
  19. class load_raw
  20. {
  21. public:
  22. bool load_folder(string folder_path);
  23. bool load_file(string file_path);
  24. load_raw();
  25. static int m_index;
  26. static std::vector<std::string> m_vec_date;
  27. static std::string m_date;
  28. static bool m_is_history;
  29. protected:
  30. private:
  31. bool init();
  32. bool deal_with_time(string text_line);
  33. bool deal_with_raw(string text_line);
  34. void listDir(const char *path,vector<string>& vec_file_path);
  35. string raw_time;
  36. int raw_length = 0;
  37. char raw[FILEBUFFER_LENGTH] = { 0 };
  38. int m_port;
  39. int c_fd;
  40. };
  41. #endif