store_terminal.h 946 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Created by zx on 2020/7/16.
  3. //
  4. #ifndef NNXX_TESTS_STORE_TERMINAL_H
  5. #define NNXX_TESTS_STORE_TERMINAL_H
  6. #include <thread>
  7. #include "threadSafeQueue.h"
  8. #include "thread_condition.h"
  9. #include "error_code.h"
  10. #include "terminal_message.pb.h"
  11. class store_terminal {
  12. public:
  13. store_terminal(int terminal_id);
  14. ~store_terminal();
  15. Error_manager init(threadsafe_queue<message::Car_info>* input,
  16. threadsafe_queue<message::Car_info>* output);
  17. Error_manager storing(message::Car_info& msg);
  18. protected:
  19. static void storing_thread(store_terminal* pStore);
  20. std::thread* m_pthread;
  21. int m_terminal_id;
  22. threadsafe_queue<message::Car_info>* m_thread_safe_queue;
  23. Thread_condition m_exit_cond;
  24. threadsafe_queue<message::Car_info>* m_thread_safe_output_queue;
  25. };
  26. #endif //NNXX_TESTS_STORE_TERMINAL_H