00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __PLUGINS_BBLOGGER_LOGREPLAY_THREAD_H_
00025 #define __PLUGINS_BBLOGGER_LOGREPLAY_THREAD_H_
00026
00027 #include "bblogfile.h"
00028
00029 #include <core/threading/thread.h>
00030 #include <aspect/logging.h>
00031 #include <aspect/configurable.h>
00032 #include <aspect/blackboard.h>
00033 #include <aspect/clock.h>
00034 #include <core/utils/lock_queue.h>
00035
00036 #include <cstdio>
00037
00038 namespace fawkes {
00039 class BlackBoard;
00040 class Logger;
00041 class Time;
00042 }
00043
00044 class BBLogReplayThread
00045 : public fawkes::Thread,
00046 public fawkes::LoggingAspect,
00047 public fawkes::ConfigurableAspect,
00048 public fawkes::ClockAspect,
00049 public fawkes::BlackBoardAspect
00050 {
00051 public:
00052 BBLogReplayThread(const char *logfile_name,
00053 const char *logdir,
00054 const char *scenario,
00055 float grace_period,
00056 bool loop_replay,
00057 bool non_blocking = false,
00058 const char *thread_name = "BBLogReplayThread",
00059 fawkes::Thread::OpMode th_opmode = Thread::OPMODE_CONTINUOUS);
00060 virtual ~BBLogReplayThread();
00061
00062 virtual void init();
00063 virtual void finalize();
00064 virtual void loop();
00065 virtual void once();
00066
00067
00068 protected: virtual void run() { Thread::run(); }
00069
00070 private:
00071 char *__scenario;
00072 char *__filename;
00073 char *__logdir;
00074 char *__logfile_name;
00075 float __cfg_grace_period;
00076 bool __cfg_non_blocking;
00077 bool __cfg_loop_replay;
00078
00079 BBLogFile *__logfile;
00080
00081 fawkes::Time __last_offset;
00082 fawkes::Time __offsetdiff;
00083 fawkes::Time __loopdiff;
00084 fawkes::Time __waittime;
00085 fawkes::Time __last_loop;
00086 fawkes::Time __now;
00087 fawkes::Interface *__interface;
00088 };
00089
00090
00091 #endif