query.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2008, Willow Garage, Inc.
00005 *  All rights reserved.
00006 *
00007 *  Redistribution and use in source and binary forms, with or without
00008 *  modification, are permitted provided that the following conditions
00009 *  are met:
00010 *
00011 *   * Redistributions of source code must retain the above copyright
00012 *     notice, this list of conditions and the following disclaimer.
00013 *   * Redistributions in binary form must reproduce the above
00014 *     copyright notice, this list of conditions and the following
00015 *     disclaimer in the documentation and/or other materials provided
00016 *     with the distribution.
00017 *   * Neither the name of Willow Garage, Inc. nor the names of its
00018 *     contributors may be used to endorse or promote products derived
00019 *     from this software without specific prior written permission.
00020 *
00021 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032 *  POSSIBILITY OF SUCH DAMAGE.
00033 *********************************************************************/
00034 
00035 #ifndef ROSBAG_QUERY_H
00036 #define ROSBAG_QUERY_H
00037 
00038 #include "ros/time.h"
00039 
00040 #include <vector>
00041 #include <map>
00042 #include <set>
00043 
00044 #include <boost/function.hpp>
00045 
00046 namespace rosbag {
00047 
00048 class Bag;
00049 class ConnectionInfo;
00050 class IndexEntry;
00051 
00052 class Query
00053 {
00054 public:
00056 
00060     Query(boost::function<bool(ConnectionInfo const*)>& query,
00061           ros::Time const& start_time = ros::TIME_MIN,
00062           ros::Time const& end_time   = ros::TIME_MAX);
00063 
00064     boost::function<bool(ConnectionInfo const*)> const& getQuery() const;  
00065 
00066     ros::Time const& getStartTime() const; 
00067     ros::Time const& getEndTime()   const; 
00068 
00069 private:
00070     boost::function<bool(ConnectionInfo const*)> query_;
00071     ros::Time start_time_;
00072     ros::Time end_time_;
00073 };
00074 
00075 class TopicQuery
00076 {
00077 public:
00078     TopicQuery(std::string const& topic);
00079     TopicQuery(std::vector<std::string> const& topics);
00080 
00081     bool operator()(ConnectionInfo const*) const;
00082 
00083 private:
00084     std::vector<std::string> topics_;
00085 };
00086 
00087 class TypeQuery
00088 {
00089 public:
00090     TypeQuery(std::string const& type);
00091     TypeQuery(std::vector<std::string> const& types);
00092 
00093     bool operator()(ConnectionInfo const*) const;
00094 
00095 private:
00096     std::vector<std::string> types_;
00097 };
00098 
00100 struct BagQuery
00101 {
00102     BagQuery(Bag const* _bag, Query const& _query, uint32_t _bag_revision);
00103 
00104     Bag const* bag;
00105     Query      query;
00106     uint32_t   bag_revision;
00107 };
00108 
00109 struct MessageRange
00110 {
00111     MessageRange(std::multiset<IndexEntry>::const_iterator const& _begin,
00112                  std::multiset<IndexEntry>::const_iterator const& _end,
00113                  ConnectionInfo const* _connection_info,
00114                  BagQuery const* _bag_query);
00115 
00116     std::multiset<IndexEntry>::const_iterator begin;
00117     std::multiset<IndexEntry>::const_iterator end;
00118     ConnectionInfo const* connection_info;
00119     BagQuery const* bag_query;           
00120 };
00121 
00123 struct ViewIterHelper
00124 {
00125     ViewIterHelper(std::multiset<IndexEntry>::const_iterator _iter, MessageRange const* _range);
00126 
00127     std::multiset<IndexEntry>::const_iterator iter;
00128     MessageRange const* range;  
00129 };
00130 
00131 struct ViewIterHelperCompare
00132 {
00133     bool operator()(ViewIterHelper const& a, ViewIterHelper const& b);
00134 };
00135 
00136 } // namespace rosbag
00137 
00138 #endif


rosbag
Author(s): Tim Field (tfield@willowgarage.com), Jeremy Leibs (leibs@willowgarage.com), and James Bowman (jamesb@willowgarage.com)
autogenerated on Sat Dec 28 2013 17:43:05