.. _program_listing_file__tmp_ws_src_rmf_traffic_rmf_traffic_include_rmf_traffic_schedule_Query.hpp: Program Listing for File Query.hpp ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/rmf_traffic/rmf_traffic/include/rmf_traffic/schedule/Query.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright (C) 2019 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef RMF_TRAFFIC__SCHEDULE__QUERY_HPP #define RMF_TRAFFIC__SCHEDULE__QUERY_HPP #include #include #include #include #include #include #include #include namespace rmf_traffic { namespace schedule { //============================================================================== class Query { public: template using base_iterator = rmf_traffic::detail::bidirectional_iterator; class Spacetime { public: using Space = geometry::Space; enum class Mode : uint16_t { Invalid, All, Regions, Timespan, }; //========================================================================== class All { public: class Implementation; private: rmf_utils::impl_ptr _pimpl; }; //========================================================================== class Regions { public: class IterImpl; using iterator = base_iterator; using const_iterator = base_iterator; void push_back(Region region); void pop_back(); iterator erase(iterator it); iterator erase(iterator first, iterator last); iterator begin(); const_iterator begin() const; const_iterator cbegin() const; iterator end(); const_iterator end() const; const_iterator cend() const; std::size_t size() const; class Implementation; private: Regions(); rmf_utils::impl_ptr _pimpl; }; //========================================================================== class Timespan { public: const std::unordered_set& maps() const; Timespan& add_map(std::string map_name); Timespan& remove_map(const std::string& map_name); Timespan& clear_maps(); bool all_maps() const; Timespan& all_maps(bool query_all_maps); const Time* get_lower_time_bound() const; Timespan& set_lower_time_bound(Time time); Timespan& remove_lower_time_bound(); const Time* get_upper_time_bound() const; Timespan& set_upper_time_bound(Time time); Timespan& remove_upper_time_bound(); class Implementation; private: Timespan(); rmf_utils::impl_ptr _pimpl; }; Spacetime(); Spacetime(std::vector regions); Spacetime(std::vector maps); Spacetime( std::vector maps, Time lower_bound); Spacetime( std::vector maps, Time lower_bound, Time upper_bound); Mode get_mode() const; All& query_all(); Regions& query_regions(std::vector regions = {}); Regions* regions(); const Regions* regions() const; Timespan& query_timespan( std::vector maps, Time lower_bound, Time upper_bound); Timespan& query_timespan( std::vector maps, Time lower_bound); Timespan& query_timespan(std::vector maps); Timespan& query_timespan(bool query_all_maps = true); Timespan* timespan(); const Timespan* timespan() const; class Implementation; private: rmf_utils::impl_ptr _pimpl; }; class Participants { public: enum class Mode : uint16_t { Invalid, All, Include, Exclude }; class All { public: class Implementation; private: All(); friend class Participants; rmf_utils::impl_ptr _pimpl; }; class Include { public: Include(std::vector ids); // TODO(MXG): Consider returning unordered_set const std::vector& get_ids() const; Include& set_ids(std::vector ids); class Implementation; private: Include(); friend class Participants; rmf_utils::impl_ptr _pimpl; }; class Exclude { public: Exclude(std::vector ids); // TODO(MXG): Consider returning unordered_set const std::vector& get_ids() const; Exclude& set_ids(std::vector ids); class Implementation; private: Exclude(); friend class Participants; rmf_utils::impl_ptr _pimpl; }; Participants(); static const Participants& make_all(); static Participants make_only(std::vector ids); static Participants make_all_except(std::vector ids); Mode get_mode() const; All* all(); const All* all() const; Include* include(); const Include* include() const; Participants& include(std::vector ids); Exclude* exclude(); const Exclude* exclude() const; Participants& exclude(std::vector ids); private: class Implementation; rmf_utils::impl_ptr _pimpl; }; Spacetime& spacetime(); const Spacetime& spacetime() const; Participants& participants(); const Participants& participants() const; class Implementation; private: Query(); rmf_utils::impl_ptr _pimpl; }; //============================================================================== Query query_all(); //============================================================================== Query make_query( std::vector regions); //============================================================================== Query make_query( std::vector maps, const Time* start_time, const Time* finish_time); //============================================================================== bool operator==( const Query& lhs, const Query& rhs); //============================================================================== bool operator!=( const Query& lhs, const Query& rhs); } // namespace schedule namespace detail { extern template class bidirectional_iterator< Region, schedule::Query::Spacetime::Regions::IterImpl, schedule::Query::Spacetime::Regions >; extern template class bidirectional_iterator< const Region, schedule::Query::Spacetime::Regions::IterImpl, schedule::Query::Spacetime::Regions >; } // namespace detail } // namespace rmf_traffic #endif // RMF_TRAFFIC__SCHEDULE__QUERY_HPP