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/example_plugin.h>
24 #include <plugins/examples/basics/thread.h>
25 #include <plugins/examples/basics/net_thread.h>
26 #include <plugins/examples/basics/finalize_nettler_thread.h>
27 #include <plugins/examples/basics/blackboard_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 
37 using namespace fawkes;
38 
39 /** Modulo count */
40 #define MODC 100
41 
42 /** Constructor.
43  * @param config Fawkes configuration
44  */
46  : Plugin(config)
47 {
48  // printf("ExamplePlugin constructor called\n");
49  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_PRE_LOOP,
50  "PreLoopThread", MODC));
51  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_SENSOR,
52  "SensorThread", MODC));
53  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_WORLDSTATE,
54  "WorldStateThread", MODC));
55  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_THINK,
56  "ThinkThread", MODC));
57  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_SKILL,
58  "SkillThread", MODC));
59  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_ACT,
60  "ActThread", MODC));
61  thread_list.push_back(new ExampleThread(BlockedTimingAspect::WAKEUP_HOOK_POST_LOOP,
62  "PostLoopThread", MODC));
63  thread_list.push_back(new ExampleNetworkThread("NetworkThread"));
64  thread_list.push_back(new ExampleFinalizeNettlerThread("FinalizeNettlerThread"));
65  thread_list.push_back(new ExampleBlackBoardThread(/* reader */ true));
66  thread_list.push_back(new ExampleBlackBoardThread(/* reader */ false));
67 }
68 
69 PLUGIN_DESCRIPTION("Example plugin demonstrating Fawkes basics")
70 EXPORT_PLUGIN(ExamplePlugin)
Network thread of example plugin.
Definition: net_thread.h:31
Simple demonstration for a thread using the BlackBoard.
Plugin interface class.
Definition: plugin.h:33
Fawkes library namespace.
ExamplePlugin(fawkes::Configuration *config)
Constructor.
ThreadList thread_list
Thread list member.
Definition: plugin.h:53
Thread of example plugin.
void push_back(Thread *thread)
Add thread to the end.
Thread of example plugin.
Definition: thread.h:30
Interface for configuration handling.
Definition: config.h:67
Simple example plugin.