From 75af9fab6f77d8515305b1f2bf89065ebcf1e9b3 Mon Sep 17 00:00:00 2001 From: Levi Armstrong Date: Sun, 8 Dec 2024 18:25:39 -0600 Subject: [PATCH] Fix windows build --- .../core/task_composer_node.h | 27 +++++-------- .../core/task_composer_node_info.h | 6 ++- .../core/task_composer_node_types.h | 40 +++++++++++++++++++ .../core/task_composer_plugin_factory.h | 4 +- .../core/src/task_composer_node.cpp | 29 ++++---------- .../core/src/task_composer_node_info.cpp | 3 ++ 6 files changed, 67 insertions(+), 42 deletions(-) create mode 100644 tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_types.h diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node.h b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node.h index 78d18cab27..2dbc602092 100644 --- a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node.h +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node.h @@ -40,7 +40,9 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include +#include #include +#include namespace YAML { @@ -52,15 +54,6 @@ namespace tesseract_planning class TaskComposerDataStorage; class TaskComposerContext; class TaskComposerExecutor; -class TaskComposerNodeInfo; - -enum class TaskComposerNodeType -{ - NODE, - TASK, - PIPELINE, - GRAPH -}; /** @brief Represents a node the pipeline to be executed */ class TaskComposerNode @@ -71,6 +64,9 @@ class TaskComposerNode using UPtr = std::unique_ptr; using ConstUPtr = std::unique_ptr; + // @brief The results map + using ResultsMap = std::map>; + /** @brief Most task will not require a executor so making it optional */ using OptionalTaskComposerExecutor = std::optional>; @@ -148,12 +144,10 @@ class TaskComposerNode TaskComposerNodePorts getPorts() const; /** @brief Generate the Dotgraph as a string */ - std::string - getDotgraph(const std::map>& results_map = {}) const; + std::string getDotgraph(const ResultsMap& results_map = ResultsMap()) const; /** @brief Generate the Dotgraph and save to file */ - bool saveDotgraph(const std::string& filepath, - const std::map>& results_map = {}) const; + bool saveDotgraph(const std::string& filepath, const ResultsMap& results_map = ResultsMap()) const; // NOLINT /** @brief Rename input keys */ virtual void renameInputKeys(const std::map& input_keys); @@ -168,10 +162,9 @@ class TaskComposerNode * @brief dump the task to dot * @brief Return additional subgraphs which should get appended if needed */ - virtual std::string - dump(std::ostream& os, - const TaskComposerNode* parent = nullptr, - const std::map>& results_map = {}) const; + virtual std::string dump(std::ostream& os, + const TaskComposerNode* parent = nullptr, + const ResultsMap& results_map = ResultsMap()) const; bool operator==(const TaskComposerNode& rhs) const; bool operator!=(const TaskComposerNode& rhs) const; diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_info.h b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_info.h index f8cdaec107..3dacf256a9 100644 --- a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_info.h +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_info.h @@ -40,12 +40,14 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include -#include +#include #include #include namespace tesseract_planning { +class TaskComposerNode; + /** Stores information about a node */ class TaskComposerNodeInfo { @@ -57,7 +59,7 @@ class TaskComposerNodeInfo TaskComposerNodeInfo() = default; // Required for serialization TaskComposerNodeInfo(const TaskComposerNode& node); - ~TaskComposerNodeInfo() = default; + ~TaskComposerNodeInfo(); TaskComposerNodeInfo(const TaskComposerNodeInfo&) = default; TaskComposerNodeInfo& operator=(const TaskComposerNodeInfo&) = default; TaskComposerNodeInfo(TaskComposerNodeInfo&&) = default; diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_types.h b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_types.h new file mode 100644 index 0000000000..41489a9aa1 --- /dev/null +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_node_types.h @@ -0,0 +1,40 @@ +/** + * @file task_composer_node_types.h + * @brief A node types enum + * + * @author Levi Armstrong + * @date July 29. 2022 + * @version TODO + * @bug No known bugs + * + * @copyright Copyright (c) 2022, Levi Armstrong + * + * @par License + * Software License Agreement (Apache License) + * @par + * 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 + * @par + * 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 TESSERACT_TASK_COMPOSER_TASK_COMPOSER_NODE_TYPES_H +#define TESSERACT_TASK_COMPOSER_TASK_COMPOSER_NODE_TYPES_H + +namespace tesseract_planning +{ +enum class TaskComposerNodeType +{ + NODE, + TASK, + PIPELINE, + GRAPH +}; +} + +#endif // TESSERACT_TASK_COMPOSER_TASK_COMPOSER_NODE_TYPES_H diff --git a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h index fe4a8a8131..69ac800335 100644 --- a/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h +++ b/tesseract_task_composer/core/include/tesseract_task_composer/core/task_composer_plugin_factory.h @@ -100,8 +100,8 @@ class TaskComposerPluginFactory ~TaskComposerPluginFactory(); TaskComposerPluginFactory(const TaskComposerPluginFactory&) = delete; TaskComposerPluginFactory& operator=(const TaskComposerPluginFactory&) = delete; - TaskComposerPluginFactory(TaskComposerPluginFactory&&) = default; - TaskComposerPluginFactory& operator=(TaskComposerPluginFactory&&) = default; + TaskComposerPluginFactory(TaskComposerPluginFactory&&) noexcept = default; + TaskComposerPluginFactory& operator=(TaskComposerPluginFactory&&) noexcept = default; /** * @brief Load plugins from a configuration object diff --git a/tesseract_task_composer/core/src/task_composer_node.cpp b/tesseract_task_composer/core/src/task_composer_node.cpp index 649c359dc9..83727b2589 100644 --- a/tesseract_task_composer/core/src/task_composer_node.cpp +++ b/tesseract_task_composer/core/src/task_composer_node.cpp @@ -31,6 +31,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH #include #include #include +#include #include #include #include @@ -384,8 +385,7 @@ const TaskComposerKeys& TaskComposerNode::getOutputKeys() const { return output_ TaskComposerNodePorts TaskComposerNode::getPorts() const { return ports_; } -std::string TaskComposerNode::getDotgraph( - const std::map>& results_map) const +std::string TaskComposerNode::getDotgraph(const ResultsMap& results_map) const { try { @@ -402,9 +402,7 @@ std::string TaskComposerNode::getDotgraph( return {}; } -bool TaskComposerNode::saveDotgraph( - const std::string& filepath, - const std::map>& results_map) const +bool TaskComposerNode::saveDotgraph(const std::string& filepath, const ResultsMap& results_map) const { try { @@ -435,10 +433,9 @@ void TaskComposerNode::renameOutputKeys(const std::map void TaskComposerNode::setConditional(bool enable) { conditional_ = enable; } -std::string -TaskComposerNode::dump(std::ostream& os, - const TaskComposerNode* /*parent*/, - const std::map>& results_map) const +std::string TaskComposerNode::dump(std::ostream& os, + const TaskComposerNode* /*parent*/, + const ResultsMap& results_map) const { const std::string tmp = toString(uuid_, "node_"); @@ -543,18 +540,8 @@ void TaskComposerNode::serialize(Archive& ar, const unsigned int /*version*/) std::string TaskComposerNode::toString(const boost::uuids::uuid& u, const std::string& prefix) { - std::string result; - result.reserve(36); - - std::size_t i = 0; - for (const auto* it_data = u.begin(); it_data != u.end(); ++it_data, ++i) - { - const size_t hi = ((*it_data) >> 4) & 0x0F; - result += boost::uuids::detail::to_char(hi); - - const size_t lo = (*it_data) & 0x0F; - result += boost::uuids::detail::to_char(lo); - } + auto result = boost::uuids::to_string(u); + boost::replace_all(result, "-", ""); return (prefix + result); } diff --git a/tesseract_task_composer/core/src/task_composer_node_info.cpp b/tesseract_task_composer/core/src/task_composer_node_info.cpp index 2a859c9f09..b970e6cd0d 100644 --- a/tesseract_task_composer/core/src/task_composer_node_info.cpp +++ b/tesseract_task_composer/core/src/task_composer_node_info.cpp @@ -39,6 +39,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH TESSERACT_COMMON_IGNORE_WARNINGS_POP #include +#include #include namespace tesseract_planning @@ -66,6 +67,8 @@ TaskComposerNodeInfo::TaskComposerNodeInfo(const TaskComposerNode& node) } } +TaskComposerNodeInfo::~TaskComposerNodeInfo() = default; + bool TaskComposerNodeInfo::operator==(const TaskComposerNodeInfo& rhs) const { static auto max_diff = static_cast(std::numeric_limits::epsilon());