Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1560 Remove convertEnumToString
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Aug 8, 2022
1 parent 59fc5cb commit 5a905ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
7 changes: 0 additions & 7 deletions iceoryx_hoofs/include/iceoryx_hoofs/cxx/helplets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,6 @@ constexpr size_t maxSize() noexcept
return sizeof(T) > maxSize<Args...>() ? sizeof(T) : maxSize<Args...>();
}

/// Convert Enum class type to string
template <typename T, typename Enumeration>
const char* convertEnumToString(T port, const Enumeration source) noexcept
{
return port[static_cast<size_t>(source)];
}

/// @brief Get the capacity of a C array at compile time. This can be used to get the capacity
/// of arrays defined by a third party.
/// @code
Expand Down
8 changes: 4 additions & 4 deletions iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 - 2021 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2022 by Apex AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -54,10 +55,9 @@ iox::config::TomlGatewayConfigParser::parse(const roudi::ConfigFilePathString_t&
catch (const std::exception& parserException)
{
auto parserError = iox::config::TomlGatewayConfigParseError::EXCEPTION_IN_PARSER;

LogWarn() << iox::cxx::convertEnumToString(iox::config::TOML_GATEWAY_CONFIG_FILE_PARSE_ERROR_STRINGS,
parserError)
<< ": " << parserException.what();
auto errorStringIndex = static_cast<uint64_t>(parserError);
LogWarn() << iox::config::TOML_GATEWAY_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex] << ": "
<< parserException.what();

return iox::cxx::error<iox::config::TomlGatewayConfigParseError>(parserError);
}
Expand Down
7 changes: 4 additions & 3 deletions iceoryx_posh/source/roudi/application/roudi_main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019, 2020 by Robert Bosch GmbH, Apex.AI Inc. All rights reserved.
// Copyright (c) 2019 - 2020 by Robert Bosch GmbH.
// Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,9 +41,9 @@ int main(int argc, char* argv[]) noexcept

if (roudiConfig.has_error())
{
auto errorStringIndex = static_cast<uint64_t>(roudiConfig.get_error());
iox::LogFatal() << "Couldn't parse config file. Error: "
<< iox::cxx::convertEnumToString(iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS,
roudiConfig.get_error());
<< iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex];
return EXIT_FAILURE;
}

Expand Down
7 changes: 4 additions & 3 deletions iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2022 by Apex AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,9 +77,9 @@ TomlRouDiConfigFileProvider::parse() noexcept
catch (const std::exception& parserException)
{
auto parserError = iox::roudi::RouDiConfigFileParseError::EXCEPTION_IN_PARSER;

LogWarn() << iox::cxx::convertEnumToString(iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS, parserError)
<< ": " << parserException.what();
auto errorStringIndex = static_cast<uint64_t>(parserError);
LogWarn() << iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex] << ": "
<< parserException.what();

return iox::cxx::error<iox::roudi::RouDiConfigFileParseError>(parserError);
}
Expand Down

0 comments on commit 5a905ef

Please sign in to comment.