include
ros
subscription_queue.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 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_SUBSCRIPTION_QUEUE_H
29
#define ROSCPP_SUBSCRIPTION_QUEUE_H
30
31
#include "
forwards.h
"
32
#include "common.h"
33
#include "
ros/message_event.h
"
34
#include "
callback_queue_interface.h
"
35
36
#include <boost/thread/recursive_mutex.hpp>
37
#include <boost/thread/mutex.hpp>
38
#include <boost/enable_shared_from_this.hpp>
39
#include <deque>
40
41
namespace
ros
42
{
43
44
class
MessageDeserializer;
45
typedef
boost::shared_ptr<MessageDeserializer>
MessageDeserializerPtr
;
46
47
class
SubscriptionCallbackHelper;
48
typedef
boost::shared_ptr<SubscriptionCallbackHelper>
SubscriptionCallbackHelperPtr
;
49
50
class
ROSCPP_DECL
SubscriptionQueue
:
public
CallbackInterface
,
public
boost::enable_shared_from_this<SubscriptionQueue>
51
{
52
private
:
53
struct
Item
54
{
55
SubscriptionCallbackHelperPtr
helper
;
56
MessageDeserializerPtr
deserializer
;
57
58
bool
has_tracked_object
;
59
VoidConstWPtr
tracked_object
;
60
61
bool
nonconst_need_copy
;
62
ros::Time
receipt_time
;
63
};
64
typedef
std::deque<Item>
D_Item
;
65
66
public
:
67
SubscriptionQueue
(
const
std::string& topic, int32_t queue_size,
bool
allow_concurrent_callbacks);
68
~
SubscriptionQueue
();
69
70
void
push(
const
SubscriptionCallbackHelperPtr
& helper,
const
MessageDeserializerPtr
& deserializer,
71
bool
has_tracked_object,
const
VoidConstWPtr
& tracked_object,
bool
nonconst_need_copy,
72
ros::Time
receipt_time =
ros::Time
(),
bool
* was_full = 0);
73
void
clear();
74
75
virtual
CallbackInterface::CallResult
call
();
76
virtual
bool
ready();
77
bool
full();
78
79
private
:
80
bool
fullNoLock();
81
std::string
topic_
;
82
int32_t
size_
;
83
bool
full_
;
84
85
boost::mutex
queue_mutex_
;
86
D_Item
queue_
;
87
uint32_t
queue_size_
;
88
bool
allow_concurrent_callbacks_
;
89
90
boost::recursive_mutex
callback_mutex_
;
91
};
92
93
}
94
95
#endif // ROSCPP_SUBSCRIPTION_QUEUE_H
ros::SubscriptionCallbackHelperPtr
boost::shared_ptr< SubscriptionCallbackHelper > SubscriptionCallbackHelperPtr
Definition:
message_deserializer.h:42
callback_queue_interface.h
ros::service::call
bool call(const std::string &service_name, MReq &req, MRes &res)
Invoke an RPC service.
Definition:
service.h:65
ros::SubscriptionQueue::queue_
D_Item queue_
Definition:
subscription_queue.h:86
ros::MessageDeserializerPtr
boost::shared_ptr< MessageDeserializer > MessageDeserializerPtr
Definition:
message_deserializer.h:61
boost::shared_ptr< MessageDeserializer >
forwards.h
ros::SubscriptionQueue::Item::helper
SubscriptionCallbackHelperPtr helper
Definition:
subscription_queue.h:55
ros::SubscriptionQueue::Item::nonconst_need_copy
bool nonconst_need_copy
Definition:
subscription_queue.h:61
ros
ros::SubscriptionQueue::full_
bool full_
Definition:
subscription_queue.h:83
ros::SubscriptionQueue::size_
int32_t size_
Definition:
subscription_queue.h:82
ros::SubscriptionQueue::queue_mutex_
boost::mutex queue_mutex_
Definition:
subscription_queue.h:85
ros::SubscriptionQueue::topic_
std::string topic_
Definition:
subscription_queue.h:81
ros::CallbackInterface::CallResult
CallResult
Possible results for the call() method.
Definition:
callback_queue_interface.h:54
ros::SubscriptionQueue::Item::tracked_object
VoidConstWPtr tracked_object
Definition:
subscription_queue.h:59
ros::SubscriptionQueue::allow_concurrent_callbacks_
bool allow_concurrent_callbacks_
Definition:
subscription_queue.h:88
ros::CallbackInterface
Abstract interface for items which can be added to a CallbackQueueInterface.
Definition:
callback_queue_interface.h:48
ros::SubscriptionQueue::Item::deserializer
MessageDeserializerPtr deserializer
Definition:
subscription_queue.h:56
ros::VoidConstWPtr
boost::weak_ptr< void const > VoidConstWPtr
Definition:
forwards.h:53
ros::SubscriptionQueue::queue_size_
uint32_t queue_size_
Definition:
subscription_queue.h:87
ros::Time
ros::SubscriptionQueue::callback_mutex_
boost::recursive_mutex callback_mutex_
Definition:
subscription_queue.h:90
ros::SubscriptionQueue::D_Item
std::deque< Item > D_Item
Definition:
subscription_queue.h:64
ros::SubscriptionQueue::Item::receipt_time
ros::Time receipt_time
Definition:
subscription_queue.h:62
ros::SubscriptionQueue::Item::has_tracked_object
bool has_tracked_object
Definition:
subscription_queue.h:58
ros::SubscriptionQueue
Definition:
subscription_queue.h:50
ros::SubscriptionQueue::Item
Definition:
subscription_queue.h:53
message_event.h
roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:36