Program Listing for File demangle.h

Return to documentation for file (src/desert_classes/demangle.h)

/****************************************************************************
 * Copyright (C) 2024 Davide Costa                                          *
 *                                                                          *
 * This file is part of RMW desert.                                         *
 *                                                                          *
 *   RMW desert is free software: you can redistribute it and/or modify it  *
 *   under the terms of the GNU General Public License as published by the  *
 *   Free Software Foundation, either version 3 of the License, or any      *
 *   later version.                                                         *
 *                                                                          *
 *   RMW desert is distributed in the hope that it will be useful,          *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *   GNU General Public License for more details.                           *
 *                                                                          *
 *   You should have received a copy of the GNU General Public License      *
 *   along with RMW desert.  If not, see <http://www.gnu.org/licenses/>.    *
 ****************************************************************************/

#ifndef DEMANGLE_H_
#define DEMANGLE_H_

#include <algorithm>
#include <string>
#include <vector>

#include "rcpputils/find_and_replace.hpp"
#include "rcutils/logging_macros.h"
#include "rcutils/types.h"

#include "CBorStream.h"

namespace Discovery
{

  char * integer_to_string(int x);

  const char * const ros_topic_publisher_prefix = integer_to_string(PUBLISHER_TYPE);
  const char * const ros_topic_subscriber_prefix = integer_to_string(SUBSCRIBER_TYPE);
  const char * const ros_service_requester_prefix = integer_to_string(CLIENT_TYPE);
  const char * const ros_service_response_prefix = integer_to_string(SERVICE_TYPE);

  std::string resolve_prefix(const std::string & name, const std::string & prefix);

  std::string demangle_publisher_from_topic(const std::string & topic_name);

  std::string demangle_subscriber_from_topic(const std::string & topic_name);

  std::string demangle_topic(const std::string & topic_name);

  std::string demangle_service_request_from_topic(const std::string & topic_name);

  std::string demangle_service_reply_from_topic(const std::string & topic_name);

  std::string demangle_service_from_topic(const std::string & topic_name);

  std::string identity_demangle(const std::string & name);

  using DemangleFunction = std::string (*)(const std::string &);

}

#endif  // DEMANGLE_H_