Program Listing for File bridge_config.hpp

Return to documentation for file (/tmp/ws/src/ros_gz/ros_gz_bridge/include/ros_gz_bridge/bridge_config.hpp)

// Copyright 2022 Open Source Robotics Foundation, Inc.
//
// 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 ROS_GZ_BRIDGE__BRIDGE_CONFIG_HPP_
#define ROS_GZ_BRIDGE__BRIDGE_CONFIG_HPP_

#include <string>
#include <vector>

namespace ros_gz_bridge
{

enum class BridgeDirection
{
  NONE = 0,
  BIDIRECTIONAL = 1,
  GZ_TO_ROS = 2,
  ROS_TO_GZ = 3,
};

static constexpr size_t kDefaultSubscriberQueue = 10;

static constexpr size_t kDefaultPublisherQueue = 10;

// \brief Default lazy param
static constexpr bool kDefaultLazy = false;

// \brief Default bridge connectivity
static constexpr BridgeDirection kDefaultDirection = BridgeDirection::BIDIRECTIONAL;

struct BridgeConfig
{
  std::string ros_type_name;

  std::string ros_topic_name;

  std::string gz_type_name;

  std::string gz_topic_name;

  BridgeDirection direction = kDefaultDirection;

  size_t subscriber_queue_size = kDefaultSubscriberQueue;

  size_t publisher_queue_size = kDefaultPublisherQueue;

  bool is_lazy = kDefaultLazy;
};

std::vector<BridgeConfig> readFromYamlString(const std::string & data);

std::vector<BridgeConfig> readFromYamlFile(const std::string & filename);

}  // namespace ros_gz_bridge

#endif  // ROS_GZ_BRIDGE__BRIDGE_CONFIG_HPP_