Open3D (C++ API)  0.15.1
MessageUtils.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// The MIT License (MIT)
5//
6// Copyright (c) 2018-2021 www.open3d.org
7//
8// Permission is hereby granted, free of charge, to any person obtaining a copy
9// of this software and associated documentation files (the "Software"), to deal
10// in the Software without restriction, including without limitation the rights
11// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12// copies of the Software, and to permit persons to whom the Software is
13// furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included in
16// all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24// IN THE SOFTWARE.
25// ----------------------------------------------------------------------------
26
27#pragma once
28
29#include <map>
30#include <tuple>
31
32#include "open3d/core/Tensor.h"
37
38namespace zmq {
39class message_t;
40}
41
42namespace open3d {
43namespace io {
44namespace rpc {
45
46namespace messages {
47struct Array;
48struct Status;
49struct MeshData;
50} // namespace messages
51
65std::shared_ptr<messages::Status> UnpackStatusFromReply(
66 const zmq::message_t& msg, size_t& offset, bool& ok);
67
69bool ReplyIsOKStatus(const zmq::message_t& msg);
70
73bool ReplyIsOKStatus(const zmq::message_t& msg, size_t& offset);
74
76std::string CreateSerializedRequestMessage(const std::string& msg_id);
77
78std::tuple<const void*, size_t> GetZMQMessageDataAndSize(
79 const zmq::message_t& msg);
80
81std::tuple<int32_t, std::string> GetStatusCodeAndStr(
82 const messages::Status& status);
83
84std::shared_ptr<zmq::message_t> CreateStatusOKMsg();
85
91std::shared_ptr<t::geometry::Geometry> MeshDataToGeometry(
92 const messages::MeshData& mesh_data);
93
96messages::MeshData GeometryToMeshData(const t::geometry::TriangleMesh& trimesh);
97
100messages::MeshData GeometryToMeshData(const t::geometry::PointCloud& pcd);
101
104messages::MeshData GeometryToMeshData(const t::geometry::LineSet& ls);
105
110std::tuple<std::string, double, std::shared_ptr<t::geometry::Geometry>>
111DataBufferToMetaGeometry(std::string& data);
112
113} // namespace rpc
114} // namespace io
115} // namespace open3d
int offset
Definition: FilePCD.cpp:64
const char const char value recording_handle imu_sample recording_handle uint8_t data
Definition: K4aPlugin.cpp:288
bool ReplyIsOKStatus(const zmq::message_t &msg)
Convenience function for checking if the message is an OK.
Definition: MessageUtils.cpp:71
messages::MeshData GeometryToMeshData(const t::geometry::TriangleMesh &trimesh)
Definition: MessageUtils.cpp:278
std::string CreateSerializedRequestMessage(const std::string &msg_id)
Creates a serialized Request message for testing purposes.
Definition: MessageUtils.cpp:85
std::tuple< const void *, size_t > GetZMQMessageDataAndSize(const zmq::message_t &msg)
Definition: MessageUtils.cpp:92
std::tuple< int32_t, std::string > GetStatusCodeAndStr(const messages::Status &status)
Definition: MessageUtils.cpp:97
std::tuple< std::string, double, std::shared_ptr< t::geometry::Geometry > > DataBufferToMetaGeometry(std::string &data)
Definition: MessageUtils.cpp:359
std::shared_ptr< t::geometry::Geometry > MeshDataToGeometry(const messages::MeshData &mesh_data)
Definition: MessageUtils.cpp:187
std::shared_ptr< zmq::message_t > CreateStatusOKMsg()
Definition: MessageUtils.cpp:102
std::shared_ptr< messages::Status > UnpackStatusFromReply(const zmq::message_t &msg, size_t &offset, bool &ok)
Definition: MessageUtils.cpp:42
Definition: PinholeCameraIntrinsic.cpp:35
Definition: ConnectionBase.h:31