.. _program_listing_file__tmp_ws_src_rmf_task_rmf_task_include_rmf_task_Task.hpp: Program Listing for File Task.hpp ================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/rmf_task/rmf_task/include/rmf_task/Task.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright (C) 2021 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_TASK__TASK_HPP #define RMF_TASK__TASK_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include namespace rmf_task { //============================================================================== class Task { public: // Declarations class Booking; using ConstBookingPtr = std::shared_ptr; class Tag; using ConstTagPtr = std::shared_ptr; class Model; using ConstModelPtr = std::shared_ptr; class Description; using ConstDescriptionPtr = std::shared_ptr; class Active; using ActivePtr = std::shared_ptr; }; //============================================================================== class Task::Booking { public: Booking( std::string id, rmf_traffic::Time earliest_start_time, ConstPriorityPtr priority, bool automatic = false); Booking( std::string id, rmf_traffic::Time earliest_start_time, ConstPriorityPtr priority, const std::string& requester, rmf_traffic::Time request_time, bool automatic = false); const std::string& id() const; rmf_traffic::Time earliest_start_time() const; ConstPriorityPtr priority() const; std::optional requester() const; std::optional request_time() const; // Returns true if this booking was automatically generated. bool automatic() const; class Implementation; private: rmf_utils::impl_ptr _pimpl; }; //============================================================================== class Task::Tag { public: Tag( ConstBookingPtr booking_, Header header_); const ConstBookingPtr& booking() const; const Header& header() const; class Implementation; private: rmf_utils::impl_ptr _pimpl; }; //============================================================================== class Task::Model { public: virtual std::optional estimate_finish( const State& initial_state, const Constraints& task_planning_constraints, const TravelEstimator& travel_estimator) const = 0; virtual rmf_traffic::Duration invariant_duration() const = 0; virtual ~Model() = default; }; //============================================================================== class Task::Description { public: virtual ConstModelPtr make_model( rmf_traffic::Time earliest_start_time, const Parameters& parameters) const = 0; struct Info { std::string category; std::string detail; }; virtual Info generate_info( const State& initial_state, const Parameters& parameters) const = 0; // Virtual destructor virtual ~Description() = default; }; //============================================================================== class Task::Active { public: using Backup = detail::Backup; virtual Event::Status status_overview() const = 0; virtual bool finished() const = 0; virtual const std::vector& completed_phases() const = 0; virtual Phase::ConstActivePtr active_phase() const = 0; virtual std::optional active_phase_start_time() const = 0; virtual const std::vector& pending_phases() const = 0; virtual const ConstTagPtr& tag() const = 0; virtual rmf_traffic::Duration estimate_remaining_time() const = 0; virtual Backup backup() const = 0; using Resume = detail::Resume; virtual Resume interrupt(std::function task_is_interrupted) = 0; // TODO(MXG): Should we have a pause() interface? It would be the same as // interrupt() except without the expectation that the robot will do any other // task before resuming. virtual void cancel() = 0; virtual void kill() = 0; virtual void skip(uint64_t phase_id, bool value = true) = 0; virtual void rewind(uint64_t phase_id) = 0; // Virtual destructor virtual ~Active() = default; protected: static Resume make_resumer(std::function callback); }; } // namespace rmf_task #endif // RMF_TASK__TASK_HPP