include
ros
spinner.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2009, Willow Garage, Inc.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
6
* * Redistributions of source code must retain the above copyright notice,
7
* this list of conditions and the following disclaimer.
8
* * Redistributions in binary form must reproduce the above copyright
9
* notice, this list of conditions and the following disclaimer in the
10
* documentation and/or other materials provided with the distribution.
11
* * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
12
* contributors may be used to endorse or promote products derived from
13
* this software without specific prior written permission.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
* POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#ifndef ROSCPP_SPINNER_H
29
#define ROSCPP_SPINNER_H
30
31
#include "
ros/types.h
"
32
#include "common.h"
33
34
#include <boost/shared_ptr.hpp>
35
36
namespace
ros
37
{
38
class
NodeHandle;
39
class
CallbackQueue;
40
44
class
ROSCPP_DECL
Spinner
45
{
46
public
:
47
virtual
~Spinner
() {}
48
52
virtual
void
spin
(
CallbackQueue
* queue = 0) = 0;
53
};
54
58
class
ROSCPP_DECL
SingleThreadedSpinner
:
public
Spinner
59
{
60
public
:
61
virtual
void
spin
(
CallbackQueue
* queue = 0);
62
};
63
67
class
ROSCPP_DECL
MultiThreadedSpinner
:
public
Spinner
68
{
69
public
:
74
MultiThreadedSpinner
(uint32_t thread_count = 0);
75
76
virtual
void
spin
(
CallbackQueue
* queue = 0);
77
78
private
:
79
uint32_t
thread_count_
;
80
};
81
82
class
AsyncSpinnerImpl
;
83
typedef
boost::shared_ptr<AsyncSpinnerImpl>
AsyncSpinnerImplPtr
;
84
93
class
ROSCPP_DECL
AsyncSpinner
94
{
95
public
:
100
AsyncSpinner
(uint32_t thread_count);
101
107
AsyncSpinner
(uint32_t thread_count,
CallbackQueue
* queue);
108
109
110
118
// TODO: deprecate in L-turtle
119
bool
canStart();
123
void
start
();
127
void
stop();
128
129
private
:
130
AsyncSpinnerImplPtr
impl_
;
131
};
132
133
}
134
135
#endif // ROSCPP_SPIN_POLICY_H
ros::AsyncSpinnerImplPtr
boost::shared_ptr< AsyncSpinnerImpl > AsyncSpinnerImplPtr
Definition:
spinner.h:82
ros::MultiThreadedSpinner::thread_count_
uint32_t thread_count_
Definition:
spinner.h:79
ros::MultiThreadedSpinner
Spinner which spins in multiple threads.
Definition:
spinner.h:67
boost::shared_ptr< AsyncSpinnerImpl >
ros
ros::Spinner
Abstract interface for classes which spin on a callback queue.
Definition:
spinner.h:44
ros::AsyncSpinner
AsyncSpinner is a spinner that does not conform to the abstract Spinner interface....
Definition:
spinner.h:93
ros::Spinner::~Spinner
virtual ~Spinner()
Definition:
spinner.h:47
ros::SingleThreadedSpinner
Spinner which runs in a single thread.
Definition:
spinner.h:58
ros::start
ROSCPP_DECL void start()
Actually starts the internals of the node (spins up threads, starts the network polling and xmlrpc lo...
Definition:
init.cpp:294
ros::CallbackQueue
This is the default implementation of the ros::CallbackQueueInterface.
Definition:
callback_queue.h:57
ros::AsyncSpinnerImpl
Definition:
spinner.cpp:159
ros::spin
ROSCPP_DECL void spin()
Enter simple event loop.
Definition:
init.cpp:574
types.h
ros::AsyncSpinner::impl_
AsyncSpinnerImplPtr impl_
Definition:
spinner.h:130
roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:35