EasyFleet
A simple-by-default framework for multi-robot, multi-capability fleets built on ROS 2
Loading...
Searching...
No Matches
namespace_utils.hpp
1// Copyright 2026 Intelligent Robotics Lab
2//
3// This file is part of the project EasyFleet
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef EASYFLEET_CORE__DETAIL__NAMESPACE_UTILS_HPP_
17#define EASYFLEET_CORE__DETAIL__NAMESPACE_UTILS_HPP_
18
19#include <string>
20
21namespace easyfleet_core
22{
23namespace detail
24{
25
28inline std::string strip_leading_slash(const std::string & ns)
29{
30 return (!ns.empty() && ns.front() == '/') ? ns.substr(1) : ns;
31}
32
36inline std::string robot_label(const std::string & ns)
37{
38 const auto stripped = strip_leading_slash(ns);
39 return stripped.empty() ? std::string("-") : stripped;
40}
41
42} // namespace detail
43} // namespace easyfleet_core
44
45#endif // EASYFLEET_CORE__DETAIL__NAMESPACE_UTILS_HPP_