Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * aspect_provider.h - Aspect to provider a new aspect for Fawkes 00004 * 00005 * Created: Thu Nov 25 12:08:21 2010 (Thanksgiving) 00006 * Copyright 2006-2010 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/aspect_provider.h> 00025 00026 namespace fawkes { 00027 #if 0 /* just to make Emacs auto-indent happy */ 00028 } 00029 #endif 00030 00031 /** @class AspectProviderAspect <aspect/aspect_provider.h> 00032 * Thread aspect provide a new aspect. 00033 * Aspects in Fawkes are used to provide access to framework features. 00034 * More generally speaking they are used to provide access to features on the 00035 * C++ programming level. In some situations, it might be useful to provide 00036 * a custom aspect to allow for access to a resource on this level, e.g. 00037 * bypassing the blackboard for communication. In this case the 00038 * AspectProviderAspect can be used. 00039 * 00040 * Use this rarely! Be absolutely certain, that there is no better or equally 00041 * good way to implement a feature without a new aspect. If used it allows 00042 * for a well-defined way to exchange resources between threads (and even 00043 * plugins). Make sure that you define strong guarantees and keep them by 00044 * means of your aspect initializer/finalizer. For example if you share a 00045 * (pointer to a) resource, you <i>must</i> make sure, that this 00046 * resource stays as long as there is any user! 00047 * 00048 * @ingroup Aspects 00049 * @author Tim Niemueller 00050 */ 00051 00052 /** Constructor. 00053 * This special constructor is needed to define the wakeup point. 00054 * @param aspect_name Name of the aspect which is provided. The string 00055 * must exist for the whole lifetime of this AspectProviderAspect instance! 00056 * @param inifin intializer/finalizer for the aspect. The inifin 00057 * must exist for the whole lifetime of this AspectProviderAspect instance! 00058 */ 00059 AspectProviderAspect::AspectProviderAspect(const char *aspect_name, 00060 AspectIniFin *inifin) 00061 { 00062 add_aspect("AspectProviderAspect"); 00063 __aspect_name = aspect_name; 00064 __aspect_inifin = inifin; 00065 } 00066 00067 00068 /** Virtual empty destructor. */ 00069 AspectProviderAspect::~AspectProviderAspect() 00070 { 00071 } 00072 00073 00074 /** Get name of the provided aspect. 00075 * @return name of the provided aspect 00076 */ 00077 const char * 00078 AspectProviderAspect::aspect_provider_name() const 00079 { 00080 return __aspect_name; 00081 } 00082 00083 00084 /** Get initializer/finalizer for the provided aspect. 00085 * @return initializer/finalizer for the provided aspect 00086 */ 00087 AspectIniFin * 00088 AspectProviderAspect::aspect_provider_inifin() const 00089 { 00090 return __aspect_inifin; 00091 } 00092 00093 } // end namespace fawkes