cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
kitti.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint> // For fixed-width integers
5#include <cstring> // For memcpy
6#include <iosfwd> // Forward declare std::istream
7#include <map>
8#include <memory> // unique_ptr
9#include <optional>
10#include <string>
11#include <vector>
12
13#include <cpp-toolbox/container/string.hpp> // For string utilities like ends_with
14#include <cpp-toolbox/cpp-toolbox_export.hpp>
15#include <cpp-toolbox/file/file.hpp> // Assuming MemoryMappedFile is here
17#include <cpp-toolbox/io/formats/base.hpp> // base_file_format_t, base_file_data_t
19#include <cpp-toolbox/macro.hpp> // For platform checks if needed directly
20#include <cpp-toolbox/types/point.hpp> // point_cloud_t (inherits base_file_data_t)
21
22namespace toolbox::io
23{
24
25// Forward declare the concrete data type we'll work with
28
66class CPP_TOOLBOX_EXPORT kitti_format_t final : public base_file_format_t
67{
68public:
72 explicit kitti_format_t() = default;
73
77 ~kitti_format_t() override = default;
78
79 // 禁用复制,继承移动操作/Disable copy, inherit move operations
82 // kitti_format_t(kitti_format_t&&) = default; // 继承的足够了/Inherited is
83 // fine kitti_format_t& operator=(kitti_format_t&&) = default; //
84 // 继承的足够了/Inherited is fine
85
104 [[nodiscard]] auto can_read(const std::string& path) const -> bool override;
105
119 [[nodiscard]] auto get_supported_extensions() const
120 -> std::vector<std::string> override;
121
152 auto read(const std::string& path, std::unique_ptr<base_file_data_t>& data)
153 -> bool override;
154
202 [[nodiscard]] auto write(const std::string& path,
203 const std::unique_ptr<base_file_data_t>& data,
204 bool binary) const -> bool override;
205
206private:
207 // --- Internal Helper Functions ---
208
220 template<typename T>
221 bool write_internal(const std::string& path,
222 const point_cloud_t<T>& cloud,
223 bool binary) const;
224
234 template<typename T>
235 static bool read_binary_data(const std::string& path,
236 point_cloud_t<T>& cloud);
237
238}; // class pcd_format_t
239
263template<typename T>
264CPP_TOOLBOX_EXPORT std::unique_ptr<toolbox::types::point_cloud_t<T>>
265read_kitti_bin(const std::string& path);
266
289template<typename T>
290CPP_TOOLBOX_EXPORT bool write_kitti_bin(
291 const std::string& path, const toolbox::types::point_cloud_t<T>& cloud);
292
293} // namespace toolbox::io
294
295#include <cpp-toolbox/io/formats/detail/kitti_impl.hpp>
文件数据的基类 / Base class for data loaded from files
Definition base.hpp:33
文件格式读写器的基类 / Base class for file format readers/writers
Definition base.hpp:85
KITTI 点云数据(.bin)文件格式处理器。/File format handler for KITTI Point Cloud Data (.bin) files.
Definition kitti.hpp:67
kitti_format_t(const kitti_format_t &)=delete
kitti_format_t & operator=(const kitti_format_t &)=delete
auto get_supported_extensions() const -> std::vector< std::string > override
返回支持的文件扩展名。/Returns the supported file extension.
~kitti_format_t() override=default
析构函数。/Destructor.
kitti_format_t()=default
构造函数。/Constructor.
auto can_read(const std::string &path) const -> bool override
检查文件扩展名是否为".bin"。/Checks if the file extension is ".bin".
包含点和相关数据的点云类 / A point cloud class containing points and associated data
Definition point.hpp:268
通用的编译器、平台、架构检测和实用宏定义 / Common macros for compiler, platform, architecture detection and utility macro...
< 用于列出目录下的文件/For listing files in a directory
Definition dataloader.hpp:15
3D点/向量模板类 / A 3D point/vector template class
Definition point.hpp:48