Fawkes API  Fawkes Development Version
openrave_inifin.cpp
00001 
00002 /***************************************************************************
00003  *  openrave_inifin.cpp - Fawkes OpenRaveAspect initializer/finalizer
00004  *
00005  *  Created: Fri Feb 25 15:08:00 2011
00006  *  Copyright  2011  Bahram Maleki-Fard
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 <plugins/openrave/aspect/openrave_inifin.h>
00025 #include <plugins/openrave/aspect/openrave.h>
00026 #include <plugins/openrave/aspect/openrave_connector.h>
00027 
00028 #include <core/threading/thread_finalizer.h>
00029 
00030 namespace fawkes {
00031 #if 0 /* just to make Emacs auto-indent happy */
00032 }
00033 #endif
00034 
00035 /** @class OpenRaveAspectIniFin <plugins/openrave/aspect/openrave_inifin.h>
00036  * OpenRaveAspect initializer/finalizer.
00037  * This initializer/finalizer will provide the OpenRaveConnector to threads with
00038  * the OpenRaveAspect.
00039  * @author Bahram Maleki-Fard
00040  */
00041 
00042 /** Constructor.
00043  * @param openrave OpenRaveConnector to pass on to threads
00044  */
00045 OpenRaveAspectIniFin::OpenRaveAspectIniFin(OpenRaveConnector *openrave)
00046   : AspectIniFin("OpenRaveAspect")
00047 {
00048   __openrave = openrave;
00049 }
00050 
00051 void
00052 OpenRaveAspectIniFin::init(Thread *thread)
00053 {
00054   OpenRaveAspect *or_thread;
00055 
00056   or_thread = dynamic_cast<OpenRaveAspect *>(thread);
00057   if (or_thread == NULL) {
00058     throw CannotInitializeThreadException("Thread '%s' claims to have the "
00059                                           "OpenRaveAspect, but RTTI says it "
00060                                           "has not. ", thread->name());
00061   }
00062 
00063   or_thread->init_OpenRaveAspect(__openrave);
00064 }
00065 
00066 void
00067 OpenRaveAspectIniFin::finalize(Thread *thread)
00068 {
00069 }
00070 
00071 
00072 
00073 } // end namespace fawkes