Program Listing for File MockAdapter.hpp

Return to documentation for file (/tmp/ws/src/rmf_ros2/rmf_fleet_adapter/include/rmf_fleet_adapter/agv/test/MockAdapter.hpp)

/*
 * Copyright (C) 2020 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.
 *
*/

#include <memory>

#include <rmf_fleet_adapter/agv/FleetUpdateHandle.hpp>

#include <rclcpp/node.hpp>

#include <rmf_task_msgs/msg/task_profile.hpp>

#include <rmf_traffic/schedule/Snapshot.hpp>

namespace rmf_fleet_adapter {
namespace agv {
namespace test {

//==============================================================================
class MockAdapter : public std::enable_shared_from_this<MockAdapter>
{
public:

  MockAdapter(
    const std::string& node_name,
    const rclcpp::NodeOptions& node_options = rclcpp::NodeOptions());

  std::shared_ptr<FleetUpdateHandle> add_fleet(
    const std::string& fleet_name,
    rmf_traffic::agv::VehicleTraits traits,
    rmf_traffic::agv::Graph navigation_graph,
    std::optional<std::string> server_uri = std::nullopt);

  std::shared_ptr<rclcpp::Node> node();

  std::shared_ptr<const rclcpp::Node> node() const;

  void add_secondary_node(std::shared_ptr<rclcpp::Node> secondary_node);

  void start();

  void stop();

  void dispatch_task(std::string task_id, const nlohmann::json& request);

  ~MockAdapter();

  class Implementation;
private:
  rmf_utils::unique_impl_ptr<Implementation> _pimpl;
};

} // namespace test
} // namespace agv
} // namespace rmf_fleet_adapter