Program Listing for File topic_bridge.hpp
↰ Return to documentation for file (include/domain_bridge/topic_bridge.hpp
)
// Copyright 2021, 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 DOMAIN_BRIDGE__TOPIC_BRIDGE_HPP_
#define DOMAIN_BRIDGE__TOPIC_BRIDGE_HPP_
#include <cstddef>
#include <string>
namespace domain_bridge
{
struct TopicBridge
{
std::string topic_name;
std::string type_name;
std::size_t from_domain_id;
std::size_t to_domain_id;
bool operator<(const TopicBridge & other) const
{
if (from_domain_id < other.from_domain_id) {
return true;
}
if (from_domain_id > other.from_domain_id) {
return false;
}
if (to_domain_id < other.to_domain_id) {
return true;
}
if (to_domain_id > other.to_domain_id) {
return false;
}
int name_compare = topic_name.compare(other.topic_name);
if (name_compare < 0) {
return true;
}
if (name_compare > 0) {
return false;
}
int type_compare = type_name.compare(other.type_name);
if (type_compare < 0) {
return true;
}
return false;
}
};
} // namespace domain_bridge
#endif // DOMAIN_BRIDGE__TOPIC_BRIDGE_HPP_