diff --git a/g2o/core/CMakeLists.txt b/g2o/core/CMakeLists.txt index 4dd13a10b..58b400b1a 100644 --- a/g2o/core/CMakeLists.txt +++ b/g2o/core/CMakeLists.txt @@ -44,7 +44,6 @@ io/io_format.cpp io/io_binary.cpp io/io_binary.h io/io_json.cpp io/io_json.h io/io_g2o.cpp io/io_g2o.h -io/io_xml.cpp io/io_xml.h ) target_include_directories(core PUBLIC diff --git a/g2o/core/abstract_graph.cpp b/g2o/core/abstract_graph.cpp index 013eb09b3..fbf177405 100644 --- a/g2o/core/abstract_graph.cpp +++ b/g2o/core/abstract_graph.cpp @@ -32,7 +32,6 @@ #include "g2o/core/io/io_binary.h" #include "g2o/core/io/io_format.h" #include "g2o/core/io/io_json.h" -#include "g2o/core/io/io_xml.h" #include "g2o/stuff/logger.h" #include "io/io_g2o.h" @@ -54,8 +53,6 @@ std::unique_ptr allocate(g2o::io::Format format) { return std::make_unique(); case g2o::io::Format::kJson: return std::make_unique(); - case g2o::io::Format::kXML: - return std::make_unique(); } G2O_CRITICAL("Failed to create graph IO interface for format {}", g2o::io::to_string(format)); diff --git a/g2o/core/io/io_format.cpp b/g2o/core/io/io_format.cpp index b0a5f8121..4ffbc523a 100644 --- a/g2o/core/io/io_format.cpp +++ b/g2o/core/io/io_format.cpp @@ -41,8 +41,6 @@ std::string_view to_string(g2o::io::Format format) { return "Binary"; case g2o::io::Format::kJson: return "JSON"; - case g2o::io::Format::kXML: - return "XML"; } return ""; } @@ -50,7 +48,6 @@ std::string_view to_string(g2o::io::Format format) { std::optional formatForFileExtension(std::string_view extension) { if (extension == "g2o" || extension == "G2O") return Format::kG2O; if (extension == "json" || extension == "JSON") return Format::kJson; - if (extension == "xml" || extension == "XML") return Format::kXML; if (extension == "bin" || extension == "BIN") return Format::kBinary; return std::nullopt; } @@ -66,7 +63,6 @@ std::vector getFileFilter(bool open) { std::vector result; result.emplace_back("g2o Ascii files (*.g2o)", Format::kG2O); result.emplace_back("g2o Json files (*.json)", Format::kJson); - result.emplace_back("g2o XML files (*.xml)", Format::kXML); result.emplace_back("g2o BIN files (*.bin)", Format::kBinary); if (open) { result.emplace_back("All Files (*)", Format::kUndefined); diff --git a/g2o/core/io/io_format.h b/g2o/core/io/io_format.h index fdefb6e6f..90352b558 100644 --- a/g2o/core/io/io_format.h +++ b/g2o/core/io/io_format.h @@ -40,7 +40,6 @@ enum class G2O_CORE_API Format { kG2O = 0, kBinary = 1, kJson = 2, - kXML = 3 }; G2O_CORE_API std::string_view to_string(g2o::io::Format format); diff --git a/g2o/core/io/io_xml.cpp b/g2o/core/io/io_xml.cpp deleted file mode 100644 index e8099db05..000000000 --- a/g2o/core/io/io_xml.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// g2o - General Graph Optimization -// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "io_xml.h" - -#include - -#include "g2o/config.h" -#include "g2o/core/abstract_graph.h" - -#ifdef G2O_HAVE_CEREAL -#include -#include - -#include "io_wrapper_cereal.h" // IWYU pragma: keep -#else -#include "g2o/stuff/logger.h" -#endif // HAVE CEREAL - -namespace g2o { - -#ifdef G2O_HAVE_CEREAL - -std::optional IoXml::load(std::istream& input) { - return io::load(input, "XML"); -} - -bool IoXml::save(std::ostream& output, const AbstractGraph& graph) { - return io::save(output, graph, "XML"); -} - -#else - -std::optional IoXml::load(std::istream&) { - G2O_WARN("Loading XML is not supported"); - return std::nullopt; -} - -bool IoXml::save(std::ostream&, const AbstractGraph&) { - G2O_WARN("Saving XML is not supported"); - return false; -} - -#endif - -} // namespace g2o diff --git a/g2o/core/io/io_xml.h b/g2o/core/io/io_xml.h deleted file mode 100644 index e77149c0e..000000000 --- a/g2o/core/io/io_xml.h +++ /dev/null @@ -1,43 +0,0 @@ -// g2o - General Graph Optimization -// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef G2O_CORE_IO_XML_FORMAT_H -#define G2O_CORE_IO_XML_FORMAT_H - -#include "g2o/core/g2o_core_api.h" -#include "io_interface.h" - -namespace g2o { - -class G2O_CORE_API IoXml : public IoInterface { - public: - std::optional load(std::istream& input) override; - bool save(std::ostream& output, const AbstractGraph& graph) override; -}; - -} // namespace g2o - -#endif diff --git a/python/core/py_io_format.cpp b/python/core/py_io_format.cpp index b314e14f3..1780c71f6 100644 --- a/python/core/py_io_format.cpp +++ b/python/core/py_io_format.cpp @@ -8,8 +8,7 @@ void declareIOFormat(py::module& m) { py::enum_(m, "IoFormat") .value("G2O", io::Format::kG2O, "G2O's custom ASCII IO format") .value("JSON", io::Format::kJson, "JSON IO format") - .value("BINARY", io::Format::kBinary, "G2O's custom binary format") - .value("XML", io::Format::kXML, "XML IO format"); + .value("BINARY", io::Format::kBinary, "G2O's custom binary format"); } } // end namespace g2o diff --git a/unit_test/general/graph_io.cpp b/unit_test/general/graph_io.cpp index d68fb67d3..f4ecae4a4 100644 --- a/unit_test/general/graph_io.cpp +++ b/unit_test/general/graph_io.cpp @@ -304,13 +304,13 @@ TEST_P(OptimizableGraphIO, SaveAndLoad) { namespace { // We can always test G2O format, others depend on libraries -const auto kFileformatsToTest = Values( - g2o::io::Format::kG2O +const auto kFileformatsToTest = + Values(g2o::io::Format::kG2O #ifdef G2O_HAVE_CEREAL - , - g2o::io::Format::kJson, g2o::io::Format::kXML, g2o::io::Format::kBinary + , + g2o::io::Format::kJson, g2o::io::Format::kBinary #endif -); + ); } // namespace INSTANTIATE_TEST_SUITE_P(AbstractGraph, AbstractGraphIO, kFileformatsToTest); @@ -327,7 +327,7 @@ TEST(OptimizableGraphIO, FileFilter) { TEST(OptimizableGraphIO, FormatToString) { static constexpr g2o::io::Format kAllFormats[] = { g2o::io::Format::kUndefined, g2o::io::Format::kG2O, - g2o::io::Format::kBinary, g2o::io::Format::kJson, g2o::io::Format::kXML}; + g2o::io::Format::kBinary, g2o::io::Format::kJson}; for (const auto& f : kAllFormats) EXPECT_THAT(g2o::io::to_string(f), Not(IsEmpty())); diff --git a/unit_test/general/graph_io_dynamic.cpp b/unit_test/general/graph_io_dynamic.cpp index f233bec63..738322744 100644 --- a/unit_test/general/graph_io_dynamic.cpp +++ b/unit_test/general/graph_io_dynamic.cpp @@ -180,7 +180,6 @@ const auto kFileformatsToTest = #ifdef G2O_HAVE_CEREAL , std::make_tuple(g2o::io::Format::kJson, true), - std::make_tuple(g2o::io::Format::kXML, true), std::make_tuple(g2o::io::Format::kBinary, true) #endif );