query_results_impl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  */
30 
40 namespace warehouse_ros
41 {
42 template <class M>
44  : results_(results), metadata_only_(metadata_only)
45 {
46  if (!results_->hasData())
47  results_.reset();
48 }
49 
50 template <class M>
52 {
53  if (!results_->next())
54  {
55  results_.reset();
56  }
57 }
58 
59 template <class M>
61 {
62  ROS_ASSERT(results_);
63 
64  typename MessageWithMetadata<M>::Ptr msg(new MessageWithMetadata<M>(results_->metadata()));
65  if (!metadata_only_)
66  {
67  std::string str = results_->message();
68  uint8_t* buf = (uint8_t*)str.c_str();
69  ros::serialization::IStream istream(buf, str.size());
71  }
72  return msg;
73 }
74 
75 template <class M>
77 {
78  // Incomplete, the only case we care about is whether iter is at the end
79  return (!results_ && !other.results_);
80 }
81 
82 } // namespace warehouse_ros
boost::shared_ptr< ResultIteratorHelper >
warehouse_ros::ResultIterator
Definition: query_results.h:61
ros::serialization::IStream
ros::serialization::Serializer::read
static void read(Stream &stream, typename boost::call_traits< T >::reference t)
warehouse_ros::ResultIterator::increment
void increment()
Definition: query_results_impl.hpp:51
warehouse_ros::ResultIterator::ResultIterator
ResultIterator()=default
Default constructor.
warehouse_ros::ResultIterator::equal
bool equal(const ResultIterator< M > &other) const
Definition: query_results_impl.hpp:76
warehouse_ros::MessageWithMetadata
Class that wraps (via inheritance) a ROS message type, together with additional metadata (a yaml dict...
Definition: message_with_metadata.h:55
warehouse_ros
Definition: database_connection.h:44
warehouse_ros::ResultIterator::results_
ResultIteratorHelper::Ptr results_
Definition: query_results.h:80
ROS_ASSERT
#define ROS_ASSERT(cond)
warehouse_ros::ResultIterator::dereference
MessageWithMetadata< M >::ConstPtr dereference() const
Definition: query_results_impl.hpp:60


warehouse_ros
Author(s): Bhaskara Marthi , Connor Brew
autogenerated on Tue May 10 2022 02:42:06