cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
i_client_builder_impl.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 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
28#include "msgpack_rpc/impl/msgpack_rpc_export.h"
31
33
37class IClientBuilderImpl {
38public:
44 virtual void register_protocol(
45 std::shared_ptr<transport::IBackend> backend) = 0;
46
52 virtual void connect_to(addresses::URI uri) = 0;
53
59 [[nodiscard]] virtual std::shared_ptr<clients::impl::IClientImpl>
60 build() = 0;
61
62 IClientBuilderImpl(const IClientBuilderImpl&) = delete;
63 IClientBuilderImpl(IClientBuilderImpl&&) = delete;
64 IClientBuilderImpl& operator=(const IClientBuilderImpl&) = delete;
65 IClientBuilderImpl& operator=(IClientBuilderImpl&&) = delete;
66
68 virtual ~IClientBuilderImpl() noexcept = default;
69
70protected:
72 IClientBuilderImpl() noexcept = default;
73};
74
83[[nodiscard]] MSGPACK_RPC_EXPORT std::unique_ptr<IClientBuilderImpl>
85 std::shared_ptr<executors::IAsyncExecutor> executor,
86 std::shared_ptr<logging::Logger> logger, config::ClientConfig config);
87
95[[nodiscard]] MSGPACK_RPC_EXPORT std::unique_ptr<IClientBuilderImpl>
97 const std::shared_ptr<logging::Logger>& logger);
98
99}; // namespace msgpack_rpc::clients::impl
Class of URIs (Uniform Resource Identifiers) to specify endpoints in this library.
Definition uri.h:38
virtual std::shared_ptr< clients::impl::IClientImpl > build()=0
Build a client.
IClientBuilderImpl() noexcept=default
Constructor.
virtual void register_protocol(std::shared_ptr< transport::IBackend > backend)=0
Register a protocol.
virtual ~IClientBuilderImpl() noexcept=default
Destructor.
virtual void connect_to(addresses::URI uri)=0
Add a URI to connect to.
Definition of ClientConfig class.
Definition of IAsyncExecutor class.
Definition of IBackend class.
Definition of IClientImpl class.
Definition of Logger class.
Namespace of internal implementations.
std::unique_ptr< IClientBuilderImpl > create_empty_client_builder_impl(std::shared_ptr< executors::IAsyncExecutor > executor, std::shared_ptr< logging::Logger > logger, config::ClientConfig config)
Create an empty IClientBuilderImpl object.
std::unique_ptr< IClientBuilderImpl > create_default_client_builder_impl(config::ClientConfig config, const std::shared_ptr< logging::Logger > &logger)
Create an IClientBuilderImpl object with default protocols.
Namespace of configurations.
Namespace of executors to process asynchronous tasks.
Namespace of logging.
Definition i_log_sink.h:27
STL namespace.
Definition of URI class.