ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Connection.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <memory>
11 #include <string>
12 
13 #include "io/rpc/ConnectionBase.h"
14 #include "io/rpc/ZMQContext.h"
15 
16 namespace cloudViewer {
17 namespace io {
18 namespace rpc {
19 
22 class Connection : public ConnectionBase {
23 public:
25  Connection();
26 
35  Connection(const std::string& address, int connect_timeout, int timeout);
36  ~Connection();
37 
39  std::shared_ptr<zmq::message_t> Send(zmq::message_t& send_msg);
40 
42  std::shared_ptr<zmq::message_t> Send(const void* data, size_t size);
43 
44  static std::string DefaultAddress();
45 
46 private:
47  std::shared_ptr<zmq::context_t> context_;
48  std::unique_ptr<zmq::socket_t> socket_;
49  const std::string address_;
50  const int connect_timeout_;
51  const int timeout_;
52 };
53 } // namespace rpc
54 } // namespace io
55 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
data
GraphType data
Definition: graph_cut.cc:138
cloudViewer::io::rpc::Connection::DefaultAddress
static std::string DefaultAddress()
Definition: Connection.cpp:80
cloudViewer::io::rpc::Connection::~Connection
~Connection()
Definition: Connection.cpp:51
cloudViewer::io::rpc::ConnectionBase
Base class for all connections.
Definition: ConnectionBase.h:22
ConnectionBase.h
cloudViewer::io::rpc::GetZMQContext
std::shared_ptr< zmq::context_t > GetZMQContext()
Returns the zeromq context for this process.
Definition: ZMQContext.cpp:22
zmq
Definition: ConnectionBase.h:12
size
int size
Definition: FileIOFactory.cpp:130
LogDebug
#define LogDebug(...)
Definition: Logging.h:90
cloudViewer::utility
Definition: Console.h:17
Connection.h
ZMQContext.h
cloudViewer::io::rpc::Connection::Send
std::shared_ptr< zmq::message_t > Send(zmq::message_t &send_msg)
Function for sending data wrapped in a zmq message object.
Definition: Connection.cpp:53
cloudViewer::io::rpc::Connection::Connection
Connection()
Creates a connection with the default parameters.
Definition: Connection.cpp:32
LogInfo
#define LogInfo(...)
Definition: Logging.h:81
cloudViewer::io::rpc::Connection
Definition: Connection.h:22