Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
configurable.cpp
1
2
/***************************************************************************
3
* configurable.cpp - Configurable aspect for Fawkes
4
*
5
* Created: Fri Jan 12 14:34:12 2007
6
* Copyright 2006-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/configurable.h>
25
26
namespace
fawkes {
27
#if 0
/* just to make Emacs auto-indent happy */
28
}
29
#endif
30
31
/** @class ConfigurableAspect <aspect/configurable.h>
32
* Thread aspect to access configuration data.
33
* Give this aspect to your thread to gain access to the configuration.
34
* This aspects defines a thread as being configurable.
35
* It is guaranteed that if used properly from within plugins that
36
* setConfiguration() is called before the thread is started and that
37
* you can access the configuration via the config member.
38
*
39
* It is higly recommended to also implement ConfigurationChangeHandler
40
* to get notified about configuration changes as soon as they happen.
41
* All threads which are configurable shall react immediately to config
42
* changes and use the new configuration. Therefore all inner structures
43
* shall be updated as necessary and member reinitialized if needed.
44
* Only this way no restart or at least plugin load/unload cycle is needed
45
* anymore to change the configuration. This should tremendously help
46
* to decrease debugging, testing and parameter tuning time!
47
*
48
* @ingroup Aspects
49
* @author Tim Niemueller
50
*/
51
52
53
/** @var Configuration * ConfigurableAspect::config
54
* This is the Configuration member used to access the configuration.
55
* The configuration will remain valid for the whole lifetime of the
56
* thread.
57
*/
58
59
/** Constructor. */
60
ConfigurableAspect::ConfigurableAspect()
61
{
62
add_aspect(
"ConfigurableAspect"
);
63
}
64
65
/** Virtual empty Destructor. */
66
ConfigurableAspect::~ConfigurableAspect()
67
{
68
}
69
70
71
/** Set the configuration
72
* It is guaranteed that this is called for a configurable thread before
73
* Thread::start() is called (when running regularly inside Fawkes).
74
* @param config Configuration instance to use.
75
*/
76
void
77
ConfigurableAspect::init_ConfigurableAspect(
Configuration
*config)
78
{
79
this->config = config;
80
}
81
82
}
// end namespace fawkes
src
libs
aspect
configurable.cpp
Generated by
1.8.3.1