39 #include <ament_index_cpp/get_package_share_directory.hpp>
43 #include <yaml-cpp/yaml.h>
61 return std::filesystem::is_directory(output_path) || std::filesystem::create_directories(output_path);
81 std::filesystem::path& relative_filepath);
105 tinyxml2::XMLElement*
uniqueInsert(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement& element,
const char* tag,
106 const std::vector<XMLAttribute>& attributes = {},
const char*
text =
nullptr);
109 template <
typename T>
110 inline bool getYamlProperty(
const YAML::Node& node,
const std::string& key, T& storage,
const T& default_value = T())
112 const YAML::Node& n = node[key];
113 bool valid = n.IsDefined();
114 storage = valid ? n.as<T>() : default_value;
118 inline bool getYamlProperty(
const YAML::Node& node,
const std::string& key, std::filesystem::path& storage,
119 const std::string& default_value =
"")
121 std::string storage_s;
def get_package_share_directory(pkg_name)
bool getYamlProperty(const YAML::Node &node, const std::string &key, T &storage, const T &default_value=T())
std::filesystem::path getSharePath(const std::string &package_name)
Return a path for the given package's share folder.
tinyxml2::XMLElement * uniqueInsert(tinyxml2::XMLDocument &doc, tinyxml2::XMLElement &element, const char *tag, const std::vector< XMLAttribute > &attributes={}, const char *text=nullptr)
Insert a new XML element with a given tag, attributes, and text.
bool extractPackageNameFromPath(const std::filesystem::path &path, std::string &package_name, std::filesystem::path &relative_filepath)
bool createParentFolders(const std::filesystem::path &file_path)
Create parent folders (recursively)
bool createFolders(const std::filesystem::path &output_path)
Create folders (recursively)
Simple structure for easy xml creation.