00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #ifndef TIME_HPP
00029 #define TIME_HPP
00030
00031 #include "include/proxy/message_format.hpp"
00032
00033 #include <list>
00034 #include <boost/thread.hpp>
00035
00039 #define TIME_POLL_INTERVAL 500 //msec
00040
00041 class proxy_instance;
00042
00046 class timing{
00047 private:
00048 struct timehandling {
00049 timehandling(struct timeval time, proxy_instance* pr_i, proxy_msg pr_msg);
00050 struct timeval m_time;
00051 proxy_instance* m_pr_i;
00052 proxy_msg m_pr_msg;
00053 };
00054
00055 bool m_running;
00056 boost::thread* m_worker_thread;
00057 static void worker_thread(timing* t);
00058
00059 boost::mutex m_global_lock;
00060 std::list<struct timehandling> m_time_list;
00061
00062
00063 timing();
00064 timing(const timing&);
00065 timing& operator=(const timing&);
00066 ~timing();
00067 public:
00071 static timing* getInstance();
00072
00080 void add_time(int msec, proxy_instance* pr_i, proxy_msg& pr_msg);
00081
00086 void stop_all_time(proxy_instance* pr_i);
00087
00091 void start();
00092
00096 void stop();
00097
00101 void join();
00102
00106 static void test_timing();
00107 };
00108
00109
00110
00111 #endif // TIME_HPP
00112