Fawkes API
Fawkes Development Version
naoqi_inifin.cpp
1
2
/***************************************************************************
3
* naoqi_inifin.cpp - Fawkes NaoQiAspect initializer/finalizer
4
*
5
* Created: Thu May 12 15:54:02 2011
6
* Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
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/nao/aspect/naoqi_inifin.h>
26
27
namespace
fawkes
{
28
29
/** @class NaoQiAspectIniFin <plugins/nao/aspect/naoqi_inifin.h>
30
* NaoQiAspect initializer/finalizer.
31
* This initializer/finalizer will provide the NaoQi broker to threads
32
* with the NaoQiAspect.
33
* @author Tim Niemueller
34
*/
35
36
/** Constructor. */
37
NaoQiAspectIniFin::NaoQiAspectIniFin
() : AspectIniFin(
"NaoQiAspect"
)
38
{
39
}
40
41
void
42
NaoQiAspectIniFin::init
(Thread *thread)
43
{
44
NaoQiAspect
*naoqi_thread;
45
naoqi_thread =
dynamic_cast<
NaoQiAspect
*
>
(thread);
46
if
(naoqi_thread == NULL) {
47
throw
CannotInitializeThreadException
(
"Thread '%s' claims to have the "
48
"NaoQiAspect, but RTTI says it "
49
"has not. "
,
50
thread->name());
51
}
52
if
(!naoqi_broker_) {
53
throw
CannotInitializeThreadException
(
"NaoQi broker has not been set."
);
54
}
55
56
naoqi_thread->init_NaoQiAspect(naoqi_broker_);
57
}
58
59
void
60
NaoQiAspectIniFin::finalize
(Thread *thread)
61
{
62
}
63
64
/** Set the NaoQi broker to use for aspect initialization.
65
* @param naoqi_broker NaoQi broker to pass to threads with NaoQiAspect.
66
*/
67
void
68
NaoQiAspectIniFin::set_naoqi_broker
(AL::ALPtr<AL::ALBroker> naoqi_broker)
69
{
70
naoqi_broker_ = naoqi_broker;
71
}
72
73
}
// end namespace fawkes
fawkes::NaoQiAspectIniFin::finalize
virtual void finalize(Thread *thread)
Definition:
naoqi_inifin.cpp:66
fawkes::NaoQiAspect
Definition:
naoqi.h:41
fawkes::CannotInitializeThreadException
Definition:
thread_initializer.h:39
fawkes::NaoQiAspectIniFin::init
virtual void init(Thread *thread)
Definition:
naoqi_inifin.cpp:48
fawkes
fawkes::NaoQiAspectIniFin::set_naoqi_broker
void set_naoqi_broker(AL::ALPtr< AL::ALBroker > naoqi_broker)
Set the NaoQi broker to use for aspect initialization.
Definition:
naoqi_inifin.cpp:74
fawkes::NaoQiAspectIniFin::NaoQiAspectIniFin
NaoQiAspectIniFin()
Constructor.
Definition:
naoqi_inifin.cpp:43
src
plugins
nao
aspect
naoqi_inifin.cpp
Generated by
1.8.17