cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
server.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <memory>
23#include <utility>
24#include <vector>
25
29
30namespace msgpack_rpc::servers {
31
37class Server {
38public:
47 explicit Server(std::unique_ptr<impl::IServerImpl> impl) noexcept
48 : impl_(std::move(impl)) {}
49
56 void stop() { impl_->stop(); }
57
63 void run_until_signal() { impl_->run_until_signal(); }
64
70 [[nodiscard]] std::vector<addresses::URI> local_endpoint_uris() {
71 return impl_->local_endpoint_uris();
72 }
73
82 [[nodiscard]] std::shared_ptr<executors::IExecutor> executor() {
83 return impl_->executor();
84 }
85
86private:
88 std::unique_ptr<impl::IServerImpl> impl_;
89};
90
91} // namespace msgpack_rpc::servers
void stop()
Stop processing of this server.
Definition server.h:56
Server(std::unique_ptr< impl::IServerImpl > impl) noexcept
Constructor.
Definition server.h:47
std::unique_ptr< impl::IServerImpl > impl_
Object of the internal implementation.
Definition server.h:88
void run_until_signal()
Run processing of this server until SIGINT or SIGTERM is received.
Definition server.h:63
std::vector< addresses::URI > local_endpoint_uris()
Get the URIs of the local endpoints in this server.
Definition server.h:70
std::shared_ptr< executors::IExecutor > executor()
Get the executor.
Definition server.h:82
Definition of IExecutor class.
Definition of IServerImpl class.
Namespace of internal implementation.
Namespace of servers.
Definition of URI class.