Skip to content

Commit

Permalink
Moved server split implementation to src again, added builder functions
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMabille committed Apr 24, 2024
1 parent e9992e3 commit 17f41b8
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 22 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ set(XEUS_ZMQ_HEADERS
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xdebugger_base.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xeus-zmq.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xmiddleware.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xserver_control_main.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xserver_shell_main.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xserver_zmq.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xserver_zmq_split.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xshell_default_runner.hpp
Expand Down Expand Up @@ -177,7 +175,9 @@ set(XEUS_ZMQ_SOURCES
${XEUS_ZMQ_SOURCE_DIR}/server/xpublisher.cpp
${XEUS_ZMQ_SOURCE_DIR}/server/xpublisher.hpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_control_main.cpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_control_main.hpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_shell_main.cpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_shell_main.hpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_zmq_default.cpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_zmq_default.hpp
${XEUS_ZMQ_SOURCE_DIR}/server/xserver_zmq_impl.cpp
Expand Down
31 changes: 25 additions & 6 deletions include/xeus-zmq/xserver_zmq_split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,33 @@ namespace xeus
};

XEUS_ZMQ_API
std::unique_ptr<xserver> make_xserver_control_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh = nl::json::error_handler_t::strict);
std::unique_ptr<xserver>
make_xserver_control_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh = nl::json::error_handler_t::strict);

XEUS_ZMQ_API
std::unique_ptr<xserver>
make_xserver_control(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh,
std::unique_ptr<xcontrol_runner> control,
std::unique_ptr<xshell_runner> shell);


XEUS_ZMQ_API
std::unique_ptr<xserver>
make_xserver_shell_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh = nl::json::error_handler_t::strict);

XEUS_ZMQ_API
std::unique_ptr<xserver> make_xserver_shell_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh = nl::json::error_handler_t::strict);
std::unique_ptr<xserver>
make_xserver_shell(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh,
std::unique_ptr<xcontrol_runner> control,
std::unique_ptr<xshell_runner> shell);
}

#endif
Expand Down
29 changes: 24 additions & 5 deletions src/server/xserver_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "xeus-zmq/xcontrol_default_runner.hpp"
#include "xeus-zmq/xshell_default_runner.hpp"
#include "xeus-zmq/xserver_control_main.hpp"
#include "xserver_control_main.hpp"

namespace xeus
{
Expand Down Expand Up @@ -39,11 +39,12 @@ namespace xeus
xserver_zmq_split::run_control();
}

std::unique_ptr<xserver> make_xserver_control_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh)
std::unique_ptr<xserver>
make_xserver_control_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh)
{
return std::make_unique<xserver_control_main>
return make_xserver_control
(
context,
config,
Expand All @@ -52,5 +53,23 @@ namespace xeus
std::make_unique<xshell_default_runner>()
);
}


std::unique_ptr<xserver>
make_xserver_control(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh,
std::unique_ptr<xcontrol_default_runner> control,
std::unique_ptr<xshell_default_runner> shell)
{
return std::make_unique<xserver_control_main>
(
context,
config,
eh,
std::move(control),
std::move(shell)
);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "xeus/xeus_context.hpp"
#include "xeus/xkernel_configuration.hpp"

#include "xeus-zmq.hpp"
#include "xserver_zmq_split.hpp"
#include "xeus-zmq/xeus-zmq.hpp"
#include "xeus-zmq/xserver_zmq_split.hpp"

namespace xeus
{
Expand Down
28 changes: 23 additions & 5 deletions src/server/xserver_shell_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "xeus-zmq/xcontrol_default_runner.hpp"
#include "xeus-zmq/xshell_default_runner.hpp"
#include "xeus-zmq/xserver_shell_main.hpp"
#include "xserver_shell_main.hpp"

namespace xeus
{
Expand Down Expand Up @@ -38,11 +38,12 @@ namespace xeus
xserver_zmq_split::run_shell();
}

std::unique_ptr<xserver> make_xserver_shell_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh)
std::unique_ptr<xserver>
make_xserver_shell_main(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh)
{
return std::make_unique<xserver_shell_main>
return make_xserver_shell
(
context,
config,
Expand All @@ -51,5 +52,22 @@ namespace xeus
std::make_unique<xshell_default_runner>()
);
}

std::unique_ptr<xserver>
make_xserver_shell(xcontext& context,
const xconfiguration& config,
nl::json::error_handler_t eh,
std::unique_ptr<xcontrol_runner> control,
std::unique_ptr<xshell_runner> shell)
{
return std::make_unique<xserver_shell_main>
(
context,
config,
eh,
std::move(control),
std::move(shell)
);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "xeus/xeus_context.hpp"
#include "xeus/xkernel_configuration.hpp"

#include "xeus-zmq.hpp"
#include "xserver_zmq_split.hpp"
#include "xeus-zmq/xeus-zmq.hpp"
#include "xeus-zmq/xserver_zmq_split.hpp"

namespace xeus
{
Expand Down

0 comments on commit 17f41b8

Please sign in to comment.