58 std::shared_ptr<logging::Logger>
logger,
68 std::shared_ptr<transport::IBackend> backend)
override {
74 uris_.push_back(std::move(uri));
78 void add_method(std::unique_ptr<methods::IMethod> method)
override {
83 [[nodiscard]] std::unique_ptr<IServerImpl>
build()
override {
86 "No URI to listen to was given.");
89 std::vector<std::shared_ptr<transport::IAcceptor>> acceptors;
90 for (
const auto& uri :
uris_) {
91 const auto backend =
backends_.find(uri.scheme());
93 const auto added_acceptors =
94 backend->create_acceptor_factory()->create(uri);
95 for (
const auto& acceptor : added_acceptors) {
96 acceptors.push_back(acceptor);
100 if (acceptors.empty()) {
102 "All URI set to listen to was unusable.");
105 auto server = std::make_unique<ServerImpl>(
113 [[nodiscard]] std::shared_ptr<logging::Logger>
logger()
override {
128 std::vector<addresses::URI>
uris_{};
Definition of BackendList class.
Class of URIs (Uniform Resource Identifiers) to specify endpoints in this library.
Class of exceptions in cpp-msgpack-rpc library.
std::shared_ptr< executors::IAsyncExecutor > executor_
Executor.
void add_method(std::unique_ptr< methods::IMethod > method) override
Add a method.
ServerBuilderImpl(std::shared_ptr< executors::IAsyncExecutor > executor, std::shared_ptr< logging::Logger > logger, transport::BackendList backends, std::vector< addresses::URI > uris)
Constructor.
std::shared_ptr< logging::Logger > logger_
Logger.
std::unique_ptr< IServerImpl > build() override
Build a server.
void listen_to(addresses::URI uri) override
Add a URI to listen to.
void register_protocol(std::shared_ptr< transport::IBackend > backend) override
Register a protocol.
transport::BackendList backends_
Backends.
std::vector< addresses::URI > uris_
URIs to listen to.
std::shared_ptr< logging::Logger > logger() override
Get the logger in this builder.
std::unique_ptr< methods::IMethodProcessor > processor_
Processor of methods.
Class of lists of backends of protocols.
Definition of IAcceptor class.
Definition of IAcceptorFactory class.
Definition of IAsyncExecutor class.
Definition of IBackend class.
Definition of IMethod class.
Definition of IMethodProcessor class.
Definition of IServerBuilderImpl class.
Definition of IServerImpl class.
Definition of Logger class.
Definition of functions for processor of method calls.
Definition of MsgpackRPCException class.
Namespace of methods in MessagePack-RPC.
Namespace of internal implementation.
Definition of ServerImpl class.
Definition of StatusCode enumeration.