diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f2deecb9c4..bf42cb8394 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -309,7 +309,6 @@ variables:
refs:
- merge_requests
changes:
- - "src/karathon/**/*" # bound api old binding code
- "src/karabind/**/*" # bound api new binding code
- "src/karabo/**/*" # bound api depends on the c++ build
- "src/pythonKarabo/**/*"
diff --git a/auto_build_all.sh b/auto_build_all.sh
index efcc213534..375b3f0315 100755
--- a/auto_build_all.sh
+++ b/auto_build_all.sh
@@ -488,7 +488,7 @@ if [ -d $FRAMEWORK_INSTALL_DIR ]; then
done
fi
-# Builds libkarabo, libkarathon, libkarabind, karabo-* utilities
+# Builds libkarabo, libkarabind, karabo-* utilities
# and installs them in FRAMEWORK_INSTALL_DIR.
safeRunCommand $EXTERN_DEPS_DIR/bin/cmake --build . -j $NUM_JOBS --target install
if [ $? -ne 0 ]; then
diff --git a/build/karabo/bundle.sh b/build/karabo/bundle.sh
index 0519991ffb..3aa1e49c5b 100755
--- a/build/karabo/bundle.sh
+++ b/build/karabo/bundle.sh
@@ -101,14 +101,12 @@ mkdir -p $PACKAGEDIR/var/data
cp -rf $EXTERN_DEPS_DIR $PACKAGEDIR/extern
rm -rf $PACKAGEDIR/extern/conan_toolchain
-# karathon and karabind
+# karabind
# Use karabo embedded python interpreter
PATH=$PACKAGEDIR/extern/bin:$PATH
SITE_PACKAGES=`python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
-cp -rf $PACKAGEDIR/lib/libkarathon.so $SITE_PACKAGES/karathon.so # <-- karathon.so
cp -rf $PACKAGEDIR/lib/libkarabind.so $SITE_PACKAGES/karabind.so # <-- karabind.so
-# ln -s $SITE_PACKAGES/karathon.so $PACKAGEDIR/lib/libkarathon.so
[ -d $PACKAGEDIR/extern/include/python3.8m ] && (cd $PACKAGEDIR/extern/include; rm -f python3.8; ln -s python3.8m python3.8)
# deviceServer, brokerMessageLogger, idxview, idxbuild, brokerRates are
diff --git a/ci/lint b/ci/lint
index f2ef9c7efd..05289d63cb 100755
--- a/ci/lint
+++ b/ci/lint
@@ -52,7 +52,7 @@ __lint_clang_format() {
SCAN_DIRS="$CI_PROJECT_DIR/src/karabo $CI_PROJECT_DIR/src/brokerMessageLogger \
$CI_PROJECT_DIR/src/cppLongTests $CI_PROJECT_DIR/src/deviceServer \
- $CI_PROJECT_DIR/src/integrationTests $CI_PROJECT_DIR/src/karathon \
+ $CI_PROJECT_DIR/src/integrationTests \
$CI_PROJECT_DIR/src/karabind $CI_PROJECT_DIR/src/tools"
echo "Linting format with `clang-format --version` ..."
diff --git a/run_python_tests.sh b/run_python_tests.sh
index 34259abff9..955282b784 100755
--- a/run_python_tests.sh
+++ b/run_python_tests.sh
@@ -131,18 +131,12 @@ safeRunTests() {
fi
export KARABO_BROKER=$BROKER
- if [ "$USE_KARATHON" = "1" ]; then
- BIND_MODE="Running tests with karathon"
- else
- BIND_MODE="Running tests with karabind"
- fi
echo
echo "*************************************************************************************************"
echo "*************************************************************************************************"
echo "**"
echo "** Running Karabo Python ${TEST_SUITE_NAME} tests with ${BROKER_TYPE^^} broker ... ${KARABO_BROKER}"
echo "** Broker Topic is ${KARABO_BROKER_TOPIC}"
- echo "** Python bindings: ${BIND_MODE}"
echo "**"
echo "*************************************************************************************************"
echo "*************************************************************************************************"
@@ -175,10 +169,6 @@ runPythonTestsCI() {
do
safeRunTests $BROKER $*
done
- # On CI we run once with karathon
- export USE_KARATHON="1"
- safeRunTests $BROKER $*
- unset USE_KARATHON
}
runPythonTests() {
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5cb5e71bdb..2366cfa137 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,7 +14,7 @@
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# The project that builds the various C++ components of the Karabo Framework:
-# libkarabo, libkarathon, C++ device server, unit tests, integration tests,
+# libkarabo, C++ device server, unit tests, integration tests,
# and karabo C++ utilities like BrokerMessageLogs, BrokerMessageRates, ...
#
# Variables that influence the configuration behavior and that should be
@@ -116,9 +116,6 @@ endif()
# is used.
add_subdirectory(karabo ${CMAKE_BINARY_DIR}/karabo)
-# The build of the Karathon Library (used by the Bound Python API).
-add_subdirectory(karathon ${CMAKE_BINARY_DIR}/karathon)
-
# The build of the Karabind Library (used by the Bound Python API).
add_subdirectory(karabind ${CMAKE_BINARY_DIR}/karabind)
@@ -171,7 +168,6 @@ if (BUILD_UNIT_TESTING OR BUILD_INTEGRATION_TESTING OR BUILD_LONG_RUN_TESTING)
"*/include/numpy/*" "${CMAKE_CURRENT_SOURCE_DIR}/tools/*"
"${CMAKE_CURRENT_SOURCE_DIR}/deviceServer/*"
"${CMAKE_CURRENT_SOURCE_DIR}/brokerMessageLogger/*"
- "${CMAKE_CURRENT_SOURCE_DIR}/karathon/*"
"${CMAKE_CURRENT_SOURCE_DIR}/karabind/*"
"${CMAKE_CURRENT_SOURCE_DIR}/integrationTests/*"
"${CMAKE_CURRENT_SOURCE_DIR}/cppLongTests/*"
diff --git a/src/karathon/AttributesNodeWrap.hh b/src/karathon/AttributesNodeWrap.hh
deleted file mode 100644
index 7ba2914bfc..0000000000
--- a/src/karathon/AttributesNodeWrap.hh
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * This file is part of Karabo.
- *
- * http://www.karabo.eu
- *
- * Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
- *
- * Karabo is free software: you can redistribute it and/or modify it under
- * the terms of the MPL-2 Mozilla Public License.
- *
- * You should have received a copy of the MPL-2 Public License along with
- * Karabo. If not, see .
- *
- * Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
-/*
- * File: AttributesNodeWrap.hh
- * Author: esenov
- *
- * Created on March 20, 2013, 2:28 PM
- */
-
-#ifndef ATTRIBUTESNODEWRAP_HH
-#define ATTRIBUTESNODEWRAP_HH
-
-#include
-#include
-#include
-
-#include "Wrapper.hh"
-
-namespace bp = boost::python;
-
-namespace karathon {
-
- class AttributesNodeWrap {
- struct null_deleter {
- void operator()(void const*) const {}
- };
-
- public:
- typedef boost::shared_ptr Pointer;
-
- static bp::object getKey(const Pointer& node) {
- return bp::object(node->getKey());
- }
-
- static void setValue(const Pointer& node, const bp::object& obj) {
- boost::any any;
- Wrapper::toAny(obj, any);
- node->setValue(any);
- }
-
- static bp::object getValue(const Pointer& node) {
- using namespace karabo::util;
- boost::any& a = node->getValueAsAny();
- // handle Hash differently returning reference to Hash
- if (a.type() == typeid(Hash)) {
- Hash& hash = boost::any_cast(a);
- boost::shared_ptr p(&hash, null_deleter());
- return bp::object(p);
- }
- return Wrapper::toObject(a);
- }
-
- static bp::object getValueAs(const Pointer& node, const bp::object& o_type) {
- using namespace karabo::util;
- Types::ReferenceType reftype = Types::UNKNOWN;
- if (bp::extract(o_type).check()) {
- std::string type = bp::extract(o_type);
- reftype = Types::from(type);
- } else if (bp::extract(o_type).check()) {
- PyTypes::ReferenceType type = bp::extract(o_type);
- reftype = PyTypes::to(type);
- }
-
- switch (reftype) {
- case Types::BOOL:
- return bp::object(node->getValueAs());
- case Types::CHAR:
- return bp::object(node->getValueAs());
- case Types::INT8:
- return bp::object(node->getValueAs());
- case Types::UINT8:
- return bp::object(node->getValueAs());
- case Types::INT16:
- return bp::object(node->getValueAs());
- case Types::UINT16:
- return bp::object(node->getValueAs());
- case Types::INT32:
- return bp::object(node->getValueAs());
- case Types::UINT32:
- return bp::object(node->getValueAs());
- case Types::INT64:
- return bp::object(node->getValueAs());
- case Types::UINT64:
- return bp::object(node->getValueAs());
- case Types::FLOAT:
- return bp::object(node->getValueAs());
- case Types::DOUBLE:
- return bp::object(node->getValueAs());
- case Types::STRING:
- return bp::object(node->getValueAs());
- case Types::VECTOR_BOOL:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- case Types::VECTOR_CHAR:
- return Wrapper::fromStdVectorToPyByteArray(node->getValueAs());
- case Types::VECTOR_INT8:
- return Wrapper::fromStdVectorToPyByteArray(node->getValueAs());
- case Types::VECTOR_UINT8:
- return Wrapper::fromStdVectorToPyByteArray(node->getValueAs());
- case Types::VECTOR_INT16:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- case Types::VECTOR_UINT16:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- case Types::VECTOR_INT32:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- case Types::VECTOR_UINT32:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- case Types::VECTOR_INT64:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- case Types::VECTOR_UINT64:
- return Wrapper::fromStdVectorToPyArray(node->getValueAs());
- // case Types::HASH:
- // return bp::object(node->getValueAs());
- // case Types::VECTOR_HASH:
- // return Wrapper::fromStdVectorToPyList(node->getValueAs());
- default:
- break;
- }
- throw KARABO_NOT_SUPPORTED_EXCEPTION("Type is not yet supported");
- }
-
- static bp::object getType(const Pointer& node) {
- using namespace karabo::util;
- PyTypes::ReferenceType type = static_cast(node->getType());
- return bp::object(type);
- }
-
- static void setType(const Pointer& node, const bp::object& o_type) {
- using namespace karabo::util;
- if (bp::extract(o_type).check()) {
- std::string type = bp::extract(o_type);
- node->setType(Types::from(type));
- } else if (bp::extract(o_type).check()) {
- PyTypes::ReferenceType type = bp::extract(o_type);
- node->setType(PyTypes::to(type));
- }
- }
- };
-} // namespace karathon
-
-#endif /* ATTRIBUTESNODEWRAP_HH */
diff --git a/src/karathon/AttributesWrap.hh b/src/karathon/AttributesWrap.hh
deleted file mode 100644
index e54f0796c3..0000000000
--- a/src/karathon/AttributesWrap.hh
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * This file is part of Karabo.
- *
- * http://www.karabo.eu
- *
- * Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
- *
- * Karabo is free software: you can redistribute it and/or modify it under
- * the terms of the MPL-2 Mozilla Public License.
- *
- * You should have received a copy of the MPL-2 Public License along with
- * Karabo. If not, see .
- *
- * Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
-/*
- * File: AttributesWrap.hh
- * Author: esenov
- *
- * Created on March 20, 2013, 10:15 AM
- */
-
-#ifndef ATTRIBUTESWRAP_HH
-#define ATTRIBUTESWRAP_HH
-
-#include
-#include
-#include
-#include
-
-
-namespace karathon {
-
- class AttributesWrap {
- struct null_deleter {
- void operator()(void const*) const {}
- };
-
- public:
- static bool has(karabo::util::Hash::Attributes& self, const std::string& key) {
- return self.has(key);
- }
-
- static bool is(karabo::util::Hash::Attributes& self, const std::string& key, const std::string& type) {
- using namespace karabo::util;
- Types::ReferenceType reftype = Types::from(type);
- return self.is(key, reftype);
- }
-
- static void erase(karabo::util::Hash::Attributes& self, const std::string& key) {
- self.erase(key);
- }
-
- static bp::object size(karabo::util::Hash::Attributes& self) {
- return bp::object(self.size());
- }
-
- static bool empty(karabo::util::Hash::Attributes& self) {
- return self.empty();
- }
-
- static void clear(karabo::util::Hash::Attributes& self) {
- self.clear();
- }
-
- static bp::object getNode(karabo::util::Hash::Attributes& self, const std::string& key) {
- using namespace karabo::util;
- Hash::Attributes::Node& nodeRef = self.getNode(key);
- boost::optional node(nodeRef);
- return bp::object(boost::shared_ptr(&(*node), null_deleter()));
- }
-
- static bp::object get(karabo::util::Hash::Attributes& self, const std::string& key) {
- return Wrapper::toObject(self.getAny(key));
- }
-
- static bp::object getAs(karabo::util::Hash::Attributes& self, const std::string& key,
- const bp::object& o_type) {
- using namespace karabo::util;
- Types::ReferenceType reftype = Types::UNKNOWN;
- if (bp::extract(o_type).check()) {
- std::string type = bp::extract(o_type);
- reftype = Types::from(type);
- } else if (bp::extract(o_type).check()) {
- PyTypes::ReferenceType type = bp::extract(o_type);
- reftype = PyTypes::to(type);
- }
-
- switch (reftype) {
- case Types::BOOL:
- return bp::object(self.getAs(key));
- case Types::CHAR:
- return bp::object(self.getAs(key));
- case Types::INT8:
- return bp::object(self.getAs(key));
- case Types::UINT8:
- return bp::object(self.getAs(key));
- case Types::INT16:
- return bp::object(self.getAs(key));
- case Types::UINT16:
- return bp::object(self.getAs(key));
- case Types::INT32:
- return bp::object(self.getAs(key));
- case Types::UINT32:
- return bp::object(self.getAs(key));
- case Types::INT64:
- return bp::object(self.getAs(key));
- case Types::UINT64:
- return bp::object(self.getAs(key));
- case Types::FLOAT:
- return bp::object(self.getAs(key));
- case Types::DOUBLE:
- return bp::object(self.getAs(key));
- case Types::STRING:
- return bp::object(self.getAs(key));
- case Types::VECTOR_BOOL:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- case Types::VECTOR_CHAR:
- return Wrapper::fromStdVectorToPyByteArray(self.getAs(key));
- case Types::VECTOR_INT8:
- return Wrapper::fromStdVectorToPyByteArray(self.getAs(key));
- case Types::VECTOR_UINT8:
- return Wrapper::fromStdVectorToPyByteArray(self.getAs(key));
- case Types::VECTOR_INT16:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- case Types::VECTOR_UINT16:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- case Types::VECTOR_INT32:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- case Types::VECTOR_UINT32:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- case Types::VECTOR_INT64:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- case Types::VECTOR_UINT64:
- return Wrapper::fromStdVectorToPyArray(self.getAs(key));
- // case Types::HASH:
- // return bp::object(self.getAs(key));
- // case Types::VECTOR_HASH:
- // return Wrapper::fromStdVectorToPyList(self.getAs(key));
- default:
- break;
- }
- throw KARABO_NOT_SUPPORTED_EXCEPTION("Type is not yet supported");
- }
-
- static bp::object set(karabo::util::Hash::Attributes& self, const std::string& key, const bp::object& value) {
- boost::any any;
- Wrapper::toAny(value, any);
- return bp::object(self.set(key, any));
- }
-
- // static bp::object find(karabo::util::Hash::Attributes& self, const std::string& key) {
- // karabo::util::Hash::Attributes::const_map_iterator it = self.find(key);
- // if (it == self.mend())
- // return bp::object();
- // return bp::object(it);
- // }
- //
- // static bp::object getIt(karabo::util::Hash::Attributes& self, const bp::object& obj) {
- // if (bp::extract(obj).check()) {
- // karabo::util::Hash::Attributes::const_map_iterator it =
- // bp::extract(obj); boost::any any =
- // self.get(it); std::cout << "getIt for const_map_iterator:" << any.type().name() <<
- // std::endl; return Wrapper::toObject(any);
- // } else if (bp::extract(obj).check()) {
- // std::cout << "getIt for map_iterator:" << std::endl;
- // karabo::util::Hash::Attributes::map_iterator it =
- // bp::extract(obj); return
- // Wrapper::toObject(self.get(it));
- // }
- // throw KARABO_NOT_SUPPORTED_EXCEPTION("Python type cannot be converted to
- // Hash::Attributes::map_iterator");
- // }
-
- static bp::object __getitem__(karabo::util::Hash::Attributes& self, const bp::object& obj) {
- if (bp::extract(obj).check()) {
- karabo::util::Hash::Attributes::Node& node = bp::extract(obj);
- if (node.getType() == karabo::util::Types::HASH) {
- boost::shared_ptr hash =
- boost::shared_ptr(&node.getValue(), null_deleter());
- return bp::object(hash);
- }
- return Wrapper::toObject(node.getValueAsAny(), false);
- } else if (bp::extract(obj).check()) {
- karabo::util::Hash::Attributes::Node& node = self.getNode(bp::extract(obj));
- if (node.getType() == karabo::util::Types::HASH) {
- boost::shared_ptr hash =
- boost::shared_ptr(&node.getValue(), null_deleter());
- return bp::object(hash);
- }
- return Wrapper::toObject(node.getValueAsAny(), false);
- }
- throw KARABO_PYTHON_EXCEPTION("Invalid type for Hash index. The type should be 'Node' or 'str'!");
- }
- };
-} // namespace karathon
-
-#endif /* ATTRIBUTESWRAP_HH */
diff --git a/src/karathon/CMakeLists.txt b/src/karathon/CMakeLists.txt
deleted file mode 100644
index 1b22f753ba..0000000000
--- a/src/karathon/CMakeLists.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-# This file is part of Karabo.
-#
-# http://www.karabo.eu
-#
-# Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
-#
-# Karabo is free software: you can redistribute it and/or modify it under
-# the terms of the MPL-2 Mozilla Public License.
-#
-# You should have received a copy of the MPL-2 Public License along with
-# Karabo. If not, see .
-#
-# Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.
-
-cmake_minimum_required(VERSION 3.15)
-
-project(
- "KarathonLib"
- LANGUAGES C CXX
-)
-
-include("../cmake/cxx-options.cmake")
-include("../cmake/karabo-lib-target-name.cmake")
-
-set(KARATHON_LIB_TARGET_NAME "karathon")
-
-# Uses Python3_ROOT_DIR to avoid other Python interpreters that maybe on the
-# system with wrong NumPy version or no NumPy package at all.
-set(Python3_ROOT_DIR ${CMAKE_PREFIX_PATH})
-find_package(
- Python3 3.11 EXACT REQUIRED
- COMPONENTS Interpreter Development NumPy
-)
-
-message(STATUS "Found NumPy version '${Python3_NumPy_VERSION}'.")
-message(STATUS "NumPy include dirs = '${Python3_NumPy_INCLUDE_DIRS}'")
-
-# From Boost 1.67 onwards, the identifier of the Boost Python component
-# requires a suffix with the version of Python the Boost Python package has
-# been built against. More details at:
-# https://stackoverflow.com/questions/56067518/cmake-could-not-find-boost-python
-
-find_package(Boost REQUIRED COMPONENTS python311)
-
-file(GLOB_RECURSE KARATHON_SRCS CONFIGURE_DEPENDS "*.cc")
-
-add_library(
- ${KARATHON_LIB_TARGET_NAME} SHARED
- ${KARATHON_SRCS}
-)
-
-# The last two RPATH entries are for when libkarathon.so is packaged as
-# karathon.so inside INSTALL_PACKAGE_ROOT/extern/lib/python3.11/site-packages.
-set_target_properties(
- ${KARATHON_LIB_TARGET_NAME} PROPERTIES
- INSTALL_RPATH "$ORIGIN/../extern/lib;$ORIGIN;$ORIGIN/../../../../lib;$ORIGIN/../.."
-)
-
-# To avoid warnings about deprecated version for NumPy API.
-target_compile_definitions(
- ${KARATHON_LIB_TARGET_NAME}
- PRIVATE
- NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
-)
-
-# Options lifted from the legacy Netbeans based project.
-target_compile_options(
- ${KARATHON_LIB_TARGET_NAME}
- PRIVATE
- -Wfatal-errors
- -Wno-unused-local-typedefs
- -Wno-noexcept-type
- -Wall)
-
-target_include_directories(
- ${KARATHON_LIB_TARGET_NAME}
- PUBLIC
- ${Python3_INCLUDE_DIRS}
- ${Python3_NumPy_INCLUDE_DIRS}
- # The Boost Python include directories are "inherited" from the
- # Karabo lib dependency - they are on the same tree as the other
- # components of Boost that libkarabo already used.
-)
-
-target_link_libraries(
- ${KARATHON_LIB_TARGET_NAME}
- ${KARABO_LIB_TARGET_NAME}
- boost::python311
- ${PYTHON_LIBRARIES}
-)
-
-install(
- TARGETS ${KARATHON_LIB_TARGET_NAME}
- LIBRARY DESTINATION "lib"
- PUBLIC_HEADER DESTINATION "include/karathon"
- RUNTIME DESTINATION "bin"
-)
-
-# Add karathon header files to the installation tree.
-file(GLOB INCLUDE_FILES CONFIGURE_DEPENDS "*.hh")
-foreach (FILE_PATH ${INCLUDE_FILES})
- install(FILES ${FILE_PATH} DESTINATION "include/karathon")
-endforeach()
diff --git a/src/karathon/ChannelWrap.cc b/src/karathon/ChannelWrap.cc
deleted file mode 100644
index 092c110148..0000000000
--- a/src/karathon/ChannelWrap.cc
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * This file is part of Karabo.
- *
- * http://www.karabo.eu
- *
- * Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
- *
- * Karabo is free software: you can redistribute it and/or modify it under
- * the terms of the MPL-2 Mozilla Public License.
- *
- * You should have received a copy of the MPL-2 Public License along with
- * Karabo. If not, see .
- *
- * Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
-/*
- * File: ChannelWrap.cc
- * Author: Sergey Esenov
- *
- * Created on April 6, 2013, 12:47 AM
- */
-
-#include "ChannelWrap.hh"
-
-#include "ScopedGILAcquire.hh"
-#include "Wrapper.hh"
-
-namespace bp = boost::python;
-using namespace std;
-using namespace karabo::util;
-using namespace karabo::net;
-using namespace boost::placeholders;
-
-namespace karathon {
-
-
- bp::object ChannelWrap::readStr(karabo::net::Channel::Pointer channel) {
- char* data = 0;
- size_t size = 0;
- {
- ScopedGILRelease nogil;
- size = channel->readSizeInBytes();
- data = new char[size];
- channel->read(data, size);
- }
- PyObject* pyobj = PyUnicode_FromStringAndSize(data, size);
- return bp::object(bp::handle<>(pyobj));
- }
-
-
- bp::object ChannelWrap::readHash(karabo::net::Channel::Pointer channel) {
- boost::shared_ptr hash(new Hash());
- {
- ScopedGILRelease nogil;
- channel->read(*hash);
- }
- return bp::object(hash);
- }
-
-
- bp::tuple ChannelWrap::readHashStr(karabo::net::Channel::Pointer channel) {
- boost::shared_ptr header(new Hash());
- char* data = 0;
- size_t size = 0;
- {
- ScopedGILRelease nogil;
- channel->read(*header);
- size = channel->readSizeInBytes();
- data = new char[size];
- channel->read(data, size);
- }
- PyObject* pyobj = PyUnicode_FromStringAndSize(data, size);
- return bp::make_tuple(bp::object(header), bp::object(bp::handle<>(pyobj)));
- }
-
-
- bp::tuple ChannelWrap::readHashHash(karabo::net::Channel::Pointer channel) {
- boost::shared_ptr header(new Hash());
- boost::shared_ptr body(new Hash());
- {
- ScopedGILRelease nogil;
- channel->read(*header);
- channel->read(*body);
- }
- return bp::make_tuple(bp::object(header), bp::object(body));
- }
-
-
- void ChannelWrap::write(karabo::net::Channel::Pointer channel, const bp::object& obj) {
- if (PyBytes_Check(obj.ptr())) {
- PyObject* bytearray = obj.ptr();
- size_t size = PyBytes_Size(bytearray);
- char* data = PyBytes_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->write(data, size);
- return;
- } else if (PyByteArray_Check(obj.ptr())) {
- PyObject* bytearray = obj.ptr();
- size_t size = PyByteArray_Size(bytearray);
- char* data = PyByteArray_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->write(data, size);
- return;
- } else if (bp::extract(obj).check()) {
- const Hash& hash = bp::extract(obj);
- ScopedGILRelease nogil;
- channel->write(hash);
- return;
- } else if (PyUnicode_Check(obj.ptr())) {
- Py_ssize_t size;
- const char* data = PyUnicode_AsUTF8AndSize(obj.ptr(), &size);
- ScopedGILRelease nogil;
- channel->write(data, size);
- return;
- }
- throw KARABO_PYTHON_EXCEPTION("Not supported type");
- }
-
-
- void ChannelWrap::write2(karabo::net::Channel::Pointer channel, const bp::object& header, const bp::object& obj) {
- if (bp::extract(header).check()) {
- const karabo::util::Hash hdr = bp::extract(header);
- if (PyBytes_Check(obj.ptr())) {
- PyObject* bytearray = obj.ptr();
- size_t size = PyBytes_Size(bytearray);
- char* data = PyBytes_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->write(hdr, data, size);
- return;
- } else if (PyByteArray_Check(obj.ptr())) {
- PyObject* bytearray = obj.ptr();
- size_t size = PyByteArray_Size(bytearray);
- char* data = PyByteArray_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->write(hdr, data, size);
- return;
- } else if (PyUnicode_Check(obj.ptr())) {
- std::string data = bp::extract(obj);
- ScopedGILRelease nogil;
- channel->write(hdr, data);
- return;
- } else if (bp::extract(obj).check()) {
- const karabo::util::Hash& hash = bp::extract(obj);
- ScopedGILRelease nogil;
- channel->write(hdr, hash);
- return;
- }
- }
- throw KARABO_PYTHON_EXCEPTION("Not supported type");
- }
-
-
- void ChannelWrap::readAsyncStr(karabo::net::Channel::Pointer channel, const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "readAsyncStr", channel);
- ScopedGILRelease nogil;
- channel->readAsyncString(proxyWrap);
- }
-
-
- void ChannelWrap::readAsyncHash(karabo::net::Channel::Pointer channel, const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "readAsyncHash", channel);
- ScopedGILRelease nogil;
- channel->readAsyncHash(proxyWrap);
- }
-
-
- void ChannelWrap::readAsyncHashStr(karabo::net::Channel::Pointer channel, const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "readAsyncHashStr", channel);
- ScopedGILRelease nogil;
- channel->readAsyncHashString(proxyWrap);
- }
-
-
- void ChannelWrap::readAsyncHashHash(karabo::net::Channel::Pointer channel, const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "readAsyncHashHash", channel);
- ScopedGILRelease nogil;
- channel->readAsyncHashHash(proxyWrap);
- }
-
-
- void ChannelWrap::writeAsyncStr(karabo::net::Channel::Pointer channel, const bp::object& obj,
- const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
-
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "writeAsyncStr", channel);
- if (PyBytes_Check(obj.ptr())) {
- PyObject* bytearray = obj.ptr();
- size_t size = PyBytes_Size(bytearray);
- char* data = PyBytes_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->writeAsyncRaw(data, size, proxyWrap);
- return;
- }
- if (PyByteArray_Check(obj.ptr())) {
- PyObject* bytearray = obj.ptr();
- size_t size = PyByteArray_Size(bytearray);
- char* data = PyByteArray_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->writeAsyncRaw(data, size, proxyWrap);
- return;
- }
- if (PyUnicode_Check(obj.ptr())) {
- Py_ssize_t size;
- const char* data = PyUnicode_AsUTF8AndSize(obj.ptr(), &size);
- ScopedGILRelease nogil;
- channel->writeAsyncRaw(data, size, proxyWrap);
- return;
- }
- throw KARABO_PYTHON_EXCEPTION("Not supported type");
- }
-
-
- void ChannelWrap::writeAsyncHash(karabo::net::Channel::Pointer channel, const bp::object& data,
- const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- if (bp::extract(data).check()) {
- const Hash& h = bp::extract(data);
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "writeAsyncHash", channel);
- ScopedGILRelease nogil;
- channel->writeAsyncHash(h, proxyWrap);
- return;
- }
- throw KARABO_PYTHON_EXCEPTION("Not supported type");
- }
-
-
- void ChannelWrap::writeAsyncHashStr(karabo::net::Channel::Pointer channel, const bp::object& hdr,
- const bp::object& body, const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- if (bp::extract(hdr).check()) {
- const Hash& h = bp::extract(hdr);
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "writeAsyncHashStr", channel);
- PyObject* bytearray = body.ptr();
- if (PyUnicode_Check(bytearray)) {
- Py_ssize_t size;
- const char* data = PyUnicode_AsUTF8AndSize(bytearray, &size);
- ScopedGILRelease nogil;
- channel->writeAsyncHashRaw(h, data, size, proxyWrap);
- return;
- }
- if (PyBytes_Check(bytearray)) {
- size_t size = PyBytes_Size(bytearray);
- const char* data = PyBytes_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->writeAsyncHashRaw(h, data, size, proxyWrap);
- return;
- }
- if (PyByteArray_Check(bytearray)) {
- size_t size = PyByteArray_Size(bytearray);
- const char* data = PyByteArray_AsString(bytearray);
- ScopedGILRelease nogil;
- channel->writeAsyncHashRaw(h, data, size, proxyWrap);
- return;
- }
- }
- throw KARABO_PYTHON_EXCEPTION("Not supported type");
- }
-
-
- void ChannelWrap::writeAsyncHashHash(karabo::net::Channel::Pointer channel, const bp::object& hdr,
- const bp::object& body, const bp::object& handler) {
- if (!PyCallable_Check(handler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- if (bp::extract(hdr).check() && bp::extract(body).check()) {
- const Hash& header = bp::extract(hdr);
- const Hash& data = bp::extract(body);
- using Wrap = HandlerWrapExtra;
- Wrap proxyWrap(handler, "writeAsyncHashHash", channel);
- ScopedGILRelease nogil;
- channel->writeAsyncHashHash(header, data, proxyWrap);
- return;
- }
- throw KARABO_PYTHON_EXCEPTION("Not supported type");
- }
-} // namespace karathon
diff --git a/src/karathon/ChannelWrap.hh b/src/karathon/ChannelWrap.hh
deleted file mode 100644
index 1dbc3b2cc5..0000000000
--- a/src/karathon/ChannelWrap.hh
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file is part of Karabo.
- *
- * http://www.karabo.eu
- *
- * Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
- *
- * Karabo is free software: you can redistribute it and/or modify it under
- * the terms of the MPL-2 Mozilla Public License.
- *
- * You should have received a copy of the MPL-2 Public License along with
- * Karabo. If not, see .
- *
- * Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
-/*
- * File: ChannelWrap.hh
- * Author: Sergey Esenov
- *
- * Created on April 4, 2013, 3:22 PM
- */
-
-#ifndef KARABO_PYEXFEL_CHANNELWRAP_HH
-#define KARABO_PYEXFEL_CHANNELWRAP_HH
-
-#include
-#include
-
-#include "ScopedGILRelease.hh"
-
-namespace bp = boost::python;
-
-namespace karathon {
-
- class ChannelWrap {
- public:
- static bp::object getConnection(karabo::net::Channel::Pointer channel) {
- karabo::net::Connection::Pointer connection;
- {
- ScopedGILRelease nogil;
- connection = channel->getConnection();
- }
- return bp::object(connection);
- }
-
- static bp::object readStr(karabo::net::Channel::Pointer channel);
- static bp::object readHash(karabo::net::Channel::Pointer channel);
- static bp::tuple readHashStr(karabo::net::Channel::Pointer channel);
- static bp::tuple readHashHash(karabo::net::Channel::Pointer channel);
- static void write(karabo::net::Channel::Pointer channel, const bp::object& obj);
- static void write2(karabo::net::Channel::Pointer channel, const bp::object& header, const bp::object& obj);
- static void readAsyncStr(karabo::net::Channel::Pointer channel, const bp::object& handler);
- static void readAsyncHash(karabo::net::Channel::Pointer channel, const bp::object& handler);
- static void readAsyncHashStr(karabo::net::Channel::Pointer channel, const bp::object& handler);
- static void readAsyncHashHash(karabo::net::Channel::Pointer channel, const bp::object& handler);
- static void writeAsyncStr(karabo::net::Channel::Pointer channel, const bp::object& data,
- const bp::object& handler);
- static void writeAsyncHash(karabo::net::Channel::Pointer channel, const bp::object& data,
- const bp::object& handler);
- static void writeAsyncHashStr(karabo::net::Channel::Pointer channel, const bp::object& hdr,
- const bp::object& data, const bp::object& handler);
- static void writeAsyncHashHash(karabo::net::Channel::Pointer channel, const bp::object& hdr,
- const bp::object& data, const bp::object& handler);
- // static void setErrorHandler(karabo::net::Channel::Pointer channel, const bp::object& handler);
-
- static size_t id(karabo::net::Channel::Pointer channel) {
- return size_t(&(*channel));
- }
-
- static void clear() {}
-
- private:
- static bool hasattr(bp::object obj, const std::string& attrName) {
- return PyObject_HasAttrString(obj.ptr(), const_cast(attrName.c_str()));
- }
- };
-
-} // namespace karathon
-#endif /* KARABO_PYEXFEL_CHANNELWRAP_HH */
diff --git a/src/karathon/ConnectionWrap.cc b/src/karathon/ConnectionWrap.cc
deleted file mode 100644
index bac4092e12..0000000000
--- a/src/karathon/ConnectionWrap.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of Karabo.
- *
- * http://www.karabo.eu
- *
- * Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
- *
- * Karabo is free software: you can redistribute it and/or modify it under
- * the terms of the MPL-2 Mozilla Public License.
- *
- * You should have received a copy of the MPL-2 Public License along with
- * Karabo. If not, see .
- *
- * Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
-#include "ConnectionWrap.hh"
-
-#include "Wrapper.hh"
-
-using namespace std;
-using namespace karabo::net;
-using namespace karabo::util;
-using namespace boost::placeholders;
-
-namespace bp = boost::python;
-
-
-namespace karathon {
-
-
- int ConnectionWrap::startAsync(const karabo::net::Connection::Pointer& connection,
- const bp::object& connectionHandler) {
- if (!PyCallable_Check(connectionHandler.ptr()))
- throw KARABO_PYTHON_EXCEPTION("Registered object is not a function object.");
- int port = 0;
- auto proxyWrap = HandlerWrap(connectionHandler, "startAsync");
- try {
- ScopedGILRelease nogil;
- port = connection->startAsync(proxyWrap);
- } catch (...) {
- KARABO_RETHROW
- }
- return port;
- }
-
-} // namespace karathon
diff --git a/src/karathon/ConnectionWrap.hh b/src/karathon/ConnectionWrap.hh
deleted file mode 100644
index 6c2cdbacb1..0000000000
--- a/src/karathon/ConnectionWrap.hh
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of Karabo.
- *
- * http://www.karabo.eu
- *
- * Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
- *
- * Karabo is free software: you can redistribute it and/or modify it under
- * the terms of the MPL-2 Mozilla Public License.
- *
- * You should have received a copy of the MPL-2 Public License along with
- * Karabo. If not, see .
- *
- * Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
-/*
- * File: ConnectionWrap.hh
- * Author: Sergey Esenov
- *
- * Created on April 5, 2013, 10:10 AM
- */
-
-#ifndef KARATHON_CONNECTIONWRAP_HH
-#define KARATHON_CONNECTIONWRAP_HH
-
-#include
-#include