Fawkes API Fawkes Development Version
openrave_inifin.cpp
1
2/***************************************************************************
3 * openrave_inifin.cpp - Fawkes OpenRaveAspect initializer/finalizer
4 *
5 * Created: Fri Feb 25 15:08:00 2011
6 * Copyright 2011 Bahram Maleki-Fard
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 <core/threading/thread_finalizer.h>
25#include <plugins/openrave/aspect/openrave.h>
26#include <plugins/openrave/aspect/openrave_connector.h>
27#include <plugins/openrave/aspect/openrave_inifin.h>
28
29namespace fawkes {
30
31/** @class OpenRaveAspectIniFin <plugins/openrave/aspect/openrave_inifin.h>
32 * OpenRaveAspect initializer/finalizer.
33 * This initializer/finalizer will provide the OpenRaveConnector to threads with
34 * the OpenRaveAspect.
35 * @author Bahram Maleki-Fard
36 */
37
38/** Constructor.
39 * @param openrave OpenRaveConnector to pass on to threads
40 */
42: AspectIniFin("OpenRaveAspect")
43{
44 openrave_ = openrave;
45}
46
47void
49{
50 OpenRaveAspect *or_thread;
51
52 or_thread = dynamic_cast<OpenRaveAspect *>(thread);
53 if (or_thread == NULL) {
54 throw CannotInitializeThreadException("Thread '%s' claims to have the "
55 "OpenRaveAspect, but RTTI says it "
56 "has not. ",
57 thread->name());
58 }
59
60 or_thread->init_OpenRaveAspect(openrave_);
61}
62
63void
65{
66}
67
68} // end namespace fawkes
Aspect initializer/finalizer base class.
Definition: inifin.h:34
virtual void finalize(Thread *thread)
Finalize thread.
OpenRaveAspectIniFin(OpenRaveConnector *openrave)
Constructor.
virtual void init(Thread *thread)
Initialize thread.
Thread aspect create, update, and graph round-robin databases (RRD).
Definition: openrave.h:35
Interface for a OpenRave connection creator.
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100
Fawkes library namespace.