diff --git a/rosbag2_py/CMakeLists.txt b/rosbag2_py/CMakeLists.txt index d4d4b2de79..97e74f24f9 100644 --- a/rosbag2_py/CMakeLists.txt +++ b/rosbag2_py/CMakeLists.txt @@ -48,20 +48,6 @@ target_link_libraries(_compression_options PUBLIC rosbag2_compression::rosbag2_compression ) -add_library(rosbag2_format_output SHARED - src/rosbag2_py/format_bag_metadata.cpp - src/rosbag2_py/format_service_info.cpp -) -target_link_libraries(rosbag2_format_output PUBLIC - rosbag2_cpp::rosbag2_cpp -) -install( - TARGETS rosbag2_format_output - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin -) - pybind11_add_module(_reader SHARED src/rosbag2_py/_reader.cpp ) @@ -73,11 +59,11 @@ target_link_libraries(_reader PUBLIC pybind11_add_module(_storage SHARED src/rosbag2_py/_storage.cpp + src/rosbag2_py/format_bag_metadata.cpp ) target_link_libraries(_storage PUBLIC rosbag2_cpp::rosbag2_cpp rosbag2_storage::rosbag2_storage - rosbag2_format_output ) pybind11_add_module(_writer SHARED @@ -91,11 +77,12 @@ target_link_libraries(_writer PUBLIC pybind11_add_module(_info SHARED src/rosbag2_py/_info.cpp + src/rosbag2_py/format_bag_metadata.cpp + src/rosbag2_py/format_service_info.cpp ) target_link_libraries(_info PUBLIC rosbag2_cpp::rosbag2_cpp rosbag2_storage::rosbag2_storage - rosbag2_format_output ) pybind11_add_module(_transport SHARED diff --git a/rosbag2_py/src/rosbag2_py/_info.cpp b/rosbag2_py/src/rosbag2_py/_info.cpp index f6e0f428a1..714a570066 100644 --- a/rosbag2_py/src/rosbag2_py/_info.cpp +++ b/rosbag2_py/src/rosbag2_py/_info.cpp @@ -20,7 +20,7 @@ #include "rosbag2_cpp/info.hpp" #include "rosbag2_storage/bag_metadata.hpp" -#include "./pybind11.hpp" +#include "pybind11.hpp" namespace rosbag2_py { diff --git a/rosbag2_py/src/rosbag2_py/_storage.cpp b/rosbag2_py/src/rosbag2_py/_storage.cpp index 8d9c7285ec..db0c150db3 100644 --- a/rosbag2_py/src/rosbag2_py/_storage.cpp +++ b/rosbag2_py/src/rosbag2_py/_storage.cpp @@ -23,11 +23,9 @@ #include "rosbag2_storage/storage_interfaces/base_read_interface.hpp" #include "rosbag2_storage/storage_options.hpp" #include "rosbag2_storage/topic_metadata.hpp" -#include "rosbag2_storage/qos.hpp" -#include "./format_bag_metadata.hpp" - -#include "./pybind11.hpp" +#include "format_bag_metadata.hpp" +#include "pybind11.hpp" namespace { @@ -358,7 +356,7 @@ PYBIND11_MODULE(_storage, m) { .def_readwrite("ros_distro", &rosbag2_storage::BagMetadata::ros_distro) .def( "__repr__", [](const rosbag2_storage::BagMetadata & metadata) { - return format_bag_meta_data(metadata); + return rosbag2_py::format_bag_meta_data(metadata); }); pybind11::enum_(m, "ReadOrderSortBy") diff --git a/rosbag2_py/src/rosbag2_py/format_bag_metadata.cpp b/rosbag2_py/src/rosbag2_py/format_bag_metadata.cpp index c7ed84645d..074cf332c3 100644 --- a/rosbag2_py/src/rosbag2_py/format_bag_metadata.cpp +++ b/rosbag2_py/src/rosbag2_py/format_bag_metadata.cpp @@ -223,6 +223,9 @@ void format_service_with_type( } // namespace +namespace rosbag2_py +{ + std::string format_bag_meta_data( const rosbag2_storage::BagMetadata & metadata, bool only_topic) @@ -270,3 +273,5 @@ std::string format_bag_meta_data( return info_stream.str(); } + +} // namespace rosbag2_py diff --git a/rosbag2_py/src/rosbag2_py/format_bag_metadata.hpp b/rosbag2_py/src/rosbag2_py/format_bag_metadata.hpp index bfc9fa5c29..dabd871f93 100644 --- a/rosbag2_py/src/rosbag2_py/format_bag_metadata.hpp +++ b/rosbag2_py/src/rosbag2_py/format_bag_metadata.hpp @@ -18,9 +18,13 @@ #include #include "rosbag2_storage/bag_metadata.hpp" -#include "visibility_control.hpp" -ROSBAG2_PY_PUBLIC std::string format_bag_meta_data( +namespace rosbag2_py +{ + +std::string format_bag_meta_data( const rosbag2_storage::BagMetadata & metadata, bool only_topic = false); +} // namespace rosbag2_py + #endif // ROSBAG2_PY__FORMAT_BAG_METADATA_HPP_ diff --git a/rosbag2_py/src/rosbag2_py/format_service_info.cpp b/rosbag2_py/src/rosbag2_py/format_service_info.cpp index aec57a0550..a14ee89e01 100644 --- a/rosbag2_py/src/rosbag2_py/format_service_info.cpp +++ b/rosbag2_py/src/rosbag2_py/format_service_info.cpp @@ -16,6 +16,9 @@ #include "format_service_info.hpp" +namespace rosbag2_py +{ + std::string format_service_info( std::vector> & service_info_list) @@ -49,3 +52,5 @@ format_service_info( return info_stream.str(); } + +} // namespace rosbag2_py diff --git a/rosbag2_py/src/rosbag2_py/format_service_info.hpp b/rosbag2_py/src/rosbag2_py/format_service_info.hpp index d91269b68f..d5cb5fc788 100644 --- a/rosbag2_py/src/rosbag2_py/format_service_info.hpp +++ b/rosbag2_py/src/rosbag2_py/format_service_info.hpp @@ -20,9 +20,13 @@ #include #include "rosbag2_cpp/info.hpp" -#include "visibility_control.hpp" -ROSBAG2_PY_PUBLIC std::string format_service_info( +namespace rosbag2_py +{ + +std::string format_service_info( std::vector> & service_info); +} // namespace rosbag2_py + #endif // ROSBAG2_PY__FORMAT_SERVICE_INFO_HPP_ diff --git a/rosbag2_py/src/rosbag2_py/visibility_control.hpp b/rosbag2_py/src/rosbag2_py/visibility_control.hpp deleted file mode 100644 index 5b7f557b00..0000000000 --- a/rosbag2_py/src/rosbag2_py/visibility_control.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018 Open Source Robotics Foundation, Inc. -// -// 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 -// -// 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 ROSBAG2_PY__VISIBILITY_CONTROL_HPP_ -#define ROSBAG2_PY__VISIBILITY_CONTROL_HPP_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ - #ifdef __GNUC__ - #define ROSBAG2_PY_EXPORT __attribute__ ((dllexport)) - #define ROSBAG2_PY_IMPORT __attribute__ ((dllimport)) - #else - #define ROSBAG2_PY_EXPORT __declspec(dllexport) - #define ROSBAG2_PY_IMPORT __declspec(dllimport) - #endif - #ifdef ROSBAG2_PY_BUILDING_DLL - #define ROSBAG2_PY_PUBLIC ROSBAG2_PY_EXPORT - #else - #define ROSBAG2_PY_PUBLIC ROSBAG2_PY_IMPORT - #endif - #define ROSBAG2_PY_PUBLIC_TYPE ROSBAG2_PY_PUBLIC - #define ROSBAG2_PY_LOCAL -#else - #define ROSBAG2_PY_EXPORT __attribute__ ((visibility("default"))) - #define ROSBAG2_PY_IMPORT - #if __GNUC__ >= 4 - #define ROSBAG2_PY_PUBLIC __attribute__ ((visibility("default"))) - #define ROSBAG2_PY_LOCAL __attribute__ ((visibility("hidden"))) - #else - #define ROSBAG2_PY_PUBLIC - #define ROSBAG2_PY_LOCAL - #endif - #define ROSBAG2_PY_PUBLIC_TYPE -#endif - -#ifdef __cplusplus -} -#endif - -#endif // ROSBAG2_PY__VISIBILITY_CONTROL_HPP_