Fawkes API Fawkes Development Version

configurable.cpp

00001 
00002 /***************************************************************************
00003  *  configurable.h - Configurable aspect for Fawkes
00004  *
00005  *  Created: Fri Jan 12 14:34:12 2007
00006  *  Copyright  2006-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #include <aspect/configurable.h>
00025 
00026 namespace fawkes {
00027 
00028 /** @class ConfigurableAspect <aspect/configurable.h>
00029  * Thread aspect to access configuration data.
00030  * Give this aspect to your thread to gain access to the configuration.
00031  * This aspects defines a thread as being configurable.
00032  * It is guaranteed that if used properly from within plugins that
00033  * setConfiguration() is called before the thread is started and that
00034  * you can access the configuration via the config member.
00035  *
00036  * It is higly recommended to also implement ConfigurationChangeHandler
00037  * to get notified about configuration changes as soon as they happen.
00038  * All threads which are configurable shall react immediately to config
00039  * changes and use the new configuration. Therefore all inner structures
00040  * shall be updated as necessary and member reinitialized if needed.
00041  * Only this way no restart or at least plugin load/unload cycle is needed
00042  * anymore to change the configuration. This should tremendously help
00043  * to decrease debugging, testing and parameter tuning time!
00044  *
00045  * @ingroup Aspects
00046  * @author Tim Niemueller
00047  */
00048 
00049 
00050 /** @var Configuration *  ConfigurableAspect::config
00051  * This is the Configuration member used to access the configuration.
00052  * The configuration will remain valid for the whole lifetime of the
00053  * thread.
00054  */
00055 
00056 /** Virtual empty Destructor. */
00057 ConfigurableAspect::~ConfigurableAspect()
00058 {
00059 }
00060 
00061 
00062 /** Set the configuration
00063  * It is guaranteed that this is called for a configurable thread before
00064  * Thread::start() is called (when running regularly inside Fawkes).
00065  * @param config Configuration instance to use.
00066  */
00067 void
00068 ConfigurableAspect::init_ConfigurableAspect(Configuration *config)
00069 {
00070   this->config = config;
00071 }
00072 
00073 } // end namespace fawkes
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends