Fawkes API Fawkes Development Version

logreplay_bt_thread.cpp

00001 
00002 /***************************************************************************
00003  *  logreplay_bt_thread.cpp - BB Log Replay Blocked Timing Thread
00004  *
00005  *  Created: Mon Feb 22 00:09:58 2010
00006  *  Copyright  2010  Tim Niemueller [www.niemueller.de]
00007  *             2010  Masrur Doostdar <doostdar@kbsg.rwth-aachen.de>
00008  *
00009  ****************************************************************************/
00010 
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version.
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL file in the doc directory.
00022  */
00023 
00024 #include "logreplay_bt_thread.h"
00025 
00026 using namespace fawkes;
00027 
00028 /** @class BBLogReplayBlockedTimingThread "logreplay_bt_thread.h"
00029  * BlackBoard log replay blocked timing thread.
00030  * This thread basically does the same task as the BBLogReplayThread, with
00031  * the difference that this thread operates in blocked timing mode and
00032  * integrates into the Fawkes main loop. It will replay one data set per
00033  * loop and will block the loop until the data is ready. This is most useful
00034  * to replay sensor logs of sensors, which are integrated into the main loop
00035  * and thus influence timing also on the real data system.
00036  * @author Masrur Doostdar
00037  * @author Tim Niemueller
00038  */
00039 
00040 /** Constructor.
00041  * @param hook main loop hook to register for
00042  * @param logfile_name filename of the log to be replayed
00043  * @param logdir directory containing the logfile
00044  * @param scenario ID of the log scenario
00045  * @param grace_period time in seconds that desired offset and loop offset may
00046  * diverge to still write the new data
00047  * @param loop_replay specifies if the replay should be looped
00048  * @param non_blocking do not block the main loop if not enough time has elapsed
00049  * to replay new data but just wait for the next cycle. This is ignored in
00050  * continuous thread mode as it could cause busy waiting.
00051  */
00052 BBLogReplayBlockedTimingThread::BBLogReplayBlockedTimingThread(
00053                                    BlockedTimingAspect::WakeupHook hook,
00054                                    const char *logfile_name,
00055                                    const char *logdir,
00056                                    const char *scenario,
00057                                    float grace_period,
00058                                    bool loop_replay,
00059                                    bool non_blocking)
00060   : BBLogReplayThread(logfile_name, logdir, scenario,
00061                       grace_period, loop_replay, non_blocking,
00062                       "BBLogReplayBTThread", Thread::OPMODE_WAITFORWAKEUP),
00063     BlockedTimingAspect(hook)
00064 {
00065   set_name("BBLogReplayBTThread(%s)", logfile_name);
00066   set_prepfin_conc_loop(false);
00067 }
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends