From 7a83063737d5b6c40c5ab927177b6aa80828840f Mon Sep 17 00:00:00 2001 From: Jackson Date: Wed, 19 Jan 2022 10:44:46 -0500 Subject: [PATCH] Exception handling (#77) * Cleanup based on best practices and clang-tidy * Fix data race issues by cleaning up server impl * Added `noexcept` where feasible * Further cleanup including additional `nodiscard` * Optimize memory usage and speed of adapters * Add precondition asserts for func ptrs * Hide more internals and remove unused functions * Eliminated unnecessary/unused internal functions * Add exception handling to public API * `void` functions can now fail * Tests added to verify the correct exceptions are being used * Add version info, update to 0.7.1 --- CMakeLists.txt | 3 +- INSTALL.md | 11 +- README.md | 7 +- benchmarks/CMakeLists.txt | 1 + benchmarks/benchmark.cpp | 129 +- benchmarks/meson.build | 57 - benchmarks/pch.hpp | 41 + dispatch_gen.py | 4 +- docs/annotated.html | 43 +- docs/classes.html | 25 +- ..._1client_1_1client__interface-members.html | 15 +- ...assrpc_1_1client_1_1client__interface.html | 138 +- ...ons_1_1client__receive__error-members.html | 88 + ...1exceptions_1_1client__receive__error.html | 126 ++ ...1_1client__receive__error__coll__graph.map | 5 + ...1_1client__receive__error__coll__graph.md5 | 1 + ...1_1client__receive__error__coll__graph.png | Bin 0 -> 2526 bytes ...client__receive__error__inherit__graph.map | 5 + ...client__receive__error__inherit__graph.md5 | 1 + ...client__receive__error__inherit__graph.png | Bin 0 -> 2526 bytes ...ptions_1_1client__send__error-members.html | 88 + ..._1_1exceptions_1_1client__send__error.html | 126 ++ ...ns_1_1client__send__error__coll__graph.map | 5 + ...ns_1_1client__send__error__coll__graph.md5 | 1 + ...ns_1_1client__send__error__coll__graph.png | Bin 0 -> 2503 bytes ...1_1client__send__error__inherit__graph.map | 5 + ...1_1client__send__error__inherit__graph.md5 | 1 + ...1_1client__send__error__inherit__graph.png | Bin 0 -> 2503 bytes ...ons_1_1deserialization__error-members.html | 88 + ...1exceptions_1_1deserialization__error.html | 126 ++ ...1_1deserialization__error__coll__graph.map | 5 + ...1_1deserialization__error__coll__graph.md5 | 1 + ...1_1deserialization__error__coll__graph.png | Bin 0 -> 2668 bytes ...deserialization__error__inherit__graph.map | 5 + ...deserialization__error__inherit__graph.md5 | 1 + ...deserialization__error__inherit__graph.png | Bin 0 -> 2668 bytes ...eptions_1_1function__mismatch-members.html | 88 + ...c_1_1exceptions_1_1function__mismatch.html | 126 ++ ...ons_1_1function__mismatch__coll__graph.map | 5 + ...ons_1_1function__mismatch__coll__graph.md5 | 1 + ...ons_1_1function__mismatch__coll__graph.png | Bin 0 -> 2743 bytes ..._1_1function__mismatch__inherit__graph.map | 5 + ..._1_1function__mismatch__inherit__graph.md5 | 1 + ..._1_1function__mismatch__inherit__graph.png | Bin 0 -> 2743 bytes ...tions_1_1function__not__found-members.html | 88 + ...1_1exceptions_1_1function__not__found.html | 126 ++ ...s_1_1function__not__found__coll__graph.map | 5 + ...s_1_1function__not__found__coll__graph.md5 | 1 + ...s_1_1function__not__found__coll__graph.png | Bin 0 -> 2702 bytes ..._1function__not__found__inherit__graph.map | 5 + ..._1function__not__found__inherit__graph.md5 | 1 + ..._1function__not__found__inherit__graph.png | Bin 0 -> 2702 bytes ...ptions_1_1remote__exec__error-members.html | 88 + ..._1_1exceptions_1_1remote__exec__error.html | 126 ++ ...ns_1_1remote__exec__error__coll__graph.map | 5 + ...ns_1_1remote__exec__error__coll__graph.md5 | 1 + ...ns_1_1remote__exec__error__coll__graph.png | Bin 0 -> 2499 bytes ...1_1remote__exec__error__inherit__graph.map | 5 + ...1_1remote__exec__error__inherit__graph.md5 | 1 + ...1_1remote__exec__error__inherit__graph.png | Bin 0 -> 2499 bytes ...exceptions_1_1rpc__exception-members.html} | 17 +- ...ssrpc_1_1exceptions_1_1rpc__exception.html | 126 ++ ...eptions_1_1rpc__exception__coll__graph.map | 4 + ...eptions_1_1rpc__exception__coll__graph.md5 | 1 + ...eptions_1_1rpc__exception__coll__graph.png | Bin 0 -> 1576 bytes ...ions_1_1rpc__exception__inherit__graph.map | 13 + ...ions_1_1rpc__exception__inherit__graph.md5 | 1 + ...ions_1_1rpc__exception__inherit__graph.png | Bin 0 -> 29865 bytes ...tions_1_1serialization__error-members.html | 88 + ...1_1exceptions_1_1serialization__error.html | 126 ++ ...s_1_1serialization__error__coll__graph.map | 5 + ...s_1_1serialization__error__coll__graph.md5 | 1 + ...s_1_1serialization__error__coll__graph.png | Bin 0 -> 2741 bytes ..._1serialization__error__inherit__graph.map | 5 + ..._1serialization__error__inherit__graph.md5 | 1 + ..._1serialization__error__inherit__graph.png | Bin 0 -> 2741 bytes ...ons_1_1server__receive__error-members.html | 88 + ...1exceptions_1_1server__receive__error.html | 126 ++ ...1_1server__receive__error__coll__graph.map | 5 + ...1_1server__receive__error__coll__graph.md5 | 1 + ...1_1server__receive__error__coll__graph.png | Bin 0 -> 2506 bytes ...server__receive__error__inherit__graph.map | 5 + ...server__receive__error__inherit__graph.md5 | 1 + ...server__receive__error__inherit__graph.png | Bin 0 -> 2506 bytes ...ptions_1_1server__send__error-members.html | 88 + ..._1_1exceptions_1_1server__send__error.html | 126 ++ ...ns_1_1server__send__error__coll__graph.map | 5 + ...ns_1_1server__send__error__coll__graph.md5 | 1 + ...ns_1_1server__send__error__coll__graph.png | Bin 0 -> 2476 bytes ...1_1server__send__error__inherit__graph.map | 5 + ...1_1server__send__error__inherit__graph.md5 | 1 + ...1_1server__send__error__inherit__graph.png | Bin 0 -> 2476 bytes docs/classrpc_1_1pack__adapter-members.html | 38 +- docs/classrpc_1_1pack__adapter.html | 189 +-- docs/classrpc_1_1packed__func.html | 304 ---- ...__func_3_01void_00_01_args_8_8_8_01_4.html | 183 --- ...oid_00_01_args_8_8_8_01_4__coll__graph.map | 4 - ...oid_00_01_args_8_8_8_01_4__coll__graph.md5 | 1 - ...oid_00_01_args_8_8_8_01_4__coll__graph.png | Bin 1968 -> 0 bytes ..._00_01_args_8_8_8_01_4__inherit__graph.map | 4 - ..._00_01_args_8_8_8_01_4__inherit__graph.md5 | 1 - ..._00_01_args_8_8_8_01_4__inherit__graph.png | Bin 1968 -> 0 bytes .../classrpc_1_1packed__func__coll__graph.map | 4 - .../classrpc_1_1packed__func__coll__graph.md5 | 1 - .../classrpc_1_1packed__func__coll__graph.png | Bin 1923 -> 0 bytes ...assrpc_1_1packed__func__inherit__graph.map | 4 - ...assrpc_1_1packed__func__inherit__graph.md5 | 1 - ...assrpc_1_1packed__func__inherit__graph.png | Bin 1923 -> 0 bytes ..._1server_1_1server__interface-members.html | 19 +- ...assrpc_1_1server_1_1server__interface.html | 154 +- .../dir_0ca40f09774b0c9b36fedfbb476b8248.html | 5 +- .../dir_d44c64559bbebec7f509842c48db8b23.html | 2 +- docs/files.html | 13 +- docs/functions.html | 39 +- docs/functions_func.html | 35 +- docs/globals.html | 29 +- docs/globals_defs.html | 29 +- docs/graph_legend.html | 2 +- docs/hierarchy.html | 32 +- docs/index.html | 157 +- docs/inherit_graph_0.map | 2 +- docs/inherit_graph_0.md5 | 2 +- docs/inherit_graph_0.png | Bin 730 -> 874 bytes docs/inherit_graph_1.map | 2 +- docs/inherit_graph_1.md5 | 2 +- docs/inherit_graph_1.png | Bin 717 -> 884 bytes docs/inherit_graph_10.map | 3 + docs/inherit_graph_10.md5 | 1 + docs/inherit_graph_10.png | Bin 0 -> 699 bytes docs/inherit_graph_11.map | 3 + docs/inherit_graph_11.md5 | 1 + docs/inherit_graph_11.png | Bin 0 -> 730 bytes docs/inherit_graph_12.map | 3 + docs/inherit_graph_12.md5 | 1 + docs/inherit_graph_12.png | Bin 0 -> 734 bytes docs/inherit_graph_13.map | 3 + docs/inherit_graph_13.md5 | 1 + docs/inherit_graph_13.png | Bin 0 -> 774 bytes docs/inherit_graph_2.map | 2 +- docs/inherit_graph_2.md5 | 2 +- docs/inherit_graph_2.png | Bin 699 -> 870 bytes docs/inherit_graph_3.map | 4 +- docs/inherit_graph_3.md5 | 2 +- docs/inherit_graph_3.png | Bin 3364 -> 884 bytes docs/inherit_graph_4.map | 2 +- docs/inherit_graph_4.md5 | 2 +- docs/inherit_graph_4.png | Bin 730 -> 979 bytes docs/inherit_graph_5.map | 2 +- docs/inherit_graph_5.md5 | 2 +- docs/inherit_graph_5.png | Bin 734 -> 1091 bytes docs/inherit_graph_6.map | 3 + docs/inherit_graph_6.md5 | 1 + docs/inherit_graph_6.png | Bin 0 -> 1101 bytes docs/inherit_graph_7.map | 3 + docs/inherit_graph_7.md5 | 1 + docs/inherit_graph_7.png | Bin 0 -> 730 bytes docs/inherit_graph_8.map | 3 + docs/inherit_graph_8.md5 | 1 + docs/inherit_graph_8.png | Bin 0 -> 717 bytes docs/inherit_graph_9.map | 13 + docs/inherit_graph_9.md5 | 1 + docs/inherit_graph_9.png | Bin 0 -> 29670 bytes docs/inherits.html | 74 +- docs/md__c_o_d_e__o_f__c_o_n_d_u_c_t.html | 134 ++ docs/md__c_o_n_t_r_i_b_u_t_i_n_g.html | 361 +++++ docs/md__i_n_s_t_a_l_l.html | 258 +++ docs/md__s_e_c_u_r_i_t_y.html | 108 ++ docs/menudata.js | 4 +- docs/namespacerpc.html | 10 +- docs/namespacerpc_1_1client.html | 2 +- docs/namespacerpc_1_1details.html | 2 +- docs/namespacerpc_1_1server.html | 2 +- docs/namespaces.html | 50 +- docs/pages.html | 84 + docs/rpc_8hpp.html | 90 +- docs/rpc_8hpp__dep__incl.map | 9 +- docs/rpc_8hpp__dep__incl.md5 | 2 +- docs/rpc_8hpp__dep__incl.png | Bin 4981 -> 7200 bytes docs/rpc_8hpp__incl.map | 19 +- docs/rpc_8hpp__incl.md5 | 2 +- docs/rpc_8hpp__incl.png | Bin 10995 -> 12588 bytes docs/rpc_8hpp_source.html | 1424 +++++++++++------ docs/rpc__bitsery_8hpp.html | 212 +++ docs/rpc__bitsery_8hpp__incl.map | 20 + docs/rpc__bitsery_8hpp__incl.md5 | 1 + docs/rpc__bitsery_8hpp__incl.png | Bin 0 -> 28951 bytes docs/rpc__bitsery_8hpp_source.html | 576 +++++++ docs/rpc__boost__json_8hpp.html | 71 +- docs/rpc__boost__json_8hpp__incl.map | 24 +- docs/rpc__boost__json_8hpp__incl.md5 | 2 +- docs/rpc__boost__json_8hpp__incl.png | Bin 16037 -> 20126 bytes docs/rpc__boost__json_8hpp_source.html | 582 ++++--- docs/rpc__dispatch__helper_8hpp.html | 44 +- docs/rpc__dispatch__helper_8hpp_source.html | 44 +- docs/rpc__njson_8hpp.html | 61 +- docs/rpc__njson_8hpp__incl.map | 23 +- docs/rpc__njson_8hpp__incl.md5 | 2 +- docs/rpc__njson_8hpp__incl.png | Bin 15127 -> 16841 bytes docs/rpc__njson_8hpp_source.html | 434 ++--- docs/rpc__rapidjson_8hpp.html | 74 +- docs/rpc__rapidjson_8hpp__incl.map | 27 +- docs/rpc__rapidjson_8hpp__incl.md5 | 2 +- docs/rpc__rapidjson_8hpp__incl.png | Bin 18542 -> 20224 bytes docs/rpc__rapidjson_8hpp_source.html | 788 +++++---- docs/search/all_0.js | 8 +- docs/search/all_1.js | 10 +- docs/search/all_2.js | 4 +- docs/search/all_3.js | 2 +- docs/search/all_4.js | 5 +- docs/search/all_5.js | 26 +- docs/search/all_6.js | 10 +- docs/search/{typedefs_0.html => all_7.html} | 2 +- docs/search/all_7.js | 6 + docs/search/{functions_5.html => all_8.html} | 2 +- docs/search/all_8.js | 21 + docs/search/{functions_6.html => all_9.html} | 2 +- docs/search/all_9.js | 9 + docs/search/classes_0.js | 4 +- docs/search/classes_1.js | 4 +- docs/search/classes_2.js | 3 +- docs/search/classes_3.html | 37 + docs/search/classes_3.js | 4 + docs/search/classes_4.html | 37 + docs/search/classes_4.js | 8 + docs/search/classes_5.html | 37 + docs/search/classes_5.js | 6 + docs/search/classes_6.html | 37 + docs/search/classes_6.js | 5 + docs/search/classes_7.html | 37 + docs/search/classes_7.js | 7 + docs/search/defines_0.js | 17 +- docs/search/files_0.js | 11 +- docs/search/functions_0.js | 3 +- docs/search/functions_1.js | 9 +- docs/search/functions_2.js | 3 +- docs/search/functions_3.js | 2 +- docs/search/functions_4.js | 3 +- docs/search/functions_5.js | 5 - docs/search/functions_6.js | 7 - docs/search/namespaces_0.js | 8 +- docs/search/pages_0.html | 37 + docs/search/pages_0.js | 4 + docs/search/pages_1.html | 37 + docs/search/pages_1.js | 4 + docs/search/pages_2.html | 37 + docs/search/pages_2.js | 4 + docs/search/pages_3.html | 37 + docs/search/pages_3.js | 4 + docs/search/searchdata.js | 16 +- docs/search/typedefs_0.js | 4 - ...ers_1_1bitsery_1_1details_1_1largest.html} | 21 +- ..._1largest_3_01_t_00_010_01_4-members.html} | 11 +- ...details_1_1largest_3_01_t_00_010_01_4.html | 93 ++ ...1_1largest_3_01_t_00_013_01_4-members.html | 84 + ...details_1_1largest_3_01_t_00_013_01_4.html | 93 ++ ...1_1largest_3_01_t_00_014_01_4-members.html | 84 + ...details_1_1largest_3_01_t_00_014_01_4.html | 93 ++ ...1_1largest_3_01_t_00_016_01_4-members.html | 84 + ...details_1_1largest_3_01_t_00_016_01_4.html | 93 ++ ...ry_1_1details_1_1pack__helper-members.html | 90 ++ ...1_1bitsery_1_1details_1_1pack__helper.html | 112 ++ ..._01void_00_01_args_8_8_8_01_4-members.html | 89 ++ ...helper_3_01void_00_01_args_8_8_8_01_4.html | 109 ++ ...vector_3_01uint8__t_01_4_01_4-members.html | 84 + ...1std_1_1vector_3_01uint8__t_01_4_01_4.html | 93 ++ examples/meson.build | 64 - examples/module/client.cpp | 33 +- examples/module/client.hpp | 5 +- examples/module/module.cpp | 11 +- examples/tcp_server/client.cpp | 2 +- examples/tcp_server/client.hpp | 6 + examples/tcp_server/server.hpp | 4 +- include/rpc.hpp | 785 ++++++--- include/rpc_adapters/meson.build | 50 - include/rpc_adapters/rpc_bitsery.hpp | 212 +-- include/rpc_adapters/rpc_boost_json.hpp | 315 ++-- include/rpc_adapters/rpc_njson.hpp | 167 +- include/rpc_adapters/rpc_rapidjson.hpp | 343 ++-- include/rpc_dispatch_helper.hpp | 4 +- meson.build | 136 -- meson_options.txt | 7 - tests/CMakeLists.txt | 6 +- tests/meson.build | 56 - tests/test_client/pch.hpp | 41 + tests/{ => test_client}/rpc.client.hpp | 24 +- tests/{ => test_client}/rpc.test.cpp | 92 +- tests/test_server/pch.hpp | 51 + tests/{ => test_server}/rpc.server.cpp | 52 +- tests/{ => test_server}/rpc.server.hpp | 49 +- tests/test_structs.hpp | 12 +- 290 files changed, 10169 insertions(+), 3786 deletions(-) delete mode 100644 benchmarks/meson.build create mode 100644 benchmarks/pch.hpp create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1client__receive__error__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1client__send__error__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1deserialization__error__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch.html create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1function__mismatch__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found.html create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1function__not__found__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1remote__exec__error__inherit__graph.png rename docs/{classrpc_1_1packed__func-members.html => classrpc_1_1exceptions_1_1rpc__exception-members.html} (57%) create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception.html create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1rpc__exception__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1serialization__error__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1server__receive__error__inherit__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error-members.html create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error.html create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error__coll__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error__coll__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error__coll__graph.png create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error__inherit__graph.map create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error__inherit__graph.md5 create mode 100644 docs/classrpc_1_1exceptions_1_1server__send__error__inherit__graph.png delete mode 100644 docs/classrpc_1_1packed__func.html delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4.html delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4__coll__graph.map delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4__coll__graph.md5 delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4__coll__graph.png delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4__inherit__graph.map delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4__inherit__graph.md5 delete mode 100644 docs/classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4__inherit__graph.png delete mode 100644 docs/classrpc_1_1packed__func__coll__graph.map delete mode 100644 docs/classrpc_1_1packed__func__coll__graph.md5 delete mode 100644 docs/classrpc_1_1packed__func__coll__graph.png delete mode 100644 docs/classrpc_1_1packed__func__inherit__graph.map delete mode 100644 docs/classrpc_1_1packed__func__inherit__graph.md5 delete mode 100644 docs/classrpc_1_1packed__func__inherit__graph.png create mode 100644 docs/inherit_graph_10.map create mode 100644 docs/inherit_graph_10.md5 create mode 100644 docs/inherit_graph_10.png create mode 100644 docs/inherit_graph_11.map create mode 100644 docs/inherit_graph_11.md5 create mode 100644 docs/inherit_graph_11.png create mode 100644 docs/inherit_graph_12.map create mode 100644 docs/inherit_graph_12.md5 create mode 100644 docs/inherit_graph_12.png create mode 100644 docs/inherit_graph_13.map create mode 100644 docs/inherit_graph_13.md5 create mode 100644 docs/inherit_graph_13.png create mode 100644 docs/inherit_graph_6.map create mode 100644 docs/inherit_graph_6.md5 create mode 100644 docs/inherit_graph_6.png create mode 100644 docs/inherit_graph_7.map create mode 100644 docs/inherit_graph_7.md5 create mode 100644 docs/inherit_graph_7.png create mode 100644 docs/inherit_graph_8.map create mode 100644 docs/inherit_graph_8.md5 create mode 100644 docs/inherit_graph_8.png create mode 100644 docs/inherit_graph_9.map create mode 100644 docs/inherit_graph_9.md5 create mode 100644 docs/inherit_graph_9.png create mode 100644 docs/md__c_o_d_e__o_f__c_o_n_d_u_c_t.html create mode 100644 docs/md__c_o_n_t_r_i_b_u_t_i_n_g.html create mode 100644 docs/md__i_n_s_t_a_l_l.html create mode 100644 docs/md__s_e_c_u_r_i_t_y.html create mode 100644 docs/pages.html create mode 100644 docs/rpc__bitsery_8hpp.html create mode 100644 docs/rpc__bitsery_8hpp__incl.map create mode 100644 docs/rpc__bitsery_8hpp__incl.md5 create mode 100644 docs/rpc__bitsery_8hpp__incl.png create mode 100644 docs/rpc__bitsery_8hpp_source.html rename docs/search/{typedefs_0.html => all_7.html} (95%) create mode 100644 docs/search/all_7.js rename docs/search/{functions_5.html => all_8.html} (95%) create mode 100644 docs/search/all_8.js rename docs/search/{functions_6.html => all_9.html} (95%) create mode 100644 docs/search/all_9.js create mode 100644 docs/search/classes_3.html create mode 100644 docs/search/classes_3.js create mode 100644 docs/search/classes_4.html create mode 100644 docs/search/classes_4.js create mode 100644 docs/search/classes_5.html create mode 100644 docs/search/classes_5.js create mode 100644 docs/search/classes_6.html create mode 100644 docs/search/classes_6.js create mode 100644 docs/search/classes_7.html create mode 100644 docs/search/classes_7.js delete mode 100644 docs/search/functions_5.js delete mode 100644 docs/search/functions_6.js create mode 100644 docs/search/pages_0.html create mode 100644 docs/search/pages_0.js create mode 100644 docs/search/pages_1.html create mode 100644 docs/search/pages_1.js create mode 100644 docs/search/pages_2.html create mode 100644 docs/search/pages_2.js create mode 100644 docs/search/pages_3.html create mode 100644 docs/search/pages_3.js delete mode 100644 docs/search/typedefs_0.js rename docs/{functions_type.html => structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest.html} (75%) rename docs/{classrpc_1_1packed__func_3_01void_00_01_args_8_8_8_01_4-members.html => structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_010_01_4-members.html} (71%) create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_010_01_4.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_013_01_4-members.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_013_01_4.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_014_01_4-members.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_014_01_4.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_016_01_4-members.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1largest_3_01_t_00_016_01_4.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1pack__helper-members.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1pack__helper.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1pack__helper_3_01void_00_01_args_8_8_8_01_4-members.html create mode 100644 docs/structrpc_1_1adapters_1_1bitsery_1_1details_1_1pack__helper_3_01void_00_01_args_8_8_8_01_4.html create mode 100644 docs/structstd_1_1hash_3_01std_1_1vector_3_01uint8__t_01_4_01_4-members.html create mode 100644 docs/structstd_1_1hash_3_01std_1_1vector_3_01uint8__t_01_4_01_4.html delete mode 100644 examples/meson.build delete mode 100644 include/rpc_adapters/meson.build delete mode 100644 meson.build delete mode 100644 meson_options.txt delete mode 100644 tests/meson.build create mode 100644 tests/test_client/pch.hpp rename tests/{ => test_client}/rpc.client.hpp (83%) rename tests/{ => test_client}/rpc.test.cpp (77%) create mode 100644 tests/test_server/pch.hpp rename tests/{ => test_server}/rpc.server.cpp (90%) rename tests/{ => test_server}/rpc.server.hpp (79%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67cd5323..b614663b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ cmake_minimum_required(VERSION 3.16) project( "rpc.hpp" - VERSION 0.6.1 + VERSION 0.7.1 DESCRIPTION "Simple RPC Header-Only Library" LANGUAGES CXX ) @@ -162,6 +162,7 @@ elseif(CXX_CLANG) -Wno-documentation -Wno-documentation-unknown-command -Wno-weak-vtables + -Wno-reserved-identifier -Wno-reserved-id-macro -Wno-missing-braces -Wno-covered-switch-default) diff --git a/INSTALL.md b/INSTALL.md index 445b8baf..5c56a76a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -24,7 +24,7 @@ $ cmake -B build -D BUILD_ADAPTER_BOOST_JSON=ON -D BUILD_ADAPTER_NJSON=ON -D BUI $ cmake --install build ``` -CMake version 3.12 or newer is required for this method, see below for instructions to install CMake +CMake version 3.16 or newer is required for this method, see below for instructions to install CMake if it is not already installed. ## Building and Testing the Project @@ -36,7 +36,7 @@ need to make sure that you can build the project and its test suite. While `rpc.hpp` is a header-only library, the project relies on using a buildsystem to perform certain tasks. -It is therefore required that CMake (version 3.12 or newer) is installed on your machine and +It is therefore required that CMake (version 3.16 or newer) is installed on your machine and available on your `$PATH` to build the project. Additionally, `rpc.hpp` requires at least one C++ compiler that fully supports C++17 or newer: @@ -209,16 +209,16 @@ $ mkdir build 3. Configure the project ```shell -$ cmake -B build -G Ninja -D BUILD_ADAPTER_BOOST_JSON=ON -D BUILD_ADAPTER_NJSON=ON -D BUILD_ADAPTER_RAPIDJSON=ON -D BUILD_TESTING=ON +$ cmake -B build -G Ninja -D BUILD_ADAPTER_BITSERY -D BUILD_ADAPTER_BOOST_JSON=ON -D BUILD_ADAPTER_NJSON=ON -D BUILD_ADAPTER_RAPIDJSON=ON -D BUILD_TESTING=ON ``` NOTE: The above command can be altered based on your needs: - In this example, the "Ninja" generator is used as it is fast, but `-G Ninja` may be omitted to use the system default make system -- With this example, all three adapters are to be built. By omitting one or more, they will not be +- With this example, all adapters are to be built. By omitting one or more, they will not be built (example: `-D BUILD_ADAPTER_BOOST_JSON=ON` could be omitted or set to `=OFF`) - - `BUILD_ADAPTER_NJSON` is required for testing + - **NOTE:** `BUILD_ADAPTER_NJSON` is required for testing - If using Conan to auto-install dependencies, make sure to set its option (add `-D DEPENDS_CONAN=ON`) - If using vcpkg to manage dependencies, make sure to set its option (add `-D DEPENDS_VCPKG=ON`) - You may also need to provide CMake with a vcpkg toolchain file: @@ -235,6 +235,7 @@ $ cmake --build build | Option | Description | |--|--| +| `BUILD_ADAPTER_BITSERY` | Build the adapter for Bitsery | | `BUILD_ADAPTER_BOOST_JSON` | Build the adapter for Boost.JSON | | `BUILD_ADAPTER_NJSON` | Build the adapter for nlohmann/json | | `BUILD_ADAPTER_RAPIDJSON` | Build the adapter for rapidjson | diff --git a/README.md b/README.md index bad8ac06..b5bc4e96 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,6 @@ server.cpp ```C++ #define RPC_HPP_SERVER_IMPL -#define RPC_HPP_ENABLE_NJSON #include #include @@ -101,7 +100,6 @@ client.cpp ```C++ #define RPC_HPP_CLIENT_IMPL -#define RPC_HPP_ENABLE_NJSON #include @@ -126,6 +124,11 @@ private: // Send mesg to server... } + void send(std::string&& mesg) override + { + // Send mesg to server... + } + std::string receive() override { // Get message back from server... diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index d880cf77..ae8186f9 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -77,6 +77,7 @@ endif() add_executable(rpc_benchmark benchmark.cpp) target_include_directories(rpc_benchmark PRIVATE ../tests) target_link_libraries(rpc_benchmark PRIVATE rpc_hpp catch2_lib asio_lib) +target_precompile_headers(rpc_benchmark PRIVATE pch.hpp) if(${BUILD_ADAPTER_BITSERY}) target_link_libraries(rpc_benchmark PRIVATE bitsery_adapter) diff --git a/benchmarks/benchmark.cpp b/benchmarks/benchmark.cpp index b1c6040f..39df21c8 100644 --- a/benchmarks/benchmark.cpp +++ b/benchmarks/benchmark.cpp @@ -1,26 +1,26 @@ -#define CATCH_CONFIG_ENABLE_BENCHMARKING -#define CATCH_CONFIG_MAIN #define RPC_HPP_CLIENT_IMPL - -#include "rpc.client.hpp" +#include "test_client/rpc.client.hpp" #include "test_structs.hpp" +#define CATCH_CONFIG_ENABLE_BENCHMARKING +#define CATCH_CONFIG_MAIN #include #if defined(RPC_HPP_ENABLE_BITSERY) const uint64_t rpc::adapters::bitsery::config::max_func_name_size = 30; -const uint64_t rpc::adapters::bitsery::config::max_string_size = 100; -const uint64_t rpc::adapters::bitsery::config::max_container_size = 100; +const uint64_t rpc::adapters::bitsery::config::max_string_size = 2048; +const uint64_t rpc::adapters::bitsery::config::max_container_size = 1'000; #endif TEST_CASE("By Value (simple)", "[value][simple][cached]") { constexpr uint64_t expected = 10946UL; + constexpr uint64_t input = 20; uint64_t test = 1; BENCHMARK("rpc.hpp (asio::tcp, njson)") { - test = GetClient().template call_func("Fibonacci", 20); + test = GetClient().template call_func("Fibonacci", input); }; REQUIRE(expected == test); @@ -30,7 +30,7 @@ TEST_CASE("By Value (simple)", "[value][simple][cached]") BENCHMARK("rpc.hpp (asio::tcp, rapidjson)") { - test = GetClient().template call_func("Fibonacci", 20); + test = GetClient().template call_func("Fibonacci", input); }; REQUIRE(expected == test); @@ -41,7 +41,7 @@ TEST_CASE("By Value (simple)", "[value][simple][cached]") BENCHMARK("rpc.hpp (asio::tcp, Boost.JSON)") { - test = GetClient().template call_func("Fibonacci", 20); + test = GetClient().template call_func("Fibonacci", input); }; REQUIRE(expected == test); @@ -52,7 +52,7 @@ TEST_CASE("By Value (simple)", "[value][simple][cached]") BENCHMARK("rpc.hpp (asio::tcp, bitsery)") { - test = GetClient().template call_func("Fibonacci", 20); + test = GetClient().template call_func("Fibonacci", input); }; REQUIRE(expected == test); @@ -64,15 +64,11 @@ TEST_CASE("By Value (complex)", "[value][complex][cached]") const std::string expected = "467365747274747d315a473a527073796c7e707b85"; std::string test; + const ComplexObject cx{ 24, "Franklin D. Roosevelt", false, true, + { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 } }; + BENCHMARK("rpc.hpp (asio::tcp, njson)") { - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; - test = GetClient().template call_func("HashComplex", cx); }; @@ -83,13 +79,6 @@ TEST_CASE("By Value (complex)", "[value][complex][cached]") BENCHMARK("rpc.hpp (asio::tcp, rapidjson)") { - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; - test = GetClient().template call_func("HashComplex", cx); }; @@ -101,13 +90,6 @@ TEST_CASE("By Value (complex)", "[value][complex][cached]") BENCHMARK("rpc.hpp (asio::tcp, Boost.JSON)") { - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; - test = GetClient().template call_func("HashComplex", cx); }; @@ -119,13 +101,6 @@ TEST_CASE("By Value (complex)", "[value][complex][cached]") BENCHMARK("rpc.hpp (asio::tcp, bitsery)") { - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; - test = GetClient().template call_func("HashComplex", cx); }; @@ -186,11 +161,12 @@ TEST_CASE("By Value (many)", "[value][many][cached]") TEST_CASE("By Reference (simple)", "[ref][simple]") { constexpr uint64_t expected = 10946UL; - uint64_t test = 20; + constexpr uint64_t input = 20; + uint64_t test{}; BENCHMARK("rpc.hpp (asio::tcp, njson)") { - test = 20; + test = input; GetClient().call_func("FibonacciRef", test); }; @@ -199,7 +175,7 @@ TEST_CASE("By Reference (simple)", "[ref][simple]") #if defined(RPC_HPP_ENABLE_RAPIDJSON) BENCHMARK("rpc.hpp (asio::tcp, rapidjson)") { - test = 20; + test = input; GetClient().call_func("FibonacciRef", test); }; #endif @@ -209,7 +185,7 @@ TEST_CASE("By Reference (simple)", "[ref][simple]") #if defined(RPC_HPP_ENABLE_BOOST_JSON) BENCHMARK("rpc.hpp (asio::tcp, Boost.JSON)") { - test = 20; + test = input; GetClient().call_func("FibonacciRef", test); }; @@ -219,7 +195,7 @@ TEST_CASE("By Reference (simple)", "[ref][simple]") #if defined(RPC_HPP_ENABLE_BITSERY) BENCHMARK("rpc.hpp (asio::tcp, bitsery)") { - test = 20; + test = input; GetClient().call_func("FibonacciRef", test); }; @@ -230,17 +206,17 @@ TEST_CASE("By Reference (simple)", "[ref][simple]") TEST_CASE("By Reference (complex)", "[ref][complex]") { const std::string expected = "467365747274747d315a473a527073796c7e707b85"; + const ComplexObject input{ 24, "Franklin D. Roosevelt", false, true, + { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 } }; + + ComplexObject cx{}; + std::string test; BENCHMARK("rpc.hpp (asio::tcp, njson)") { test.clear(); - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; + cx = input; GetClient().call_func("HashComplexRef", cx, test); }; @@ -251,12 +227,7 @@ TEST_CASE("By Reference (complex)", "[ref][complex]") BENCHMARK("rpc.hpp (asio::tcp, rapidjson)") { test.clear(); - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; + cx = input; GetClient().call_func("HashComplexRef", cx, test); }; @@ -268,12 +239,7 @@ TEST_CASE("By Reference (complex)", "[ref][complex]") BENCHMARK("rpc.hpp (asio::tcp, Boost.JSON)") { test.clear(); - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; + cx = input; GetClient().call_func("HashComplexRef", cx, test); }; @@ -285,12 +251,7 @@ TEST_CASE("By Reference (complex)", "[ref][complex]") BENCHMARK("rpc.hpp (asio::tcp, bitsery)") { test.clear(); - ComplexObject cx; - cx.flag1 = false; - cx.flag2 = true; - cx.id = 24; - cx.name = "Franklin D. Roosevelt"; - cx.vals = { 0, 1, 4, 6, 7, 8, 11, 15, 17, 22, 25, 26 }; + cx = input; GetClient().call_func("HashComplexRef", cx, test); }; @@ -302,7 +263,7 @@ TEST_CASE("By Reference (complex)", "[ref][complex]") TEST_CASE("By Reference (many)", "[ref][many]") { constexpr double expected = 313.2216436152; - double test; + double test{}; BENCHMARK("rpc.hpp (asio::tcp, njson)") { @@ -402,13 +363,14 @@ TEST_CASE("By Reference (many)", "[ref][many]") TEST_CASE("With Container", "[container][cached]") { constexpr double expected = 1731.8635996333; + const std::vector input{ 55.65, 125.325, 552.125, 12.767, 2599.6, 1245.125663, 9783.49, + 125.12, 553.3333333333, 2266.1 }; + double test = 1.0; BENCHMARK("rpc.hpp (asio::tcp, njson)") { - const std::vector vec{ 55.65, 125.325, 552.125, 12.767, 2599.6, 1245.125663, - 9783.49, 125.12, 553.3333333333, 2266.1 }; - + const auto& vec = input; test = GetClient().template call_func("AverageContainer", vec); }; @@ -420,9 +382,7 @@ TEST_CASE("With Container", "[container][cached]") BENCHMARK("rpc.hpp (asio::tcp, rapidjson)") { - const std::vector vec{ 55.65, 125.325, 552.125, 12.767, 2599.6, 1245.125663, - 9783.49, 125.12, 553.3333333333, 2266.1 }; - + const auto& vec = input; test = GetClient().template call_func( "AverageContainer", vec); }; @@ -433,9 +393,7 @@ TEST_CASE("With Container", "[container][cached]") BENCHMARK("rpc.hpp (asio::tcp, Boost.JSON)") { - const std::vector vec{ 55.65, 125.325, 552.125, 12.767, 2599.6, 1245.125663, - 9783.49, 125.12, 553.3333333333, 2266.1 }; - + const auto& vec = input; test = GetClient().template call_func( "AverageContainer", vec); }; @@ -446,9 +404,7 @@ TEST_CASE("With Container", "[container][cached]") BENCHMARK("rpc.hpp (asio::tcp, bitsery)") { - const std::vector vec{ 55.65, 125.325, 552.125, 12.767, 2599.6, 1245.125663, - 9783.49, 125.12, 553.3333333333, 2266.1 }; - + const auto& vec = input; test = GetClient().template call_func( "AverageContainer", vec); }; @@ -457,10 +413,14 @@ TEST_CASE("With Container", "[container][cached]") TEST_CASE("Sequential", "[sequential][cached]") { + constexpr uint64_t min_num = 5; + constexpr uint64_t max_num = 30; + constexpr size_t num_rands = 1'000; + BENCHMARK("rpc.hpp (asio::tcp, njson)") { auto vec = GetClient().template call_func>( - "GenRandInts", 5, 30, 1000); + "GenRandInts", min_num, max_num, num_rands); for (auto& val : vec) { @@ -475,7 +435,7 @@ TEST_CASE("Sequential", "[sequential][cached]") BENCHMARK("rpc.hpp (asio::tcp, rapidjson)") { auto vec = GetClient().template call_func>( - "GenRandInts", 5, 30, 1000); + "GenRandInts", min_num, max_num, num_rands); for (auto& val : vec) { @@ -491,7 +451,7 @@ TEST_CASE("Sequential", "[sequential][cached]") BENCHMARK("rpc.hpp (asio::tcp, bjson)") { auto vec = GetClient().template call_func>( - "GenRandInts", 5, 30, 1000); + "GenRandInts", min_num, max_num, num_rands); for (auto& val : vec) { @@ -507,7 +467,7 @@ TEST_CASE("Sequential", "[sequential][cached]") BENCHMARK("rpc.hpp (asio::tcp, bitsery)") { auto vec = GetClient().template call_func>( - "GenRandInts", 5, 30, 1000); + "GenRandInts", min_num, max_num, num_rands); for (auto& val : vec) { @@ -531,5 +491,6 @@ TEST_CASE("KillServer", } catch (...) { + // Exception is expected so continue } } diff --git a/benchmarks/meson.build b/benchmarks/meson.build deleted file mode 100644 index c0adb59a..00000000 --- a/benchmarks/meson.build +++ /dev/null @@ -1,57 +0,0 @@ -# BSD 3-Clause License -# -# Copyright (c) 2020-2021, Jackson Harmer -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -asio_dep = dependency('asio') -catch2_dep = dependency('catch2', version : ['>2.10.0', '<3.0.0']) -thread_dep = dependency('threads') - -bench_dependencies = [rpc_hpp_dep, asio_dep, catch2_dep, thread_dep] -bench_defines = [] - -if get_option('build_adapter_boost_json') - bench_dependencies += [boost_json_adapter_dep] - bench_defines += ['-DRPC_HPP_ENABLE_BOOST_JSON'] -endif - -if get_option('build_adapter_njson') - bench_dependencies += [njson_adapter_dep] - bench_defines += ['-DRPC_HPP_ENABLE_NJSON'] -endif - -if get_option('build_adapter_rapidjson') - bench_dependencies += [rapidjson_adapter_dep] - bench_defines += ['-DRPC_HPP_ENABLE_RAPIDJSON'] -endif - -rpc_bench_exe = executable('rpc_benchmark', 'benchmark.cpp', include_directories : '../tests', dependencies : bench_dependencies, install : false, cpp_args : [project_warnings, bench_defines]) - -if get_option('buildtype') in ['debugoptimized', 'release'] - benchmark('rpc_benchmark', rpc_bench_exe, args : ['--benchmark-samples 20'], timeout : 90) -endif diff --git a/benchmarks/pch.hpp b/benchmarks/pch.hpp new file mode 100644 index 00000000..f134bdc5 --- /dev/null +++ b/benchmarks/pch.hpp @@ -0,0 +1,41 @@ +#pragma once + +// Standard Library +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// 3rd Party +#include + +#if defined(RPC_HPP_ENABLE_BITSERY) +# include +# include +# include +# include +# include +# include +#endif + +#if defined(RPC_HPP_ENABLE_BOOST_JSON) +# include +#endif + +#if defined(RPC_HPP_ENABLE_NJSON) +# include +#endif + +#if defined(RPC_HPP_ENABLE_RAPIDJSON) +# include +# include +# include +#endif diff --git a/dispatch_gen.py b/dispatch_gen.py index 76a5e06f..d53ab0b4 100644 --- a/dispatch_gen.py +++ b/dispatch_gen.py @@ -129,11 +129,11 @@ f.write("#if defined(RPC_HPP_SERVER_IMPL) || defined(RPC_HPP_MODULE_IMPL)\n") f.write( - "# define RPC_HEADER_FUNC(RETURN, FUNCNAME, ...) extern RETURN (*FUNCNAME)(__VA_ARGS__)\n" + "# define RPC_HEADER_FUNC(RETURN, FUNCNAME, ...) extern RETURN (* const FUNCNAME)(__VA_ARGS__)\n" ) f.write("#elif defined(RPC_HPP_CLIENT_IMPL)\n") f.write( - "# define RPC_HEADER_FUNC(RETURN, FUNCNAME, ...) inline RETURN (*FUNCNAME)(__VA_ARGS__) = nullptr" + "# define RPC_HEADER_FUNC(RETURN, FUNCNAME, ...) inline RETURN (* const FUNCNAME)(__VA_ARGS__) = nullptr\n" ) f.write("#endif\n\n") diff --git a/docs/annotated.html b/docs/annotated.html index a319094a..cdabf4da 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -22,7 +22,7 @@
rpc.hpp -  0.6.1 +  0.7.1
Simple RPC Header-Only Library
@@ -68,17 +68,38 @@
Here are the classes, structs, unions and interfaces with brief descriptions:
-
[detail level 123]
+
[detail level 12345]
- - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 NrpcTop-level namespace for rpc.hpp classes and functions
 NclientNamespace containing functions and classes only relevant to "client-side" implentations
 Cclient_interfaceClass defining an interface for calling into an RPC server or module
 NserverNamespace containing functions and classes only relevant to "server-side" implentations
 Cserver_interfaceClass defining an interface for serving functions via RPC
 Cpacked_funcObject representing a function call, including the function's name, arguments and result
 Cpacked_func< void, Args... >Object representing a void returning function call, including the function's name and arguments
 Cpack_adapterClass collecting several functions for interoperating between serial objects and a packed_func
 Cserver_interfaceClass defining an interface for serving functions via RPC
 Cclient_interfaceClass defining an interface for calling into an RPC server or module
 Nadapters
 Nbitsery
 Ndetails
 Clargest
 Clargest< T, 0 >
 Clargest< T, 3 >
 Clargest< T, 4 >
 Clargest< T, 6 >
 Cpack_helper
 Cpack_helper< void, Args... >
 NclientNamespace containing functions and classes only relevant to "client-side" implentations
 Cclient_interfaceClass defining an interface for calling into an RPC server or module
 Nexceptions
 Crpc_exception
 Cfunction_not_found
 Cremote_exec_error
 Cserialization_error
 Cdeserialization_error
 Cfunction_mismatch
 Cclient_send_error
 Cclient_receive_error
 Cserver_send_error
 Cserver_receive_error
 NserverNamespace containing functions and classes only relevant to "server-side" implentations
 Cserver_interfaceClass defining an interface for serving functions via RPC
 Cpack_adapterClass collecting several functions for interoperating between serial objects and a packed_func
 Cserver_interfaceClass defining an interface for serving functions via RPC
 Cclient_interfaceClass defining an interface for calling into an RPC server or module
 Nstd
 Chash< std::vector< uint8_t > >
diff --git a/docs/classes.html b/docs/classes.html index a54bda22..106f50be 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -22,7 +22,7 @@
rpc.hpp -  0.6.1 +  0.7.1
Simple RPC Header-Only Library
@@ -67,17 +67,32 @@
Class Index
-
C | P | S
+
C | D | F | H | L | P | R | S
C
-
client_interface (rpc::client)
client_interface (rpc)
+
client_interface (rpc::client)
client_interface (rpc)
client_receive_error (rpc::exceptions)
client_send_error (rpc::exceptions)
+
+
D
+
deserialization_error (rpc::exceptions)
+
+
F
+
function_mismatch (rpc::exceptions)
function_not_found (rpc::exceptions)
+
+
H
+
hash< std::vector< uint8_t > > (std)
+
+
L
+
largest (rpc::adapters::bitsery::details)
largest< T, 0 > (rpc::adapters::bitsery::details)
largest< T, 3 > (rpc::adapters::bitsery::details)
largest< T, 4 > (rpc::adapters::bitsery::details)
largest< T, 6 > (rpc::adapters::bitsery::details)
P
-
pack_adapter (rpc)
packed_func (rpc)
packed_func< void, Args... > (rpc)
+
pack_adapter (rpc)
pack_helper (rpc::adapters::bitsery::details)
pack_helper< void, Args... > (rpc::adapters::bitsery::details)
+
R
+
remote_exec_error (rpc::exceptions)
rpc_exception (rpc::exceptions)
+
S
-
server_interface (rpc::server)
server_interface (rpc)
+
serialization_error (rpc::exceptions)
server_interface (rpc::server)
server_interface (rpc)
server_receive_error (rpc::exceptions)
server_send_error (rpc::exceptions)
diff --git a/docs/classrpc_1_1client_1_1client__interface-members.html b/docs/classrpc_1_1client_1_1client__interface-members.html index 5a7d4481..6bd4b43f 100644 --- a/docs/classrpc_1_1client_1_1client__interface-members.html +++ b/docs/classrpc_1_1client_1_1client__interface-members.html @@ -22,7 +22,7 @@
rpc.hpp -  0.6.1 +  0.7.1
Simple RPC Header-Only Library
@@ -74,10 +74,19 @@

This is the complete list of members for rpc::client::client_interface< Serial >, including all inherited members.

- + + + + + + + + + - + +
call_func(std::string func_name, Args &&... args)rpc::client::client_interface< Serial >inline
call_func(const std::string &func_name, Args &&... args)rpc::client::client_interface< Serial >inline
call_func(std::string &&func_name, Args &&... args)rpc::client::client_interface< Serial >inline
call_header_func_impl([[maybe_unused]] R(*func)(Args...), const std::string &func_name, Args &&... args) (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >inline
call_header_func_impl([[maybe_unused]] R(*func)(Args...), std::string &&func_name, Args &&... args) (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >inline
client_interface() noexcept=default (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >
client_interface(const client_interface &)=delete (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >
client_interface(client_interface &&) noexcept=default (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >
operator=(const client_interface &)=delete (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >
operator=(client_interface &&)=delete (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >
receive()=0rpc::client::client_interface< Serial >protectedpure virtual
send(const typename Serial::bytes_t &bytes)=0rpc::client::client_interface< Serial >protectedpure virtual
~client_interface()=default (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >virtual
send(typename Serial::bytes_t &&bytes)=0rpc::client::client_interface< Serial >protectedpure virtual
~client_interface() noexcept=default (defined in rpc::client::client_interface< Serial >)rpc::client::client_interface< Serial >virtual