packio
nlohmann_json.h
Go to the documentation of this file.
1 // This Source Code Form is subject to the terms of the Mozilla Public
2 // License, v. 2.0. If a copy of the MPL was not distributed with this
3 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4 
5 #ifndef PACKIO_NLOHMANN_JSON_NLOHMANN_JSON_H
6 #define PACKIO_NLOHMANN_JSON_NLOHMANN_JSON_H
7 
11 
12 #include "../client.h"
13 #include "../server.h"
14 #include "rpc.h"
15 
19 namespace packio::nlohmann_json {
20 
24 template <typename Socket, template <class...> class Map = default_map>
26 
30 template <typename Socket, template <class...> class Map = default_map>
31 auto make_client(Socket&& socket)
32 {
33  return std::make_shared<client<Socket, Map>>(std::forward<Socket>(socket));
34 }
35 
39 template <typename Acceptor, typename Dispatcher = dispatcher<rpc>>
41 
45 template <typename Acceptor, typename Dispatcher = dispatcher<rpc>>
46 auto make_server(Acceptor&& acceptor)
47 {
48  return std::make_shared<server<Acceptor, Dispatcher>>(
49  std::forward<Acceptor>(acceptor));
50 }
51 
59 
60 } // packio::nlohmann_json
61 
62 #endif // PACKIO_NLOHMANN_JSON_NLOHMANN_JSON_H
packio::client
The client class.
Definition: client.h:34
packio::server
The server class.
Definition: server.h:27
packio::nlohmann_json
Definition: incremental_buffers.h:13
packio::nlohmann_json::completion_handler
completion_handler< rpc > completion_handler
The completion_handler class.
Definition: nlohmann_json.h:58
packio::nlohmann_json::make_server
auto make_server(Acceptor &&acceptor)
Create a msgpack server from an acceptor.
Definition: nlohmann_json.h:46
packio::nlohmann_json::make_client
auto make_client(Socket &&socket)
Create a msgpack client from a socket.
Definition: nlohmann_json.h:31