Fawkes API  Fawkes Development Version
mainloop.cpp
1 
2 /***************************************************************************
3  * mainloop.cpp - Main loop aspect for Fawkes
4  *
5  * Created: Sat Aug 02 00:16:30 2008
6  * Copyright 2008-2010 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. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
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_WRE file in the doc directory.
22  */
23 
24 #include <aspect/mainloop.h>
25 
26 namespace fawkes {
27 
28 /** @class MainLoopAspect <aspect/mainloop.h>
29  * Thread aspect that allows to replace the main loop of the main application
30  * of Fawkes.
31  * Warning, replacing the main loop may severely interfere with the
32  * functionality of Fawkes. Make sure that you know what the main loop
33  * needs, what it has to do and what it should not do.
34  *
35  * At any given time there can only be one thread active with this aspect.
36  *
37  * @ingroup Aspects
38  * @author Tim Niemueller
39  */
40 
41 /** @var BlockedTimingExecutor * MainLoopAspect::blocked_timing_executor
42  * This is a blocked timing executor instance which can be used to run threads
43  * with the BlockedTimingAspect.
44  */
45 
46 /** Constructor. */
48 {
49  add_aspect("MainLoopAspect");
50 }
51 
52 /** Virtual empty destructor. */
54 {
55 }
56 
57 /** Initialize main loop aspect.
58  * Called from the Aspect initializer.
59  * @param btexec blocked timing executor instance that can be used to run
60  * threads that have the blocked timing aspect. It's accessible as
61  * blocked_timing_aspect.
62  */
63 void
65 {
66  blocked_timing_executor = btexec;
67 }
68 
69 } // end namespace fawkes
fawkes::Aspect::add_aspect
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:55
fawkes::MainLoopAspect::~MainLoopAspect
virtual ~MainLoopAspect()
Virtual empty destructor.
Definition: mainloop.cpp:59
fawkes::MainLoopAspect::MainLoopAspect
MainLoopAspect()
Constructor.
Definition: mainloop.cpp:53
fawkes::BlockedTimingExecutor
Definition: executor.h:42
fawkes::MainLoopAspect::blocked_timing_executor
BlockedTimingExecutor * blocked_timing_executor
Definition: mainloop.h:49
fawkes
fawkes::MainLoopAspect::init_MainLoopAspect
void init_MainLoopAspect(BlockedTimingExecutor *btexec)
Initialize main loop aspect.
Definition: mainloop.cpp:70