cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
i_method.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
26
27namespace msgpack_rpc::methods {
28
32class IMethod {
33public:
39 [[nodiscard]] virtual messages::MethodNameView name() const noexcept = 0;
40
47 [[nodiscard]] virtual messages::SerializedMessage call(
48 const messages::ParsedRequest& request) = 0;
49
55 virtual void notify(const messages::ParsedNotification& notification) = 0;
56
57 IMethod(const IMethod&) = delete;
58 IMethod(IMethod&&) = delete;
59 IMethod& operator=(const IMethod&) = delete;
60 IMethod& operator=(IMethod&&) = delete;
61
63 virtual ~IMethod() noexcept = default;
64
65protected:
67 IMethod() noexcept = default;
68};
69
70} // namespace msgpack_rpc::methods
virtual messages::MethodNameView name() const noexcept=0
Get the method name.
virtual void notify(const messages::ParsedNotification &notification)=0
Notify this method.
virtual messages::SerializedMessage call(const messages::ParsedRequest &request)=0
Call this method.
Definition of MethodNameView class.
Namespace of messages.
Definition buffer_view.h:24
Namespace of methods in MessagePack-RPC.
Definition of ParsedNotification class.
Definition of ParsedRequest class.
Definition of SerializedMessage class.