Fawkes API Fawkes Development Version
logreplay_bt_thread.cpp
1
2/***************************************************************************
3 * logreplay_bt_thread.cpp - BB Log Replay Blocked Timing Thread
4 *
5 * Created: Mon Feb 22 00:09:58 2010
6 * Copyright 2010 Tim Niemueller [www.niemueller.de]
7 * 2010 Masrur Doostdar <doostdar@kbsg.rwth-aachen.de>
8 *
9 ****************************************************************************/
10
11/* This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL file in the doc directory.
22 */
23
24#include "logreplay_bt_thread.h"
25
26using namespace fawkes;
27
28/** @class BBLogReplayBlockedTimingThread "logreplay_bt_thread.h"
29 * BlackBoard log replay blocked timing thread.
30 * This thread basically does the same task as the BBLogReplayThread, with
31 * the difference that this thread operates in blocked timing mode and
32 * integrates into the Fawkes main loop. It will replay one data set per
33 * loop and will block the loop until the data is ready. This is most useful
34 * to replay sensor logs of sensors, which are integrated into the main loop
35 * and thus influence timing also on the real data system.
36 * @author Masrur Doostdar
37 * @author Tim Niemueller
38 */
39
40/** Constructor.
41 * @param hook main loop hook to register for
42 * @param logfile_name filename of the log to be replayed
43 * @param logdir directory containing the logfile
44 * @param scenario ID of the log scenario
45 * @param grace_period time in seconds that desired offset and loop offset may
46 * diverge to still write the new data
47 * @param loop_replay specifies if the replay should be looped
48 * @param non_blocking do not block the main loop if not enough time has elapsed
49 * to replay new data but just wait for the next cycle. This is ignored in
50 * continuous thread mode as it could cause busy waiting.
51 */
53 const char *logfile_name,
54 const char *logdir,
55 const char *scenario,
56 float grace_period,
57 bool loop_replay,
58 bool non_blocking)
59: BBLogReplayThread(logfile_name,
60 logdir,
61 scenario,
62 grace_period,
63 loop_replay,
64 non_blocking,
65 "BBLogReplayBTThread",
66 Thread::OPMODE_WAITFORWAKEUP),
68{
69 set_name("BBLogReplayBTThread(%s)", logfile_name);
71}
BBLogReplayBlockedTimingThread(fawkes::BlockedTimingAspect::WakeupHook hook, const char *logfile_name, const char *logdir, const char *scenario, float grace_period, bool loop_replay, bool non_blocking)
Constructor.
BlackBoard log Replay thread.
Thread aspect to use blocked timing.
WakeupHook
Type to define at which hook the thread is woken up.
Thread class encapsulation of pthreads.
Definition: thread.h:46
void set_prepfin_conc_loop(bool concurrent=true)
Set concurrent execution of prepare_finalize() and loop().
Definition: thread.cpp:716
void set_name(const char *format,...)
Set name of thread.
Definition: thread.cpp:748
Fawkes library namespace.