Fawkes API Fawkes Development Version
example_plugin.cpp
1
2/***************************************************************************
3 * example_plugin.cpp - Fawkes Example Plugin
4 *
5 * Generated: Wed Nov 22 17:06:33 2006
6 * Copyright 2006 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#include <plugins/examples/basics/blackboard_thread.h>
24#include <plugins/examples/basics/example_plugin.h>
25#include <plugins/examples/basics/finalize_nettler_thread.h>
26#include <plugins/examples/basics/net_thread.h>
27#include <plugins/examples/basics/thread.h>
28
29/** @class ExamplePlugin plugins/examples/basics/example_plugin.h
30 * Simple example plugin.
31 * Creates a few threads for different wakeup hooks that print out messages
32 * every 10 iterations.
33 *
34 * @author Tim Niemueller
35 */
36
37using namespace fawkes;
38
39/** Modulo count */
40#define MODC 100
41
42/** Constructor.
43 * @param config Fawkes configuration
44 */
46{
47 // printf("ExamplePlugin constructor called\n");
49 new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_PRE_LOOP, "PreLoopThread", MODC));
51 new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_SENSOR, "SensorThread", MODC));
53 new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_WORLDSTATE, "WorldStateThread", MODC));
55 new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_THINK, "ThinkThread", MODC));
57 new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_SKILL, "SkillThread", MODC));
58 thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_ACT, "ActThread", MODC));
60 new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_POST_LOOP, "PostLoopThread", MODC));
61 thread_list.push_back(new ExampleNetworkThread("NetworkThread"));
62 thread_list.push_back(new ExampleFinalizeNettlerThread("FinalizeNettlerThread"));
63 thread_list.push_back(new ExampleBlackBoardThread(/* reader */ true));
64 thread_list.push_back(new ExampleBlackBoardThread(/* reader */ false));
65}
66
67PLUGIN_DESCRIPTION("Example plugin demonstrating Fawkes basics")
68EXPORT_PLUGIN(ExamplePlugin)
Simple demonstration for a thread using the BlackBoard.
Network thread of example plugin.
Definition: net_thread.h:35
Simple example plugin.
ExamplePlugin(fawkes::Configuration *config)
Constructor.
Thread of example plugin.
Definition: thread.h:33
Interface for configuration handling.
Definition: config.h:68
Plugin interface class.
Definition: plugin.h:34
ThreadList thread_list
Thread list member.
Definition: plugin.h:53
void push_back(Thread *thread)
Add thread to the end.
Fawkes library namespace.