Skip to content

Commit

Permalink
Merge pull request #43 from JohanMabille/middleware_impl
Browse files Browse the repository at this point in the history
Moved zmq dependent part of xmiddleware to src
  • Loading branch information
JohanMabille authored Apr 11, 2024
2 parents f1c73eb + 8712151 commit b33fd19
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 40 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,30 +124,42 @@ find_package(OpenSSL REQUIRED)

set(XEUS_ZMQ_HEADERS
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xauthentication.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xclient_zmq.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xdap_tcp_client.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xdebugger_base.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xeus-zmq.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xdap_tcp_client.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xmiddleware.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xserver_zmq.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xthread.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xzmq_context.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xzmq_serializer.hpp
${XEUS_ZMQ_INCLUDE_DIR}/xeus-zmq/xclient_zmq.hpp
)

set(XEUS_ZMQ_SOURCES
${XEUS_ZMQ_SOURCE_DIR}/xauthentication.cpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_zmq.cpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_messenger.hpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_messenger.cpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_zmq_impl.hpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_zmq_impl.cpp
${XEUS_ZMQ_SOURCE_DIR}/xcontrol.hpp
${XEUS_ZMQ_SOURCE_DIR}/xcontrol.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdap_tcp_client.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdap_tcp_client_impl.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdap_tcp_client_impl.hpp
${XEUS_ZMQ_SOURCE_DIR}/xdealer_channel.hpp
${XEUS_ZMQ_SOURCE_DIR}/xdealer_channel.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdebugger_base.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdebugger_middleware.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdebugger_middleware.hpp
${XEUS_ZMQ_SOURCE_DIR}/xheartbeat.cpp
${XEUS_ZMQ_SOURCE_DIR}/xheartbeat.hpp
${XEUS_ZMQ_SOURCE_DIR}/xheartbeat_client.hpp
${XEUS_ZMQ_SOURCE_DIR}/xheartbeat_client.cpp
${XEUS_ZMQ_SOURCE_DIR}/xiopub_client.hpp
${XEUS_ZMQ_SOURCE_DIR}/xiopub_client.cpp
${XEUS_ZMQ_SOURCE_DIR}/xmiddleware.cpp
${XEUS_ZMQ_SOURCE_DIR}/xmiddleware_impl.hpp
${XEUS_ZMQ_SOURCE_DIR}/xpublisher.cpp
${XEUS_ZMQ_SOURCE_DIR}/xpublisher.hpp
${XEUS_ZMQ_SOURCE_DIR}/xserver_control_main.cpp
Expand All @@ -169,17 +181,6 @@ set(XEUS_ZMQ_SOURCES
${XEUS_ZMQ_SOURCE_DIR}/xzmq_messenger.hpp
${XEUS_ZMQ_SOURCE_DIR}/xzmq_messenger.cpp
${XEUS_ZMQ_SOURCE_DIR}/xzmq_serializer.cpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_zmq.cpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_messenger.hpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_messenger.cpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_zmq_impl.hpp
${XEUS_ZMQ_SOURCE_DIR}/xclient_zmq_impl.cpp
${XEUS_ZMQ_SOURCE_DIR}/xdealer_channel.hpp
${XEUS_ZMQ_SOURCE_DIR}/xdealer_channel.cpp
${XEUS_ZMQ_SOURCE_DIR}/xiopub_client.hpp
${XEUS_ZMQ_SOURCE_DIR}/xiopub_client.cpp
${XEUS_ZMQ_SOURCE_DIR}/xheartbeat_client.hpp
${XEUS_ZMQ_SOURCE_DIR}/xheartbeat_client.cpp
)

# Targets and link
Expand Down
12 changes: 0 additions & 12 deletions include/xeus-zmq/xmiddleware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <string>

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

namespace xeus
Expand All @@ -31,17 +30,6 @@ namespace xeus
XEUS_ZMQ_API
int get_socket_linger();

XEUS_ZMQ_API
void init_socket(zmq::socket_t& socket,
const std::string& transport,
const std::string& ip,
const std::string& port);
XEUS_ZMQ_API
void init_socket(zmq::socket_t& socket, const std::string& end_point);

XEUS_ZMQ_API
std::string get_socket_port(const zmq::socket_t& socket);

XEUS_ZMQ_API
std::string find_free_port(std::size_t max_tries = 100, int start = 49152, int stop = 65536);
}
Expand Down
3 changes: 1 addition & 2 deletions src/xcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include <chrono>
#include <iostream>

#include "xeus-zmq/xmiddleware.hpp"

#include "xmiddleware_impl.hpp"
#include "xserver_zmq_split.hpp"
#include "xcontrol.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/xheartbeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>

#include "zmq_addon.hpp"
#include "xeus-zmq/xmiddleware.hpp"
#include "xmiddleware_impl.hpp"
#include "xheartbeat.hpp"

namespace xeus
Expand Down
5 changes: 2 additions & 3 deletions src/xheartbeat_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include "xheartbeat_client.hpp"
#include "xclient_zmq_impl.hpp"

#include "xeus-zmq/xmiddleware.hpp"
#include "xmiddleware_impl.hpp"

namespace xeus
{
Expand Down Expand Up @@ -78,4 +77,4 @@ namespace xeus
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
}
}
8 changes: 4 additions & 4 deletions src/xiopub_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#include <iostream>

#include "xeus-zmq/xzmq_serializer.hpp"

#include "xiopub_client.hpp"
#include "xclient_zmq_impl.hpp"

#include "xeus-zmq/xzmq_serializer.hpp"
#include "xeus-zmq/xmiddleware.hpp"
#include "xmiddleware_impl.hpp"

namespace xeus
{
Expand Down Expand Up @@ -80,4 +80,4 @@ namespace xeus
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/xmiddleware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <random>

#include "zmq_addon.hpp"
#include "xeus-zmq/xmiddleware.hpp"
#include "xmiddleware_impl.hpp"

namespace xeus
{
Expand Down
30 changes: 30 additions & 0 deletions src/xmiddleware_impl.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/***************************************************************************
* Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Martin Renou *
* Copyright (c) 2016, QuantStack *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XEUS_MIDDLEWARE_IMPL_HPP
#define XEUS_MIDDLEWARE_IMPL_HPP

#include <string>
#include "zmq.hpp"

#include "xeus-zmq/xmiddleware.hpp"

namespace xeus
{
void init_socket(zmq::socket_t& socket,
const std::string& transport,
const std::string& ip,
const std::string& port);

void init_socket(zmq::socket_t& socket, const std::string& end_point);

std::string get_socket_port(const zmq::socket_t& socket);
}

#endif
2 changes: 1 addition & 1 deletion src/xpublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <iostream>
#include <string>

#include "xeus-zmq/xmiddleware.hpp"
#include "xmiddleware_impl.hpp"
#include "xpublisher.hpp"

namespace xeus
Expand Down
2 changes: 1 addition & 1 deletion src/xserver_zmq_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

#include "xeus/xguid.hpp"
#include "xeus-zmq/xauthentication.hpp"
#include "xeus-zmq/xmiddleware.hpp"
#include "xeus-zmq/xzmq_serializer.hpp"
#include "xserver_zmq_default.hpp"
#include "xmiddleware_impl.hpp"
#include "xpublisher.hpp"
#include "xheartbeat.hpp"
#include "xtrivial_messenger.hpp"
Expand Down
3 changes: 1 addition & 2 deletions src/xshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
#include <chrono>
#include <iostream>

#include "xeus-zmq/xmiddleware.hpp"

#include "xserver_zmq_split.hpp"
#include "xmiddleware_impl.hpp"
#include "xshell.hpp"

namespace xeus
Expand Down

0 comments on commit b33fd19

Please sign in to comment.