VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
point_cloud.h 文件参考

Zero-copy, schema-aware 3-D point cloud container for VLink transport. 更多...

#include <cstdint>
#include <iostream>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>
#include "../base/bytes.h"
#include "./header.h"
point_cloud.h 的引用(Include)关系图:

浏览该文件的源代码.

命名空间

详细描述

Zero-copy, schema-aware 3-D point cloud container for VLink transport.

PointCloud stores an array of fixed-size point records together with a compact compile-time schema that describes the name, type, and byte size of every field per point. The schema is encoded into two uint64_t values (size_num and type_num) where each nibble (4 bits) encodes one field, and a comma-separated name string (up to 160 chars, 3-16 fields).

Protocol encoding
size_num: 0x0408... (nibble N = byte-size of field N, high nibble = first field)
type_num: 0x0A0B... (nibble N = Type enum value of field N)
names: "x,y,z,intensity"
Supported field types
Enum C++ type Size
kBoolType bool 1
kInt8Type int8_t 1
kUint8Type uint8_t 1
kInt16Type int16_t 2
kUint16Type uint16_t 2
kInt32Type int32_t 4
kUint32Type uint32_t 4
kInt64Type int64_t 8
kUint64Type uint64_t 8
kFloatType float 4
kDoubleType double 8
Binary wire format
[ magic_begin (4) | PointCloud struct (256) | point data (size * pack_size) | magic_end (4) ]
Schema-aware zero-copy 3-D point cloud with typed per-point fields.
Usage – float XYZ + intensity
vlink::zerocopy::PointCloud pc;
pc.create_v3f<float>(1000, {"x", "y", "z", "intensity"});
// Append points
pc.push_value_v3f(1.0f, 2.0f, 3.0f, 0.8f);
pc.push_value_v3f(4.0f, 5.0f, 6.0f, 0.5f);
// Read back
auto key_map = pc.get_key_map();
float x = pc.get_value<float>(0, key_map, "x");
// Serialise
pc >> wire;
// Deserialise (zero-copy, borrows wire)
vlink::zerocopy::PointCloud pc2;
pc2 << wire;
注解
  • 32-bit architectures emit a compile-time warning and are not supported.
  • After operator<<, the data pointer references memory inside the source Bytes. The Bytes must outlive the PointCloud.
  • create<T...>() requires 3-16 type parameters, all of which must be fundamental types.
  • set_value() requires resize() to have been called first so that the internal write-cursor is positioned correctly.
  • The struct is exactly 256 bytes on 64-bit platforms (verified by static_assert).