Skip to content

Commit

Permalink
fix compilation error and warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Feb 10, 2024
1 parent 58326a8 commit 3326553
Showing 1 changed file with 3 additions and 61 deletions.
64 changes: 3 additions & 61 deletions include/behaviortree_cpp/basic_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ std::string toStr(const T& value)
{
if constexpr (IsConvertibleToString<T>())
{
return value;
return static_cast<std::string>(value);
}
else if constexpr(!std::is_arithmetic_v<T>)
{
Expand Down Expand Up @@ -440,7 +440,7 @@ inline std::pair<std::string, PortInfo> InputPort(StringView name,
static_assert(std::is_same_v<T, DefaultT> ||
IsConvertibleToString<DefaultT>() ||
std::is_convertible_v<DefaultT, T>,
"The default value must be either the same of the port or BlackboardKey");
"The default value must be either the same of the port or a string");

auto out = CreatePort<T>(PortDirection::INPUT, name, description);
out.second.setDefaultValue(default_value);
Expand All @@ -462,7 +462,7 @@ inline std::pair<std::string, PortInfo> BidirectionalPort(StringView name,
static_assert(std::is_same_v<T, DefaultT> ||
IsConvertibleToString<DefaultT>() ||
std::is_convertible_v<DefaultT, T>,
"The default value must be either the same of the port or BlackboardKey");
"The default value must be either the same of the port or a string");

auto out = CreatePort<T>(PortDirection::INOUT, name, description);
out.second.setDefaultValue(default_value);
Expand Down Expand Up @@ -492,64 +492,6 @@ inline std::pair<std::string, PortInfo> OutputPort(StringView name,

//----------

// /** Syntactic sugar to invoke CreatePort<T>(PortDirection::INPUT,...)
// * It also sets the default value to the blackboard entry specified
// * in "default_key"
// *
// * @param name the name of the port
// * @param default_key the key of an entry in the blackbard
// * @param description optional human-readable description
// */
// template <typename T> [[nodiscard]]
// inline std::pair<std::string, PortInfo> InputPort(
// StringView name,
// BlackboardKey default_key,
// StringView description)
// {
// auto out = CreatePort<T>(PortDirection::INPUT, name, description);
// out.second.setDefaultValue(default_key);
// return out;
// }

// /** Syntactic sugar to invoke CreatePort<T>(PortDirection::INOUT,...)
// * It also sets the default value to the blackboard entry specified
// * in "default_key"
// *
// * @param name the name of the port
// * @param default_key the key of an entry in the blackbard
// * @param description optional human-readable description
// */
// template <typename T> [[nodiscard]]
// inline std::pair<std::string, PortInfo> BidirectionalPort(
// StringView name,
// BlackboardKey default_key,
// StringView description)
// {
// auto out = CreatePort<T>(PortDirection::INOUT, name, description);
// out.second.setDefaultValue(default_key);
// return out;
// }

// /** Syntactic sugar to invoke CreatePort<T>(PortDirection::OUTPUT,...)
// * It also sets the default value to the blackboard entry specified
// * in "default_key"
// *
// * @param name the name of the port
// * @param default_key the key of an entry in the blackbard
// * @param description optional human-readable description
// */
// template <typename T> [[nodiscard]]
// inline std::pair<std::string, PortInfo> OutputPort(
// StringView name,
// BlackboardKey default_key,
// StringView description)
// {
// auto out = CreatePort<T>(PortDirection::OUTPUT, name, description);
// out.second.setDefaultValue(default_key);
// return out;
// }
//----------

using PortsList = std::unordered_map<std::string, PortInfo>;

template <typename T, typename = void>
Expand Down

0 comments on commit 3326553

Please sign in to comment.