Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * tf.cpp - Fawkes TransformAspect initializer/finalizer 00004 * 00005 * Created: Tue Oct 25 22:32:59 2011 00006 * Copyright 2006-2011 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/inifins/tf.h> 00025 #include <aspect/tf.h> 00026 00027 namespace fawkes { 00028 #if 0 /* just to make Emacs auto-indent happy */ 00029 } 00030 #endif 00031 00032 /** @class TransformAspectIniFin <aspect/inifins/tf.h> 00033 * Initializer/finalizer for the TransformAspect. 00034 * @author Tim Niemueller 00035 */ 00036 00037 /** Constructor. 00038 * @param blackboard blackboard instance to pass to threads 00039 */ 00040 TransformAspectIniFin::TransformAspectIniFin(BlackBoard *blackboard) 00041 : AspectIniFin("TransformAspect") 00042 { 00043 __blackboard = blackboard; 00044 } 00045 00046 void 00047 TransformAspectIniFin::init(Thread *thread) 00048 { 00049 TransformAspect *transform_thread; 00050 transform_thread = dynamic_cast<TransformAspect *>(thread); 00051 if (transform_thread == NULL) { 00052 throw CannotInitializeThreadException("Thread '%s' claims to have the " 00053 "TransformAspect, but RTTI says it " 00054 "has not. ", thread->name()); 00055 } 00056 00057 transform_thread->init_TransformAspect(__blackboard); 00058 } 00059 00060 void 00061 TransformAspectIniFin::finalize(Thread *thread) 00062 { 00063 TransformAspect *transform_thread; 00064 transform_thread = dynamic_cast<TransformAspect *>(thread); 00065 if (transform_thread == NULL) { 00066 throw CannotFinalizeThreadException("Thread '%s' claims to have the " 00067 "TransformAspect, but RTTI says it " 00068 "has not. ", thread->name()); 00069 } 00070 00071 transform_thread->finalize_TransformAspect(); 00072 } 00073 00074 00075 } // end namespace fawkes