From 64d90d62859a0569fc06375adcc178f6c218148f Mon Sep 17 00:00:00 2001 From: Marius Elvert Date: Tue, 17 Dec 2019 17:06:12 +0100 Subject: [PATCH 01/48] Only install() PTHREAD_WIN files if it is enabled --- configure/cmake_win.cmake | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/configure/cmake_win.cmake b/configure/cmake_win.cmake index 9fdfe8db7..8e6c2adba 100644 --- a/configure/cmake_win.cmake +++ b/configure/cmake_win.cmake @@ -17,7 +17,10 @@ file(WRITE ${PROJECT_BINARY_DIR}/VERSION ${LIBRARY_VERSION}) include_directories(${INCLUDE_OBJECT_MS}) include_directories(${PTHREAD_WIN_PKG_INCLUDE_DIRS}) set(WIN32_LIBS "ws2_32.lib;mswsock.lib;advapi32.lib;comctl32.lib;odbc32.lib;") -link_directories($ENV{PTHREAD_WIN}/lib) +if(PTHREAD_WIN) + link_directories(${PTHREAD_WIN}/lib) +endif(PTHREAD_WIN) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_library(tangod-static STATIC $ @@ -310,19 +313,20 @@ if(CMAKE_VS_PLATFORM_TOOLSET STREQUAL "v141") endif(CMAKE_VS_PLATFORM_TOOLSET STREQUAL "v141") #pthreads -install(FILES $ENV{PTHREAD_WIN}/lib/pthreadVC2.lib DESTINATION lib COMPONENT static) -install(FILES $ENV{PTHREAD_WIN}/lib/pthreadVC2-s.lib DESTINATION lib COMPONENT static) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2.dll DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2.pdb DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2.exp DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2.ilk DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/lib/pthreadVC2d.lib DESTINATION lib COMPONENT static) -install(FILES $ENV{PTHREAD_WIN}/lib/pthreadVC2-sd.lib DESTINATION lib COMPONENT static) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2d.dll DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2d.pdb DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2d.exp DESTINATION bin COMPONENT dynamic) -install(FILES $ENV{PTHREAD_WIN}/bin/pthreadVC2d.ilk DESTINATION bin COMPONENT dynamic) - +if (PTHREAD_WIN) + install(FILES ${PTHREAD_WIN}/lib/pthreadVC2.lib DESTINATION lib COMPONENT static) + install(FILES ${PTHREAD_WIN}/lib/pthreadVC2-s.lib DESTINATION lib COMPONENT static) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2.dll DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2.pdb DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2.exp DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2.ilk DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/lib/pthreadVC2d.lib DESTINATION lib COMPONENT static) + install(FILES ${PTHREAD_WIN}/lib/pthreadVC2-sd.lib DESTINATION lib COMPONENT static) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2d.dll DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2d.pdb DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2d.exp DESTINATION bin COMPONENT dynamic) + install(FILES ${PTHREAD_WIN}/bin/pthreadVC2d.ilk DESTINATION bin COMPONENT dynamic) +endif(PTHREAD_WIN) configure_file(tango.pc.cmake tango.pc @ONLY) From b6dee8d12fe65b4997e9c198a9a570752e4735f5 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Thu, 9 Jan 2020 18:32:40 +0100 Subject: [PATCH 02/48] log4tango: Fix snprintf test The snprintf test was missing the declaration of the exit function. This never found a working system snprintf implementation. The fallout from this bug is that the LOG_* macros are not working as e.g. TangoTest returns 1453759720 [140389277255488] INFO tangotest/tt/1 TangoTest::init_device::init device Ready to accept request 1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook() TangoTest/tt/1 1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook() TangoTest/tt/1 1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook() TangoTest/tt/1 1453759720 [140389141108480] INFO tangotest/tt/1 TangoTest::always_executed_hook() TangoTest/tt/1 instead of 1453842671 [139686148966208] INFO tangotest/tt/1 TangoTest::init_device::init device TangoTest/tt/1 1453842671 [139686148966208] DEBUG tangotest/tt/1 sleep_period=2000 1453842671 [139686148966208] DEBUG tangotest/tt/1 mthreaded_impl=0 1453842671 [139686148966208] DEBUG tangotest/tt/1 uShort_image_ro_size=251 Ready to accept request 1453842671 [139685942777600] INFO tangotest/tt/1 TangoTest::always_executed_hook() TangoTest/tt/1 from the lines TangoTest.cpp: LOG_INFO(("TangoTest::init_device::init device %s", device_name.c_str())); TangoTest.cpp: LOG_DEBUG(("In read_attr_hardware for %d attributes",attr_list.size())); Original report from the author of this commit at [1]. [1]: https://www.tango-controls.org/community/forum/c/development/c/log_-macros-not-working/ --- log4tango/m4/AC_FUNC_SNPRINTF.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/log4tango/m4/AC_FUNC_SNPRINTF.m4 b/log4tango/m4/AC_FUNC_SNPRINTF.m4 index 08af5218e..ede0d0881 100755 --- a/log4tango/m4/AC_FUNC_SNPRINTF.m4 +++ b/log4tango/m4/AC_FUNC_SNPRINTF.m4 @@ -13,6 +13,7 @@ dnl AC_DEFUN([AC_FUNC_SNPRINTF], [AC_CACHE_CHECK(for working snprintf, ac_cv_func_snprintf, [AC_TRY_RUN([#include +#include // exit int main () { int l = snprintf(NULL,0,"%d",100); exit (!((3 <= l) || (-1 == l))); } ], ac_cv_func_snprintf=yes, ac_cv_func_snprintf=no, ac_cv_func_snprintf=no)]) From 4e732d430a9817109615de9a0698e901d2ec4e55 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 01:44:47 +0100 Subject: [PATCH 03/48] Travis: Add testing with ubuntu 20.04 (aka focal) --- .travis.yml | 1 + .travis/ubuntu-20.04/Dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .travis/ubuntu-20.04/Dockerfile diff --git a/.travis.yml b/.travis.yml index 17f6c1a46..3d0a84679 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: matrix: - OS_TYPE=llvm-latest RUN_TESTS=OFF WARNINGS_AS_ERRORS=ON TANGO_USE_USING_NAMESPACE=OFF USE_PCH=OFF - OS_TYPE=gcc-latest RUN_TESTS=OFF WARNINGS_AS_ERRORS=ON TANGO_USE_USING_NAMESPACE=OFF USE_PCH=OFF + - OS_TYPE=ubuntu-20.04 - OS_TYPE=debian10 - OS_TYPE=debian10 USE_PCH=OFF RUN_TESTS=OFF - OS_TYPE=debian10 CMAKE_BUILD_TYPE=Release diff --git a/.travis/ubuntu-20.04/Dockerfile b/.travis/ubuntu-20.04/Dockerfile new file mode 100644 index 000000000..157a9c614 --- /dev/null +++ b/.travis/ubuntu-20.04/Dockerfile @@ -0,0 +1,31 @@ +FROM ubuntu:focal + +ARG APP_UID=2000 + +ARG APP_GID=2000 + +MAINTAINER TANGO Controls team + +RUN apt-get update && apt-get install -y \ + apt-utils \ + build-essential \ + cmake \ + curl \ + git \ + libcos4-dev \ + libomniorb4-dev \ + libomnithread4-dev \ + libzmq3-dev \ + lsb-release \ + omniidl \ + python2 + +RUN groupadd -g "$APP_GID" tango + +RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango + +ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig + +USER tango + +WORKDIR /home/tango From 92586afe8a24f28aa1dbc978ee00f4f981550938 Mon Sep 17 00:00:00 2001 From: reszelaz Date: Mon, 13 Jan 2020 10:03:24 +0100 Subject: [PATCH 04/48] Fix interface name collission on MSC_VER = 1900 Undefine interface for Microsoft Visual Studio version 14.0.25431.01 Update 3 comming with _MSC_VER = 1900 to fix compilation error: "error C2236: unexpected token 'struct'. Did you forget a ';'? --- cppapi/server/dintrthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cppapi/server/dintrthread.h b/cppapi/server/dintrthread.h index dbcb5c98d..d99428d49 100644 --- a/cppapi/server/dintrthread.h +++ b/cppapi/server/dintrthread.h @@ -58,7 +58,7 @@ struct _ShDevIntrTh bool cmd_pending; // The new command flag DevIntrCmdCode cmd_code; // The command code bool th_running; // Thread running flag - #if _MSC_VER > 1900 + #if _MSC_VER >= 1900 #ifdef interface #undef interface #endif From 5bcd47a53ced9ac28d08ef58ef6e6152689960bf Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sat, 15 Jun 2019 20:51:51 +0200 Subject: [PATCH 05/48] Expose docker daemon in CI containers --- .travis.yml | 9 +++++++-- .travis/debian10/Dockerfile | 14 ++++++++++++++ .travis/debian7/Dockerfile | 16 ++++++++++++++++ .travis/debian8/Dockerfile | 14 ++++++++++++++ .travis/debian9/Dockerfile | 14 ++++++++++++++ 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d0a84679..656c08499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,13 +75,17 @@ before_script: tangocs/tango-cs:latest - TANGO_HOST_IP=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' tango_cs) - TANGO_HOST=${TANGO_HOST_IP}:10000 - - docker build --build-arg APP_UID=$(id -u) --build-arg APP_GID=$(id -g) -t cpp_tango .travis/${OS_TYPE} + - > + docker build + --build-arg APP_UID=$(id -u) + --build-arg APP_GID=$(id -g) + -t cpp_tango + .travis/${OS_TYPE} - > docker run --rm --name cpp_tango -e TANGO_HOST=${TANGO_HOST} - -e TANGO_HOST2=${TANGO_HOST_IP2}:10000 -e BINTRAY_USER_NAME=tango-ci -e BINTRAY_API_KEY=${CI_BINTRAY_API_KEY} -e COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN} @@ -92,6 +96,7 @@ before_script: -v `pwd`/tango_admin:/home/tango/tango_admin -v `pwd`/coveralls-cmake:/home/tango/coveralls-cmake -v `pwd`/build-wrapper-linux-x86:/home/tango/build-wrapper-linux-x86 + -v /var/run/docker.sock:/var/run/docker.sock -dit cpp_tango - .travis/install_tango_idl.sh diff --git a/.travis/debian10/Dockerfile b/.travis/debian10/Dockerfile index dbe76fa8f..c036e8c4d 100644 --- a/.travis/debian10/Dockerfile +++ b/.travis/debian10/Dockerfile @@ -20,10 +20,24 @@ RUN apt-get update && apt-get install -y \ omniidl \ python2 +RUN apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common \ + && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ + && add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/debian buster stable" \ + && apt-get update \ + && apt-get install -y docker-ce + RUN groupadd -g "$APP_GID" tango RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango +RUN usermod -a -G docker tango + ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig USER tango diff --git a/.travis/debian7/Dockerfile b/.travis/debian7/Dockerfile index f16f6a0c7..1bab58876 100644 --- a/.travis/debian7/Dockerfile +++ b/.travis/debian7/Dockerfile @@ -28,10 +28,26 @@ RUN wget --no-check-certificate https://cmake.org/files/v3.10/cmake-3.10.0-Linux && chmod +x /tmp/cmake-install.sh \ && /tmp/cmake-install.sh --skip-license --exclude-subdir +RUN apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common \ + python-software-properties \ + && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ + && add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/debian wheezy stable" \ + && sed -i -e '/^deb-src.*docker.*/d' /etc/apt/sources.list \ + && apt-get update \ + && apt-get install -y docker-ce + RUN groupadd -g "$APP_GID" tango RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango +RUN usermod -a -G docker tango + ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig USER tango diff --git a/.travis/debian8/Dockerfile b/.travis/debian8/Dockerfile index 7f364e2aa..30004da17 100644 --- a/.travis/debian8/Dockerfile +++ b/.travis/debian8/Dockerfile @@ -21,10 +21,24 @@ RUN apt-get update && apt-get install -y \ libomnithread3-dev \ libzmq3-dev +RUN apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common \ + && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ + && add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/debian jessie stable" \ + && apt-get update \ + && apt-get install -y docker-ce + RUN groupadd -g "$APP_GID" tango RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango +RUN usermod -a -G docker tango + ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig USER tango diff --git a/.travis/debian9/Dockerfile b/.travis/debian9/Dockerfile index 7e8dd7dfb..388778fa7 100644 --- a/.travis/debian9/Dockerfile +++ b/.travis/debian9/Dockerfile @@ -19,10 +19,24 @@ RUN apt-get update && apt-get install -y \ libomnithread3-dev \ libzmq3-dev +RUN apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg2 \ + software-properties-common \ + && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ + && add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" \ + && apt-get update \ + && apt-get install -y docker-ce + RUN groupadd -g "$APP_GID" tango RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango +RUN usermod -a -G docker tango + ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig USER tango From 1c1e205fb7d44884f3ee35c81723065d9fa6bc38 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sat, 15 Jun 2019 23:13:01 +0200 Subject: [PATCH 06/48] Add new test runner and server start/stop scripts The test runner will start a fresh environment (database and device servers) for each test case. --- cpp_test_suite/environment/CMakeLists.txt | 9 ++ .../environment/kill_server.sh.cmake | 16 +++ .../environment/run_with_fixture.sh.cmake | 112 ++++++++++++++++++ .../environment/start_server.sh.cmake | 33 ++++++ 4 files changed, 170 insertions(+) create mode 100755 cpp_test_suite/environment/kill_server.sh.cmake create mode 100755 cpp_test_suite/environment/run_with_fixture.sh.cmake create mode 100755 cpp_test_suite/environment/start_server.sh.cmake diff --git a/cpp_test_suite/environment/CMakeLists.txt b/cpp_test_suite/environment/CMakeLists.txt index f22e4b28b..ceaa1a3f8 100644 --- a/cpp_test_suite/environment/CMakeLists.txt +++ b/cpp_test_suite/environment/CMakeLists.txt @@ -21,3 +21,12 @@ execute_process(COMMAND chmod +x ${CMAKE_CURRENT_SOURCE_DIR}/shutdown.sh) add_custom_target(stop-tango ${CMAKE_CURRENT_SOURCE_DIR}/shutdown.sh WORKING_DIRECTORY ${PROJECT_BINARY_DIR} SOURCES shutdown.sh) + +configure_file(run_with_fixture.sh.cmake run_with_fixture.sh @ONLY) +execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/run_with_fixture.sh) + +configure_file(start_server.sh.cmake start_server.sh @ONLY) +execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/start_server.sh) + +configure_file(kill_server.sh.cmake kill_server.sh @ONLY) +execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/kill_server.sh) diff --git a/cpp_test_suite/environment/kill_server.sh.cmake b/cpp_test_suite/environment/kill_server.sh.cmake new file mode 100755 index 000000000..04766286e --- /dev/null +++ b/cpp_test_suite/environment/kill_server.sh.cmake @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# vim: syntax=sh + +pids="$(find \ + "$TANGO_TEST_CASE_DIRECTORY/server_pids/" \ + -maxdepth 1 \ + -mindepth 1 \ + -type d \ + -printf "%f\n" \ + 2> /dev/null)" + +echo "Killing PIDS: " $pids + +kill $pids &>/dev/null + +sleep 2 diff --git a/cpp_test_suite/environment/run_with_fixture.sh.cmake b/cpp_test_suite/environment/run_with_fixture.sh.cmake new file mode 100755 index 000000000..21fe3f61c --- /dev/null +++ b/cpp_test_suite/environment/run_with_fixture.sh.cmake @@ -0,0 +1,112 @@ +#!/usr/bin/env bash +# vim: syntax=sh + +set -e + +if [ $# -lt 1 ]; then + echo "usage: $0 [args...]" + exit 1 +fi + +tc_program="$1" +tc_run_name="$(basename "$tc_program")_$(date '+%Y%m%d.%H%M%S.%N')" +shift 1 + +tc_tango_container="tango_cs_${tc_run_name}" +tc_mysql_container="mysql_db_${tc_run_name}" + +export TANGO_TEST_CASE_DIRECTORY="@PROJECT_BINARY_DIR@/test_results/${tc_run_name}" +mkdir -p "$TANGO_TEST_CASE_DIRECTORY" + +function teardown { + ( + # close stdout and stderr to allow ctest finish the test early + exec 1<&- + exec 2<&- + "@CMAKE_CURRENT_BINARY_DIR@/kill_server.sh" &>/dev/null || true + docker stop "$tc_tango_container" "$tc_mysql_container" &>/dev/null || true + ) & +} + + +if [[ -z "$TANGO_TEST_CASE_SKIP_FIXTURE" ]]; then + + trap teardown EXIT + +# --- setup database ---------------------------------------------------------- + + docker run \ + --name "$tc_mysql_container" \ + --rm \ + -e MYSQL_ROOT_PASSWORD=root \ + -e MYSQL_INITDB_SKIP_TZINFO=1 \ + -d \ + tangocs/mysql:9.2.2 \ + --sql-mode="" \ + --innodb=OFF \ + --default-storage-engine=MyISAM \ + > /dev/null + + docker run \ + --name "$tc_tango_container" \ + --rm \ + -e TANGO_HOST=127.0.0.1:10000 \ + -e MYSQL_HOST=mysql_db:3306 \ + -e MYSQL_USER=tango \ + -e MYSQL_PASSWORD=tango \ + -e MYSQL_DATABASE=tango \ + --link "$tc_mysql_container":mysql_db \ + -d \ + tangocs/tango-cs:latest \ + > /dev/null + + tc_tango_ipaddr="$(docker inspect \ + -f '{{ .NetworkSettings.IPAddress }}' \ + "$tc_tango_container")" + + export TANGO_HOST="$tc_tango_ipaddr:10000" + + if hash tango_admin 2>/dev/null; then + if ! tango_admin --ping-database 30; then + echo "Failed to ping database" + exit 1 + fi + else + sleep 30 + fi + +# -- setup devices ------------------------------------------------------------ + + "@PROJECT_BINARY_DIR@/new_tests/conf_devtest" \ + @SERV_NAME@/@INST_NAME@ \ + @DEV1@ \ + @DEV2@ \ + @DEV3@ \ + @DEV1_ALIAS@ \ + @ATTR_ALIAS@ \ + @FWD_DEV@ \ + @DEV20@ \ + &> "${TANGO_TEST_CASE_DIRECTORY}/conf_devtest.out" + + "@CMAKE_CURRENT_BINARY_DIR@/start_server.sh" @INST_NAME@ DevTest cpp_test_ds + + "@CMAKE_CURRENT_BINARY_DIR@/start_server.sh" @INST_NAME@ FwdTest cpp_test_ds/fwd_ds + +fi # TANGO_TEST_CASE_SKIP_FIXTURE + + +# --- run test ---------------------------------------------------------------- + +set +e +set -o pipefail + +"$tc_program" "$@" 2>&1 | tee "${TANGO_TEST_CASE_DIRECTORY}/testcase.out" + +tc_exit_code="$?" + +set +o pipefail +set -e + +echo "$tc_exit_code" > "${TANGO_TEST_CASE_DIRECTORY}/testcase_exit_code.out" + +exit "$tc_exit_code" diff --git a/cpp_test_suite/environment/start_server.sh.cmake b/cpp_test_suite/environment/start_server.sh.cmake new file mode 100755 index 000000000..0bbc117df --- /dev/null +++ b/cpp_test_suite/environment/start_server.sh.cmake @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# vim: syntax=sh + +set -e + +instance="$1" +server="${2:-DevTest}" +server_path="${3:-cpp_test_ds}" + +index="$(find \ + "$TANGO_TEST_CASE_DIRECTORY" \ + -maxdepth 1 \ + -mindepth 1 \ + -type f \ + -name "${server}_${instance}.*.out" | wc -l)" + +echo "Starting $server/$instance" + +"@PROJECT_BINARY_DIR@/${server_path}/${server}" "$instance" -v5 \ + &> "${TANGO_TEST_CASE_DIRECTORY}/${server}_${instance}.${index}.out" & + +server_pid="$!" + +mkdir -p "${TANGO_TEST_CASE_DIRECTORY}/server_pids/${server_pid}" + +if hash tango_admin 2>/dev/null; then + instance_lower="$(echo "$server/$instance" | awk '{print tolower($0)}')" + tango_admin --ping-device "dserver/${instance_lower}" 7 +else + sleep 7 +fi + +echo "$server/$instance PID: ${server_pid}" From c243cb28fa478a9bc068c99a07c3f4542f8fa4bf Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sat, 15 Jun 2019 23:39:09 +0200 Subject: [PATCH 07/48] Enable new test runner script (9d6a727) --- .travis.yml | 28 ---------- .travis/test.sh | 13 ----- cpp_test_suite/CMakeLists.txt | 9 +++- cpp_test_suite/CTestCustom.cmake | 2 - cpp_test_suite/asyn/CMakeLists.txt | 22 ++++---- cpp_test_suite/cxxtest/CMakeLists.txt | 2 +- cpp_test_suite/cxxtest/include/config.h.cmake | 6 +-- cpp_test_suite/event/CMakeLists.txt | 34 ++++++------ cpp_test_suite/old_tests/CMakeLists.txt | 52 +++++++++---------- 9 files changed, 65 insertions(+), 103 deletions(-) delete mode 100644 cpp_test_suite/CTestCustom.cmake diff --git a/.travis.yml b/.travis.yml index 656c08499..28e44abd3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,31 +50,6 @@ before_install: - wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip && unzip build-wrapper-linux-x86.zip before_script: - - > - docker run - --rm - --name mysql_db - -e MYSQL_ROOT_PASSWORD=root - -e MYSQL_INITDB_SKIP_TZINFO=1 - -d - tangocs/mysql:9.2.2 - --sql-mode="" - --innodb=OFF - --default-storage-engine=MyISAM - - > - docker run - --rm - --name tango_cs - -e TANGO_HOST=127.0.0.1:10000 - -e MYSQL_HOST=mysql_db:3306 - -e MYSQL_USER=tango - -e MYSQL_PASSWORD=tango - -e MYSQL_DATABASE=tango - --link mysql_db:mysq_db - -d - tangocs/tango-cs:latest - - TANGO_HOST_IP=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' tango_cs) - - TANGO_HOST=${TANGO_HOST_IP}:10000 - > docker build --build-arg APP_UID=$(id -u) @@ -89,7 +64,6 @@ before_script: -e BINTRAY_USER_NAME=tango-ci -e BINTRAY_API_KEY=${CI_BINTRAY_API_KEY} -e COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN} - --link tango_cs -v `pwd`:/home/tango/src -v `pwd`/idl:/home/tango/idl -v `pwd`/cppzmq:/home/tango/cppzmq @@ -124,5 +98,3 @@ deploy: after-script: - docker stop cpp_tango - - docker stop tango_cs - - docker stop mysql_db diff --git a/.travis/test.sh b/.travis/test.sh index 2ec8fb145..41db77546 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -12,12 +12,6 @@ then TEST_COMMAND="exec make coveralls" fi -echo "PreTest" -docker exec cpp_tango /bin/sh -c 'cd /home/tango/src/build/cpp_test_suite/environment; exec ./pre_test.sh' -if [ $? -ne "0" ] -then - exit -1 -fi echo "Test" echo "TEST_COMMAND=$TEST_COMMAND" docker exec cpp_tango /bin/sh -c "cd /home/tango/src/build; $TEST_COMMAND" @@ -25,10 +19,3 @@ if [ $? -ne "0" ] then exit -1 fi - -echo "PostTest" -docker exec cpp_tango /bin/sh -c 'cd /home/tango/src/build/cpp_test_suite/environment; exec ./post_test.sh' -if [ $? -ne "0" ] -then - exit -1 -fi diff --git a/cpp_test_suite/CMakeLists.txt b/cpp_test_suite/CMakeLists.txt index 468d2c356..d28647afa 100644 --- a/cpp_test_suite/CMakeLists.txt +++ b/cpp_test_suite/CMakeLists.txt @@ -2,8 +2,6 @@ project(test_suite) set(CMAKE_CXX_FLAGS_RELEASE "-O0 -g") -configure_file(CTestCustom.cmake CTestCustom.cmake) - #TODO different OS set(SERV_NAME "DevTest") set(INST_NAME "test") @@ -33,6 +31,13 @@ macro(TEST_SUITE_ADD_TEST test) # add_test(NAME "CPP::${test}" COMMAND $ ${DEV1} ${DEV2} ${DEV3} ${DEV1_ALIAS}) endmacro() +function(tango_add_test name_tag name command_tag command) + add_test( + NAME "${name}" + COMMAND "${CMAKE_BINARY_DIR}/cpp_test_suite/environment/run_with_fixture.sh" "${command}" + ${ARGN}) +endfunction() + add_subdirectory(cxxtest) add_subdirectory(old_tests) diff --git a/cpp_test_suite/CTestCustom.cmake b/cpp_test_suite/CTestCustom.cmake deleted file mode 100644 index 44e09541c..000000000 --- a/cpp_test_suite/CTestCustom.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(CTEST_CUSTOM_PRE_TEST ${PROJECT_BINARY_DIR}/environment/pre_test.sh) -set(CTEST_CUSTOM_POST_TEST ${PROJECT_BINARY_DIR}/environment/post_test.sh) \ No newline at end of file diff --git a/cpp_test_suite/asyn/CMakeLists.txt b/cpp_test_suite/asyn/CMakeLists.txt index 2f8ae5c70..3947ee77e 100644 --- a/cpp_test_suite/asyn/CMakeLists.txt +++ b/cpp_test_suite/asyn/CMakeLists.txt @@ -16,14 +16,14 @@ foreach(TEST ${TESTS}) TEST_SUITE_ADD_TEST(${TEST}) endforeach(TEST) -add_test(NAME "asyn::asyn_cmd" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_attr" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_attr_multi" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_write_attr" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_write_attr_multi" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_cb" COMMAND $ ${DEV1} ${DEV2}) -add_test(NAME "asyn::asyn_cb2" COMMAND $ ${DEV1} ${DEV2}) -add_test(NAME "asyn::asyn_cb_cmd" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_attr_cb" COMMAND $ ${DEV1}) -add_test(NAME "asyn::asyn_write_cb" COMMAND $ ${DEV1}) -add_test(NAME "asyn::auto_asyn_cmd" COMMAND $ ${DEV1}) \ No newline at end of file +tango_add_test(NAME "asyn::asyn_cmd" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_attr" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_attr_multi" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_write_attr" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_write_attr_multi" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_cb" COMMAND $ ${DEV1} ${DEV2}) +tango_add_test(NAME "asyn::asyn_cb2" COMMAND $ ${DEV1} ${DEV2}) +tango_add_test(NAME "asyn::asyn_cb_cmd" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_attr_cb" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::asyn_write_cb" COMMAND $ ${DEV1}) +tango_add_test(NAME "asyn::auto_asyn_cmd" COMMAND $ ${DEV1}) diff --git a/cpp_test_suite/cxxtest/CMakeLists.txt b/cpp_test_suite/cxxtest/CMakeLists.txt index 82ca5da20..677fdfff5 100644 --- a/cpp_test_suite/cxxtest/CMakeLists.txt +++ b/cpp_test_suite/cxxtest/CMakeLists.txt @@ -27,7 +27,7 @@ macro(CXX_GENERATE_TEST name) tango_target_test_pch(${name}) endif() - add_test(NAME "CXX::${name}" COMMAND $ + tango_add_test(NAME "CXX::${name}" COMMAND $ --device1=${DEV1} --device2=${DEV2} --device3=${DEV3} diff --git a/cpp_test_suite/cxxtest/include/config.h.cmake b/cpp_test_suite/cxxtest/include/config.h.cmake index e01262334..bee04809a 100644 --- a/cpp_test_suite/cxxtest/include/config.h.cmake +++ b/cpp_test_suite/cxxtest/include/config.h.cmake @@ -5,8 +5,8 @@ namespace Tango { const std::string kProjectBinaryDir{"@PROJECT_BINARY_DIR@"}; - const std::string kStartServerCmd{"@CMAKE_CURRENT_BINARY_DIR@/bin/start_server.sh "}; - const std::string kKillServerCmd{"@CMAKE_CURRENT_BINARY_DIR@/bin/kill_server.sh"}; + const std::string kStartServerCmd{"@CMAKE_BINARY_DIR@/cpp_test_suite/environment/start_server.sh "}; + const std::string kKillServerCmd{"@CMAKE_BINARY_DIR@/cpp_test_suite/environment/kill_server.sh"}; } -#endif \ No newline at end of file +#endif diff --git a/cpp_test_suite/event/CMakeLists.txt b/cpp_test_suite/event/CMakeLists.txt index e042432e9..6ada0b6ee 100644 --- a/cpp_test_suite/event/CMakeLists.txt +++ b/cpp_test_suite/event/CMakeLists.txt @@ -24,20 +24,20 @@ foreach(TEST ${TESTS}) TEST_SUITE_ADD_TEST(${TEST}) endforeach(TEST) -add_test(NAME "event::per_event" COMMAND $ ${DEV1} ${DEV2}) -add_test(NAME "event::att_type_event" COMMAND $ ${DEV1}) -add_test(NAME "event::change_event" COMMAND $ ${DEV1}) -add_test(NAME "event::change_event64" COMMAND $ ${DEV1}) -add_test(NAME "event::change_event_buffer" COMMAND $ ${DEV1}) -add_test(NAME "event::archive_event" COMMAND $ ${DEV1}) -add_test(NAME "event::user_event" COMMAND $ ${DEV1}) -add_test(NAME "event::multi_event" COMMAND $ ${DEV1}) -add_test(NAME "event::state_event" COMMAND $ ${DEV1}) -add_test(NAME "event::att_conf_event" COMMAND $ ${DEV1}) -add_test(NAME "event::att_conf_event_buffer" COMMAND $ ${DEV1}) -add_test(NAME "event::data_ready_event" COMMAND $ ${DEV1}) -add_test(NAME "event::data_ready_event_buffer" COMMAND $ ${DEV1}) -add_test(NAME "event::multi_dev_event" COMMAND $ ${DEV1} ${DEV2} ${DEV3}) -add_test(NAME "event::dev_intr_event" COMMAND $ ${DEV1}) -add_test(NAME "event::pipe_event" COMMAND $ ${DEV1}) -add_test(NAME "event::event_lock" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::per_event" COMMAND $ ${DEV1} ${DEV2}) +tango_add_test(NAME "event::att_type_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::change_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::change_event64" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::change_event_buffer" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::archive_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::user_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::multi_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::state_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::att_conf_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::att_conf_event_buffer" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::data_ready_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::data_ready_event_buffer" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::multi_dev_event" COMMAND $ ${DEV1} ${DEV2} ${DEV3}) +tango_add_test(NAME "event::dev_intr_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::pipe_event" COMMAND $ ${DEV1}) +tango_add_test(NAME "event::event_lock" COMMAND $ ${DEV1}) diff --git a/cpp_test_suite/old_tests/CMakeLists.txt b/cpp_test_suite/old_tests/CMakeLists.txt index 668a8a6b8..33aa48228 100644 --- a/cpp_test_suite/old_tests/CMakeLists.txt +++ b/cpp_test_suite/old_tests/CMakeLists.txt @@ -51,33 +51,33 @@ endforeach(TEST) configure_file(locked_device_cmd.h.cmake locked_device_cmd.h @ONLY) target_include_directories(lock PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -add_test(NAME "old_tests::misc_devproxy" COMMAND $ ${DEV1} ${SERV_NAME}/${INST_NAME}) +tango_add_test(NAME "old_tests::misc_devproxy" COMMAND $ ${DEV1} ${SERV_NAME}/${INST_NAME}) -add_test(NAME "old_tests::cmd_types" COMMAND $ ${DEV1} 10) +tango_add_test(NAME "old_tests::cmd_types" COMMAND $ ${DEV1} 10) -add_test(NAME "old_tests::attr_types" COMMAND $ ${DEV1} 10) -add_test(NAME "old_tests::att_conf" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::misc_devdata" COMMAND $) -add_test(NAME "old_tests::misc_devattr" COMMAND $) -add_test(NAME "old_tests::write_attr" COMMAND $ ${DEV1} 10) -add_test(NAME "old_tests::copy_devproxy" COMMAND $ ${DEV1} ${DEV2} ${DEV3}) -add_test(NAME "old_tests::attr_misc" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::obj_prop" COMMAND $) -add_test(NAME "old_tests::attr_proxy" COMMAND $ ${DEV1}/Short_attr_rw) -add_test(NAME "old_tests::write_attr_3" COMMAND $ ${DEV1} 10) -add_test(NAME "old_tests::read_hist_ext" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::ring_depth" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::mem_att" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::state_attr" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::rds" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::ds_cache" COMMAND $) -add_test(NAME "old_tests::w_r_attr" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::lock" COMMAND $ ${DEV1} ${DEV2}) -add_test(NAME "old_tests::sub_dev" COMMAND $ ${DEV1} ${DEV2} ${DEV3}) -add_test(NAME "old_tests::print_data" COMMAND $ ${DEV1}) -add_test(NAME "old_tests::attr_manip" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::attr_types" COMMAND $ ${DEV1} 10) +tango_add_test(NAME "old_tests::att_conf" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::misc_devdata" COMMAND $) +tango_add_test(NAME "old_tests::misc_devattr" COMMAND $) +tango_add_test(NAME "old_tests::write_attr" COMMAND $ ${DEV1} 10) +tango_add_test(NAME "old_tests::copy_devproxy" COMMAND $ ${DEV1} ${DEV2} ${DEV3}) +tango_add_test(NAME "old_tests::attr_misc" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::obj_prop" COMMAND $) +tango_add_test(NAME "old_tests::attr_proxy" COMMAND $ ${DEV1}/Short_attr_rw) +tango_add_test(NAME "old_tests::write_attr_3" COMMAND $ ${DEV1} 10) +tango_add_test(NAME "old_tests::read_hist_ext" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::ring_depth" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::mem_att" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::state_attr" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::rds" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::ds_cache" COMMAND $) +tango_add_test(NAME "old_tests::w_r_attr" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::lock" COMMAND $ ${DEV1} ${DEV2}) +tango_add_test(NAME "old_tests::sub_dev" COMMAND $ ${DEV1} ${DEV2} ${DEV3}) +tango_add_test(NAME "old_tests::print_data" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::attr_manip" COMMAND $ ${DEV1}) if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9.2) - add_test(NAME "old_tests::size" COMMAND $) + tango_add_test(NAME "old_tests::size" COMMAND $) endif() -add_test(NAME "old_tests::ConfEventBugClient" COMMAND $ ${DEV3}) -add_test(NAME "old_tests::attr_conf_test" COMMAND $ ${DEV1}) +tango_add_test(NAME "old_tests::ConfEventBugClient" COMMAND $ ${DEV3}) +tango_add_test(NAME "old_tests::attr_conf_test" COMMAND $ ${DEV1}) From 445764a8c7ea0979ac608df38a87ec3a5ce5c129 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sun, 15 Dec 2019 09:41:43 +0100 Subject: [PATCH 08/48] Remove old scripts for running the tests The scripts are not needed anymore as ctest command sets the test environment up. --- cpp_test_suite/cxxtest/CMakeLists.txt | 14 ----- .../cxxtest/bin/kill_server.sh.cmake | 15 ------ .../cxxtest/bin/start_server.sh.cmake | 17 ------ cpp_test_suite/environment/CMakeLists.txt | 22 -------- cpp_test_suite/environment/post_test.sh.cmake | 11 ---- cpp_test_suite/environment/pre_test.sh.cmake | 32 ----------- cpp_test_suite/environment/run.sh.cmake | 4 -- cpp_test_suite/environment/setup.sh | 53 ------------------- cpp_test_suite/environment/shutdown.sh | 10 ---- cpp_test_suite/environment/tango_host.cmake | 2 - 10 files changed, 180 deletions(-) delete mode 100644 cpp_test_suite/cxxtest/bin/kill_server.sh.cmake delete mode 100644 cpp_test_suite/cxxtest/bin/start_server.sh.cmake delete mode 100644 cpp_test_suite/environment/post_test.sh.cmake delete mode 100644 cpp_test_suite/environment/pre_test.sh.cmake delete mode 100644 cpp_test_suite/environment/run.sh.cmake delete mode 100755 cpp_test_suite/environment/setup.sh delete mode 100755 cpp_test_suite/environment/shutdown.sh delete mode 100644 cpp_test_suite/environment/tango_host.cmake diff --git a/cpp_test_suite/cxxtest/CMakeLists.txt b/cpp_test_suite/cxxtest/CMakeLists.txt index 677fdfff5..9c981d0ad 100644 --- a/cpp_test_suite/cxxtest/CMakeLists.txt +++ b/cpp_test_suite/cxxtest/CMakeLists.txt @@ -91,18 +91,4 @@ CXX_GENERATE_TEST(cxx_stateless_subscription) CXX_GENERATE_TEST(cxx_nan_inf_in_prop) CXX_GENERATE_TEST(cxx_asyn_reconnection) -#utilities -configure_file(bin/start_server.sh.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/start_server.sh @ONLY) -configure_file(bin/kill_server.sh.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/kill_server.sh @ONLY) - -# now copy the temporary into the final destination, setting the permissions -file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/start_server.sh - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ - GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/kill_server.sh - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ - GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - configure_file(include/config.h.cmake include/config.h @ONLY) diff --git a/cpp_test_suite/cxxtest/bin/kill_server.sh.cmake b/cpp_test_suite/cxxtest/bin/kill_server.sh.cmake deleted file mode 100644 index 84ab8a367..000000000 --- a/cpp_test_suite/cxxtest/bin/kill_server.sh.cmake +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -kill_servers(){ - PIDS=`ps -e | grep DevTest | grep -v grep | awk '{print $1}'` - echo "PIDS = $PIDS" - for pid in $PIDS - do - echo "Killing process with PID $pid" - kill $pid - done - - sleep 2 -} - -kill_servers \ No newline at end of file diff --git a/cpp_test_suite/cxxtest/bin/start_server.sh.cmake b/cpp_test_suite/cxxtest/bin/start_server.sh.cmake deleted file mode 100644 index d26502e94..000000000 --- a/cpp_test_suite/cxxtest/bin/start_server.sh.cmake +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -start_server(){ - echo "Starting DevTest $1" - @PROJECT_BINARY_DIR@/cpp_test_ds/DevTest $1 -v5 1>@PROJECT_BINARY_DIR@/cpp_test_ds/DevTest_$1.out 2>&1 & - echo $! > @PROJECT_BINARY_DIR@/cpp_test_ds/DevTest_$1.pid - - if hash tango_admin 2>/dev/null; then - tango_admin --ping-device "dserver/devtest/$1" 7 - else - sleep 7 - fi - - echo "Done. PID="`cat @PROJECT_BINARY_DIR@/cpp_test_ds/DevTest_$1.pid` -} - -start_server $1 diff --git a/cpp_test_suite/environment/CMakeLists.txt b/cpp_test_suite/environment/CMakeLists.txt index ceaa1a3f8..e4947b71f 100644 --- a/cpp_test_suite/environment/CMakeLists.txt +++ b/cpp_test_suite/environment/CMakeLists.txt @@ -1,26 +1,4 @@ #TODO windows -configure_file(tango_host.cmake tango_host @ONLY) - -configure_file(pre_test.sh.cmake pre_test.sh @ONLY) -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/pre_test.sh) -configure_file(post_test.sh.cmake post_test.sh @ONLY) -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/post_test.sh) - -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_SOURCE_DIR}/setup.sh) -add_custom_target(start-tango ${CMAKE_CURRENT_SOURCE_DIR}/setup.sh - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - SOURCES setup.sh) - -configure_file(run.sh.cmake run.sh @ONLY) -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/run.sh) -add_custom_target(run-tests ${CMAKE_CURRENT_BINARY_DIR}/run.sh - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - SOURCES run.sh.cmake) - -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_SOURCE_DIR}/shutdown.sh) -add_custom_target(stop-tango ${CMAKE_CURRENT_SOURCE_DIR}/shutdown.sh - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} - SOURCES shutdown.sh) configure_file(run_with_fixture.sh.cmake run_with_fixture.sh @ONLY) execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/run_with_fixture.sh) diff --git a/cpp_test_suite/environment/post_test.sh.cmake b/cpp_test_suite/environment/post_test.sh.cmake deleted file mode 100644 index 34d4c1ce4..000000000 --- a/cpp_test_suite/environment/post_test.sh.cmake +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -#TODO Starter? - -PID=$(<@PROJECT_BINARY_DIR@/cpp_test_ds/DevTest_@INST_NAME@.pid) -kill $PID - -PID=$(<@PROJECT_BINARY_DIR@/cpp_test_ds/fwd_ds/FwdTest_@INST_NAME@.pid) -kill $PID - -exit 0 diff --git a/cpp_test_suite/environment/pre_test.sh.cmake b/cpp_test_suite/environment/pre_test.sh.cmake deleted file mode 100644 index 1bf9dffe9..000000000 --- a/cpp_test_suite/environment/pre_test.sh.cmake +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -source tango_host - -echo "TANGO_HOST=$TANGO_HOST" - -echo "Run conf_devtest" -@PROJECT_BINARY_DIR@/new_tests/conf_devtest @SERV_NAME@/@INST_NAME@ @DEV1@ @DEV2@ @DEV3@ @DEV1_ALIAS@ @ATTR_ALIAS@ @FWD_DEV@ @DEV20@ - -echo "Start DevTest" -echo "DevTest libraries:" -echo "`ldd @PROJECT_BINARY_DIR@/cpp_test_ds/DevTest`" -#TODO Starter? -@PROJECT_BINARY_DIR@/cpp_test_ds/DevTest @INST_NAME@ -v5 1>@PROJECT_BINARY_DIR@/cpp_test_ds/DevTest_@INST_NAME@.out 2>&1 & -echo $! > @PROJECT_BINARY_DIR@/cpp_test_ds/DevTest_@INST_NAME@.pid - -if hash tango_admin 2>/dev/null; then - tango_admin --ping-device "dserver/devtest/@INST_NAME@" 3 -else - sleep 3 -fi - -echo "Start FwdTest" -echo "FwdTest libraries:" -echo "`ldd @PROJECT_BINARY_DIR@/cpp_test_ds/fwd_ds/FwdTest`" -@PROJECT_BINARY_DIR@/cpp_test_ds/fwd_ds/FwdTest @INST_NAME@ -v5 1>@PROJECT_BINARY_DIR@/cpp_test_ds/fwd_ds/FwdTest_@INST_NAME@.out 2>&1 & -echo $! > @PROJECT_BINARY_DIR@/cpp_test_ds/fwd_ds/FwdTest_@INST_NAME@.pid - -if hash tango_admin 2>/dev/null; then - tango_admin --ping-device "dserver/fwdtest/@INST_NAME@" 3 -else - sleep 3 -fi diff --git a/cpp_test_suite/environment/run.sh.cmake b/cpp_test_suite/environment/run.sh.cmake deleted file mode 100644 index 3aaeabb43..000000000 --- a/cpp_test_suite/environment/run.sh.cmake +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -source tango_host -echo "TANGO_HOST=$TANGO_HOST" -@CMAKE_CTEST_COMMAND@ -V \ No newline at end of file diff --git a/cpp_test_suite/environment/setup.sh b/cpp_test_suite/environment/setup.sh deleted file mode 100755 index 3c6e2f4d2..000000000 --- a/cpp_test_suite/environment/setup.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -echo "Setup test environment" - -function run_mysql_container { - docker run \ - --rm \ - --name $1 \ - -e MYSQL_ROOT_PASSWORD=root \ - -e MYSQL_INITDB_SKIP_TZINFO=1 \ - -d \ - tangocs/mysql:9.2.2 \ - --sql-mode="" \ - --innodb=OFF \ - --default-storage-engine=MyISAM -} - -function run_tango_container { - docker run \ - --rm \ - --name $1 \ - -e TANGO_HOST=127.0.0.1:10000 \ - -e MYSQL_HOST=$2:3306 \ - -e MYSQL_USER=tango \ - -e MYSQL_PASSWORD=tango \ - -e MYSQL_DATABASE=tango \ - --link $2:$2 \ - -d \ - tangocs/tango-cs:latest -} - -run_mysql_container mysql_db -run_tango_container tango_cs mysql_db - -IPADDR=$(docker inspect -f '{{ .NetworkSettings.IPAddress }}' tango_cs) - -export TANGO_HOST=$IPADDR:10000 - -echo "TANGO_HOST=$TANGO_HOST" - -echo "Create tango_host file" - -cat << EOF > tango_host -#!/bin/bash -export TANGO_HOST=$TANGO_HOST -EOF - -echo "Wait till tango-cs is online" -if hash tango_admin 2>/dev/null; then - tango_admin --ping-database 30 -else - sleep 30 -fi diff --git a/cpp_test_suite/environment/shutdown.sh b/cpp_test_suite/environment/shutdown.sh deleted file mode 100755 index 2487a56cb..000000000 --- a/cpp_test_suite/environment/shutdown.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -echo "Shutdown test environment" -docker stop tango_cs -docker stop mysql_db - -echo "Revert tango_host file" -echo "TANGO_HOST=$TANGO_HOST" -echo "#!/bin/bash" > tango_host -echo "export TANGO_HOST=$TANGO_HOST" >> tango_host diff --git a/cpp_test_suite/environment/tango_host.cmake b/cpp_test_suite/environment/tango_host.cmake deleted file mode 100644 index 3a38ccf06..000000000 --- a/cpp_test_suite/environment/tango_host.cmake +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -export TANGO_HOST=@TANGO_HOST@ \ No newline at end of file From 7cd2351a06503243d20a733cde5d93f20e5e6005 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sun, 15 Dec 2019 11:05:04 +0100 Subject: [PATCH 09/48] Run tests in parallel in CI If some tests failed during parallel run, try to re-run them sequentially to see if the failure is permanent. --- .travis/run.sh | 3 ++- .travis/run_ctest.sh | 14 ++++++++++++++ .travis/test.sh | 18 +++++++----------- 3 files changed, 23 insertions(+), 12 deletions(-) create mode 100755 .travis/run_ctest.sh diff --git a/.travis/run.sh b/.travis/run.sh index a44c596a2..fc04459ea 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -31,7 +31,8 @@ docker exec cpp_tango cmake \ -DTANGO_USE_USING_NAMESPACE=${TANGO_USE_USING_NAMESPACE} \ -DWARNINGS_AS_ERRORS=${WARNINGS_AS_ERRORS} \ -DCOVERALLS=${COVERALLS} \ - -DCOVERALLS_MODULE_PATH=${COVERALLS_MODULE_PATH} + -DCOVERALLS_MODULE_PATH=${COVERALLS_MODULE_PATH} \ + -DCMAKE_CTEST_COMMAND="$([[ "$COVERALLS" == "ON" ]] && echo '/home/tango/src/.travis/run_ctest.sh' || echo 'ctest')" if [[ "$COVERALLS" == "ON" ]] then diff --git a/.travis/run_ctest.sh b/.travis/run_ctest.sh new file mode 100755 index 000000000..87f36c681 --- /dev/null +++ b/.travis/run_ctest.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +if ! ctest \ + --output-on-failure \ + --parallel 8 +then + if ! ctest \ + --output-on-failure \ + --rerun-failed \ + --repeat-until-fail 2 + then + exit 1 + fi +fi diff --git a/.travis/test.sh b/.travis/test.sh index 41db77546..998b16f2c 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -6,16 +6,12 @@ then exit 0 fi -TEST_COMMAND="exec ctest --output-on-failure" -if [ $COVERALLS = "ON" ] -then - TEST_COMMAND="exec make coveralls" -fi +build_dir="/home/tango/src/build" -echo "Test" -echo "TEST_COMMAND=$TEST_COMMAND" -docker exec cpp_tango /bin/sh -c "cd /home/tango/src/build; $TEST_COMMAND" -if [ $? -ne "0" ] -then - exit -1 +set -e + +if [[ "$COVERALLS" == "ON" ]]; then + docker exec -w "${build_dir}" cpp_tango make coveralls +else + docker exec -w "${build_dir}" cpp_tango ../.travis/run_ctest.sh fi From 7ab4262120cf3acfd658deb62e425510c6945cb3 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sun, 16 Jun 2019 16:44:47 +0200 Subject: [PATCH 10/48] Update instructions how to run the tests --- INSTALL.md | 151 +++++++++++++++++++---------------------------------- 1 file changed, 54 insertions(+), 97 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index ac664421c..60b516c82 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -112,128 +112,85 @@ $ cmake .. $ make ``` -### Start TANGO environment - -``` -$ make start-tango -Setup test environment -557e3c8a3daa2b75aac4fe04562bac32570db0ace08edd06a23cebaa7fd86f5e -CONTAINER=27bad3659305155c33d99505c4836b616d9c2a6de3431229e79b71a020f18455 -TANGO_HOST=172.17.0.3:10000 -Create tango_host file -Wait till tango-cs is online -``` - -This process takes ~30 s - ### Run tests -``` -$ make run-tests -TANGO_HOST=172.17.0.3:10000 -Run conf_devtest -Added test server : DevTest/test -> test/debian8/10, class : DevTest -Added test server : DevTest/test -> test/debian8/11, class : DevTest -Added test server : DevTest/test -> test/debian8/12, class : DevTest - -Added test server : FwdTest/test -> test/fwd_debian8/10, class : FwdTest +> Note: The test runner automatically starts database and all required +> device servers for each test. If you want to set up the environment +> manually, run ctest with following environment variable: +> +> `TANGO_TEST_CASE_SKIP_FIXTURE=1 ctest -V -R ds_cache` -Added pseudo server : DsCache/test -> test/cache1/1, class : CacheTest1 -Added pseudo server : DsCache/test -> test/cache1/2, class : CacheTest1 -Added pseudo server : DsCache/test -> test/cache2/1, class : CacheTest2 +From `build/` directory run: - - -Constructing a list of tests -Done constructing a list of tests -Checking test dependency graph... -Checking test dependency graph end -test 1 - Start 1: log4tango_test - - - -100% tests passed, 0 tests failed out of 59 - -Total Test time (real) = 843.30 sec - -Run command: /home/tango/src/build/cpp_test_suite/environment/post_test.sh ``` +$ ctest --output-on-failure --parallel 4 -The whole test suite takes ~ 15 min +Test project /home/tango-cs/Documents/cppTango/build + Start 54: old_tests::ring_depth + Start 66: asyn::asyn_cmd + Start 77: event::per_event + Start 83: event::user_event + 1/93 Test #83: event::user_event ................. Passed 22.65 sec -### Setup and run individual tests +... -To run individual tests use TANGO_HOST provided by the `start-tango` target. +90/93 Test #1: log4tango_test .................... Passed 0.20 sec +91/93 Test #39: CXX::cxx_nan_inf_in_prop .......... Passed 13.28 sec +92/93 Test #43: old_tests::attr_types ............. Passed 12.89 sec +93/93 Test #14: CXX::cxx_attr_conf ................ Passed 12.81 sec -Make sure TANGO_HOST is set correctly: +100% tests passed, 0 tests failed out of 93 +Total Test time (real) = 546.93 sec ``` -$ cd build -$ cat tango_host -#!/bin/bash -export TANGO_HOST=172.17.0.3:10000 -``` - -TANGO_HOST must be the same as what `start-tango` has returned. -``` -$ . tango_host -``` +Test output and device server logs are collected in `build/cpp_test_suite/test_results`. -Now run some test: +### Run individual tests ``` -$ ctest -R attr_misc -V -UpdateCTestConfiguration from :/storage/Projects/org.tango/git/cppTango/build/DartConfiguration.tcl -Parse Config file:/storage/Projects/org.tango/git/cppTango/build/DartConfiguration.tcl - Add coverage exclude regular expressions. -UpdateCTestConfiguration from :/storage/Projects/org.tango/git/cppTango/build/DartConfiguration.tcl -Parse Config file:/storage/Projects/org.tango/git/cppTango/build/DartConfiguration.tcl -Test project /storage/Projects/org.tango/git/cppTango/build -Run command: /storage/Projects/org.tango/git/cppTango/build/cpp_test_suite/environment/pre_test.sh -TANGO_HOST=172.17.0.3:10000 -Run conf_devtest - +$ ctest -R old_tests::attr_misc -V + +UpdateCTestConfiguration from :/home/tango-cs/Documents/cppTango/build/DartConfiguration.tcl +Parse Config file:/home/tango-cs/Documents/cppTango/build/DartConfiguration.tcl +UpdateCTestConfiguration from :/home/tango-cs/Documents/cppTango/build/DartConfiguration.tcl +Parse Config file:/home/tango-cs/Documents/cppTango/build/DartConfiguration.tcl +Test project /home/tango-cs/Documents/cppTango/build Constructing a list of tests Done constructing a list of tests +Updating test list for fixtures +Added 0 tests to meet fixture requirements Checking test dependency graph... Checking test dependency graph end -test 12 - Start 12: old_tests::attr_misc - -12: Test command: /storage/Projects/org.tango/git/cppTango/build/cpp_test_suite/old_tests/attr_misc "test/debian8/10" -12: Test timeout computed to be: 1500 -12: -12: new DeviceProxy(test/debian8/10) returned -12: -12: Setting/Getting attribute info --> OK -12: Writing outside attribute limits --> OK -12: Min alarm detection (on a float spectrum) --> OK -12: Reset min alarm detection --> OK -12: Max alarm detection (on a float spectrum) --> OK -12: Reset max alarm detection --> OK -12: Min alarm detection (on a unsigned short spectrum) --> OK -12: Reset min alarm detection --> OK -12: Max alarm detection (on a unsigned short spectrum) --> OK -12: Reset max alarm detection --> OK -12: Setting/Getting V5 attribute info --> OK -12: Alarm, Warning level detection --> OK -12: Exception when trying to change "hard coded" properties --> OK -1/1 Test #12: old_tests::attr_misc ............. Passed 0.29 sec +test 49 + Start 49: old_tests::attr_misc + +49: Test command: /home/tango-cs/Documents/cppTango/build/cpp_test_suite/environment/run_with_fixture.sh "/home/tango-cs/Documents/cppTango/build/cpp_test_suite/old_tests/attr_misc" "test/debian8/10" +49: Test timeout computed to be: 1500 +49: +49: new DeviceProxy(test/debian8/10) returned +49: +49: Setting/Getting attribute info --> OK +49: Writing outside attribute limits --> OK +49: Min alarm detection (on a float spectrum) --> OK +49: Reset min alarm detection --> OK +49: Max alarm detection (on a float spectrum) --> OK +49: Reset max alarm detection --> OK +49: Min alarm detection (on a unsigned short spectrum) --> OK +49: Reset min alarm detection --> OK +49: Max alarm detection (on a unsigned short spectrum) --> OK +49: Reset max alarm detection --> OK +49: Setting/Getting V5 attribute info --> OK +49: Alarm, Warning level detection --> OK +49: Exception when trying to change "hard coded" properties --> OK +1/1 Test #49: old_tests::attr_misc ............. Passed 8.55 sec The following tests passed: old_tests::attr_misc 100% tests passed, 0 tests failed out of 1 -Total Test time (real) = 0.33 sec +Total Test time (real) = 8.56 sec ``` See [CTest guide](https://cmake.org/Wiki/CMake/Testing_With_CTest) - -### Stop TANGO environment - -``` -$ make stop-tango -``` From 7671bb1cea94e489fbe0e0003b090bccf11bbfce Mon Sep 17 00:00:00 2001 From: mliszcz Date: Sun, 15 Dec 2019 22:27:23 +0100 Subject: [PATCH 11/48] Extract test fixture setup to a separate script Extract setup scripts so that it is possible to run the setup manually and then attach the debugger or perform some additional configuration. --- INSTALL.md | 23 ++++-- cpp_test_suite/environment/CMakeLists.txt | 18 +++-- .../environment/run_with_fixture.sh.cmake | 79 +++---------------- .../environment/setup_database.sh.cmake | 45 +++++++++++ .../environment/setup_devices.sh.cmake | 21 +++++ 5 files changed, 103 insertions(+), 83 deletions(-) create mode 100755 cpp_test_suite/environment/setup_database.sh.cmake create mode 100755 cpp_test_suite/environment/setup_devices.sh.cmake diff --git a/INSTALL.md b/INSTALL.md index 60b516c82..38b530b21 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -114,12 +114,6 @@ $ make ### Run tests -> Note: The test runner automatically starts database and all required -> device servers for each test. If you want to set up the environment -> manually, run ctest with following environment variable: -> -> `TANGO_TEST_CASE_SKIP_FIXTURE=1 ctest -V -R ds_cache` - From `build/` directory run: ``` @@ -146,6 +140,8 @@ Total Test time (real) = 546.93 sec Test output and device server logs are collected in `build/cpp_test_suite/test_results`. +For more details on testing with CTest, [see the guide](https://cmake.org/Wiki/CMake/Testing_With_CTest). + ### Run individual tests ``` @@ -193,4 +189,17 @@ The following tests passed: Total Test time (real) = 8.56 sec ``` -See [CTest guide](https://cmake.org/Wiki/CMake/Testing_With_CTest) +### Setting environment up manually + +The test runner automatically starts database and all required +device servers for each test. If you want to set up the environment +manually, from `build/` directory run: + +```bash +source ./cpp_test_suite/environment/setup_database.sh # source to get TANGO_HOST +./cpp_test_suite/environment/setup_devices.sh +# attach the debugger or perform some additional configuration +TANGO_TEST_CASE_SKIP_FIXTURE=1 ctest -V -R ds_cache +killall DevTest FwdTest +docker stop tango_cs mysql_db +``` diff --git a/cpp_test_suite/environment/CMakeLists.txt b/cpp_test_suite/environment/CMakeLists.txt index e4947b71f..fa64b382e 100644 --- a/cpp_test_suite/environment/CMakeLists.txt +++ b/cpp_test_suite/environment/CMakeLists.txt @@ -1,10 +1,14 @@ #TODO windows -configure_file(run_with_fixture.sh.cmake run_with_fixture.sh @ONLY) -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/run_with_fixture.sh) +SET(SCRIPTS + run_with_fixture.sh + setup_database.sh + setup_devices.sh + start_server.sh + kill_server.sh +) -configure_file(start_server.sh.cmake start_server.sh @ONLY) -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/start_server.sh) - -configure_file(kill_server.sh.cmake kill_server.sh @ONLY) -execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/kill_server.sh) +foreach(SCRIPT ${SCRIPTS}) + configure_file(${SCRIPT}.cmake ${SCRIPT} @ONLY) + execute_process(COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}) +endforeach(SCRIPT) diff --git a/cpp_test_suite/environment/run_with_fixture.sh.cmake b/cpp_test_suite/environment/run_with_fixture.sh.cmake index 21fe3f61c..1d52699c0 100755 --- a/cpp_test_suite/environment/run_with_fixture.sh.cmake +++ b/cpp_test_suite/environment/run_with_fixture.sh.cmake @@ -12,8 +12,8 @@ tc_program="$1" tc_run_name="$(basename "$tc_program")_$(date '+%Y%m%d.%H%M%S.%N')" shift 1 -tc_tango_container="tango_cs_${tc_run_name}" tc_mysql_container="mysql_db_${tc_run_name}" +tc_tango_container="tango_cs_${tc_run_name}" export TANGO_TEST_CASE_DIRECTORY="@PROJECT_BINARY_DIR@/test_results/${tc_run_name}" mkdir -p "$TANGO_TEST_CASE_DIRECTORY" @@ -28,85 +28,26 @@ function teardown { ) & } - if [[ -z "$TANGO_TEST_CASE_SKIP_FIXTURE" ]]; then - trap teardown EXIT - -# --- setup database ---------------------------------------------------------- - - docker run \ - --name "$tc_mysql_container" \ - --rm \ - -e MYSQL_ROOT_PASSWORD=root \ - -e MYSQL_INITDB_SKIP_TZINFO=1 \ - -d \ - tangocs/mysql:9.2.2 \ - --sql-mode="" \ - --innodb=OFF \ - --default-storage-engine=MyISAM \ - > /dev/null - - docker run \ - --name "$tc_tango_container" \ - --rm \ - -e TANGO_HOST=127.0.0.1:10000 \ - -e MYSQL_HOST=mysql_db:3306 \ - -e MYSQL_USER=tango \ - -e MYSQL_PASSWORD=tango \ - -e MYSQL_DATABASE=tango \ - --link "$tc_mysql_container":mysql_db \ - -d \ - tangocs/tango-cs:latest \ - > /dev/null - - tc_tango_ipaddr="$(docker inspect \ - -f '{{ .NetworkSettings.IPAddress }}' \ - "$tc_tango_container")" - - export TANGO_HOST="$tc_tango_ipaddr:10000" - - if hash tango_admin 2>/dev/null; then - if ! tango_admin --ping-database 30; then - echo "Failed to ping database" - exit 1 - fi - else - sleep 30 - fi - -# -- setup devices ------------------------------------------------------------ - - "@PROJECT_BINARY_DIR@/new_tests/conf_devtest" \ - @SERV_NAME@/@INST_NAME@ \ - @DEV1@ \ - @DEV2@ \ - @DEV3@ \ - @DEV1_ALIAS@ \ - @ATTR_ALIAS@ \ - @FWD_DEV@ \ - @DEV20@ \ - &> "${TANGO_TEST_CASE_DIRECTORY}/conf_devtest.out" - - "@CMAKE_CURRENT_BINARY_DIR@/start_server.sh" @INST_NAME@ DevTest cpp_test_ds - - "@CMAKE_CURRENT_BINARY_DIR@/start_server.sh" @INST_NAME@ FwdTest cpp_test_ds/fwd_ds - -fi # TANGO_TEST_CASE_SKIP_FIXTURE - - -# --- run test ---------------------------------------------------------------- + eval $( + set -e + source "@CMAKE_CURRENT_BINARY_DIR@/setup_database.sh" \ + "$tc_mysql_container" \ + "$tc_tango_container" + echo "export TANGO_HOST=$TANGO_HOST" + ) + "@CMAKE_CURRENT_BINARY_DIR@/setup_devices.sh" +fi set +e set -o pipefail "$tc_program" "$@" 2>&1 | tee "${TANGO_TEST_CASE_DIRECTORY}/testcase.out" - tc_exit_code="$?" set +o pipefail set -e echo "$tc_exit_code" > "${TANGO_TEST_CASE_DIRECTORY}/testcase_exit_code.out" - exit "$tc_exit_code" diff --git a/cpp_test_suite/environment/setup_database.sh.cmake b/cpp_test_suite/environment/setup_database.sh.cmake new file mode 100755 index 000000000..fdbe14468 --- /dev/null +++ b/cpp_test_suite/environment/setup_database.sh.cmake @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# vim: syntax=sh + +mysql_container="${1:-mysql_db}" +tango_container="${2:-tango_cs}" + +docker run \ + --name "$mysql_container" \ + --rm \ + -e MYSQL_ROOT_PASSWORD=root \ + -e MYSQL_INITDB_SKIP_TZINFO=1 \ + -d \ + tangocs/mysql:9.2.2 \ + --sql-mode="" \ + --innodb=OFF \ + --default-storage-engine=MyISAM \ + > /dev/null + +docker run \ + --name "$tango_container" \ + --rm \ + -e TANGO_HOST=127.0.0.1:10000 \ + -e MYSQL_HOST=mysql_db:3306 \ + -e MYSQL_USER=tango \ + -e MYSQL_PASSWORD=tango \ + -e MYSQL_DATABASE=tango \ + --link "$mysql_container":mysql_db \ + -d \ + tangocs/tango-cs:latest \ + > /dev/null + +tango_ipaddr="$(docker inspect \ + -f '{{ .NetworkSettings.IPAddress }}' \ + "$tango_container")" + +export TANGO_HOST="${tango_ipaddr}:10000" + +if hash tango_admin 2>/dev/null; then + if ! tango_admin --ping-database 30; then + echo "Failed to ping database" + exit 1 + fi +else + sleep 30 +fi diff --git a/cpp_test_suite/environment/setup_devices.sh.cmake b/cpp_test_suite/environment/setup_devices.sh.cmake new file mode 100755 index 000000000..24ba39813 --- /dev/null +++ b/cpp_test_suite/environment/setup_devices.sh.cmake @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# vim: syntax=sh + +set -e + +export TANGO_TEST_CASE_DIRECTORY="${TANGO_TEST_CASE_DIRECTORY:-.}" + +"@PROJECT_BINARY_DIR@/new_tests/conf_devtest" \ + @SERV_NAME@/@INST_NAME@ \ + @DEV1@ \ + @DEV2@ \ + @DEV3@ \ + @DEV1_ALIAS@ \ + @ATTR_ALIAS@ \ + @FWD_DEV@ \ + @DEV20@ \ + &> "${TANGO_TEST_CASE_DIRECTORY}/conf_devtest.out" + +"@CMAKE_CURRENT_BINARY_DIR@/start_server.sh" @INST_NAME@ DevTest cpp_test_ds + +"@CMAKE_CURRENT_BINARY_DIR@/start_server.sh" @INST_NAME@ FwdTest cpp_test_ds/fwd_ds From ee64cece86b8142ea6a9392e39cf8edbe87b121c Mon Sep 17 00:00:00 2001 From: mliszcz Date: Thu, 19 Dec 2019 09:31:30 +0100 Subject: [PATCH 12/48] Set number of parallel tests basing on CPU count Run up to (num of CPUs) tests in parallel to avoid overloading the machine and to reduce the number of failures of unstable tests. --- .travis/run_ctest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis/run_ctest.sh b/.travis/run_ctest.sh index 87f36c681..bed25000f 100755 --- a/.travis/run_ctest.sh +++ b/.travis/run_ctest.sh @@ -2,7 +2,7 @@ if ! ctest \ --output-on-failure \ - --parallel 8 + --parallel $(nproc) then if ! ctest \ --output-on-failure \ From 6dc48da7c57e3ea63089e533610612d53ec28265 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Mon, 20 Jan 2020 09:19:49 +0100 Subject: [PATCH 13/48] Do not re-run the tests on a failure in CI Since we are running up to (num of CPUs) tests in parallel, no failures are expected. --- .travis/run.sh | 3 +-- .travis/run_ctest.sh | 14 -------------- .travis/test.sh | 12 ++++++++++-- 3 files changed, 11 insertions(+), 18 deletions(-) delete mode 100755 .travis/run_ctest.sh diff --git a/.travis/run.sh b/.travis/run.sh index fc04459ea..a44c596a2 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -31,8 +31,7 @@ docker exec cpp_tango cmake \ -DTANGO_USE_USING_NAMESPACE=${TANGO_USE_USING_NAMESPACE} \ -DWARNINGS_AS_ERRORS=${WARNINGS_AS_ERRORS} \ -DCOVERALLS=${COVERALLS} \ - -DCOVERALLS_MODULE_PATH=${COVERALLS_MODULE_PATH} \ - -DCMAKE_CTEST_COMMAND="$([[ "$COVERALLS" == "ON" ]] && echo '/home/tango/src/.travis/run_ctest.sh' || echo 'ctest')" + -DCOVERALLS_MODULE_PATH=${COVERALLS_MODULE_PATH} if [[ "$COVERALLS" == "ON" ]] then diff --git a/.travis/run_ctest.sh b/.travis/run_ctest.sh deleted file mode 100755 index bed25000f..000000000 --- a/.travis/run_ctest.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -if ! ctest \ - --output-on-failure \ - --parallel $(nproc) -then - if ! ctest \ - --output-on-failure \ - --rerun-failed \ - --repeat-until-fail 2 - then - exit 1 - fi -fi diff --git a/.travis/test.sh b/.travis/test.sh index 998b16f2c..91276b2bc 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -8,10 +8,18 @@ fi build_dir="/home/tango/src/build" +function run_in_container { + docker exec \ + -w "${build_dir}" \ + -e CTEST_PARALLEL_LEVEL=$(nproc) \ + -e CTEST_OUTPUT_ON_FAILURE=ON \ + cpp_tango "$@" +} + set -e if [[ "$COVERALLS" == "ON" ]]; then - docker exec -w "${build_dir}" cpp_tango make coveralls + run_in_container make coveralls else - docker exec -w "${build_dir}" cpp_tango ../.travis/run_ctest.sh + run_in_container ctest fi From 0c13be4d06d11483ba736c058e9753fe8d35ee69 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Mon, 20 Jan 2020 09:43:28 +0100 Subject: [PATCH 14/48] Install Docker in Ubuntu 20.04 container in CI --- .travis/ubuntu-20.04/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis/ubuntu-20.04/Dockerfile b/.travis/ubuntu-20.04/Dockerfile index 157a9c614..791659a4f 100644 --- a/.travis/ubuntu-20.04/Dockerfile +++ b/.travis/ubuntu-20.04/Dockerfile @@ -18,12 +18,15 @@ RUN apt-get update && apt-get install -y \ libzmq3-dev \ lsb-release \ omniidl \ - python2 + python2 \ + docker.io RUN groupadd -g "$APP_GID" tango RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango +RUN usermod -a -G docker tango + ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig USER tango From 6329017a68f91e995b98ca0e038ba5c1bb6fe587 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Wed, 22 Jan 2020 09:45:05 +0100 Subject: [PATCH 15/48] Add cpp_tango user to group owning docker socket The owning group of docker socket varies between different docker packages and different operating systems. Official docker-ce package uses gid 957 while docker.io package on Ubuntu 20.04 uses gid 103. New group with matching gid matching docker host is added to the cpp_tango container to allow tango user access the docker socket. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 28e44abd3..1ee5d3fbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,6 +73,10 @@ before_script: -v /var/run/docker.sock:/var/run/docker.sock -dit cpp_tango + - > + docker exec -u root cpp_tango + groupadd -g $(grep docker /etc/group | awk -F ':' '{print $3}') dockerhost || true + - docker exec -u root cpp_tango usermod -a -G dockerhost tango || true - .travis/install_tango_idl.sh - (test ${STOCK_CPPZMQ} = "OFF" && .travis/install_cppzmq.sh) || true #work around gcov ignored by sonar From 890fd5947dc288e1746baca6cbaf4ddfa8d06b0f Mon Sep 17 00:00:00 2001 From: mliszcz Date: Wed, 22 Jan 2020 13:42:29 +0100 Subject: [PATCH 16/48] Enable Sonar and Coveralls integration in CI build Sonar and Coveralls were disabled in 226d70c and this was unnoticed until now. We again enable those integrations. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1ee5d3fbd..1205e8593 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ env: - OS_TYPE=debian10 USE_PCH=OFF RUN_TESTS=OFF - OS_TYPE=debian10 CMAKE_BUILD_TYPE=Release - OS_TYPE=debian9 - - OS_TYPE=debian8 STOCK_CPPZMQ=OFF + - OS_TYPE=debian8 SONAR_SCANNER=ON COVERALLS=ON STOCK_CPPZMQ=OFF - OS_TYPE=debian7 notifications: From 7158749f2784dcc53a13d8491fe6f5987086a874 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:09:01 +0100 Subject: [PATCH 17/48] CMakeLists.txt: Require C++11 and cmake 3.7 We don't use per target properties like cxx_std_11 as these are only supported starting with cmake 3.8. So we set it globally instead. --- CMakeLists.txt | 4 +++- configure/CMakeLists.txt | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ae9a2675..d0ac0f5c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,9 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.7 FATAL_ERROR) project(cppTango) +set(CXX_STANDARD_REQUIRED 11) + include(CTest) option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF) diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt index 72d74bad4..2de129228 100644 --- a/configure/CMakeLists.txt +++ b/configure/CMakeLists.txt @@ -191,17 +191,9 @@ if(NOT WIN32) # C++17 and higher support is currently not possible as omniorb uses # throw specifications and these are not supported anymore. CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) - CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) - CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) CHECK_CXX_COMPILER_FLAG("-Og" COMPILER_SUPPORTS_OG) if(COMPILER_SUPPORTS_CXX14) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - elseif(COMPILER_SUPPORTS_CXX11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - elseif(COMPILER_SUPPORTS_CXX0X) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - else() - message("The compiler ${CMAKE_CXX_COMPILER} has no C++11/14 support. You may not benefit from performance optimizations.") endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") From c46ea53237e5a0cc74c19da6c66791952f61dfd4 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:17:39 +0100 Subject: [PATCH 18/48] cppapi/server/tango_config.h: Remove test for gcc >= 3.0 This is way too old to work anymore as we now require C++11. --- cppapi/server/tango_config.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 1389f6f88..83ae10117 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -129,16 +129,6 @@ #define TANGO_IMP #endif /* _WINDOWS_ */ -// -// Check GCC release -// - -#ifndef _TG_WINDOWS_ - #if __GNUC__ < 3 - #error "Gcc too old to use Tango!" - #endif -#endif - // // Some C++11 feature // map::at() -> gcc 4.1.0 (See C++ Standard Library Defect Report 464) From ce2cdab72b45ca9c39c1a21a22dcfdca1c46487c Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 19/48] Remove HAS_UNIQUE_PTR We now require C++11. Done with unifdef -DHAS_UNIQUE_PTR --- cppapi/client/ApiUtil.h | 4 --- cppapi/client/AttributeProxy.h | 4 --- cppapi/client/Connection.h | 4 --- cppapi/client/Database.h | 4 --- cppapi/client/DbDevice.h | 4 --- cppapi/client/DeviceAttribute.h | 4 --- cppapi/client/DeviceData.h | 4 --- cppapi/client/DevicePipe.h | 8 ----- cppapi/client/DeviceProxy.h | 4 --- cppapi/client/api_util.cpp | 7 ---- cppapi/client/attr_proxy.cpp | 23 ------------ cppapi/client/dbapi.h | 12 ------- cppapi/client/dbapi_base.cpp | 22 ------------ cppapi/client/dbapi_datum.cpp | 13 ------- cppapi/client/devapi.h | 8 ----- cppapi/client/devapi_attr.cpp | 35 ------------------ cppapi/client/devapi_base.cpp | 59 ------------------------------- cppapi/client/devapi_data.cpp | 25 ------------- cppapi/client/devapi_datahist.cpp | 56 ----------------------------- cppapi/client/devapi_pipe.cpp | 47 ------------------------ cppapi/client/devasyn.h | 16 --------- cppapi/client/filedatabase.cpp | 3 -- cppapi/client/filedatabase.h | 4 --- cppapi/client/proxy_asyn_cb.cpp | 12 ------- cppapi/server/attrdesc.cpp | 3 -- cppapi/server/attrdesc.h | 16 --------- cppapi/server/attrprop.h | 12 ------- cppapi/server/attrprop.tpp | 4 --- cppapi/server/command.h | 30 ++-------------- cppapi/server/device.cpp | 3 -- cppapi/server/device.h | 4 --- cppapi/server/device_2.h | 4 --- cppapi/server/device_3.h | 8 ----- cppapi/server/device_4.h | 4 --- cppapi/server/device_5.h | 4 --- cppapi/server/deviceclass.cpp | 3 -- cppapi/server/deviceclass.h | 4 --- cppapi/server/encoded_attribute.h | 4 --- cppapi/server/fwdattrdesc.h | 8 ----- cppapi/server/multiattribute.cpp | 3 -- cppapi/server/multiattribute.h | 4 --- cppapi/server/pipe.h | 8 ----- cppapi/server/pipedesc.h | 4 --- cppapi/server/utils.cpp | 3 -- cppapi/server/utils.h | 4 --- cppapi/server/w_attribute.cpp | 3 -- cppapi/server/w_attribute.h | 4 --- cppapi/server/w_pipe.h | 8 ----- 48 files changed, 3 insertions(+), 531 deletions(-) diff --git a/cppapi/client/ApiUtil.h b/cppapi/client/ApiUtil.h index b82af9de2..169ce2a79 100644 --- a/cppapi/client/ApiUtil.h +++ b/cppapi/client/ApiUtil.h @@ -240,11 +240,7 @@ class ApiUtil bool exit_lock_installed; bool reset_already_executed_flag; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - ApiUtilExt *ext; // Class extension -#endif NotifdEventConsumer *notifd_event_consumer; TangoSys_Pid cl_pid; diff --git a/cppapi/client/AttributeProxy.h b/cppapi/client/AttributeProxy.h index 6a20e5342..5576f5b19 100644 --- a/cppapi/client/AttributeProxy.h +++ b/cppapi/client/AttributeProxy.h @@ -83,11 +83,7 @@ private : AttributeProxyExt(const std::string& name):user_defined_name(name) {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - AttributeProxyExt *ext; // Class extension -#endif public : std::string get_user_defined_name() const { return ext->user_defined_name; } diff --git a/cppapi/client/Connection.h b/cppapi/client/Connection.h index 69113ca4a..9344b8b85 100644 --- a/cppapi/client/Connection.h +++ b/cppapi/client/Connection.h @@ -117,11 +117,7 @@ protected : bool has_alt_adr; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - ConnectionExt *ext; // Class extension -#endif bool tr_reco; Tango::Device_3_var device_3; diff --git a/cppapi/client/Database.h b/cppapi/client/Database.h index 1339ad048..4d11ea4bd 100644 --- a/cppapi/client/Database.h +++ b/cppapi/client/Database.h @@ -64,11 +64,7 @@ private : std::string orig_tango_host; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DatabaseExt *ext; -#endif bool db_multi_svc; std::vector multi_db_port; diff --git a/cppapi/client/DbDevice.h b/cppapi/client/DbDevice.h index 1d452fb00..4cb8498e1 100644 --- a/cppapi/client/DbDevice.h +++ b/cppapi/client/DbDevice.h @@ -62,11 +62,7 @@ private : DbDeviceExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DbDeviceExt *ext; -#endif public : /**@name Constructors */ diff --git a/cppapi/client/DeviceAttribute.h b/cppapi/client/DeviceAttribute.h index 37ce04548..8faec8383 100644 --- a/cppapi/client/DeviceAttribute.h +++ b/cppapi/client/DeviceAttribute.h @@ -1313,11 +1313,7 @@ protected : void deep_copy(const DeviceAttributeExt &); }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DeviceAttributeExt *ext; // Class extension -#endif private: void init_common_class_members(const char * name,int dim_x,int dim_y); diff --git a/cppapi/client/DeviceData.h b/cppapi/client/DeviceData.h index c0f9e588c..e96e6f26f 100644 --- a/cppapi/client/DeviceData.h +++ b/cppapi/client/DeviceData.h @@ -640,11 +640,7 @@ protected : std::bitset ext_state; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DeviceDataExt *ext; // Class extension -#endif }; diff --git a/cppapi/client/DevicePipe.h b/cppapi/client/DevicePipe.h index c98fcd336..0c539f458 100644 --- a/cppapi/client/DevicePipe.h +++ b/cppapi/client/DevicePipe.h @@ -774,11 +774,7 @@ class DevicePipeBlob DevicePipeBlobExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DevicePipeBlobExt *ext; // Class extension -#endif }; @@ -1104,11 +1100,7 @@ public : DevicePipeExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DevicePipeExt *ext; // Class extension -#endif }; /**************************************************************************************** diff --git a/cppapi/client/DeviceProxy.h b/cppapi/client/DeviceProxy.h index bf5be689f..db8264f19 100644 --- a/cppapi/client/DeviceProxy.h +++ b/cppapi/client/DeviceProxy.h @@ -129,11 +129,7 @@ protected : std::string orig_tango_host; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_proxy; -#else - DeviceProxyExt *ext_proxy; // Class extension -#endif omni_mutex lock_mutex; diff --git a/cppapi/client/api_util.cpp b/cppapi/client/api_util.cpp index 7d7346727..afa0ef139 100644 --- a/cppapi/client/api_util.cpp +++ b/cppapi/client/api_util.cpp @@ -207,11 +207,7 @@ ApiUtil::~ApiUtil() bool event_was_used = false; -#ifdef HAS_UNIQUE_PTR if (ext.get() != NULL) -#else - if (ext != NULL) -#endif { if ((notifd_event_consumer != NULL) || (zmq_event_consumer != NULL)) { @@ -220,9 +216,6 @@ ApiUtil::~ApiUtil() NotifdEventConsumer::cleanup(); ZmqEventConsumer::cleanup(); } -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } // diff --git a/cppapi/client/attr_proxy.cpp b/cppapi/client/attr_proxy.cpp index bbc5fee34..b51709256 100644 --- a/cppapi/client/attr_proxy.cpp +++ b/cppapi/client/attr_proxy.cpp @@ -290,20 +290,10 @@ AttributeProxy::AttributeProxy(const AttributeProxy &prev):ext(Tango_nullptr) } } -#ifdef HAS_UNIQUE_PTR if (prev.ext.get() != NULL) { ext.reset(new AttributeProxyExt(prev.get_user_defined_name())); } -#else - if (prev.ext != NULL) - { - ext = new AttributeProxyExt(prev.get_user_defined_name()); - *ext = *(prev.ext); - } - else - ext = NULL; -#endif } @@ -367,20 +357,10 @@ AttributeProxy &AttributeProxy::operator=(const AttributeProxy &rval) } } -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) ext.reset(new AttributeProxyExt(rval.get_user_defined_name())); else ext.reset(); -#else - if (rval.ext != NULL) - { - ext = new AttributeProxyExt(rval.get_user_defined_name()); - *ext = *(rval.ext); - } - else - ext = NULL; -#endif } return *this; @@ -798,9 +778,6 @@ AttributeProxy::~AttributeProxy() delete db_attr; delete dev_proxy; -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- diff --git a/cppapi/client/dbapi.h b/cppapi/client/dbapi.h index ae40ea793..24a4b4198 100644 --- a/cppapi/client/dbapi.h +++ b/cppapi/client/dbapi.h @@ -172,11 +172,7 @@ private : DbServerExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DbServerExt *ext; -#endif public : /**@name Constructors */ @@ -282,11 +278,7 @@ private : DbClassExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DbClassExt *ext; -#endif public : /**@name Constructors */ @@ -705,11 +697,7 @@ private : DbDatumExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DbDatumExt *ext; -#endif }; /********************************************************************** diff --git a/cppapi/client/dbapi_base.cpp b/cppapi/client/dbapi_base.cpp index b5676447c..22e629fcf 100644 --- a/cppapi/client/dbapi_base.cpp +++ b/cppapi/client/dbapi_base.cpp @@ -385,19 +385,10 @@ Database::Database(const Database &sou):Connection(sou),ext(Tango_nullptr) // Copy extension class // -#ifdef HAS_UNIQUE_PTR if (sou.ext.get() != NULL) { ext.reset(new DatabaseExt); } -#else - if (sou.ext == NULL) - ext = NULL; - else - { - ext = new DatabaseExt(); - } -#endif } @@ -444,22 +435,12 @@ Database &Database::operator=(const Database &rval) access_service_defined = rval.access_service_defined; db_tg = rval.db_tg; -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) { ext.reset(new DatabaseExt); } else ext.reset(); -#else - delete ext; - if (rval.ext != NULL) - { - ext = new DatabaseExt; - } - else - ext = NULL; -#endif } return *this; @@ -559,9 +540,6 @@ Database::~Database() delete access_proxy; -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } #ifdef _TG_WINDOWS_ diff --git a/cppapi/client/dbapi_datum.cpp b/cppapi/client/dbapi_datum.cpp index 59049651d..32c2a140f 100644 --- a/cppapi/client/dbapi_datum.cpp +++ b/cppapi/client/dbapi_datum.cpp @@ -77,9 +77,6 @@ DbDatum::DbDatum():ext(Tango_nullptr) DbDatum::~DbDatum() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- @@ -110,17 +107,7 @@ DbDatum &DbDatum::operator=(const DbDatum &rval) value_type = rval.value_type; value_size = rval.value_size; exceptions_flags = rval.exceptions_flags; -#ifdef HAS_UNIQUE_PTR ext.reset(new DbDatumExt); -#else - if (rval.ext != NULL) - { - if (ext != Tango_nullptr) - delete ext; - ext = new DbDatumExt; - *ext = *rval.ext; - } -#endif return *this; } diff --git a/cppapi/client/devapi.h b/cppapi/client/devapi.h index 4692ec814..bffb8cbb4 100644 --- a/cppapi/client/devapi.h +++ b/cppapi/client/devapi.h @@ -603,11 +603,7 @@ public : DeviceDataHistoryExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_hist; -#else - DeviceDataHistoryExt *ext_hist; // Class extension -#endif }; typedef std::vector DeviceDataHistoryList; @@ -701,11 +697,7 @@ public : DeviceAttributeHistoryExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_hist; -#else - DeviceAttributeHistoryExt *ext_hist; // Class extension -#endif }; diff --git a/cppapi/client/devapi_attr.cpp b/cppapi/client/devapi_attr.cpp index 83c8a60c6..1eda74737 100644 --- a/cppapi/client/devapi_attr.cpp +++ b/cppapi/client/devapi_attr.cpp @@ -146,21 +146,11 @@ DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullp d_state = source.d_state; d_state_filled = source.d_state_filled; -#ifdef HAS_UNIQUE_PTR if (source.ext.get() != NULL) { ext.reset(new DeviceAttributeExt); *(ext.get()) = *(source.ext.get()); } -#else - if (source.ext != NULL) - { - ext = new DeviceAttributeExt(); - *ext = *(source.ext); - } - else - ext = NULL; -#endif } //----------------------------------------------------------------------------- @@ -250,7 +240,6 @@ void DeviceAttribute::deep_copy(const DeviceAttribute & source) d_state = source.d_state; d_state_filled = source.d_state_filled; -#ifdef HAS_UNIQUE_PTR if (source.ext.get() != NULL) { ext.reset(new DeviceAttributeExt); @@ -258,16 +247,6 @@ void DeviceAttribute::deep_copy(const DeviceAttribute & source) } else ext.reset(); -#else - if (source.ext != NULL) - { - if (ext == NULL) - ext = new DeviceAttributeExt(); - ext->deep_copy(*source.ext); - } - else - ext = NULL; -#endif } //----------------------------------------------------------------------------- @@ -418,7 +397,6 @@ DeviceAttribute & DeviceAttribute::operator=(const DeviceAttribute &rval) d_state = rval.d_state; d_state_filled = rval.d_state_filled; -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) { ext.reset(new DeviceAttributeExt); @@ -426,16 +404,6 @@ DeviceAttribute & DeviceAttribute::operator=(const DeviceAttribute &rval) } else ext.reset(); -#else - delete ext; - if (rval.ext != NULL) - { - ext = new DeviceAttributeExt(); - *ext = *(rval.ext); - } - else - ext = NULL; -#endif } return *this; @@ -1355,9 +1323,6 @@ DeviceAttribute::DeviceAttribute(const char *new_name, std::vector &da DeviceAttribute::~DeviceAttribute() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index 06c0d5985..a72fa1446 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -132,11 +132,7 @@ Connection::Connection(bool dummy) { if (dummy) { -#ifdef HAS_UNIQUE_PTR ext.reset(new ConnectionExt()); -#else - ext = new ConnectionExt(); -#endif } } @@ -148,9 +144,6 @@ Connection::Connection(bool dummy) Connection::~Connection() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- @@ -203,23 +196,11 @@ Connection::Connection(const Connection &sou) device_5 = sou.device_5; -#ifdef HAS_UNIQUE_PTR if (sou.ext.get() != NULL) { ext.reset(new ConnectionExt); *(ext.get()) = *(sou.ext.get()); } -#else - if (sou.ext != NULL) - { - ext = new ConnectionExt(); - *ext = *(sou.ext); - } - else - { - ext = NULL; - } -#endif } //----------------------------------------------------------------------------- @@ -271,7 +252,6 @@ Connection &Connection::operator=(const Connection &rval) device_5 = rval.device_5; -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) { ext.reset(new ConnectionExt); @@ -281,17 +261,6 @@ Connection &Connection::operator=(const Connection &rval) { ext.reset(Tango_nullptr); } -#else - if (rval.ext != NULL) - { - ext = new ConnectionExt(); - *ext = *(rval.ext); - } - else - { - ext = NULL; - } -#endif return *this; } @@ -1944,23 +1913,11 @@ DeviceProxy::DeviceProxy(const DeviceProxy &sou) // Copy extension class // -#ifdef HAS_UNIQUE_PTR if (sou.ext_proxy.get() != NULL) { ext_proxy.reset(new DeviceProxyExt); *(ext_proxy.get()) = *(sou.ext_proxy.get()); } -#else - if (sou.ext_proxy == NULL) - { - ext_proxy = NULL; - } - else - { - ext_proxy = new DeviceProxyExt(); - *ext_proxy = *(sou.ext_proxy); - } -#endif } @@ -2020,7 +1977,6 @@ DeviceProxy &DeviceProxy::operator=(const DeviceProxy &rval) adm_device = NULL; } -#ifdef HAS_UNIQUE_PTR if (rval.ext_proxy.get() != NULL) { ext_proxy.reset(new DeviceProxyExt); @@ -2030,18 +1986,6 @@ DeviceProxy &DeviceProxy::operator=(const DeviceProxy &rval) { ext_proxy.reset(); } -#else - delete ext_proxy; - if (rval.ext_proxy != NULL) - { - ext_proxy = new DeviceProxyExt; - *ext_proxy = *(rval.ext_proxy); - } - else - { - ext_proxy = NULL; - } -#endif } return *this; @@ -2663,9 +2607,6 @@ DeviceProxy::~DeviceProxy() delete adm_device; -#ifndef HAS_UNIQUE_PTR - delete ext_proxy; -#endif } void DeviceProxy::unsubscribe_all_events() diff --git a/cppapi/client/devapi_data.cpp b/cppapi/client/devapi_data.cpp index 8d8f5d97a..602b1f434 100644 --- a/cppapi/client/devapi_data.cpp +++ b/cppapi/client/devapi_data.cpp @@ -77,21 +77,11 @@ DeviceData::DeviceData(const DeviceData &source) any = const_cast(source).any._retn(); #endif -#ifdef HAS_UNIQUE_PTR if (source.ext.get() != NULL) { ext.reset(new DeviceDataExt); *(ext.get()) = *(source.ext.get()); } -#else - if (source.ext != NULL) - { - ext = new DeviceDataExt(); - *ext = *(source.ext); - } - else - ext = NULL; -#endif } //----------------------------------------------------------------------------- @@ -131,7 +121,6 @@ DeviceData &DeviceData::operator=(const DeviceData &rval) any = const_cast(rval).any._retn(); #endif -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) { ext.reset(new DeviceDataExt); @@ -141,17 +130,6 @@ DeviceData &DeviceData::operator=(const DeviceData &rval) { ext.reset(); } -#else - delete ext; - - if (rval.ext != NULL) - { - ext = new DeviceDataExt(); - *ext = *(rval.ext); - } - else - ext = NULL; -#endif } return *this; } @@ -189,9 +167,6 @@ DeviceData &DeviceData::operator=(DeviceData &&rval) DeviceData::~DeviceData() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- diff --git a/cppapi/client/devapi_datahist.cpp b/cppapi/client/devapi_datahist.cpp index cd2bbabed..24edbbd84 100644 --- a/cppapi/client/devapi_datahist.cpp +++ b/cppapi/client/devapi_datahist.cpp @@ -84,23 +84,11 @@ DeviceDataHistory::DeviceDataHistory(const DeviceDataHistory &source) (*ref_ctr_ptr)++; } -#ifdef HAS_UNIQUE_PTR if (source.ext_hist.get() != NULL) { ext_hist.reset(new DeviceDataHistoryExt); *(ext_hist.get()) = *(source.ext_hist.get()); } -#else - if (source.ext_hist == NULL) - { - ext_hist = NULL; - } - else - { - ext_hist = new DeviceDataHistoryExt(); - *ext_hist = *(source.ext_hist); - } -#endif } #ifdef HAS_RVALUE @@ -146,9 +134,6 @@ DeviceDataHistory::~DeviceDataHistory() } } -#ifndef HAS_UNIQUE_PTR - delete ext_hist; -#endif } @@ -196,7 +181,6 @@ DeviceDataHistory &DeviceDataHistory::operator=(const DeviceDataHistory &rval) ref_ctr_ptr = rval.ref_ctr_ptr; (*ref_ctr_ptr)++; -#ifdef HAS_UNIQUE_PTR if (rval.ext_hist.get() != NULL) { ext_hist.reset(new DeviceDataHistoryExt); @@ -206,18 +190,6 @@ DeviceDataHistory &DeviceDataHistory::operator=(const DeviceDataHistory &rval) { ext_hist.reset(); } -#else - delete ext_hist; - if (rval.ext_hist != NULL) - { - ext_hist = new DeviceDataHistoryExt(); - *ext_hist = *(rval.ext_hist); - } - else - { - ext_hist = NULL; - } -#endif } return *this; @@ -676,23 +648,11 @@ DeviceAttributeHistory::DeviceAttributeHistory(const DeviceAttributeHistory &sou { fail = source.fail; -#ifdef HAS_UNIQUE_PTR if (source.ext_hist.get() != NULL) { ext_hist.reset(new DeviceAttributeHistoryExt); *(ext_hist.get()) = *(source.ext_hist.get()); } -#else - if (source.ext_hist == NULL) - { - ext_hist = NULL; - } - else - { - ext_hist = new DeviceAttributeHistoryExt(); - *ext_hist = *(source.ext_hist); - } -#endif } #ifdef HAS_RVALUE @@ -717,9 +677,6 @@ DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) DeviceAttributeHistory::~DeviceAttributeHistory() { -#ifndef HAS_UNIQUE_PTR - delete ext_hist; -#endif } @@ -746,7 +703,6 @@ DeviceAttributeHistory &DeviceAttributeHistory::operator=(const DeviceAttributeH fail = rval.fail; -#ifdef HAS_UNIQUE_PTR if (rval.ext_hist.get() != NULL) { ext_hist.reset(new DeviceAttributeHistoryExt); @@ -756,18 +712,6 @@ DeviceAttributeHistory &DeviceAttributeHistory::operator=(const DeviceAttributeH { ext_hist.reset(); } -#else - delete ext_hist; - if (rval.ext_hist != NULL) - { - ext_hist = new DeviceAttributeHistoryExt(); - *ext_hist = *(rval.ext_hist); - } - else - { - ext_hist = NULL; - } -#endif } return *this; diff --git a/cppapi/client/devapi_pipe.cpp b/cppapi/client/devapi_pipe.cpp index ebf1c60a0..0d83ab700 100644 --- a/cppapi/client/devapi_pipe.cpp +++ b/cppapi/client/devapi_pipe.cpp @@ -73,21 +73,11 @@ DevicePipe::DevicePipe(const DevicePipe & source):ext(Tango_nullptr) time = source.time; the_root_blob = source.the_root_blob; -#ifdef HAS_UNIQUE_PTR if (source.ext.get() != NULL) { ext.reset(new DevicePipeExt); *(ext.get()) = *(source.ext.get()); } -#else - if (source.ext != NULL) - { - ext = new DevicePipeExt(); - *ext = *(source.ext); - } - else - ext = NULL; -#endif } //----------------------------------------------------------------------------- @@ -104,21 +94,11 @@ DevicePipe &DevicePipe::operator=(const DevicePipe &rhs) time = rhs.time; the_root_blob = rhs.the_root_blob; -#ifdef HAS_UNIQUE_PTR if (rhs.ext.get() != NULL) { ext.reset(new DevicePipeExt); *(ext.get()) = *(rhs.ext.get()); } -#else - if (rhs.ext != NULL) - { - ext = new DevicePipeExt(); - *ext = *(rhs.ext); - } - else - ext = NULL; -#endif } return *this; } @@ -175,9 +155,6 @@ DevicePipe &DevicePipe::operator=(DevicePipe &&rhs) DevicePipe::~DevicePipe() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } DevicePipe &DevicePipe::operator[](const std::string &_na) @@ -233,9 +210,6 @@ DevicePipeBlob::~DevicePipeBlob() if (extract_delete == true) delete extract_elt_array; -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- @@ -275,21 +249,11 @@ DevicePipeBlob::DevicePipeBlob(const DevicePipeBlob & source):ext(Tango_nullptr) } extract_ctr = source.extract_ctr; -#ifdef HAS_UNIQUE_PTR if (source.ext.get() != NULL) { ext.reset(new DevicePipeBlobExt); *(ext.get()) = *(source.ext.get()); } -#else - if (source.ext != NULL) - { - ext = new DevicePipeBlobExt(); - *ext = *(source.ext); - } - else - ext = NULL; -#endif } //----------------------------------------------------------------------------- @@ -331,7 +295,6 @@ DevicePipeBlob &DevicePipeBlob::operator=(const DevicePipeBlob &rhs) } extract_ctr = rhs.extract_ctr; -#ifdef HAS_UNIQUE_PTR if (rhs.ext.get() != NULL) { ext.reset(new DevicePipeBlobExt); @@ -339,16 +302,6 @@ DevicePipeBlob &DevicePipeBlob::operator=(const DevicePipeBlob &rhs) } else ext.reset(); -#else - delete ext; - if (rhs.ext != NULL) - { - ext = new DevicePipeBlobExt(); - *ext = *(rhs.ext); - } - else - ext = NULL; -#endif } return *this; } diff --git a/cppapi/client/devasyn.h b/cppapi/client/devasyn.h index 15ddcbcc4..057c56740 100644 --- a/cppapi/client/devasyn.h +++ b/cppapi/client/devasyn.h @@ -100,11 +100,7 @@ class CmdDoneEvent CmdDoneEventExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - CmdDoneEventExt *ext; -#endif }; /******************************************************************************** @@ -151,11 +147,7 @@ class AttrReadEvent AttrReadEventExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - AttrReadEventExt *ext; -#endif }; /******************************************************************************** @@ -199,11 +191,7 @@ class AttrWrittenEvent AttrWrittenEventExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - AttrWrittenEventExt *ext; -#endif }; /******************************************************************************** @@ -330,11 +318,7 @@ friend class EventConsumerKeepAliveThread; CallBackExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - CallBackExt *ext; -#endif }; //------------------------------------------------------------------------------ diff --git a/cppapi/client/filedatabase.cpp b/cppapi/client/filedatabase.cpp index 9c7a0ffc5..6e0fde40a 100644 --- a/cppapi/client/filedatabase.cpp +++ b/cppapi/client/filedatabase.cpp @@ -287,9 +287,6 @@ FileDatabase::~FileDatabase() delete (*j); } -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } // **************************************************** diff --git a/cppapi/client/filedatabase.h b/cppapi/client/filedatabase.h index 24464cb73..46c369e40 100644 --- a/cppapi/client/filedatabase.h +++ b/cppapi/client/filedatabase.h @@ -205,11 +205,7 @@ class FileDatabase std::string word; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - FileDatabaseExt *ext; -#endif }; } // end namespace Tango diff --git a/cppapi/client/proxy_asyn_cb.cpp b/cppapi/client/proxy_asyn_cb.cpp index da68b4c51..5ea7a2fa3 100644 --- a/cppapi/client/proxy_asyn_cb.cpp +++ b/cppapi/client/proxy_asyn_cb.cpp @@ -416,11 +416,7 @@ void Connection::Cb_Cmd_Request(CORBA::Request_ptr req,Tango::CallBack *cb_ptr) DeviceProxy *local_dev = static_cast(this); CmdDoneEvent *cb_data = new CmdDoneEvent(local_dev,cmd_str,data_out,errors); -#ifdef HAS_UNIQUE_PTR std::unique_ptr auto_cb_data(cb_data); -#else - auto_ptr auto_cb_data(cb_data); -#endif cb_ptr->cmd_ended(auto_cb_data.get()); } @@ -665,11 +661,7 @@ void Connection::Cb_ReadAttr_Request(CORBA::Request_ptr req,Tango::CallBack *cb_ DeviceProxy *local_dev = static_cast(this); AttrReadEvent *cb_data = new AttrReadEvent(local_dev,attr_names,dev_attr,errors); -#ifdef HAS_UNIQUE_PTR std::unique_ptr auto_cb_data(cb_data); -#else - auto_ptr auto_cb_data(cb_data); -#endif cb_ptr->attr_read(auto_cb_data.get()); @@ -908,11 +900,7 @@ void Connection::Cb_WriteAttr_Request(CORBA::Request_ptr req,Tango::CallBack *cb DeviceProxy *local_dev = static_cast(this); AttrWrittenEvent *cb_data = new AttrWrittenEvent(local_dev,att_name,err_3); -#ifdef HAS_UNIQUE_PTR std::unique_ptr auto_cb_data(cb_data); -#else - auto_ptr auto_cb_data(cb_data); -#endif cb_ptr->attr_written(auto_cb_data.get()); diff --git a/cppapi/server/attrdesc.cpp b/cppapi/server/attrdesc.cpp index 0d5f2959d..ceabdc0a1 100644 --- a/cppapi/server/attrdesc.cpp +++ b/cppapi/server/attrdesc.cpp @@ -178,9 +178,6 @@ Attr::Attr(const Attr &sou) Attr::~Attr() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //+------------------------------------------------------------------------------------------------------------------ diff --git a/cppapi/server/attrdesc.h b/cppapi/server/attrdesc.h index 16574d733..f7b3ee61a 100644 --- a/cppapi/server/attrdesc.h +++ b/cppapi/server/attrdesc.h @@ -349,11 +349,7 @@ class UserDefaultAttrProp { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - UserDefaultAttrPropExt *ext; -#endif }; /** @@ -603,11 +599,7 @@ class Attr AttrExt() {} }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - AttrExt *ext; -#endif std::string cl_name; }; @@ -709,11 +701,7 @@ class SpectrumAttr: public Attr { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - SpectrumAttrExt *ext; -#endif }; @@ -822,11 +810,7 @@ class ImageAttr: public SpectrumAttr { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - ImageAttrExt *ext; -#endif }; } // End of Tango namespace diff --git a/cppapi/server/attrprop.h b/cppapi/server/attrprop.h index 4e983e762..89756ee4d 100644 --- a/cppapi/server/attrprop.h +++ b/cppapi/server/attrprop.h @@ -240,11 +240,7 @@ class AttrProp class AttrPropExt {}; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - AttrPropExt *ext; -#endif }; //=================================================================================================================== @@ -517,11 +513,7 @@ class DoubleAttrProp class DoubleAttrPropExt {}; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - DoubleAttrPropExt *ext; -#endif }; //================================================================================================================== @@ -665,11 +657,7 @@ class MultiAttrProp class MultiAttrPropExt {}; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - MultiAttrPropExt *ext; -#endif }; } // End of Tango namespace diff --git a/cppapi/server/attrprop.tpp b/cppapi/server/attrprop.tpp index f3b64ba77..fb9fd38f4 100644 --- a/cppapi/server/attrprop.tpp +++ b/cppapi/server/attrprop.tpp @@ -195,11 +195,7 @@ private: class MultiAttrPropExt {}; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - MultiAttrPropExt *ext; -#endif }; } // End of Tango namespace diff --git a/cppapi/server/command.h b/cppapi/server/command.h index 28a424e1b..c2985b882 100644 --- a/cppapi/server/command.h +++ b/cppapi/server/command.h @@ -216,11 +216,7 @@ class Command /** * The object desctructor. */ -#ifdef HAS_UNIQUE_PTR virtual ~Command() {} -#else - virtual ~Command() {delete ext;} -#endif //@} /**@name Miscellaneous methods */ @@ -1244,11 +1240,7 @@ class Command void alloc_any(CORBA::Any *&); void throw_bad_type(const char *); -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - CommandExt *ext; -#endif // // Ported from the extension class @@ -1631,11 +1623,7 @@ class TemplCommand:public Command }; void (DeviceImpl::*exe_ptr)(); -#ifdef HAS_UNIQUE_PTR - std::unique_ptr ext; // Class extension -#else - TemplCommandExt *ext; -#endif + std::unique_ptr ext; // Class extension protected: /**@name Class data members */ @@ -2004,11 +1992,7 @@ class TemplCommandInOut:public TemplCommand }; OUTARG (DeviceImpl::*exe_ptr_inout)(INARG); -#ifdef HAS_UNIQUE_PTR - std::unique_ptr ext; // Class extension -#else - TemplCommandInOutExt *ext; -#endif + std::unique_ptr ext; // Class extension }; //+------------------------------------------------------------------------- @@ -2559,11 +2543,7 @@ class TemplCommandIn:public TemplCommand }; void (DeviceImpl::*exe_ptr_in)(INARG); -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - TemplCommandInExt *ext; -#endif }; //+------------------------------------------------------------------------- @@ -3093,11 +3073,7 @@ class TemplCommandOut:public TemplCommand }; OUTARG (DeviceImpl::*exe_ptr_out)(); -#ifdef HAS_UNIQUE_PTR - std::unique_ptr ext; // Class extension -#else - TemplCommandOutExt *ext; -#endif + std::unique_ptr ext; // Class extension }; //+------------------------------------------------------------------------- diff --git a/cppapi/server/device.cpp b/cppapi/server/device.cpp index 3d28cb1fb..02660ac71 100644 --- a/cppapi/server/device.cpp +++ b/cppapi/server/device.cpp @@ -451,9 +451,6 @@ DeviceImpl::~DeviceImpl() // Delete the extension class instance // -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif // // Clear our ptr in the device class vector diff --git a/cppapi/server/device.h b/cppapi/server/device.h index 74d76361a..6987c125f 100644 --- a/cppapi/server/device.h +++ b/cppapi/server/device.h @@ -3463,11 +3463,7 @@ class DeviceImpl : public virtual POA_Tango::Device void init_attr_poll_period(); void init_poll_no_db(); -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - DeviceImplExt *ext; -#endif DevVarShortArray dummy_short_att_value; DevVarLongArray dummy_long_att_value; diff --git a/cppapi/server/device_2.h b/cppapi/server/device_2.h index 742db1119..f36b95ae1 100644 --- a/cppapi/server/device_2.h +++ b/cppapi/server/device_2.h @@ -317,11 +317,7 @@ class Device_2Impl : public virtual POA_Tango::Device_2, { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_2; // Class extension -#else - Device_2ImplExt *ext_2; -#endif }; } // End of Tango namespace diff --git a/cppapi/server/device_3.h b/cppapi/server/device_3.h index 087291df9..c81d3da73 100644 --- a/cppapi/server/device_3.h +++ b/cppapi/server/device_3.h @@ -162,11 +162,7 @@ class Device_3Impl : public virtual POA_Tango::Device_3, /** * The device desctructor. */ -#ifdef HAS_UNIQUE_PTR virtual ~Device_3Impl() {} -#else - virtual ~Device_3Impl() {delete ext_3;} -#endif //@} @@ -338,11 +334,7 @@ class Device_3Impl : public virtual POA_Tango::Device_3, void real_ctor(); -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_3; // Class extension -#else - Device_3ImplExt *ext_3; -#endif }; } // End of Tango namespace diff --git a/cppapi/server/device_4.h b/cppapi/server/device_4.h index 42e6499d3..1f213533a 100644 --- a/cppapi/server/device_4.h +++ b/cppapi/server/device_4.h @@ -336,11 +336,7 @@ class Device_4Impl : public virtual POA_Tango::Device_4, ~Device_4ImplExt() {} }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_4; // Class extension -#else - Device_4ImplExt *ext_4; -#endif }; diff --git a/cppapi/server/device_5.h b/cppapi/server/device_5.h index 7982a2fcb..b8044d344 100644 --- a/cppapi/server/device_5.h +++ b/cppapi/server/device_5.h @@ -375,11 +375,7 @@ class Device_5Impl : public virtual POA_Tango::Device_5, ~Device_5ImplExt() {} }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_5; // Class extension -#else - Device_5ImplExt *ext_5; -#endif }; diff --git a/cppapi/server/deviceclass.cpp b/cppapi/server/deviceclass.cpp index ed34ef8c3..5dab5f988 100644 --- a/cppapi/server/deviceclass.cpp +++ b/cppapi/server/deviceclass.cpp @@ -791,9 +791,6 @@ DeviceClass::~DeviceClass() // Delete the class extension object // -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif cout4 << "Leaving DeviceClass destructor for class " << name << std::endl; } diff --git a/cppapi/server/deviceclass.h b/cppapi/server/deviceclass.h index 56ca31b9d..ab707f92b 100644 --- a/cppapi/server/deviceclass.h +++ b/cppapi/server/deviceclass.h @@ -502,11 +502,7 @@ class std::vector allowed_cmds; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - DeviceClassExt *ext; -#endif // // Ported from the extension class diff --git a/cppapi/server/encoded_attribute.h b/cppapi/server/encoded_attribute.h index 8ac2f19cc..c7fa71d9c 100644 --- a/cppapi/server/encoded_attribute.h +++ b/cppapi/server/encoded_attribute.h @@ -231,11 +231,7 @@ class EncodedAttribute int buf_elt_nb; bool manage_exclusion; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - EncodedAttributeExt *ext; -#endif }; diff --git a/cppapi/server/fwdattrdesc.h b/cppapi/server/fwdattrdesc.h index 342a1ada6..1c778e96c 100644 --- a/cppapi/server/fwdattrdesc.h +++ b/cppapi/server/fwdattrdesc.h @@ -88,11 +88,7 @@ class UserDefaultFwdAttrProp { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - UserDefaultFwdAttrPropExt *ext; -#endif }; class MultiAttribute; @@ -170,11 +166,7 @@ class FwdAttr: public ImageAttr { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - FwdAttrExt *ext; -#endif }; diff --git a/cppapi/server/multiattribute.cpp b/cppapi/server/multiattribute.cpp index a9ed886a7..a67c2fd80 100644 --- a/cppapi/server/multiattribute.cpp +++ b/cppapi/server/multiattribute.cpp @@ -360,9 +360,6 @@ MultiAttribute::~MultiAttribute() for(unsigned long i = 0;i < attr_list.size();i++) delete attr_list[i]; ext->attr_map.clear(); -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //+----------------------------------------------------------------------------------------------------------------- diff --git a/cppapi/server/multiattribute.h b/cppapi/server/multiattribute.h index 46f761a4c..ed3cb7111 100644 --- a/cppapi/server/multiattribute.h +++ b/cppapi/server/multiattribute.h @@ -318,11 +318,7 @@ class MultiAttribute void add_user_default(std::vector &,std::vector &); void check_associated(long,std::string &); -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - MultiAttributeExt *ext; -#endif }; diff --git a/cppapi/server/pipe.h b/cppapi/server/pipe.h index 2f16687c2..974ac3a2d 100644 --- a/cppapi/server/pipe.h +++ b/cppapi/server/pipe.h @@ -103,11 +103,7 @@ class Pipe /** * The object desctructor. */ -#ifdef HAS_UNIQUE_PTR virtual ~Pipe() {} -#else - virtual ~Pipe() {delete ext;} -#endif //@} /**@name Miscellaneous methods */ @@ -449,11 +445,7 @@ class Pipe PipeExt() {} }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - PipeExt *ext; -#endif bool value_flag; // Flag set when pipe value is set Tango::TimeVal when; // Date associated to the pipe diff --git a/cppapi/server/pipedesc.h b/cppapi/server/pipedesc.h index 7e862ee85..6d53fb24c 100644 --- a/cppapi/server/pipedesc.h +++ b/cppapi/server/pipedesc.h @@ -99,11 +99,7 @@ class UserDefaultPipeProp { }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - UserDefaultPipePropExt *ext; -#endif }; diff --git a/cppapi/server/utils.cpp b/cppapi/server/utils.cpp index c271f562a..ea038a430 100644 --- a/cppapi/server/utils.cpp +++ b/cppapi/server/utils.cpp @@ -1613,9 +1613,6 @@ Util::~Util() } #endif -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif delete cr_py_lock; } diff --git a/cppapi/server/utils.h b/cppapi/server/utils.h index 75888dde4..781b9bc77 100644 --- a/cppapi/server/utils.h +++ b/cppapi/server/utils.h @@ -982,11 +982,7 @@ class Util bool display_help; // display help message flag const std::vector *cl_list_ptr; // Ptr to server device class list -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; // Class extension -#else - Util::UtilExt *ext; // Class extension -#endif std::vector cl_list; // Full class list ptr // diff --git a/cppapi/server/w_attribute.cpp b/cppapi/server/w_attribute.cpp index dc898a01e..e3d6ee960 100644 --- a/cppapi/server/w_attribute.cpp +++ b/cppapi/server/w_attribute.cpp @@ -166,9 +166,6 @@ WAttribute::WAttribute(std::vector &prop_list, WAttribute::~WAttribute() { -#ifndef HAS_UNIQUE_PTR - delete w_ext; -#endif Tango::string_free(str_val); Tango::string_free(old_str_val); // Tango::string_free(encoded_val.encoded_format); diff --git a/cppapi/server/w_attribute.h b/cppapi/server/w_attribute.h index ddec28a3f..7f90ee442 100644 --- a/cppapi/server/w_attribute.h +++ b/cppapi/server/w_attribute.h @@ -945,11 +945,7 @@ class WAttribute:public Attribute std::string mem_value; struct timeval write_date; -#ifdef HAS_UNIQUE_PTR std::unique_ptr w_ext; // Class extension -#else - WAttributeExt *w_ext; -#endif // // Ported from the extension class diff --git a/cppapi/server/w_pipe.h b/cppapi/server/w_pipe.h index c34acb7c9..8a8d0bcde 100644 --- a/cppapi/server/w_pipe.h +++ b/cppapi/server/w_pipe.h @@ -77,11 +77,7 @@ class WPipe: public Pipe /** * The object desctructor. */ -#ifdef HAS_UNIQUE_PTR virtual ~WPipe() {} -#else - virtual ~WPipe() {delete w_ext;} -#endif //@} /**@name Get/Set methods. @@ -163,11 +159,7 @@ class WPipe: public Pipe WPipeExt() {} }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr w_ext; // Class extension -#else - WPipeExt *w_ext; -#endif }; From 6d494e568d34081580338bd7479b0ac80c3bb5fd Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 20/48] Remove HAS_MAP_AT We now require C++11. Done with unifdef -DHAS_MAP_AT --- cppapi/server/multiattribute.cpp | 48 -------------------------------- 1 file changed, 48 deletions(-) diff --git a/cppapi/server/multiattribute.cpp b/cppapi/server/multiattribute.cpp index a67c2fd80..2d85d9c37 100644 --- a/cppapi/server/multiattribute.cpp +++ b/cppapi/server/multiattribute.cpp @@ -1148,7 +1148,6 @@ Attribute &MultiAttribute::get_attr_by_name(const char *attr_name) Attribute * attr = 0; std::string st(attr_name); std::transform(st.begin(),st.end(),st.begin(),::tolower); -#ifdef HAS_MAP_AT try { attr = ext->attr_map.at(st).att_ptr; @@ -1163,21 +1162,6 @@ Attribute &MultiAttribute::get_attr_by_name(const char *attr_name) o.str(), (const char *)"MultiAttribute::get_attr_by_name"); } -#else - std::map::iterator it; - it = ext->attr_map.find(st); - if (it == ext->attr_map.end()) - { - cout3 << "MultiAttribute::get_attr_by_name throwing exception" << std::endl; - TangoSys_OMemStream o; - - o << attr_name << " attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_attr_by_name"); - } - attr = it->second.att_ptr; -#endif return *attr; } @@ -1203,7 +1187,6 @@ WAttribute &MultiAttribute::get_w_attr_by_name(const char *attr_name) Attribute * attr = 0; std::string st(attr_name); std::transform(st.begin(),st.end(),st.begin(),::tolower); -#ifdef HAS_MAP_AT try { attr = ext->attr_map.at(st).att_ptr; @@ -1218,21 +1201,6 @@ WAttribute &MultiAttribute::get_w_attr_by_name(const char *attr_name) o.str(), (const char *)"MultiAttribute::get_w_attr_by_name"); } -#else - std::map::iterator it; - it = ext->attr_map.find(st); - if (it == ext->attr_map.end()) - { - cout3 << "MultiAttribute::get_attr_by_name throwing exception" << std::endl; - TangoSys_OMemStream o; - - o << attr_name << " writable attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_w_attr_by_name"); - } - attr = it->second.att_ptr; -#endif if ((attr->get_writable() != Tango::WRITE) && (attr->get_writable() != Tango::READ_WRITE)) @@ -1271,7 +1239,6 @@ long MultiAttribute::get_attr_ind_by_name(const char *attr_name) std::string st(attr_name); std::transform(st.begin(),st.end(),st.begin(),::tolower); -#ifdef HAS_MAP_AT try { i = ext->attr_map.at(st).att_index_in_vector; @@ -1286,21 +1253,6 @@ long MultiAttribute::get_attr_ind_by_name(const char *attr_name) o.str(), (const char *)"MultiAttribute::get_attr_ind_by_name"); } -#else - std::map::iterator it; - it = ext->attr_map.find(st); - if (it == ext->attr_map.end()) - { - cout3 << "MultiAttribute::get_attr_ind_by_name throwing exception" << std::endl; - TangoSys_OMemStream o; - - o << attr_name << " attribute not found" << std::ends; - Except::throw_exception((const char *)API_AttrNotFound, - o.str(), - (const char *)"MultiAttribute::get_attr_ind_by_name"); - } - i = it->second.att_index_in_vector; -#endif return i; } From 84b98e3a4daf07a8c2d1f93efacd85a68fd0bd5d Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 21/48] Remove HAS_OVERRIDE We now require C++11. Done with unifdef -DHAS_OVERRIDE --- cppapi/client/eventconsumer.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/cppapi/client/eventconsumer.h b/cppapi/client/eventconsumer.h index 74e8202d5..f6ce32681 100644 --- a/cppapi/client/eventconsumer.h +++ b/cppapi/client/eventconsumer.h @@ -535,17 +535,10 @@ protected : virtual void set_channel_type(EventChannelStruct &ecs) {ecs.channel_type = NOTIFD;} virtual void zmq_specific(DeviceData &,std::string &,DeviceProxy *,const std::string &) {} -#ifdef HAS_OVERRIDE ReceivedFromAdmin initialize_received_from_admin(const Tango::DevVarLongStringArray *pArray, const std::string &local_callback_key, const std::string &adm_name, bool device_from_env_var) override; -#else - virtual ReceivedFromAdmin initialize_received_from_admin(const Tango::DevVarLongStringArray *pArray, - const std::string &local_callback_key, - const std::string &adm_name, - bool device_from_env_var); -#endif private : @@ -605,17 +598,10 @@ protected : virtual void set_channel_type(EventChannelStruct &ecs) {ecs.channel_type = ZMQ;} virtual void zmq_specific(DeviceData &,std::string &,DeviceProxy *,const std::string &); -#ifdef HAS_OVERRIDE ReceivedFromAdmin initialize_received_from_admin(const Tango::DevVarLongStringArray *pArray, const std::string &local_callback_key, const std::string &adm_name, bool device_from_env_var) override; -#else - virtual ReceivedFromAdmin initialize_received_from_admin(const Tango::DevVarLongStringArray *pArray, - const std::string &local_callback_key, - const std::string &adm_name, - bool device_from_env_var); -#endif private : TANGO_IMP static ZmqEventConsumer *_instance; From 7483d742a583060e48d9c9fd602852748b9e6ceb Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 22/48] Remove HAS_RVALUE We now require C++11. Done with unifdef -DHAS_RVALUE --- cpp_test_suite/old_tests/misc_devattr.cpp | 2 - cpp_test_suite/old_tests/misc_devdata.cpp | 2 - cppapi/client/DeviceAttribute.h | 2 - cppapi/client/DeviceData.h | 2 - cppapi/client/DevicePipe.h | 4 - cppapi/client/devapi.h | 4 - cppapi/client/devapi_attr.cpp | 103 ---------------------- cppapi/client/devapi_data.cpp | 12 --- cppapi/client/devapi_datahist.cpp | 12 --- cppapi/client/devapi_pipe.cpp | 8 -- 10 files changed, 151 deletions(-) diff --git a/cpp_test_suite/old_tests/misc_devattr.cpp b/cpp_test_suite/old_tests/misc_devattr.cpp index b6b5c9cb9..c590a8f41 100644 --- a/cpp_test_suite/old_tests/misc_devattr.cpp +++ b/cpp_test_suite/old_tests/misc_devattr.cpp @@ -99,7 +99,6 @@ int main() // Test move assignement -#ifdef HAS_RVALUE DeviceAttribute d_ma; float fl_move = 2.0; d_ma << fl_move; @@ -113,7 +112,6 @@ int main() assert (fl_move == fl_move_out ); cout << " Move assignement --> OK" << endl; -#endif return 0; } diff --git a/cpp_test_suite/old_tests/misc_devdata.cpp b/cpp_test_suite/old_tests/misc_devdata.cpp index e5f017e6b..d10c21854 100644 --- a/cpp_test_suite/old_tests/misc_devdata.cpp +++ b/cpp_test_suite/old_tests/misc_devdata.cpp @@ -105,7 +105,6 @@ int main() // Test move assignement (if available) -#ifdef HAS_RVALUE DeviceData ma; float fl_move = 3.0; ma << fl_move; @@ -118,7 +117,6 @@ int main() assert(fl_move_out == fl_move); cout << " Move assignement --> OK" << endl; -#endif return 0; } diff --git a/cppapi/client/DeviceAttribute.h b/cppapi/client/DeviceAttribute.h index 8faec8383..28922cf60 100644 --- a/cppapi/client/DeviceAttribute.h +++ b/cppapi/client/DeviceAttribute.h @@ -89,10 +89,8 @@ public : DeviceAttribute(const DeviceAttribute&); DeviceAttribute & operator=(const DeviceAttribute &); -#ifdef HAS_RVALUE DeviceAttribute(DeviceAttribute &&); DeviceAttribute & operator=(DeviceAttribute &&); -#endif void deep_copy(const DeviceAttribute &); diff --git a/cppapi/client/DeviceData.h b/cppapi/client/DeviceData.h index e96e6f26f..549b94bf4 100644 --- a/cppapi/client/DeviceData.h +++ b/cppapi/client/DeviceData.h @@ -78,10 +78,8 @@ public : // DeviceData(); DeviceData(const DeviceData &); DeviceData & operator=(const DeviceData &); -#ifdef HAS_RVALUE DeviceData(DeviceData &&); DeviceData & operator=(DeviceData &&); -#endif virtual ~DeviceData(); CORBA::Any_var any; diff --git a/cppapi/client/DevicePipe.h b/cppapi/client/DevicePipe.h index 0c539f458..5b430c8ec 100644 --- a/cppapi/client/DevicePipe.h +++ b/cppapi/client/DevicePipe.h @@ -613,10 +613,8 @@ class DevicePipeBlob ~DevicePipeBlob(); DevicePipeBlob(const DevicePipeBlob &); DevicePipeBlob & operator=(const DevicePipeBlob &); -#ifdef HAS_RVALUE DevicePipeBlob(DevicePipeBlob &&); DevicePipeBlob & operator=(DevicePipeBlob &&); -#endif DevicePipeBlob & operator << (DevBoolean &); // DevicePipeBlob & operator << (short &); @@ -1078,10 +1076,8 @@ public : ///@privatesection DevicePipe(const DevicePipe &); DevicePipe & operator=(const DevicePipe &); -#ifdef HAS_RVALUE DevicePipe(DevicePipe &&); DevicePipe & operator=(DevicePipe &&); -#endif ~DevicePipe(); void set_time(TimeVal &_ti) {time=_ti;} diff --git a/cppapi/client/devapi.h b/cppapi/client/devapi.h index bffb8cbb4..11c16740a 100644 --- a/cppapi/client/devapi.h +++ b/cppapi/client/devapi.h @@ -519,10 +519,8 @@ public : DeviceDataHistory(int, int *,DevCmdHistoryList *); DeviceDataHistory(const DeviceDataHistory &); DeviceDataHistory & operator=(const DeviceDataHistory &); -#ifdef HAS_RVALUE DeviceDataHistory(DeviceDataHistory &&); DeviceDataHistory &operator=(DeviceDataHistory &&); -#endif ~DeviceDataHistory(); @@ -637,10 +635,8 @@ public : DeviceAttributeHistory(int, DevAttrHistoryList_3_var &); DeviceAttributeHistory(const DeviceAttributeHistory &); DeviceAttributeHistory & operator=(const DeviceAttributeHistory &); -#ifdef HAS_RVALUE DeviceAttributeHistory(DeviceAttributeHistory &&); DeviceAttributeHistory &operator=(DeviceAttributeHistory &&); -#endif ~DeviceAttributeHistory(); ///@publicsection diff --git a/cppapi/client/devapi_attr.cpp b/cppapi/client/devapi_attr.cpp index 1eda74737..4900a7d06 100644 --- a/cppapi/client/devapi_attr.cpp +++ b/cppapi/client/devapi_attr.cpp @@ -99,7 +99,6 @@ DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullp time = source.time; err_list = source.err_list; -#ifdef HAS_RVALUE LongSeq = source.LongSeq; ShortSeq = source.ShortSeq; DoubleSeq = source.DoubleSeq; @@ -113,35 +112,6 @@ DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullp ULong64Seq = source.ULong64Seq; StateSeq = source.StateSeq; EncodedSeq = source.EncodedSeq; -#else - DeviceAttribute &nc_source = const_cast(source); - if (nc_source.LongSeq.operator->() != NULL) - LongSeq = nc_source.LongSeq._retn(); - if (nc_source.ShortSeq.operator->() != NULL) - ShortSeq = nc_source.ShortSeq._retn(); - if (nc_source.DoubleSeq.operator->() != NULL) - DoubleSeq = nc_source.DoubleSeq._retn(); - if (nc_source.StringSeq.operator->() != NULL) - StringSeq = nc_source.StringSeq._retn(); - if (nc_source.FloatSeq.operator->() != NULL) - FloatSeq = nc_source.FloatSeq._retn(); - if (nc_source.BooleanSeq.operator->() != NULL) - BooleanSeq = nc_source.BooleanSeq._retn(); - if (nc_source.UShortSeq.operator->() != NULL) - UShortSeq = nc_source.UShortSeq._retn(); - if (nc_source.UCharSeq.operator->() != NULL) - UCharSeq = nc_source.UCharSeq._retn(); - if (nc_source.Long64Seq.operator->() != NULL) - Long64Seq = nc_source.Long64Seq._retn(); - if (nc_source.ULongSeq.operator->() != NULL) - ULongSeq = nc_source.ULongSeq._retn(); - if (nc_source.ULong64Seq.operator->() != NULL) - ULong64Seq = nc_source.ULong64Seq._retn(); - if (nc_source.StateSeq.operator->() != NULL) - StateSeq = nc_source.StateSeq._retn(); - if (nc_source.EncodedSeq.operator->() != NULL) - EncodedSeq = nc_source.EncodedSeq._retn(); -#endif d_state = source.d_state; d_state_filled = source.d_state_filled; @@ -159,7 +129,6 @@ DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullp // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceAttribute::DeviceAttribute(DeviceAttribute &&source):ext(Tango_nullptr) { name = std::move(source.name); @@ -207,7 +176,6 @@ DeviceAttribute::DeviceAttribute(DeviceAttribute &&source):ext(Tango_nullptr) if (source.ext.get() != NULL) ext = std::move(source.ext); } -#endif void DeviceAttribute::deep_copy(const DeviceAttribute & source) { @@ -311,7 +279,6 @@ DeviceAttribute & DeviceAttribute::operator=(const DeviceAttribute &rval) time = rval.time; err_list = rval.err_list; -#ifdef HAS_RVALUE LongSeq = rval.LongSeq; ShortSeq = rval.ShortSeq; DoubleSeq = rval.DoubleSeq; @@ -325,74 +292,6 @@ DeviceAttribute & DeviceAttribute::operator=(const DeviceAttribute &rval) ULong64Seq = rval.ULong64Seq; StateSeq = rval.StateSeq; EncodedSeq = rval.EncodedSeq; -#else - DeviceAttribute &nc_rval = const_cast(rval); - if (nc_rval.LongSeq.operator->() != NULL) - LongSeq = nc_rval.LongSeq._retn(); - else - LongSeq = NULL; - - if (nc_rval.ShortSeq.operator->() != NULL) - ShortSeq = nc_rval.ShortSeq._retn(); - else - ShortSeq = NULL; - - if (nc_rval.DoubleSeq.operator->() != NULL) - DoubleSeq = nc_rval.DoubleSeq._retn(); - else - DoubleSeq = NULL; - - if (nc_rval.StringSeq.operator->() != NULL) - StringSeq = nc_rval.StringSeq._retn(); - else - StringSeq = NULL; - - if (nc_rval.FloatSeq.operator->() != NULL) - FloatSeq = nc_rval.FloatSeq._retn(); - else - FloatSeq = NULL; - - if (nc_rval.BooleanSeq.operator->() != NULL) - BooleanSeq = nc_rval.BooleanSeq._retn(); - else - BooleanSeq = NULL; - - if (nc_rval.UShortSeq.operator->() != NULL) - UShortSeq = nc_rval.UShortSeq._retn(); - else - UShortSeq = NULL; - - if (nc_rval.UCharSeq.operator->() != NULL) - UCharSeq = nc_rval.UCharSeq._retn(); - else - UCharSeq = NULL; - - if (nc_rval.Long64Seq.operator->() != NULL) - Long64Seq = nc_rval.Long64Seq._retn(); - else - Long64Seq = NULL; - - if (nc_rval.ULongSeq.operator->() != NULL) - ULongSeq = nc_rval.ULongSeq._retn(); - else - ULongSeq = NULL; - - if (nc_rval.ULong64Seq.operator->() != NULL) - ULong64Seq = nc_rval.ULong64Seq._retn(); - else - ULong64Seq = NULL; - - if (nc_rval.StateSeq.operator->() != NULL) - StateSeq = nc_rval.StateSeq._retn(); - else - StateSeq = NULL; - - if (nc_rval.EncodedSeq.operator->() != NULL) - EncodedSeq = nc_rval.EncodedSeq._retn(); - else - EncodedSeq = NULL; - -#endif d_state = rval.d_state; d_state_filled = rval.d_state_filled; @@ -415,7 +314,6 @@ DeviceAttribute & DeviceAttribute::operator=(const DeviceAttribute &rval) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceAttribute & DeviceAttribute::operator=(DeviceAttribute &&rval) { name = std::move(rval.name); @@ -507,7 +405,6 @@ DeviceAttribute & DeviceAttribute::operator=(DeviceAttribute &&rval) return *this; } -#endif void DeviceAttribute::init_common_class_members(const char * new_name, int x_dim = 1, int y_dim = 0) { diff --git a/cppapi/client/devapi_data.cpp b/cppapi/client/devapi_data.cpp index 602b1f434..9e1cf9fce 100644 --- a/cppapi/client/devapi_data.cpp +++ b/cppapi/client/devapi_data.cpp @@ -71,11 +71,7 @@ DeviceData::DeviceData() DeviceData::DeviceData(const DeviceData &source) { exceptions_flags = source.exceptions_flags; -#ifdef HAS_RVALUE any = source.any; -#else - any = const_cast(source).any._retn(); -#endif if (source.ext.get() != NULL) { @@ -90,7 +86,6 @@ DeviceData::DeviceData(const DeviceData &source) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceData::DeviceData(DeviceData &&source) : ext(new DeviceDataExt) { @@ -102,7 +97,6 @@ DeviceData::DeviceData(DeviceData &&source) ext = std::move(source.ext); } } -#endif //----------------------------------------------------------------------------- // @@ -115,11 +109,7 @@ DeviceData &DeviceData::operator=(const DeviceData &rval) if (this != &rval) { exceptions_flags = rval.exceptions_flags; -#ifdef HAS_RVALUE any = rval.any; -#else - any = const_cast(rval).any._retn(); -#endif if (rval.ext.get() != NULL) { @@ -140,7 +130,6 @@ DeviceData &DeviceData::operator=(const DeviceData &rval) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceData &DeviceData::operator=(DeviceData &&rval) { exceptions_flags = rval.exceptions_flags; @@ -157,7 +146,6 @@ DeviceData &DeviceData::operator=(DeviceData &&rval) return *this; } -#endif //----------------------------------------------------------------------------- // diff --git a/cppapi/client/devapi_datahist.cpp b/cppapi/client/devapi_datahist.cpp index 24edbbd84..385229328 100644 --- a/cppapi/client/devapi_datahist.cpp +++ b/cppapi/client/devapi_datahist.cpp @@ -91,7 +91,6 @@ DeviceDataHistory::DeviceDataHistory(const DeviceDataHistory &source) } } -#ifdef HAS_RVALUE DeviceDataHistory::DeviceDataHistory(DeviceDataHistory &&source) : DeviceData(std::move(source)), ext_hist(Tango_nullptr) { @@ -111,7 +110,6 @@ DeviceDataHistory::DeviceDataHistory(DeviceDataHistory &&source) ext_hist.reset(); } } -#endif //----------------------------------------------------------------------------- // @@ -161,11 +159,7 @@ DeviceDataHistory &DeviceDataHistory::operator=(const DeviceDataHistory &rval) fail = rval.fail; time = rval.time; -#ifdef HAS_RVALUE err = rval.err; -#else - err = const_cast(rval).err._retn(); -#endif if (ref_ctr_ptr != NULL) { @@ -201,7 +195,6 @@ DeviceDataHistory &DeviceDataHistory::operator=(const DeviceDataHistory &rval) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceDataHistory &DeviceDataHistory::operator=(DeviceDataHistory &&rval) { @@ -254,7 +247,6 @@ DeviceDataHistory &DeviceDataHistory::operator=(DeviceDataHistory &&rval) return *this; } -#endif //+------------------------------------------------------------------------- // @@ -655,7 +647,6 @@ DeviceAttributeHistory::DeviceAttributeHistory(const DeviceAttributeHistory &sou } } -#ifdef HAS_RVALUE DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) : DeviceAttribute(std::move(source)), ext_hist(Tango_nullptr) { @@ -667,7 +658,6 @@ DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) } } -#endif //----------------------------------------------------------------------------- // @@ -717,7 +707,6 @@ DeviceAttributeHistory &DeviceAttributeHistory::operator=(const DeviceAttributeH return *this; } -#ifdef HAS_RVALUE DeviceAttributeHistory &DeviceAttributeHistory::operator=(DeviceAttributeHistory &&rval) { @@ -744,7 +733,6 @@ DeviceAttributeHistory &DeviceAttributeHistory::operator=(DeviceAttributeHistory return *this; } -#endif //+------------------------------------------------------------------------- // diff --git a/cppapi/client/devapi_pipe.cpp b/cppapi/client/devapi_pipe.cpp index 0d83ab700..ef02fcd7f 100644 --- a/cppapi/client/devapi_pipe.cpp +++ b/cppapi/client/devapi_pipe.cpp @@ -109,7 +109,6 @@ DevicePipe &DevicePipe::operator=(const DevicePipe &rhs) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) { name = std::move(source.name); @@ -121,7 +120,6 @@ DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) ext = std::move(source.ext); } } -#endif // HAS_RVALUE //----------------------------------------------------------------------------- // @@ -129,7 +127,6 @@ DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DevicePipe &DevicePipe::operator=(DevicePipe &&rhs) { name = std::move(rhs.name); @@ -145,7 +142,6 @@ DevicePipe &DevicePipe::operator=(DevicePipe &&rhs) return *this; } -#endif //---------------------------------------------------------------------------------------------------------------- // @@ -312,7 +308,6 @@ DevicePipeBlob &DevicePipeBlob::operator=(const DevicePipeBlob &rhs) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) { name = std::move(source.name); @@ -349,7 +344,6 @@ DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) ext = std::move(source.ext); } } -#endif //----------------------------------------------------------------------------- // @@ -357,7 +351,6 @@ DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DevicePipeBlob &DevicePipeBlob::operator=(DevicePipeBlob &&rhs) { name = std::move(rhs.name); @@ -391,7 +384,6 @@ DevicePipeBlob &DevicePipeBlob::operator=(DevicePipeBlob &&rhs) return *this; } -#endif //+------------------------------------------------------------------------------------------------------------------ // From fea8ade66209388ef81e505c396743ebd9ca4136 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 23/48] Remove HAS_THREAD We now require C++11. Done with unifdef -DHAS_THREAD --- cppapi/client/api_util.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/cppapi/client/api_util.cpp b/cppapi/client/api_util.cpp index afa0ef139..ea3ae5bde 100644 --- a/cppapi/client/api_util.cpp +++ b/cppapi/client/api_util.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #ifndef _TG_WINDOWS_ #include @@ -43,9 +44,6 @@ #include #include #include -#ifdef HAS_THREAD -#include -#endif #include // FreeBSD #else #include @@ -60,22 +58,15 @@ ApiUtil *ApiUtil::_instance = NULL; omni_mutex ApiUtil::inst_mutex; -#ifdef HAS_THREAD void _killproc_() { ::exit(-1); } -#endif // HAS_THREAD void _t_handler(TANGO_UNUSED(int signum)) { -#ifdef HAS_THREAD std::thread t(_killproc_); t.detach(); -#else - _KillProc_ *t = new _KillProc_; - t->start(); -#endif Tango_sleep(3); } From 1273f94adc72f603fa16db009cad323884129b72 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 24/48] Remove HAS_TYPE_TRAITS We now require C++11. Done with unifdef -DHAS_TYPE_TRAITS --- cppapi/client/devapi_attr.tpp | 6 +----- cppapi/server/attrsetval.tpp | 6 +----- cppapi/server/w_attrsetval.tpp | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/cppapi/client/devapi_attr.tpp b/cppapi/client/devapi_attr.tpp index 05e64a614..b08532b79 100644 --- a/cppapi/client/devapi_attr.tpp +++ b/cppapi/client/devapi_attr.tpp @@ -34,9 +34,7 @@ #ifndef _DEVAPI_ATTR_TPP #define _DEVAPI_ATTR_TPP -#ifdef HAS_TYPE_TRAITS - #include -#endif +#include namespace Tango { @@ -427,7 +425,6 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) } #endif // HAS_UNDERLYING -#ifdef HAS_TYPE_TRAITS if (std::is_enum::value == false) { if (exceptions_flags.test(wrongtype_flag)) @@ -439,7 +436,6 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) return false; } -#endif // HAS_TYPE_TRAITS return true; } diff --git a/cppapi/server/attrsetval.tpp b/cppapi/server/attrsetval.tpp index 34eb9a074..0bb6dcb2c 100644 --- a/cppapi/server/attrsetval.tpp +++ b/cppapi/server/attrsetval.tpp @@ -34,9 +34,7 @@ #ifndef _ATTRSETVAL_TPP #define _ATTRSETVAL_TPP -#ifdef HAS_TYPE_TRAITS - #include -#endif +#include namespace Tango { @@ -99,7 +97,6 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) // Check if the input type is an enum and if it is from the valid type // -#ifdef HAS_TYPE_TRAITS if (std::is_enum::value == false) { SAFE_DELETE(enum_ptr); @@ -107,7 +104,6 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) "The input argument data type is not an enumeration", "Attribute::set_value()"); } -#endif // HAS_TYPE_TRAITS // // Check if enum labels are defined diff --git a/cppapi/server/w_attrsetval.tpp b/cppapi/server/w_attrsetval.tpp index a714aee1c..b03e63da8 100644 --- a/cppapi/server/w_attrsetval.tpp +++ b/cppapi/server/w_attrsetval.tpp @@ -33,9 +33,7 @@ #ifndef _WATTRSETVAL_TPP #define _WATTRSETVAL_TPP -#ifdef HAS_TYPE_TRAITS - #include -#endif +#include namespace Tango { @@ -126,13 +124,11 @@ void WAttribute::check_type(T &TANGO_UNUSED(dummy), const std::string &origin) // Check if the input type is an enum and if it is from the valid type // -#ifdef HAS_TYPE_TRAITS if (std::is_enum::value == false) { Except::throw_exception(API_IncompatibleArgumentType, "The input argument data type is not an enumeration",origin); } -#endif // HAS_TYPE_TRAITS Tango::DeviceClass *dev_class; try From 2c88f9c2d177695c57cae6dfd446cd9b309cfab9 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 25/48] Remove HAS_LAMBDA_FUNC We now require C++11. Done with unifdef -DHAS_LAMBDA_FUNC --- cppapi/client/devapi_base.cpp | 11 ----------- cppapi/client/event.cpp | 17 ----------------- cppapi/server/command.h | 22 ---------------------- cppapi/server/device.cpp | 10 ---------- cppapi/server/deviceclass.cpp | 15 --------------- cppapi/server/eventsupplier.h | 24 ------------------------ cppapi/server/fwdattrdesc.cpp | 9 --------- cppapi/server/pipe.h | 21 --------------------- cppapi/server/pollthread.cpp | 16 ---------------- cppapi/server/zmqeventsupplier.cpp | 9 --------- 10 files changed, 154 deletions(-) diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index a72fa1446..2bfc5b8bc 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -10120,22 +10120,11 @@ int DeviceProxy::get_tango_lib_version() // Tango 5 or 6. The beast we can do is to get the info that it is Tango 5.2 (or above) // -#ifdef HAS_LAMBDA_FUNC auto pos = find_if((*cmd_list).begin(), (*cmd_list).end(), [](Tango::CommandInfo &cc) -> bool { return cc.cmd_name == "QueryWizardClassProperty"; }); -#else - std::vector::iterator pos, end; - for (pos = (*cmd_list).begin(), end = (*cmd_list).end(); pos != end; ++pos) - { - if (pos->cmd_name == "QueryWizardClassProperty") - { - break; - } - } -#endif if (pos != (*cmd_list).end()) { ret = 520; diff --git a/cppapi/client/event.cpp b/cppapi/client/event.cpp index 7ca32d76c..fa02091ac 100644 --- a/cppapi/client/event.cpp +++ b/cppapi/client/event.cpp @@ -293,7 +293,6 @@ void EventConsumer::get_cs_tango_host(Database *db) for (unsigned int i = 0;i < vs.size();i++) { std::transform(vs[i].begin(),vs[i].end(),vs[i].begin(),::tolower); -#ifdef HAS_LAMBDA_FUNC pos = find_if(env_var_fqdn_prefix.begin(),env_var_fqdn_prefix.end(), [&] (std::string str) -> bool { @@ -308,22 +307,6 @@ void EventConsumer::get_cs_tango_host(Database *db) std::string prefix = "tango://" + vs[i] + '/' ; env_var_fqdn_prefix.push_back(prefix); } -#else - unsigned int j; - for (j = 0;j < env_var_fqdn_prefix.size();++j) - { - if (env_var_fqdn_prefix[j].find(vs[i]) != std::string::npos) - { - break; - } - } - - if (j == env_var_fqdn_prefix.size()) - { - std::string prefix = "tango://" + vs[i] + '/'; - env_var_fqdn_prefix.push_back(prefix); - } -#endif } } catch(...) {} diff --git a/cppapi/server/command.h b/cppapi/server/command.h index c2985b882..4f6eba850 100644 --- a/cppapi/server/command.h +++ b/cppapi/server/command.h @@ -41,28 +41,6 @@ namespace Tango { -#ifndef HAS_LAMBDA_FUNC -// -// Binary function objects to be used by the find_if algorithm. -// The find_if algo. want to have a predicate, this means that the return value -// must be a boolean (R is its name). -// The find_if algo. needs a unary predicate. This function object is a binary -// function object. It must be used with the bind2nd function adapter -// - -template -struct WantedCmd : public binary_function -{ - R operator() (A1 cmd_ptr, A2 name) const - { - if (::strlen(name) != cmd_ptr->get_lower_name().size()) - return false; - std::string tmp_name(name); - std::transform(tmp_name.begin(),tmp_name.end(),tmp_name.begin(),::tolower); - return cmd_ptr->get_lower_name() == tmp_name; - } -}; -#endif typedef bool (DeviceImpl::*ALLO_PTR)(const CORBA::Any &); diff --git a/cppapi/server/device.cpp b/cppapi/server/device.cpp index 02660ac71..e230a3916 100644 --- a/cppapi/server/device.cpp +++ b/cppapi/server/device.cpp @@ -6039,7 +6039,6 @@ Command &DeviceImpl::get_local_cmd_by_name(const std::string &cmd_name) { std::vector::iterator pos; -#ifdef HAS_LAMBDA_FUNC pos = find_if(command_list.begin(), command_list.end(), [&](Command *cmd) -> bool { @@ -6051,10 +6050,6 @@ Command &DeviceImpl::get_local_cmd_by_name(const std::string &cmd_name) std::transform(tmp_name.begin(), tmp_name.end(), tmp_name.begin(), ::tolower); return cmd->get_lower_name() == tmp_name; }); -#else - pos = find_if(command_list.begin(),command_list.end(), - bind2nd(WantedCmd(),cmd_name.c_str())); -#endif if (pos == command_list.end()) { @@ -6082,7 +6077,6 @@ void DeviceImpl::remove_local_command(const std::string &cmd_name) { std::vector::iterator pos; -#ifdef HAS_LAMBDA_FUNC pos = find_if(command_list.begin(), command_list.end(), [&](Command *cmd) -> bool { @@ -6092,10 +6086,6 @@ void DeviceImpl::remove_local_command(const std::string &cmd_name) } return cmd->get_lower_name() == cmd_name; }); -#else - pos = find_if(command_list.begin(),command_list.end(), - bind2nd(WantedCmd(),cmd_name.c_str())); -#endif if (pos == command_list.end()) { diff --git a/cppapi/server/deviceclass.cpp b/cppapi/server/deviceclass.cpp index 5dab5f988..f812ae20d 100644 --- a/cppapi/server/deviceclass.cpp +++ b/cppapi/server/deviceclass.cpp @@ -1533,7 +1533,6 @@ Command &DeviceClass::get_cmd_by_name(const std::string &cmd_name) { std::vector::iterator pos; -#ifdef HAS_LAMBDA_FUNC pos = find_if(command_list.begin(),command_list.end(), [&] (Command *cmd) -> bool { @@ -1543,10 +1542,6 @@ Command &DeviceClass::get_cmd_by_name(const std::string &cmd_name) std::transform(tmp_name.begin(),tmp_name.end(),tmp_name.begin(),::tolower); return cmd->get_lower_name() == tmp_name; }); -#else - pos = find_if(command_list.begin(),command_list.end(), - std::bind2nd(WantedCmd(),cmd_name.c_str())); -#endif if (pos == command_list.end()) { @@ -1591,7 +1586,6 @@ Pipe &DeviceClass::get_pipe_by_name(const std::string &pipe_name,const std::stri std::vector::iterator pos; -#ifdef HAS_LAMBDA_FUNC pos = find_if(ite->second.begin(),ite->second.end(), [&] (Pipe *pi) -> bool { @@ -1601,10 +1595,6 @@ Pipe &DeviceClass::get_pipe_by_name(const std::string &pipe_name,const std::stri std::transform(tmp_name.begin(),tmp_name.end(),tmp_name.begin(),::tolower); return pi->get_lower_name() == tmp_name; }); -#else - pos = find_if(ite->second.begin(),ite->second.end(), - std::bind2nd(WantedPipe(),pipe_name.c_str())); -#endif if (pos == ite->second.end()) { @@ -1636,7 +1626,6 @@ void DeviceClass::remove_command(const std::string &cmd_name) { std::vector::iterator pos; -#ifdef HAS_LAMBDA_FUNC pos = find_if(command_list.begin(),command_list.end(), [&] (Command *cmd) -> bool { @@ -1644,10 +1633,6 @@ void DeviceClass::remove_command(const std::string &cmd_name) return false; return cmd->get_lower_name() == cmd_name; }); -#else - pos = find_if(command_list.begin(),command_list.end(), - std::bind2nd(WantedCmd(),cmd_name.c_str())); -#endif if (pos == command_list.end()) { diff --git a/cppapi/server/eventsupplier.h b/cppapi/server/eventsupplier.h index c6eb4e55f..bcda2ec85 100644 --- a/cppapi/server/eventsupplier.h +++ b/cppapi/server/eventsupplier.h @@ -245,30 +245,6 @@ private : #define LARGE_DATA_THRESHOLD 2048 #define LARGE_DATA_THRESHOLD_ENCODED LARGE_DATA_THRESHOLD * 4 -#ifndef HAS_LAMBDA_FUNC -template -struct WantedClient : public std::binary_function -{ - R operator() (A1 conn_client, A2 client) const - { - return conn_client.clnt == client; - } -}; - -template -struct OldClient : public std::binary_function -{ - R operator() (A1 conn_client, A2 ti) const - { - if (ti > (conn_client.date + 500)) - { - return true; - } - else - return false; - } -}; -#endif class ZmqEventSupplier : public EventSupplier { diff --git a/cppapi/server/fwdattrdesc.cpp b/cppapi/server/fwdattrdesc.cpp index 7a2bdcfa1..c81bfcd76 100644 --- a/cppapi/server/fwdattrdesc.cpp +++ b/cppapi/server/fwdattrdesc.cpp @@ -130,20 +130,11 @@ bool FwdAttr::validate_fwd_att(std::vector &prop_list,const std::s try { -#ifdef HAS_LAMBDA_FUNC auto pos = find_if(prop_list.begin(),prop_list.end(), [] (AttrProperty &ap) -> bool { return ap.get_name() == RootAttrPropName; }); -#else - std::vector::iterator pos; - for (pos = prop_list.begin();pos != prop_list.end();++pos) - { - if (pos->get_name() == RootAttrPropName) - break; - } -#endif if (pos != prop_list.end()) { root_att_db = pos->get_value(); diff --git a/cppapi/server/pipe.h b/cppapi/server/pipe.h index 974ac3a2d..46b92534a 100644 --- a/cppapi/server/pipe.h +++ b/cppapi/server/pipe.h @@ -39,27 +39,6 @@ namespace Tango { -#ifndef HAS_LAMBDA_FUNC -// -// Binary function objects to be used by the find_if algorithm. -// The find_if algo. want to have a predicate, this means that the return value must be a boolean (R is its name). -// The find_if algo. needs a unary predicate. This function object is a binary function object. -// It must be used with the bind2nd function adapter -// - -template -struct WantedPipe : public binary_function -{ - R operator() (A1 pipe_ptr, A2 name) const - { - if (::strlen(name) != pipe_ptr->get_lower_name().size()) - return false; - std::string tmp_name(name); - std::transform(tmp_name.begin(),tmp_name.end(),tmp_name.begin(),::tolower); - return pipe_ptr->get_lower_name() == tmp_name; - } -}; -#endif /** diff --git a/cppapi/server/pollthread.cpp b/cppapi/server/pollthread.cpp index 8dbfd1e21..cf439e275 100644 --- a/cppapi/server/pollthread.cpp +++ b/cppapi/server/pollthread.cpp @@ -349,16 +349,8 @@ void PollThread::execute_cmd() bool found = false; if (new_type == POLL_ATTR && wo.dev->get_dev_idl_version() >= 4 && polling_bef_9 == false) { -#ifdef HAS_LAMBDA_FUNC ite = find_if(works.begin(),works.end(), [&] (const WorkItem &wi) {return wi.dev == local_cmd.dev && wi.update == new_upd && wi.type == new_type;}); -#else - for (ite = works.begin();ite != works.end();++ite) - { - if (ite->dev == local_cmd.dev && ite->update == new_upd && ite->type == new_type) - break; - } -#endif if (ite != works.end()) { ite->name.push_back((*wo.poll_list)[local_cmd.index]->get_name()); @@ -1099,16 +1091,8 @@ void PollThread::add_insert_in_list(WorkItem &new_work) if (new_work.type == POLL_ATTR && new_work.dev->get_dev_idl_version() >= 4 && polling_bef_9 == false) { std::list::iterator ite; -#ifdef HAS_LAMBDA_FUNC ite = find_if(works.begin(),works.end(), [&] (const WorkItem &wi) {return wi.dev == new_work.dev && wi.update == new_work.update && wi.type == new_work.type;}); -#else - for (ite = works.begin();ite != works.end();++ite) - { - if (ite->dev == new_work.dev && ite->update == new_work.update && ite->type == new_work.type) - break; - } -#endif if (ite != works.end()) { diff --git a/cppapi/server/zmqeventsupplier.cpp b/cppapi/server/zmqeventsupplier.cpp index cea44241e..b36ab44a8 100644 --- a/cppapi/server/zmqeventsupplier.cpp +++ b/cppapi/server/zmqeventsupplier.cpp @@ -1628,16 +1628,11 @@ bool ZmqEventSupplier::update_connected_client(client_addr *cl) std::list::iterator pos; -#ifdef HAS_LAMBDA_FUNC pos = find_if(con_client.begin(),con_client.end(), [&] (ConnectedClient &cc) -> bool { return (cc.clnt == *cl); }); -#else - pos = find_if(con_client.begin(),con_client.end(), - std::bind2nd(WantedClient(),*cl)); -#endif // // Update date if client in list. Otherwise add client to list @@ -1661,7 +1656,6 @@ bool ZmqEventSupplier::update_connected_client(client_addr *cl) // Remove presumly dead client // -#ifdef HAS_LAMBDA_FUNC con_client.remove_if([&] (ConnectedClient &cc) -> bool { if (now.tv_sec > (cc.date + 500)) @@ -1669,9 +1663,6 @@ bool ZmqEventSupplier::update_connected_client(client_addr *cl) else return false; }); -#else - con_client.remove_if(std::bind2nd(OldClient(),now.tv_sec)); -#endif return ret; } From 94b3691537d1cd0ce1627aee8b76d9baa7cac31f Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:40:28 +0100 Subject: [PATCH 26/48] cppapi/server/tango_config.h: Map Tango_isnan always to std::isnan We now always require C++11. --- cppapi/server/tango_config.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 83ae10117..331c161be 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -288,15 +288,7 @@ // Define a common isnan call // -#ifndef _TG_WINDOWS_ - #ifdef HAS_ISNAN_IN_STD - #define Tango_isnan(A) std::isnan(A) - #else - #define Tango_isnan(A) isnan(A) - #endif -#else - #define Tango_isnan(A) _isnan(A) -#endif +#define Tango_isnan(A) std::isnan(A) // // Define a common NULL constant From dd5232ad073cea1416f2bd6004a2a0028e6af90e Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:45:53 +0100 Subject: [PATCH 27/48] Prefer nullptr over Tango_nullptr We now require C++11 so nullptr is always available. But we keep the definitions of Tango_nullptr for backwards compatibility. --- cpp_test_suite/cpp_test_ds/main.cpp | 2 +- cpp_test_suite/event/event_lock.cpp | 2 +- cpp_test_suite/new_tests/cxx_blackbox.cpp | 2 +- cpp_test_suite/new_tests/cxx_pipe.cpp | 2 +- cpp_test_suite/new_tests/cxx_syntax.cpp | 12 +-- cpp_test_suite/old_tests/state_attr.cpp | 2 +- cppapi/client/DevicePipe.h | 16 ++-- cppapi/client/DeviceProxy.h | 2 +- cppapi/client/attr_proxy.cpp | 8 +- cppapi/client/dbapi_base.cpp | 26 +++--- cppapi/client/dbapi_class.cpp | 4 +- cppapi/client/dbapi_datum.cpp | 6 +- cppapi/client/dbapi_device.cpp | 6 +- cppapi/client/dbapi_server.cpp | 4 +- cppapi/client/devapi_attr.cpp | 30 +++---- cppapi/client/devapi_base.cpp | 10 +-- cppapi/client/devapi_datahist.cpp | 18 ++--- cppapi/client/devapi_pipe.cpp | 86 ++++++++++---------- cppapi/client/event.cpp | 24 +++--- cppapi/client/eventkeepalive.cpp | 14 ++-- cppapi/client/filedatabase.cpp | 12 +-- cppapi/server/attrdesc.cpp | 16 ++-- cppapi/server/attrdesc.h | 2 +- cppapi/server/attribute.cpp | 96 +++++++++++----------- cppapi/server/attrprop.h | 8 +- cppapi/server/attrprop.tpp | 2 +- cppapi/server/basiccommand.cpp | 4 +- cppapi/server/command.cpp | 32 ++++---- cppapi/server/command.h | 98 +++++++++++------------ cppapi/server/device.cpp | 20 ++--- cppapi/server/device.h | 8 +- cppapi/server/device_2.cpp | 10 +-- cppapi/server/device_3.cpp | 84 +++++++++---------- cppapi/server/device_4.cpp | 8 +- cppapi/server/device_5.cpp | 14 ++-- cppapi/server/dserver.cpp | 4 +- cppapi/server/dserverpoll.cpp | 2 +- cppapi/server/encoded_attribute.cpp | 4 +- cppapi/server/eventcmds.cpp | 2 +- cppapi/server/eventsupplier.cpp | 12 +-- cppapi/server/fwdattrdesc.cpp | 6 +- cppapi/server/fwdattrdesc.h | 2 +- cppapi/server/fwdattribute.cpp | 10 +-- cppapi/server/notifdeventsupplier.cpp | 2 +- cppapi/server/pipe.cpp | 2 +- cppapi/server/pipedesc.h | 2 +- cppapi/server/pollring.tpp | 2 +- cppapi/server/rootattreg.cpp | 22 ++--- cppapi/server/tango_config.h | 10 +-- cppapi/server/tango_const.h.in | 6 +- 50 files changed, 385 insertions(+), 393 deletions(-) diff --git a/cpp_test_suite/cpp_test_ds/main.cpp b/cpp_test_suite/cpp_test_ds/main.cpp index cc6b2206c..de9558e94 100644 --- a/cpp_test_suite/cpp_test_ds/main.cpp +++ b/cpp_test_suite/cpp_test_ds/main.cpp @@ -26,7 +26,7 @@ int main(int argc,char *argv[]) { - Tango::Util *tg = Tango_nullptr; + Tango::Util *tg = nullptr; try { diff --git a/cpp_test_suite/event/event_lock.cpp b/cpp_test_suite/event/event_lock.cpp index cd8d7ea5f..2a6ff51fd 100644 --- a/cpp_test_suite/event/event_lock.cpp +++ b/cpp_test_suite/event/event_lock.cpp @@ -71,7 +71,7 @@ void set_abs_change(std::string device_name, std::string attribute_name) int main(int argc, char *argv[]) { - Tango::DeviceProxy *dev = Tango_nullptr; + Tango::DeviceProxy *dev = nullptr; int eventID; const vector filters; EventCallback *eventCallback = new EventCallback(); diff --git a/cpp_test_suite/new_tests/cxx_blackbox.cpp b/cpp_test_suite/new_tests/cxx_blackbox.cpp index 3c62a8850..bc3c11b60 100644 --- a/cpp_test_suite/new_tests/cxx_blackbox.cpp +++ b/cpp_test_suite/new_tests/cxx_blackbox.cpp @@ -199,7 +199,7 @@ class BlackboxTestSuite: public CxxTest::TestSuite // cout << "===> attr_prop: " << string(result.svalue[i].in()) << endl; attr_prop = string(result.svalue[i].in()); - AttributeProxy *my_attr = Tango_nullptr; + AttributeProxy *my_attr = nullptr; TS_ASSERT_THROWS_NOTHING(my_attr = new AttributeProxy(attr_name)); TS_ASSERT_THROWS_NOTHING(my_attr->delete_property(attr_prop)); delete my_attr; diff --git a/cpp_test_suite/new_tests/cxx_pipe.cpp b/cpp_test_suite/new_tests/cxx_pipe.cpp index b7d767778..6d971e606 100644 --- a/cpp_test_suite/new_tests/cxx_pipe.cpp +++ b/cpp_test_suite/new_tests/cxx_pipe.cpp @@ -271,7 +271,7 @@ class PipeTestSuite: public CxxTest::TestSuite TS_ASSERT(de_names[4] == "DevVarStringArrayDE"); string str; - DevString ds = Tango_nullptr; + DevString ds = nullptr; DevEncoded enc; vector v_str; DevVarStringArray *dvsa = new DevVarStringArray(); diff --git a/cpp_test_suite/new_tests/cxx_syntax.cpp b/cpp_test_suite/new_tests/cxx_syntax.cpp index bb7e4ba57..df890c856 100644 --- a/cpp_test_suite/new_tests/cxx_syntax.cpp +++ b/cpp_test_suite/new_tests/cxx_syntax.cpp @@ -149,7 +149,7 @@ class SyntaxTestSuite: public CxxTest::TestSuite void test_connect_to_a_device_via_its_alias_as_my_alias(void) { TS_ASSERT(check_proxy(device_alias) == 2); - DeviceProxy *device = Tango_nullptr; + DeviceProxy *device = nullptr; TS_ASSERT_THROWS_NOTHING(device = new DeviceProxy(device_alias)); TS_ASSERT(device->name() == device1_name); @@ -168,7 +168,7 @@ class SyntaxTestSuite: public CxxTest::TestSuite { string device_name = tango_host + "/" + device_alias; TS_ASSERT(check_proxy(device_name) == 2); - DeviceProxy *device = Tango_nullptr; + DeviceProxy *device = nullptr; TS_ASSERT_THROWS_NOTHING(device = new DeviceProxy(device_name)); TS_ASSERT(device->name() == device1_name); @@ -226,7 +226,7 @@ class SyntaxTestSuite: public CxxTest::TestSuite void test_connect_to_an_attribute_via_its_alias_as_attribute_alias(void) { TS_ASSERT(attr_check_proxy(attribute_alias) == 3); - AttributeProxy *attribute = Tango_nullptr; + AttributeProxy *attribute = nullptr; TS_ASSERT_THROWS_NOTHING(attribute = new AttributeProxy(attribute_alias)); TS_ASSERT(attribute->get_device_proxy()->name() == device1_name); delete attribute; @@ -238,7 +238,7 @@ class SyntaxTestSuite: public CxxTest::TestSuite { string attribute_name = tango_host + "/" + attribute_alias; TS_ASSERT(attr_check_proxy(attribute_name) == 3); - AttributeProxy *attribute = Tango_nullptr; + AttributeProxy *attribute = nullptr; TS_ASSERT_THROWS_NOTHING(attribute = new AttributeProxy(attribute_name)); TS_ASSERT(attribute->get_device_proxy()->name() == device1_name); delete attribute; @@ -248,12 +248,12 @@ class SyntaxTestSuite: public CxxTest::TestSuite void test_check_alias_call(void) { - DeviceProxy *device1 = Tango_nullptr; + DeviceProxy *device1 = nullptr; TS_ASSERT_THROWS_NOTHING(device1 = new DeviceProxy(device1_name)); TS_ASSERT(device1->alias() == device_alias); delete device1; - DeviceProxy *device2 = Tango_nullptr; + DeviceProxy *device2 = nullptr; TS_ASSERT_THROWS_NOTHING(device2 = new DeviceProxy(device2_name)); TS_ASSERT_THROWS_ASSERT(device2->alias(), Tango::DevFailed &e, TS_ASSERT(string(e.errors[0].reason.in()) == "DB_AliasNotDefined" diff --git a/cpp_test_suite/old_tests/state_attr.cpp b/cpp_test_suite/old_tests/state_attr.cpp index 690235e68..9131e9f64 100644 --- a/cpp_test_suite/old_tests/state_attr.cpp +++ b/cpp_test_suite/old_tests/state_attr.cpp @@ -478,7 +478,7 @@ int main(int argc, char **argv) build_f_name(file_name); start_logging(adm_name,file_name); - AttributeInfoListEx *att_conf2 = Tango_nullptr; + AttributeInfoListEx *att_conf2 = nullptr; try { diff --git a/cppapi/client/DevicePipe.h b/cppapi/client/DevicePipe.h index 5b430c8ec..886390485 100644 --- a/cppapi/client/DevicePipe.h +++ b/cppapi/client/DevicePipe.h @@ -736,7 +736,7 @@ class DevicePipeBlob const DevVarPipeDataEltArray *get_extract_data() {return extract_elt_array;} void set_extract_data(const DevVarPipeDataEltArray *_ptr) {extract_elt_array=_ptr;} - void reset_insert_data_ptr() {insert_elt_array=Tango_nullptr;} + void reset_insert_data_ptr() {insert_elt_array=nullptr;} void reset_extract_ctr() {extract_ctr=0;} void set_extract_delete(bool _b) {extract_delete=_b;} @@ -1192,7 +1192,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (extract_elt_array == Tango_nullptr) \ + if (extract_elt_array == nullptr) \ ext_state.set(isempty_flag); \ else if (extract_ctr > (int)extract_elt_array->length() - 1) \ ext_state.set(notenoughde_flag); \ @@ -1256,7 +1256,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (extract_elt_array == Tango_nullptr) \ + if (extract_elt_array == nullptr) \ ext_state.set(isempty_flag); \ else if (extract_ctr > (int)extract_elt_array->length() - 1) \ ext_state.set(notenoughde_flag); \ @@ -1320,7 +1320,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (extract_elt_array == Tango_nullptr) \ + if (extract_elt_array == nullptr) \ ext_state.set(isempty_flag); \ else if (extract_ctr > (int)extract_elt_array->length() - 1) \ ext_state.set(notenoughde_flag); \ @@ -1386,7 +1386,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (insert_elt_array == Tango_nullptr) \ + if (insert_elt_array == nullptr) \ ext_state.set(blobdenamenotset_flag); \ else if (insert_ctr == -1 && insert_ind == -1) \ ext_state.set(mixing_flag); \ @@ -1438,7 +1438,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (insert_elt_array == Tango_nullptr) \ + if (insert_elt_array == nullptr) \ ext_state.set(blobdenamenotset_flag); \ else if (insert_ctr == -1 && insert_ind == -1) \ ext_state.set(mixing_flag); \ @@ -1492,7 +1492,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (insert_elt_array == Tango_nullptr) \ + if (insert_elt_array == nullptr) \ ext_state.set(blobdenamenotset_flag); \ else if (insert_ctr == -1 && insert_ind == -1) \ ext_state.set(mixing_flag); \ @@ -1549,7 +1549,7 @@ DevicePipeBlob &operator>>(DevicePipeBlob &, DataElement &); failed = false; \ ext_state.reset(); \ \ - if (insert_elt_array == Tango_nullptr) \ + if (insert_elt_array == nullptr) \ ext_state.set(blobdenamenotset_flag); \ else if (insert_ctr == -1 && insert_ind == -1) \ ext_state.set(mixing_flag); \ diff --git a/cppapi/client/DeviceProxy.h b/cppapi/client/DeviceProxy.h index db8264f19..2e2f96aca 100644 --- a/cppapi/client/DeviceProxy.h +++ b/cppapi/client/DeviceProxy.h @@ -195,7 +195,7 @@ public : DeviceProxy & operator=(const DeviceProxy &); virtual ~DeviceProxy(); - DeviceProxy():Connection((CORBA::ORB *)NULL),db_dev(NULL),adm_device(NULL),lock_ctr(0),ext_proxy(Tango_nullptr) + DeviceProxy():Connection((CORBA::ORB *)NULL),db_dev(NULL),adm_device(NULL),lock_ctr(0),ext_proxy(nullptr) {dbase_used = false;} /// @publicsection diff --git a/cppapi/client/attr_proxy.cpp b/cppapi/client/attr_proxy.cpp index b51709256..230b0d060 100644 --- a/cppapi/client/attr_proxy.cpp +++ b/cppapi/client/attr_proxy.cpp @@ -87,7 +87,7 @@ void AttributeProxy::real_constructor (std::string &name) { ApiUtil *ui = ApiUtil::instance(); dev_proxy = new DeviceProxy(device_name); - if (alias_name.empty() == false && dev_proxy != Tango_nullptr) + if (alias_name.empty() == false && dev_proxy != nullptr) device_name = dev_proxy->dev_name(); if (ui->in_server() == true) db_attr = new DbAttribute(attr_name,device_name,Tango::Util::instance()->get_database()); @@ -225,13 +225,13 @@ void AttributeProxy::ctor_from_dp(const DeviceProxy *dev_ptr,std::string &att_na } } -AttributeProxy::AttributeProxy (const DeviceProxy *dev_ptr,const char *att_name):ext(Tango_nullptr) +AttributeProxy::AttributeProxy (const DeviceProxy *dev_ptr,const char *att_name):ext(nullptr) { std::string att_na(att_name); ctor_from_dp(dev_ptr,att_na); } -AttributeProxy::AttributeProxy (const DeviceProxy *dev_ptr,std::string &att_name):ext(Tango_nullptr) +AttributeProxy::AttributeProxy (const DeviceProxy *dev_ptr,std::string &att_name):ext(nullptr) { ctor_from_dp(dev_ptr,att_name); } @@ -243,7 +243,7 @@ AttributeProxy::AttributeProxy (const DeviceProxy *dev_ptr,std::string &att_name // //----------------------------------------------------------------------------- -AttributeProxy::AttributeProxy(const AttributeProxy &prev):ext(Tango_nullptr) +AttributeProxy::AttributeProxy(const AttributeProxy &prev):ext(nullptr) { // diff --git a/cppapi/client/dbapi_base.cpp b/cppapi/client/dbapi_base.cpp index 22e629fcf..4a7076ead 100644 --- a/cppapi/client/dbapi_base.cpp +++ b/cppapi/client/dbapi_base.cpp @@ -63,7 +63,7 @@ access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NUL std::string tango_host_env_var; int ret; - filedb = Tango_nullptr; + filedb = nullptr; serv_version = 0; ret = get_env_var(EnvVariable,tango_host_env_var); @@ -97,7 +97,7 @@ access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NUL // get host and port from environment variable TANGO_HOST // char *tango_host_env_c_str; - filedb = Tango_nullptr; + filedb = nullptr; serv_version = 0; if (get_tango_host_from_reg(&tango_host_env_c_str,ds_exec_name,ds_inst_name) == -1) @@ -140,7 +140,7 @@ access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NUL void Database::check_tango_host(const char *tango_host_env_c_str) { - filedb = Tango_nullptr; + filedb = nullptr; std::string tango_host_env(tango_host_env_c_str); std::string::size_type separator; @@ -307,7 +307,7 @@ Database::Database(std::string&in_host, int in_port, ORB *orb_in) : Connection(o ext(new DatabaseExt), access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NULL) { - filedb = Tango_nullptr; + filedb = nullptr; serv_version = 0; db_multi_svc = false; @@ -351,7 +351,7 @@ access_proxy(NULL),access_checked(false),access_service_defined(false),db_tg(NUL // //----------------------------------------------------------------------------- -Database::Database(const Database &sou):Connection(sou),ext(Tango_nullptr) +Database::Database(const Database &sou):Connection(sou),ext(nullptr) { // @@ -362,14 +362,14 @@ Database::Database(const Database &sou):Connection(sou),ext(Tango_nullptr) multi_db_port = sou.multi_db_port; multi_db_host = sou.multi_db_host; file_name = sou.file_name; - if (sou.filedb == Tango_nullptr) - filedb = Tango_nullptr; + if (sou.filedb == nullptr) + filedb = nullptr; else filedb = new FileDatabase(file_name); serv_version = sou.serv_version; - if (sou.access_proxy == Tango_nullptr) - access_proxy = Tango_nullptr; + if (sou.access_proxy == nullptr) + access_proxy = nullptr; else access_proxy = new AccessProxy(sou.access_proxy->name().c_str()); access_checked = sou.access_checked; @@ -416,14 +416,14 @@ Database &Database::operator=(const Database &rval) serv_version = rval.serv_version; delete filedb; - if (rval.filedb == Tango_nullptr) - filedb = Tango_nullptr; + if (rval.filedb == nullptr) + filedb = nullptr; else filedb = new FileDatabase(file_name); delete access_proxy; - if (rval.access_proxy == Tango_nullptr) - access_proxy = Tango_nullptr; + if (rval.access_proxy == nullptr) + access_proxy = nullptr; else access_proxy = new AccessProxy(rval.access_proxy->name().c_str()); access_checked = rval.access_checked; diff --git a/cppapi/client/dbapi_class.cpp b/cppapi/client/dbapi_class.cpp index 683cc543b..f9881c894 100644 --- a/cppapi/client/dbapi_class.cpp +++ b/cppapi/client/dbapi_class.cpp @@ -55,14 +55,14 @@ namespace Tango // //------------------------------------------------------------------------------------------------------------------ -DbClass::DbClass(std::string class_name, Database *class_dbase):ext(Tango_nullptr) +DbClass::DbClass(std::string class_name, Database *class_dbase):ext(nullptr) { name = std::string(class_name); dbase = class_dbase; ext_dbase = true; } -DbClass::DbClass(std::string class_name):ext(Tango_nullptr) +DbClass::DbClass(std::string class_name):ext(nullptr) { name = std::string(class_name); db_ind = ApiUtil::instance()->get_db_ind(); diff --git a/cppapi/client/dbapi_datum.cpp b/cppapi/client/dbapi_datum.cpp index 32c2a140f..7e165d7eb 100644 --- a/cppapi/client/dbapi_datum.cpp +++ b/cppapi/client/dbapi_datum.cpp @@ -46,14 +46,14 @@ namespace Tango // //----------------------------------------------------------------------------- -DbDatum::DbDatum(std::string p_name):ext(Tango_nullptr) +DbDatum::DbDatum(std::string p_name):ext(nullptr) { name = p_name; value_size = 0; value_string.resize(0); } -DbDatum::DbDatum(const char *p_name):name(p_name),ext(Tango_nullptr) +DbDatum::DbDatum(const char *p_name):name(p_name),ext(nullptr) { value_size = 0; value_string.resize(0); @@ -65,7 +65,7 @@ DbDatum::DbDatum(const char *p_name):name(p_name),ext(Tango_nullptr) // //----------------------------------------------------------------------------- -DbDatum::DbDatum():ext(Tango_nullptr) +DbDatum::DbDatum():ext(nullptr) { } diff --git a/cppapi/client/dbapi_device.cpp b/cppapi/client/dbapi_device.cpp index 5a04461ed..905ebde39 100644 --- a/cppapi/client/dbapi_device.cpp +++ b/cppapi/client/dbapi_device.cpp @@ -49,7 +49,7 @@ namespace Tango // //------------------------------------------------------------------------------------------------------------------ -DbDevice::DbDevice(std::string &dev_name, Database *dev_dbase):ext(Tango_nullptr) +DbDevice::DbDevice(std::string &dev_name, Database *dev_dbase):ext(nullptr) { name = dev_name; dbase = dev_dbase; @@ -67,7 +67,7 @@ DbDevice::DbDevice(std::string &dev_name, Database *dev_dbase):ext(Tango_nullptr // //----------------------------------------------------------------------------------------------------------------- -DbDevice::DbDevice(std::string &dev_name):ext(Tango_nullptr) +DbDevice::DbDevice(std::string &dev_name):ext(nullptr) { name = dev_name; db_ind = ApiUtil::instance()->get_db_ind(); @@ -85,7 +85,7 @@ DbDevice::DbDevice(std::string &dev_name):ext(Tango_nullptr) // //------------------------------------------------------------------------------------------------------------------ -DbDevice::DbDevice(std::string &dev_name,std::string &host,std::string &port_str):ext(Tango_nullptr) +DbDevice::DbDevice(std::string &dev_name,std::string &host,std::string &port_str):ext(nullptr) { name = dev_name; diff --git a/cppapi/client/dbapi_server.cpp b/cppapi/client/dbapi_server.cpp index 8dcf92789..460d76941 100644 --- a/cppapi/client/dbapi_server.cpp +++ b/cppapi/client/dbapi_server.cpp @@ -45,7 +45,7 @@ namespace Tango // //----------------------------------------------------------------------------- -DbServer::DbServer(std::string server_name, Database *server_dbase):ext(Tango_nullptr) +DbServer::DbServer(std::string server_name, Database *server_dbase):ext(nullptr) { name = std::string(server_name); dbase = server_dbase; @@ -60,7 +60,7 @@ DbServer::DbServer(std::string server_name, Database *server_dbase):ext(Tango_nu // //----------------------------------------------------------------------------- -DbServer::DbServer(std::string server_name):ext(Tango_nullptr) +DbServer::DbServer(std::string server_name):ext(nullptr) { name = std::string(server_name); db_ind = ApiUtil::instance()->get_db_ind(); diff --git a/cppapi/client/devapi_attr.cpp b/cppapi/client/devapi_attr.cpp index 4900a7d06..b9714bdd2 100644 --- a/cppapi/client/devapi_attr.cpp +++ b/cppapi/client/devapi_attr.cpp @@ -85,7 +85,7 @@ DeviceAttribute::DeviceAttribute():ext(new DeviceAttributeExt) // //----------------------------------------------------------------------------- -DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullptr) +DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(nullptr) { name = source.name; exceptions_flags = source.exceptions_flags; @@ -129,7 +129,7 @@ DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullp // //----------------------------------------------------------------------------- -DeviceAttribute::DeviceAttribute(DeviceAttribute &&source):ext(Tango_nullptr) +DeviceAttribute::DeviceAttribute(DeviceAttribute &&source):ext(nullptr) { name = std::move(source.name); exceptions_flags = source.exceptions_flags; @@ -331,67 +331,67 @@ DeviceAttribute & DeviceAttribute::operator=(DeviceAttribute &&rval) if (rval.LongSeq.operator->() != NULL) LongSeq = rval.LongSeq._retn(); else - LongSeq = Tango_nullptr; + LongSeq = nullptr; if (rval.ShortSeq.operator->() != NULL) ShortSeq = rval.ShortSeq._retn(); else - ShortSeq = Tango_nullptr; + ShortSeq = nullptr; if (rval.DoubleSeq.operator->() != NULL) DoubleSeq = rval.DoubleSeq._retn(); else - DoubleSeq = Tango_nullptr; + DoubleSeq = nullptr; if (rval.StringSeq.operator->() != NULL) StringSeq = rval.StringSeq._retn(); else - StringSeq = Tango_nullptr; + StringSeq = nullptr; if (rval.FloatSeq.operator->() != NULL) FloatSeq = rval.FloatSeq._retn(); else - FloatSeq = Tango_nullptr; + FloatSeq = nullptr; if (rval.BooleanSeq.operator->() != NULL) BooleanSeq = rval.BooleanSeq._retn(); else - BooleanSeq = Tango_nullptr; + BooleanSeq = nullptr; if (rval.UShortSeq.operator->() != NULL) UShortSeq = rval.UShortSeq._retn(); else - UShortSeq = Tango_nullptr; + UShortSeq = nullptr; if (rval.UCharSeq.operator->() != NULL) UCharSeq = rval.UCharSeq._retn(); else - UCharSeq = Tango_nullptr; + UCharSeq = nullptr; if (rval.Long64Seq.operator->() != NULL) Long64Seq = rval.Long64Seq._retn(); else - Long64Seq = Tango_nullptr; + Long64Seq = nullptr; if (rval.ULongSeq.operator->() != NULL) ULongSeq = rval.ULongSeq._retn(); else - ULongSeq = Tango_nullptr; + ULongSeq = nullptr; if (rval.ULong64Seq.operator->() != NULL) ULong64Seq = rval.ULong64Seq._retn(); else - ULong64Seq = Tango_nullptr; + ULong64Seq = nullptr; if (rval.StateSeq.operator->() != NULL) StateSeq = rval.StateSeq._retn(); else - StateSeq = Tango_nullptr; + StateSeq = nullptr; if (rval.EncodedSeq.operator->() != NULL) EncodedSeq = rval.EncodedSeq._retn(); else - EncodedSeq = Tango_nullptr; + EncodedSeq = nullptr; d_state = rval.d_state; d_state_filled = rval.d_state_filled; diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index 2bfc5b8bc..e71635ccb 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -127,7 +127,7 @@ Connection::Connection(ORB *orb_in) } Connection::Connection(bool dummy) - : ext(Tango_nullptr), tr_reco(true), prev_failed(false), prev_failed_t0(0.0), + : ext(nullptr), tr_reco(true), prev_failed(false), prev_failed_t0(0.0), user_connect_timeout(-1), tango_host_localhost(false) { if (dummy) @@ -153,7 +153,7 @@ Connection::~Connection() //----------------------------------------------------------------------------- Connection::Connection(const Connection &sou) - : ext(Tango_nullptr) + : ext(nullptr) { dbase_used = sou.dbase_used; from_env_var = sou.from_env_var; @@ -259,7 +259,7 @@ Connection &Connection::operator=(const Connection &rval) } else { - ext.reset(Tango_nullptr); + ext.reset(nullptr); } return *this; @@ -1863,7 +1863,7 @@ void DeviceProxy::real_constructor(std::string &name, bool need_check_acc) //----------------------------------------------------------------------------- DeviceProxy::DeviceProxy(const DeviceProxy &sou) - : Connection(sou), ext_proxy(Tango_nullptr) + : Connection(sou), ext_proxy(nullptr) { // @@ -5367,7 +5367,7 @@ void DeviceProxy::write_pipe(DevicePipe &dev_pipe) } DevVarPipeDataEltArray *tmp_ptr = dev_pipe.get_root_blob().get_insert_data(); - if (tmp_ptr == Tango_nullptr) + if (tmp_ptr == nullptr) { Except::throw_exception(API_PipeNoDataElement, "No data in pipe!", "DeviceProxy::write_pipe()"); } diff --git a/cppapi/client/devapi_datahist.cpp b/cppapi/client/devapi_datahist.cpp index 385229328..ff7329cb0 100644 --- a/cppapi/client/devapi_datahist.cpp +++ b/cppapi/client/devapi_datahist.cpp @@ -48,7 +48,7 @@ namespace Tango //----------------------------------------------------------------------------- DeviceDataHistory::DeviceDataHistory() - : DeviceData(), ext_hist(Tango_nullptr) + : DeviceData(), ext_hist(nullptr) { fail = false; err = new DevErrorList(); @@ -57,7 +57,7 @@ DeviceDataHistory::DeviceDataHistory() } DeviceDataHistory::DeviceDataHistory(int n, int *ref, DevCmdHistoryList *ptr) - : ext_hist(Tango_nullptr) + : ext_hist(nullptr) { ref_ctr_ptr = ref; seq_ptr = ptr; @@ -71,7 +71,7 @@ DeviceDataHistory::DeviceDataHistory(int n, int *ref, DevCmdHistoryList *ptr) } DeviceDataHistory::DeviceDataHistory(const DeviceDataHistory &source) - : DeviceData(source), ext_hist(Tango_nullptr) + : DeviceData(source), ext_hist(nullptr) { fail = source.fail; time = source.time; @@ -92,7 +92,7 @@ DeviceDataHistory::DeviceDataHistory(const DeviceDataHistory &source) } DeviceDataHistory::DeviceDataHistory(DeviceDataHistory &&source) - : DeviceData(std::move(source)), ext_hist(Tango_nullptr) + : DeviceData(std::move(source)), ext_hist(nullptr) { fail = source.fail; time = source.time; @@ -329,14 +329,14 @@ std::ostream &operator<<(std::ostream &o_str, DeviceDataHistory &dh) //----------------------------------------------------------------------------- DeviceAttributeHistory::DeviceAttributeHistory() - : DeviceAttribute(), ext_hist(Tango_nullptr) + : DeviceAttribute(), ext_hist(nullptr) { fail = false; err_list = new DevErrorList(); } DeviceAttributeHistory::DeviceAttributeHistory(int n, DevAttrHistoryList_var &seq) - : ext_hist(Tango_nullptr) + : ext_hist(nullptr) { fail = seq[n].attr_failed; @@ -485,7 +485,7 @@ DeviceAttributeHistory::DeviceAttributeHistory(int n, DevAttrHistoryList_var &se } DeviceAttributeHistory::DeviceAttributeHistory(int n, DevAttrHistoryList_3_var &seq) - : ext_hist(Tango_nullptr) + : ext_hist(nullptr) { fail = seq[n].attr_failed; @@ -636,7 +636,7 @@ DeviceAttributeHistory::DeviceAttributeHistory(int n, DevAttrHistoryList_3_var & } DeviceAttributeHistory::DeviceAttributeHistory(const DeviceAttributeHistory &source) - : DeviceAttribute(source), ext_hist(Tango_nullptr) + : DeviceAttribute(source), ext_hist(nullptr) { fail = source.fail; @@ -648,7 +648,7 @@ DeviceAttributeHistory::DeviceAttributeHistory(const DeviceAttributeHistory &sou } DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) - : DeviceAttribute(std::move(source)), ext_hist(Tango_nullptr) + : DeviceAttribute(std::move(source)), ext_hist(nullptr) { fail = source.fail; diff --git a/cppapi/client/devapi_pipe.cpp b/cppapi/client/devapi_pipe.cpp index ef02fcd7f..31f446229 100644 --- a/cppapi/client/devapi_pipe.cpp +++ b/cppapi/client/devapi_pipe.cpp @@ -48,15 +48,15 @@ namespace Tango // //------------------------------------------------------------------------------------------------------------------ -DevicePipe::DevicePipe():ext(Tango_nullptr) +DevicePipe::DevicePipe():ext(nullptr) { } -DevicePipe::DevicePipe(const std::string &pipe_name):name(pipe_name),ext(Tango_nullptr) +DevicePipe::DevicePipe(const std::string &pipe_name):name(pipe_name),ext(nullptr) { } -DevicePipe::DevicePipe(const std::string &pipe_name,const std::string &root_blob_name):name(pipe_name),ext(Tango_nullptr) +DevicePipe::DevicePipe(const std::string &pipe_name,const std::string &root_blob_name):name(pipe_name),ext(nullptr) { the_root_blob.set_name(root_blob_name); } @@ -67,7 +67,7 @@ DevicePipe::DevicePipe(const std::string &pipe_name,const std::string &root_blob // //----------------------------------------------------------------------------- -DevicePipe::DevicePipe(const DevicePipe & source):ext(Tango_nullptr) +DevicePipe::DevicePipe(const DevicePipe & source):ext(nullptr) { name = source.name; time = source.time; @@ -109,7 +109,7 @@ DevicePipe &DevicePipe::operator=(const DevicePipe &rhs) // //----------------------------------------------------------------------------- -DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) +DevicePipe::DevicePipe(DevicePipe && source):ext(nullptr) { name = std::move(source.name); time = source.time; @@ -175,8 +175,8 @@ DevicePipe &DevicePipe::operator[](const std::string &_na) // //------------------------------------------------------------------------------------------------------------------ -DevicePipeBlob::DevicePipeBlob():failed(false),insert_elt_array(Tango_nullptr),insert_ctr(0), -extract_elt_array(Tango_nullptr),extract_ctr(0),extract_delete(false),ext(Tango_nullptr) +DevicePipeBlob::DevicePipeBlob():failed(false),insert_elt_array(nullptr),insert_ctr(0), +extract_elt_array(nullptr),extract_ctr(0),extract_delete(false),ext(nullptr) { exceptions_flags.set(); ext_state.reset(); @@ -186,8 +186,8 @@ extract_elt_array(Tango_nullptr),extract_ctr(0),extract_delete(false),ext(Tango_ DevicePipeBlob::DevicePipeBlob(const std::string &blob_name):name(blob_name),failed(false), -insert_elt_array(Tango_nullptr),insert_ctr(0),extract_elt_array(Tango_nullptr),extract_ctr(0), -extract_delete(false),ext(Tango_nullptr) +insert_elt_array(nullptr),insert_ctr(0),extract_elt_array(nullptr),extract_ctr(0), +extract_delete(false),ext(nullptr) { exceptions_flags.set(); ext_state.reset(); @@ -214,7 +214,7 @@ DevicePipeBlob::~DevicePipeBlob() // //----------------------------------------------------------------------------- -DevicePipeBlob::DevicePipeBlob(const DevicePipeBlob & source):ext(Tango_nullptr) +DevicePipeBlob::DevicePipeBlob(const DevicePipeBlob & source):ext(nullptr) { name = source.name; exceptions_flags = source.exceptions_flags; @@ -223,16 +223,16 @@ DevicePipeBlob::DevicePipeBlob(const DevicePipeBlob & source):ext(Tango_nullptr) insert_ind = source.insert_ind; extract_ind = source.extract_ind; - if (source.insert_elt_array != Tango_nullptr) + if (source.insert_elt_array != nullptr) { insert_elt_array = new DevVarPipeDataEltArray(); (*insert_elt_array) = (*source.insert_elt_array); } else - insert_elt_array = Tango_nullptr; + insert_elt_array = nullptr; insert_ctr = source.insert_ctr; - if (source.extract_elt_array != Tango_nullptr) + if (source.extract_elt_array != nullptr) { DevVarPipeDataEltArray *tmp = new DevVarPipeDataEltArray(); *tmp = (*source.extract_elt_array); @@ -269,16 +269,16 @@ DevicePipeBlob &DevicePipeBlob::operator=(const DevicePipeBlob &rhs) insert_ind = rhs.insert_ind; extract_ind = rhs.extract_ind; - if (rhs.insert_elt_array != Tango_nullptr) + if (rhs.insert_elt_array != nullptr) { insert_elt_array = new DevVarPipeDataEltArray(); (*insert_elt_array) = (*rhs.insert_elt_array); } else - insert_elt_array = Tango_nullptr; + insert_elt_array = nullptr; insert_ctr = rhs.insert_ctr; - if (rhs.extract_elt_array != Tango_nullptr) + if (rhs.extract_elt_array != nullptr) { DevVarPipeDataEltArray *tmp = new DevVarPipeDataEltArray(); *tmp = (*rhs.extract_elt_array); @@ -308,7 +308,7 @@ DevicePipeBlob &DevicePipeBlob::operator=(const DevicePipeBlob &rhs) // //----------------------------------------------------------------------------- -DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) +DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(nullptr) { name = std::move(source.name); exceptions_flags = source.exceptions_flags; @@ -317,16 +317,16 @@ DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) insert_ind = source.insert_ind; extract_ind = source.extract_ind; - if (source.insert_elt_array != Tango_nullptr) + if (source.insert_elt_array != nullptr) { insert_elt_array = new DevVarPipeDataEltArray(); (*insert_elt_array) = (*source.insert_elt_array); } else - insert_elt_array = Tango_nullptr; + insert_elt_array = nullptr; insert_ctr = source.insert_ctr; - if (source.extract_elt_array != Tango_nullptr) + if (source.extract_elt_array != nullptr) { DevVarPipeDataEltArray *tmp = new DevVarPipeDataEltArray(); *tmp = (*source.extract_elt_array); @@ -360,17 +360,17 @@ DevicePipeBlob &DevicePipeBlob::operator=(DevicePipeBlob &&rhs) insert_ind = rhs.insert_ind; extract_ind = rhs.extract_ind; - if (rhs.insert_elt_array != Tango_nullptr) + if (rhs.insert_elt_array != nullptr) insert_elt_array = rhs.insert_elt_array; - rhs.insert_elt_array = Tango_nullptr; + rhs.insert_elt_array = nullptr; insert_ctr = rhs.insert_ctr; if (extract_delete == true) delete extract_elt_array; - if (rhs.extract_elt_array != Tango_nullptr) + if (rhs.extract_elt_array != nullptr) extract_elt_array = rhs.extract_elt_array; - rhs.extract_elt_array = Tango_nullptr; + rhs.extract_elt_array = nullptr; extract_delete = rhs.extract_delete; extract_ctr = rhs.extract_ctr; @@ -400,7 +400,7 @@ DevicePipeBlob &DevicePipeBlob::operator=(DevicePipeBlob &&rhs) std::vector DevicePipeBlob::get_data_elt_names() { - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) { std::stringstream ss; @@ -438,7 +438,7 @@ std::vector DevicePipeBlob::get_data_elt_names() std::string DevicePipeBlob::get_data_elt_name(size_t _ind) { - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) { std::stringstream ss; @@ -478,7 +478,7 @@ int DevicePipeBlob::get_data_elt_type(size_t _ind) { int ret = 0; - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) { std::stringstream ss; @@ -657,7 +657,7 @@ size_t DevicePipeBlob::get_extract_ind_from_name(const std::string &_na) bool found = false; size_t loop; - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) { Except::throw_exception(API_PipeNoDataElement, "No data element available for extraction", @@ -703,7 +703,7 @@ size_t DevicePipeBlob::get_insert_ind_from_name(const std::string &_na) bool found = false; size_t loop; - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) { Except::throw_exception(API_PipeNoDataElement, "No data element available for insertion", @@ -913,7 +913,7 @@ void DevicePipeBlob::set_data_elt_nb(size_t _nb) void DevicePipeBlob::set_current_delt_name(const std::string &_na) { - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) { insert_elt_array = new DevVarPipeDataEltArray(10); insert_elt_array->length(1); @@ -954,9 +954,9 @@ size_t DevicePipeBlob::get_data_elt_nb() { size_t ret; - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) { - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) ret = 0; else ret = insert_elt_array->length(); @@ -1044,7 +1044,7 @@ DevicePipeBlob & DevicePipeBlob::operator<<(DevString &datum) failed = false; ext_state.reset(); - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) ext_state.set(blobdenamenotset_flag); else if (insert_ctr == -1 && insert_ind == -1) ext_state.set(mixing_flag); @@ -1109,7 +1109,7 @@ DevicePipeBlob & DevicePipeBlob::operator<<(const std::string &datum) failed = false; ext_state.reset(); - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) ext_state.set(blobdenamenotset_flag); else if (insert_ctr == -1 && insert_ind == -1) ext_state.set(mixing_flag); @@ -1159,7 +1159,7 @@ DevicePipeBlob & DevicePipeBlob::operator<<(DevicePipeBlob &datum) failed = false; ext_state.reset(); - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) ext_state.set(blobdenamenotset_flag); else if (insert_ctr == -1 && insert_ind == -1) ext_state.set(mixing_flag); @@ -1171,7 +1171,7 @@ DevicePipeBlob & DevicePipeBlob::operator<<(DevicePipeBlob &datum) else { DevVarPipeDataEltArray *tmp_ptr = datum.get_insert_data(); - if (tmp_ptr != Tango_nullptr) + if (tmp_ptr != nullptr) { CORBA::ULong max,len; max = tmp_ptr->maximum(); @@ -1217,7 +1217,7 @@ DevicePipeBlob & DevicePipeBlob::operator<<(std::vector &datum) failed = false; ext_state.reset(); - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) ext_state.set(blobdenamenotset_flag); else if (insert_ctr == -1 && insert_ind == -1) ext_state.set(mixing_flag); @@ -1350,7 +1350,7 @@ DevicePipeBlob & DevicePipeBlob::operator<<(std::vector &datum) failed = false; ext_state.reset(); - if (insert_elt_array == Tango_nullptr) + if (insert_elt_array == nullptr) ext_state.set(blobdenamenotset_flag); else if (insert_ctr == -1 && insert_ind == -1) ext_state.set(mixing_flag); @@ -1662,7 +1662,7 @@ DevicePipeBlob &DevicePipeBlob::operator >> (DevString &datum) failed = false; ext_state.reset(); - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) ext_state.set(isempty_flag); else if (extract_ctr > (int)extract_elt_array->length() - 1) ext_state.set(notenoughde_flag); @@ -1741,7 +1741,7 @@ DevicePipeBlob &DevicePipeBlob::operator >> (DevicePipeBlob &datum) failed = false; ext_state.reset(); - if (extract_elt_array == Tango_nullptr) + if (extract_elt_array == nullptr) ext_state.set(isempty_flag); else if (extract_ctr > (int)extract_elt_array->length() - 1) ext_state.set(notenoughde_flag); @@ -2067,7 +2067,7 @@ void DevicePipeBlob::throw_too_many(const std::string &_meth,bool _extract) m_name = m_name + _meth; delete insert_elt_array; - insert_elt_array = Tango_nullptr; + insert_elt_array = nullptr; if (extract_delete == true) { delete extract_elt_array; @@ -2207,7 +2207,7 @@ void DevicePipeBlob::print(std::ostream &o_str,int indent,bool insert_extract) else dvpdea = get_insert_data(); - if (dvpdea != Tango_nullptr) + if (dvpdea != nullptr) { for (size_t ctr = 0;ctr < dvpdea->length();ctr++) { @@ -2390,7 +2390,7 @@ std::ostream &operator<<(std::ostream &o_str,DevicePipe &dd) // DevicePipeBlob &dpb = dd.get_root_blob(); - if (dpb.get_insert_data() == Tango_nullptr && dpb.get_extract_data() == Tango_nullptr) + if (dpb.get_insert_data() == nullptr && dpb.get_extract_data() == nullptr) o_str << "DevicePipe is empty"; else { diff --git a/cppapi/client/event.cpp b/cppapi/client/event.cpp index fa02091ac..297c718a0 100644 --- a/cppapi/client/event.cpp +++ b/cppapi/client/event.cpp @@ -3138,8 +3138,8 @@ void EventConsumer::get_fire_sync_event(DeviceProxy *device,CallBack *callback,E else domain_name = device_name + '/' + obj_name_lower; - AttributeValue_5 *av_5 = Tango_nullptr; - DeviceAttribute *da = Tango_nullptr; + AttributeValue_5 *av_5 = nullptr; + DeviceAttribute *da = nullptr; FwdEventData *event_data; try @@ -3276,8 +3276,8 @@ void EventConsumer::get_fire_sync_event(DeviceProxy *device,CallBack *callback,E { DevErrorList err; err.length(0); - CommandInfoList *c_list = Tango_nullptr; - AttributeInfoListEx *a_list = Tango_nullptr; + CommandInfoList *c_list = nullptr; + AttributeInfoListEx *a_list = nullptr; std::string ev_name(EventName[INTERFACE_CHANGE_EVENT]); try @@ -3288,9 +3288,9 @@ void EventConsumer::get_fire_sync_event(DeviceProxy *device,CallBack *callback,E catch (DevFailed &e) { delete c_list; - c_list = Tango_nullptr; + c_list = nullptr; delete a_list; - a_list = Tango_nullptr; + a_list = nullptr; err = e.errors; } @@ -3348,7 +3348,7 @@ void EventConsumer::get_fire_sync_event(DeviceProxy *device,CallBack *callback,E else domain_name = device_name + '/' + obj_name_lower; - DevicePipe *da = Tango_nullptr; + DevicePipe *da = nullptr; PipeEventData *event_data; try @@ -3596,17 +3596,17 @@ void EventData::set_time() #endif } -FwdEventData::FwdEventData():EventData(),av_5(Tango_nullptr),event_data(Tango_nullptr) +FwdEventData::FwdEventData():EventData(),av_5(nullptr),event_data(nullptr) { } FwdEventData::FwdEventData(DeviceProxy *dev,std::string &_s1,std::string &_s2,Tango::DeviceAttribute *_da,DevErrorList &_del) : - EventData(dev,_s1,_s2,_da,_del),av_5(Tango_nullptr),event_data(Tango_nullptr) + EventData(dev,_s1,_s2,_da,_del),av_5(nullptr),event_data(nullptr) { } FwdEventData::FwdEventData(DeviceProxy *dev,std::string &_s1,std::string &_s2,Tango::DeviceAttribute *_da,DevErrorList &_del,zmq::message_t *_m) : - EventData(dev,_s1,_s2,_da,_del),av_5(Tango_nullptr),event_data(_m) + EventData(dev,_s1,_s2,_da,_del),av_5(nullptr),event_data(_m) { } /************************************************************************/ @@ -3725,14 +3725,14 @@ void AttrConfEventData::set_time() #endif } -FwdAttrConfEventData::FwdAttrConfEventData():AttrConfEventData(),fwd_attr_conf(Tango_nullptr) +FwdAttrConfEventData::FwdAttrConfEventData():AttrConfEventData(),fwd_attr_conf(nullptr) { } FwdAttrConfEventData::FwdAttrConfEventData(DeviceProxy *dev,std::string &nam,std::string &evt, Tango::AttributeInfoEx *attr_conf_in,DevErrorList &errors_in) : - AttrConfEventData(dev,nam,evt,attr_conf_in,errors_in),fwd_attr_conf(Tango_nullptr) + AttrConfEventData(dev,nam,evt,attr_conf_in,errors_in),fwd_attr_conf(nullptr) { } diff --git a/cppapi/client/eventkeepalive.cpp b/cppapi/client/eventkeepalive.cpp index e79051d42..d090f23d1 100644 --- a/cppapi/client/eventkeepalive.cpp +++ b/cppapi/client/eventkeepalive.cpp @@ -1637,8 +1637,8 @@ void EventConsumerKeepAliveThread::re_subscribe_after_reconnect(ZmqEventConsumer // For device interface change event // - AttributeInfoListEx *aie = Tango_nullptr; - CommandInfoList *cil = Tango_nullptr; + AttributeInfoListEx *aie = nullptr; + CommandInfoList *cil = nullptr; DevErrorList err; err.length(0); std::string prefix = event_consumer->env_var_fqdn_prefix[0]; @@ -1655,9 +1655,9 @@ void EventConsumerKeepAliveThread::re_subscribe_after_reconnect(ZmqEventConsumer catch (DevFailed &e) { delete aie; - aie = Tango_nullptr; + aie = nullptr; delete cil; - cil = Tango_nullptr; + cil = nullptr; err = e.errors; } @@ -1665,8 +1665,8 @@ void EventConsumerKeepAliveThread::re_subscribe_after_reconnect(ZmqEventConsumer unsigned int cb_nb = epos->second.callback_list.size(); unsigned int cb_ctr = 0; - CommandInfoList *cil_copy = Tango_nullptr; - AttributeInfoListEx *aie_copy = Tango_nullptr; + CommandInfoList *cil_copy = nullptr; + AttributeInfoListEx *aie_copy = nullptr; for (esspos = epos->second.callback_list.begin(); esspos != epos->second.callback_list.end(); ++esspos) { @@ -1740,7 +1740,7 @@ void EventConsumerKeepAliveThread::re_subscribe_after_reconnect(ZmqEventConsumer // For pipe event // - DevicePipe *dp = Tango_nullptr; + DevicePipe *dp = nullptr; DevErrorList err; err.length(0); diff --git a/cppapi/client/filedatabase.cpp b/cppapi/client/filedatabase.cpp index 6e0fde40a..96bd77b66 100644 --- a/cppapi/client/filedatabase.cpp +++ b/cppapi/client/filedatabase.cpp @@ -2374,42 +2374,42 @@ CORBA::Any* FileDatabase :: DbGetAttributeAliasList(CORBA::Any&) CORBA::Any* FileDatabase::DbGetClassPipeProperty(CORBA::Any&) { - CORBA::Any* ret = Tango_nullptr; + CORBA::Any* ret = nullptr; Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbGetClassPipeProperty"); return ret; } CORBA::Any* FileDatabase::DbGetDevicePipeProperty(CORBA::Any&) { - CORBA::Any* ret = Tango_nullptr; + CORBA::Any* ret = nullptr; Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbGetDevicePipeProperty"); return ret; } CORBA::Any* FileDatabase::DbDeleteClassPipeProperty(CORBA::Any&) { - CORBA::Any* ret = Tango_nullptr; + CORBA::Any* ret = nullptr; Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbDeleteClassPipeProperty"); return ret; } CORBA::Any* FileDatabase::DbDeleteDevicePipeProperty(CORBA::Any&) { - CORBA::Any* ret = Tango_nullptr; + CORBA::Any* ret = nullptr; Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbDeleteDevicePipeProperty"); return ret; } CORBA::Any* FileDatabase::DbPutClassPipeProperty(CORBA::Any&) { - CORBA::Any* ret = Tango_nullptr; + CORBA::Any* ret = nullptr; Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbPutClassPipeProperty"); return ret; } CORBA::Any* FileDatabase::DbPutDevicePipeProperty(CORBA::Any&) { - CORBA::Any* ret = Tango_nullptr; + CORBA::Any* ret = nullptr; Tango::Except::throw_exception(API_NotSupported,"Call to a Filedatabase not implemented.","DbPutDevicePipeProperty"); return ret; } diff --git a/cppapi/server/attrdesc.cpp b/cppapi/server/attrdesc.cpp index ceabdc0a1..0dbb38688 100644 --- a/cppapi/server/attrdesc.cpp +++ b/cppapi/server/attrdesc.cpp @@ -699,7 +699,7 @@ void Attr::set_memorized() //------------------------------------------------------------------------------------------------------------------- SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x) -:Attr(att_name,att_type),ext(Tango_nullptr) +:Attr(att_name,att_type),ext(nullptr) { format = Tango::SPECTRUM; if (x <= 0) @@ -728,7 +728,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x) } SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteType w_type,long x) -:Attr(att_name,att_type,w_type),ext(Tango_nullptr) +:Attr(att_name,att_type,w_type),ext(nullptr) { format = Tango::SPECTRUM; if (x <= 0) @@ -757,7 +757,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteTy } SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x,DispLevel level) -:Attr(att_name,att_type,level),ext(Tango_nullptr) +:Attr(att_name,att_type,level),ext(nullptr) { format = Tango::SPECTRUM; if (x <= 0) @@ -786,7 +786,7 @@ SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,long x,DispLevel l } SpectrumAttr::SpectrumAttr(const char *att_name,long att_type,Tango::AttrWriteType w_type,long x,DispLevel level) -:Attr(att_name,att_type,level,w_type),ext(Tango_nullptr) +:Attr(att_name,att_type,level,w_type),ext(nullptr) { format = Tango::SPECTRUM; if (x <= 0) @@ -830,7 +830,7 @@ SpectrumAttr::SpectrumAttr(const SpectrumAttr &sou):Attr(sou) //------------------------------------------------------------------------------------------------------------------- ImageAttr::ImageAttr(const char *att_name,long att_type,long x,long y) -:SpectrumAttr(att_name,att_type,x),ext(Tango_nullptr) +:SpectrumAttr(att_name,att_type,x),ext(nullptr) { format = Tango::IMAGE; if (y <= 0) @@ -849,7 +849,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,long x,long y) ImageAttr::ImageAttr(const char *att_name,long att_type,Tango::AttrWriteType w_type, long x,long y) -:SpectrumAttr(att_name,att_type,w_type,x),ext(Tango_nullptr) +:SpectrumAttr(att_name,att_type,w_type,x),ext(nullptr) { format = Tango::IMAGE; if (y <= 0) @@ -868,7 +868,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,Tango::AttrWriteType w_t ImageAttr::ImageAttr(const char *att_name,long att_type,long x, long y,DispLevel level) -:SpectrumAttr(att_name,att_type,x,level),ext(Tango_nullptr) +:SpectrumAttr(att_name,att_type,x,level),ext(nullptr) { format = Tango::IMAGE; if (y <= 0) @@ -887,7 +887,7 @@ ImageAttr::ImageAttr(const char *att_name,long att_type,long x, ImageAttr::ImageAttr(const char *att_name,long att_type,Tango::AttrWriteType w_type, long x, long y,DispLevel level) -:SpectrumAttr(att_name,att_type,w_type,x,level),ext(Tango_nullptr) +:SpectrumAttr(att_name,att_type,w_type,x,level),ext(nullptr) { format = Tango::IMAGE; if (y <= 0) diff --git a/cppapi/server/attrdesc.h b/cppapi/server/attrdesc.h index f7b3ee61a..500c261cb 100644 --- a/cppapi/server/attrdesc.h +++ b/cppapi/server/attrdesc.h @@ -68,7 +68,7 @@ class UserDefaultAttrProp /** * Constructs a newly allocated UserDefaultAttrProp object. */ - UserDefaultAttrProp():ext(Tango_nullptr) {} + UserDefaultAttrProp():ext(nullptr) {} //@} /**@name Set default property methods */ diff --git a/cppapi/server/attribute.cpp b/cppapi/server/attribute.cpp index 74c6c7d63..9c2d15c75 100644 --- a/cppapi/server/attribute.cpp +++ b/cppapi/server/attribute.cpp @@ -84,7 +84,7 @@ static bool WantedProp_f(AttrProperty a,const char *n) Attribute::Attribute(std::vector &prop_list,Attr &tmp_attr,std::string &dev_name,long idx) :date(true),quality(Tango::ATTR_VALID),check_min_value(false),check_max_value(false), - enum_nb(0),loc_enum_ptr(Tango_nullptr),poll_period(0),event_period(0),archive_period(0),last_periodic(0.0), + enum_nb(0),loc_enum_ptr(nullptr),poll_period(0),event_period(0),archive_period(0),last_periodic(0.0), archive_last_periodic(0.0),periodic_counter(0),archive_periodic_counter(0), archive_last_event(0.0),dev(NULL),change_event_implmented(false), archive_event_implmented(false),check_change_event_criteria(true), @@ -2864,67 +2864,67 @@ void Attribute::delete_seq() case Tango::DEV_SHORT: case Tango::DEV_ENUM: delete value.sh_seq; - value.sh_seq = Tango_nullptr; + value.sh_seq = nullptr; break; case Tango::DEV_LONG: delete value.lg_seq; - value.lg_seq = Tango_nullptr; + value.lg_seq = nullptr; break; case Tango::DEV_LONG64: delete value.lg64_seq; - value.lg64_seq = Tango_nullptr; + value.lg64_seq = nullptr; break; case Tango::DEV_DOUBLE: delete value.db_seq; - value.db_seq = Tango_nullptr; + value.db_seq = nullptr; break; case Tango::DEV_STRING: delete value.str_seq; - value.str_seq = Tango_nullptr; + value.str_seq = nullptr; break; case Tango::DEV_FLOAT: delete value.fl_seq; - value.fl_seq = Tango_nullptr; + value.fl_seq = nullptr; break; case Tango::DEV_USHORT: delete value.ush_seq; - value.ush_seq = Tango_nullptr; + value.ush_seq = nullptr; break; case Tango::DEV_UCHAR: delete value.cha_seq; - value.cha_seq = Tango_nullptr; + value.cha_seq = nullptr; break; case Tango::DEV_BOOLEAN: delete value.boo_seq; - value.boo_seq = Tango_nullptr; + value.boo_seq = nullptr; break; case Tango::DEV_ULONG: delete value.ulg_seq; - value.ulg_seq = Tango_nullptr; + value.ulg_seq = nullptr; break; case Tango::DEV_ULONG64: delete value.ulg64_seq; - value.ulg64_seq = Tango_nullptr; + value.ulg64_seq = nullptr; break; case Tango::DEV_STATE: delete value.state_seq; - value.state_seq = Tango_nullptr; + value.state_seq = nullptr; break; case Tango::DEV_ENCODED: delete value.enc_seq; - value.enc_seq = Tango_nullptr; + value.enc_seq = nullptr; break; } } @@ -3776,9 +3776,9 @@ void Attribute::fire_change_event(DevFailed *except) // Check if it is needed to send an event // - Tango::AttributeValue_3 *send_attr = Tango_nullptr; - Tango::AttributeValue_4 *send_attr_4 = Tango_nullptr; - Tango::AttributeValue_5 *send_attr_5 = Tango_nullptr; + Tango::AttributeValue_3 *send_attr = nullptr; + Tango::AttributeValue_4 *send_attr_4 = nullptr; + Tango::AttributeValue_5 *send_attr_5 = nullptr; try { @@ -3952,7 +3952,7 @@ void Attribute::fire_change_event(DevFailed *except) if ( except == NULL ) { - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) Attribute_2_AttributeValue(send_attr_5,dev); else if (send_attr_4 != NULL) Attribute_2_AttributeValue(send_attr_4,dev); @@ -3974,9 +3974,9 @@ void Attribute::fire_change_event(DevFailed *except) if ( is_check_change_criteria() == true ) { - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) ad.attr_val_5 = send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) ad.attr_val_4 = send_attr_4; else ad.attr_val_3 = send_attr; @@ -4090,9 +4090,9 @@ void Attribute::fire_change_event(DevFailed *except) else filterable_data.push_back((double)0.0); - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) ad.attr_val_5 = send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) ad.attr_val_4 = send_attr_4; else ad.attr_val_3 = send_attr; @@ -4123,9 +4123,9 @@ void Attribute::fire_change_event(DevFailed *except) // Return allocated memory // - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) delete send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) delete send_attr_4; else delete send_attr; @@ -4147,7 +4147,7 @@ void Attribute::fire_change_event(DevFailed *except) } catch (...) { - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) delete send_attr_5; else if (send_attr_4 != NULL) delete send_attr_4; @@ -4200,9 +4200,9 @@ void Attribute::fire_archive_event(DevFailed *except) // Check if it is needed to send an event // - Tango::AttributeValue_3 *send_attr = Tango_nullptr; - Tango::AttributeValue_4 *send_attr_4 = Tango_nullptr; - Tango::AttributeValue_5 *send_attr_5 = Tango_nullptr; + Tango::AttributeValue_3 *send_attr = nullptr; + Tango::AttributeValue_4 *send_attr_4 = nullptr; + Tango::AttributeValue_5 *send_attr_5 = nullptr; try { @@ -4393,9 +4393,9 @@ void Attribute::fire_archive_event(DevFailed *except) if ( except == NULL ) { - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) Attribute_2_AttributeValue(send_attr_5,dev); - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) Attribute_2_AttributeValue(send_attr_4,dev); else Attribute_2_AttributeValue(send_attr,dev); @@ -4408,9 +4408,9 @@ void Attribute::fire_archive_event(DevFailed *except) EventSupplier::SuppliedEventData ad; ::memset(&ad,0,sizeof(ad)); - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) ad.attr_val_5 = send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) ad.attr_val_4 = send_attr_4; else ad.attr_val_3 = send_attr; @@ -4499,12 +4499,12 @@ void Attribute::fire_archive_event(DevFailed *except) { Tango::AttrQuality the_quality; - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) { prev_archive_event.value_4 = send_attr_5->value; the_quality = send_attr_5->quality; } - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) { prev_archive_event.value_4 = send_attr_4->value; the_quality = send_attr_4->quality; @@ -4563,9 +4563,9 @@ void Attribute::fire_archive_event(DevFailed *except) } } - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) delete send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) delete send_attr_4; else delete send_attr; @@ -4587,9 +4587,9 @@ void Attribute::fire_archive_event(DevFailed *except) } catch (...) { - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) delete send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) delete send_attr_4; else delete send_attr; @@ -4638,9 +4638,9 @@ void Attribute::fire_event(std::vector &filt_names,std::vector &filt_names,std::vector &filt_names,std::vector &filt_names,std::vectorpush_event_loop(dev,USER_EVENT,filt_names,filt_vals,filterable_names_lg,filterable_data_lg,ad,*this,except); } - if (send_attr_5 != Tango_nullptr) + if (send_attr_5 != nullptr) delete send_attr_5; - else if (send_attr_4 != Tango_nullptr) + else if (send_attr_4 != nullptr) delete send_attr_4; else delete send_attr; @@ -4873,9 +4873,9 @@ void Attribute::fire_event(std::vector &filt_names,std::vector -inline AttrProp::AttrProp(const DevUChar &value) : val(value), is_value(true), ext(Tango_nullptr) +inline AttrProp::AttrProp(const DevUChar &value) : val(value), is_value(true), ext(nullptr) { TangoSys_MemStream st; st.precision(TANGO_FLOAT_PRECISION); diff --git a/cppapi/server/basiccommand.cpp b/cppapi/server/basiccommand.cpp index 0899523b1..d4c54e24c 100644 --- a/cppapi/server/basiccommand.cpp +++ b/cppapi/server/basiccommand.cpp @@ -212,13 +212,13 @@ CORBA::Any *DevInitCmd::execute(DeviceImpl *device, TANGO_UNUSED(const CORBA::An // Get device interface only if necessary (some client(s) listening on device interface change event) // - ZmqEventSupplier *event_supplier_zmq = Tango_nullptr; + ZmqEventSupplier *event_supplier_zmq = nullptr; event_supplier_zmq = Util::instance()->get_zmq_event_supplier(); DevIntr di; bool ev_client = false; - if (event_supplier_zmq != Tango_nullptr) + if (event_supplier_zmq != nullptr) { ev_client = event_supplier_zmq->any_dev_intr_client(device); } diff --git a/cppapi/server/command.cpp b/cppapi/server/command.cpp index 625dda1c9..3351aa944 100644 --- a/cppapi/server/command.cpp +++ b/cppapi/server/command.cpp @@ -673,86 +673,86 @@ namespace Tango { TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)()) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &)) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(Tango_nullptr), allowed_ptr(a) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)()) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &)) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(Tango_nullptr), allowed_ptr(a) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), const char *in_desc, const char *out_desc) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &), const char *in_desc, const char *out_desc) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(Tango_nullptr), + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &), std::string &in_desc, std::string &out_desc) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(Tango_nullptr), + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), std::string &in_desc, std::string &out_desc) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &), Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(Tango_nullptr), allowed_ptr(a) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &), Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(Tango_nullptr), allowed_ptr(a) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, level), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), const char *in_desc, const char *out_desc, Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } TemplCommand::TemplCommand(const char *s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &), const char *in_desc, const char *out_desc, Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(Tango_nullptr), + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), bool (DeviceImpl::*a)(const CORBA::Any &), std::string &in_desc, std::string &out_desc, Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(Tango_nullptr), + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(nullptr), allowed_ptr(a) { } TemplCommand::TemplCommand(std::string &s, void (DeviceImpl::*f)(), std::string &in_desc, std::string &out_desc, Tango::DispLevel level) - : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(Tango_nullptr) { + : Command(s, Tango::DEV_VOID, Tango::DEV_VOID, in_desc, out_desc, level), exe_ptr(f), ext(nullptr) { allowed_ptr = NULL; } diff --git a/cppapi/server/command.h b/cppapi/server/command.h index 4f6eba850..030b24940 100644 --- a/cppapi/server/command.h +++ b/cppapi/server/command.h @@ -1265,7 +1265,7 @@ class TemplCommand:public Command * * The default constructor */ - TemplCommand():ext(Tango_nullptr) {} + TemplCommand():ext(nullptr) {} /** * Constructs a newly allocated TemplCommand object for a command with a @@ -1983,7 +1983,7 @@ class TemplCommandInOut:public TemplCommand template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG)) -:TemplCommand(s),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -1991,7 +1991,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &)) -:TemplCommand(s),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -1999,7 +1999,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG)) -:TemplCommand(s),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2007,7 +2007,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &)) -:TemplCommand(s),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2015,7 +2015,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),const char *in_desc,const char *out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2023,7 +2023,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),const char *in_desc,const char *out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2031,7 +2031,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),std::string &in_desc,std::string &out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2039,7 +2039,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),std::string &in_desc,std::string &out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2047,7 +2047,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2055,7 +2055,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2063,7 +2063,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2071,7 +2071,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2079,7 +2079,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),const char *in_desc,const char *out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2087,7 +2087,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),const char *in_desc,const char *out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2095,7 +2095,7 @@ TemplCommandInOut::TemplCommandInOut(const char *s,OUTARG (DeviceI template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),std::string &in_desc,std::string &out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2103,7 +2103,7 @@ TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (Device template TemplCommandInOut::TemplCommandInOut(std::string &s,OUTARG (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),std::string &in_desc,std::string &out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_inout(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2534,7 +2534,7 @@ class TemplCommandIn:public TemplCommand template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG)) -:TemplCommand(s),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2542,7 +2542,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &)) -:TemplCommand(s),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2550,7 +2550,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG)) -:TemplCommand(s),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2558,7 +2558,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &)) -:TemplCommand(s),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2566,7 +2566,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),const char *in_desc,const char *out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2574,7 +2574,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),const char *in_desc,const char *out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2582,7 +2582,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),std::string &in_desc,std::string &out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2590,7 +2590,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),std::string &in_desc,std::string &out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2598,7 +2598,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2606,7 +2606,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2614,7 +2614,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2622,7 +2622,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2630,7 +2630,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),const char *in_desc,const char *out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2638,7 +2638,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),const char *in_desc,const char *out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -2646,7 +2646,7 @@ TemplCommandIn::TemplCommandIn(const char *s,void (DeviceImpl::*f)(INARG) template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),std::string &in_desc,std::string &out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -2654,7 +2654,7 @@ TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG template TemplCommandIn::TemplCommandIn(std::string &s,void (DeviceImpl::*f)(INARG),bool (DeviceImpl::*a)(const CORBA::Any &),std::string &in_desc,std::string &out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_in(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3064,7 +3064,7 @@ class TemplCommandOut:public TemplCommand template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)()) -:TemplCommand(s),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3072,7 +3072,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &)) -:TemplCommand(s),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3080,7 +3080,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)()) -:TemplCommand(s),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3088,7 +3088,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &)) -:TemplCommand(s),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3096,7 +3096,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),const char *in_desc,const char *out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3104,7 +3104,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &),const char *in_desc,const char *out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3112,7 +3112,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),std::string &in_desc,std::string &out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3120,7 +3120,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &),std::string &in_desc,std::string &out_desc) -:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3128,7 +3128,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3136,7 +3136,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3144,7 +3144,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3152,7 +3152,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &),Tango::DispLevel level) -:TemplCommand(s,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3160,7 +3160,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),const char *in_desc,const char *out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3168,7 +3168,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &),const char *in_desc,const char *out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); @@ -3176,7 +3176,7 @@ TemplCommandOut::TemplCommandOut(const char *s,OUTARG (DeviceImpl::*f)() template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),std::string &in_desc,std::string &out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = NULL; init_types(); @@ -3184,7 +3184,7 @@ TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)( template TemplCommandOut::TemplCommandOut(std::string &s,OUTARG (DeviceImpl::*f)(),bool (DeviceImpl::*a)(const CORBA::Any &),std::string &in_desc,std::string &out_desc,Tango::DispLevel level) -:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(Tango_nullptr) +:TemplCommand(s,in_desc,out_desc,level),exe_ptr_out(f),ext(nullptr) { allowed_ptr = a; init_types(); diff --git a/cppapi/server/device.cpp b/cppapi/server/device.cpp index e230a3916..db9472e63 100644 --- a/cppapi/server/device.cpp +++ b/cppapi/server/device.cpp @@ -86,7 +86,7 @@ DeviceImpl::DeviceImpl(DeviceClass *cl_ptr, const char *d_name, state_from_read(false), py_device(false), device_locked(false), locker_client(NULL), old_locker_client(NULL), lock_ctr(0), min_poll_period(0), run_att_conf_loop(true), force_alarm_state(false), with_fwd_att(false), - event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(Tango_nullptr) + event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(nullptr) { real_ctor(); } @@ -104,7 +104,7 @@ DeviceImpl::DeviceImpl(DeviceClass *cl_ptr, std::string &d_name, std::string &de state_from_read(false), py_device(false), device_locked(false), locker_client(NULL), old_locker_client(NULL), lock_ctr(0), min_poll_period(0), run_att_conf_loop(true), force_alarm_state(false), with_fwd_att(false), - event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(Tango_nullptr) + event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(nullptr) { real_ctor(); } @@ -120,7 +120,7 @@ DeviceImpl::DeviceImpl(DeviceClass *cl_ptr, std::string &d_name) state_from_read(false), py_device(false), device_locked(false), locker_client(NULL), old_locker_client(NULL), lock_ctr(0), min_poll_period(0), run_att_conf_loop(true), force_alarm_state(false), with_fwd_att(false), - event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(Tango_nullptr) + event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(nullptr) { desc = "A Tango device"; device_state = Tango::UNKNOWN; @@ -140,7 +140,7 @@ DeviceImpl::DeviceImpl(DeviceClass *cl_ptr, std::string &d_name, std::string &de state_from_read(false), py_device(false), device_locked(false), locker_client(NULL), old_locker_client(NULL), lock_ctr(0), min_poll_period(0), run_att_conf_loop(true), force_alarm_state(false), with_fwd_att(false), - event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(Tango_nullptr) + event_intr_change_subscription(0), intr_change_ev(false), devintr_thread(nullptr) { desc = description; device_state = Tango::UNKNOWN; @@ -5243,7 +5243,7 @@ void DeviceImpl::data_into_net_object(Attribute &att, AttributeIdlData &aid, case Tango::DEV_ENCODED : { - if (aid.data_3 != Tango_nullptr) + if (aid.data_3 != nullptr) { (*aid.data_3)[index].err_list.length(1); (*aid.data_3)[index].err_list[0].severity = Tango::ERR; @@ -5258,7 +5258,7 @@ void DeviceImpl::data_into_net_object(Attribute &att, AttributeIdlData &aid, else { Tango::DevVarEncodedArray *ptr = att.get_encoded_value(); - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { (*aid.data_5)[index].value.encoded_att_value(dummy_encoded_att_value); DevVarEncodedArray &the_seq = (*aid.data_5)[index].value.encoded_att_value(); @@ -5442,7 +5442,7 @@ void DeviceImpl::polled_data_into_net_object(AttributeIdlData &aid, break; case Tango::DEV_STATE : - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { AttributeValue_5 &att_val = polled_att->get_last_attr_value_5(false); if (att_val.value._d() == DEVICE_STATE) @@ -5456,7 +5456,7 @@ void DeviceImpl::polled_data_into_net_object(AttributeIdlData &aid, (*aid.data_5)[index].value.state_att_value(union_seq); } } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if (vers >= 5) { @@ -5548,7 +5548,7 @@ void DeviceImpl::polled_data_into_net_object(AttributeIdlData &aid, break; case Tango::DEV_ENCODED: - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { AttributeValue_5 &att_val = polled_att->get_last_attr_value_5(false); DevVarEncodedArray &polled_seq = att_val.value.encoded_att_value(); @@ -5567,7 +5567,7 @@ void DeviceImpl::polled_data_into_net_object(AttributeIdlData &aid, the_seq[loop].encoded_data.replace(nb_data, nb_data, tmp_enc); } } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if (vers == 5) { diff --git a/cppapi/server/device.h b/cppapi/server/device.h index 6987c125f..ed856a49b 100644 --- a/cppapi/server/device.h +++ b/cppapi/server/device.h @@ -3606,12 +3606,12 @@ inline void DeviceImpl::set_state(const Tango::DevState &new_state) #define DATA_IN_NET_OBJECT(A,B,C,D,E) \ do \ { \ - if (aid.data_5 != Tango_nullptr) \ + if (aid.data_5 != nullptr) \ { \ AttributeValue_5 &att_val = polled_att->get_last_attr_value_5(false); \ (*aid.data_5)[index].value.A(att_val.value.A()); \ } \ - else if (aid.data_4 != Tango_nullptr) \ + else if (aid.data_4 != nullptr) \ { \ if (vers >= 5) \ { \ @@ -3664,7 +3664,7 @@ inline void DeviceImpl::set_state(const Tango::DevState &new_state) do \ { \ Tango::A *ptr = att.B(); \ - if (aid.data_5 != Tango_nullptr) \ + if (aid.data_5 != nullptr) \ { \ (*aid.data_5)[index].value.D(C); \ A &the_seq = (*aid.data_5)[index].value.D(); \ @@ -3672,7 +3672,7 @@ inline void DeviceImpl::set_state(const Tango::DevState &new_state) if (ptr->release() == true) \ ptr->get_buffer(true); \ } \ - else if (aid.data_4 != Tango_nullptr) \ + else if (aid.data_4 != nullptr) \ { \ (*aid.data_4)[index].value.D(C); \ A &the_seq = (*aid.data_4)[index].value.D(); \ diff --git a/cppapi/server/device_2.cpp b/cppapi/server/device_2.cpp index 9cd77aa47..77fbea2da 100644 --- a/cppapi/server/device_2.cpp +++ b/cppapi/server/device_2.cpp @@ -68,7 +68,7 @@ namespace Tango //-------------------------------------------------------------------------- Device_2Impl::Device_2Impl(DeviceClass *device_class,std::string &dev_name): -DeviceImpl(device_class,dev_name),ext_2(Tango_nullptr) +DeviceImpl(device_class,dev_name),ext_2(nullptr) { idl_version = 2; } @@ -76,7 +76,7 @@ DeviceImpl(device_class,dev_name),ext_2(Tango_nullptr) Device_2Impl::Device_2Impl(DeviceClass *device_class, std::string &dev_name, std::string &desc): -DeviceImpl(device_class,dev_name,desc),ext_2(Tango_nullptr) +DeviceImpl(device_class,dev_name,desc),ext_2(nullptr) { idl_version = 2; } @@ -84,7 +84,7 @@ DeviceImpl(device_class,dev_name,desc),ext_2(Tango_nullptr) Device_2Impl::Device_2Impl(DeviceClass *device_class, std::string &dev_name,std::string &desc, Tango::DevState dev_state,std::string &dev_status): -DeviceImpl(device_class,dev_name,desc,dev_state,dev_status),ext_2(Tango_nullptr) +DeviceImpl(device_class,dev_name,desc,dev_state,dev_status),ext_2(nullptr) { idl_version = 2; } @@ -94,7 +94,7 @@ Device_2Impl::Device_2Impl(DeviceClass *device_class, const char *desc, Tango::DevState dev_state, const char *dev_status): -DeviceImpl(device_class,dev_name,desc,dev_state,dev_status),ext_2(Tango_nullptr) +DeviceImpl(device_class,dev_name,desc,dev_state,dev_status),ext_2(nullptr) { idl_version = 2; } @@ -1125,7 +1125,7 @@ Tango::DevCmdInfo_2 *Device_2Impl::command_query_2(const char *command) long i; bool found = false; - Command *cmd_ptr = Tango_nullptr; + Command *cmd_ptr = nullptr; long nb_cmd = device_class->get_command_list().size(); for (i = 0;i < nb_cmd;i++) { diff --git a/cppapi/server/device_3.cpp b/cppapi/server/device_3.cpp index 7ab6d9c61..ae028bc15 100644 --- a/cppapi/server/device_3.cpp +++ b/cppapi/server/device_3.cpp @@ -442,9 +442,9 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam else index = idx[i]; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) error_from_devfailed((*aid.data_5)[index],e,names[i]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) error_from_devfailed((*aid.data_4)[index],e,names[i]); else error_from_devfailed((*aid.data_3)[index],e,names[i]); @@ -516,7 +516,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam // Take the attribute mutex before calling the user read method // - if ((att.get_attr_serial_model() == ATTR_BY_KERNEL) && (aid.data_4 != Tango_nullptr || aid.data_5 != Tango_nullptr)) + if ((att.get_attr_serial_model() == ATTR_BY_KERNEL) && (aid.data_4 != nullptr || aid.data_5 != nullptr)) { cout4 << "Locking attribute mutex for attribute " << att.get_name() << std::endl; omni_mutex *attr_mut = att.get_attr_mutex(); @@ -565,7 +565,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam wanted_attr[i].failed = true; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if ((att.get_attr_serial_model() == ATTR_BY_KERNEL) && (is_allowed_failed == false)) { @@ -575,7 +575,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } error_from_devfailed((*aid.data_5)[index],e,names[wanted_attr[i].idx_in_names]); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if ((att.get_attr_serial_model() == ATTR_BY_KERNEL) && (is_allowed_failed == false)) { @@ -605,7 +605,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam del[0].reason = Tango::string_dup("API_CorbaSysException "); del[0].desc = Tango::string_dup("Unforseen exception when trying to read attribute. It was even not a Tango DevFailed exception"); - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if ((att.get_attr_serial_model() == ATTR_BY_KERNEL) && (is_allowed_failed == false)) { @@ -615,7 +615,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } error_from_errorlist((*aid.data_5)[index],del,names[wanted_attr[i].idx_in_names]); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if ((att.get_attr_serial_model() == ATTR_BY_KERNEL) && (is_allowed_failed == false)) { @@ -669,7 +669,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam wanted_w_attr[i].failed = true; AttrSerialModel atsm = att.get_attr_serial_model(); - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if ((atsm != ATTR_NO_SYNC) && (w_type == Tango::READ_WITH_WRITE)) { @@ -679,7 +679,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } error_from_devfailed((*aid.data_5)[index],e,names[wanted_w_attr[i].idx_in_names]); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if ((atsm != ATTR_NO_SYNC) && (w_type == Tango::READ_WITH_WRITE)) { @@ -701,7 +701,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam // Tango::DevState d_state = Tango::UNKNOWN; - Tango::ConstDevString d_status = Tango_nullptr; + Tango::ConstDevString d_status = nullptr; if (state_wanted == true) { @@ -722,9 +722,9 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam catch (Tango::DevFailed &e) { state_from_read = false; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) error_from_devfailed((*aid.data_5)[state_idx],e,names[state_idx]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) error_from_devfailed((*aid.data_4)[state_idx],e,names[state_idx]); else error_from_devfailed((*aid.data_3)[state_idx],e,names[state_idx]); @@ -732,9 +732,9 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } else { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) error_from_errorlist((*aid.data_5)[state_idx],(*aid.data_5)[wanted_attr[id].idx_in_names].err_list,names[state_idx]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) error_from_errorlist((*aid.data_4)[state_idx],(*aid.data_4)[wanted_attr[id].idx_in_names].err_list,names[state_idx]); else error_from_errorlist((*aid.data_3)[state_idx],(*aid.data_3)[wanted_attr[id].idx_in_names].err_list,names[state_idx]); @@ -752,9 +752,9 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } catch (Tango::DevFailed &e) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) error_from_devfailed((*aid.data_5)[status_idx],e,names[status_idx]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) error_from_devfailed((*aid.data_4)[status_idx],e,names[status_idx]); else error_from_devfailed((*aid.data_3)[status_idx],e,names[status_idx]); @@ -775,21 +775,21 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam index = idx[i]; unsigned long nb_err; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) nb_err = (*aid.data_5)[index].err_list.length(); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) nb_err = (*aid.data_4)[index].err_list.length(); else nb_err = (*aid.data_3)[index].err_list.length(); if ((state_wanted == true) && (state_idx == i)) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if (nb_err == 0) state2attr(d_state,(*aid.data_5)[index]); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if (nb_err == 0) state2attr(d_state,(*aid.data_4)[index]); @@ -804,12 +804,12 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam if ((status_wanted == true) && (status_idx == i)) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if (nb_err == 0) status2attr(d_status,(*aid.data_5)[index]); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if (nb_err == 0) status2attr(d_status,(*aid.data_4)[index]); @@ -916,7 +916,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam att.set_time(); AttrSerialModel atsm = att.get_attr_serial_model(); - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if ((atsm != ATTR_NO_SYNC) && ((att.is_fwd_att() == true) || (w_type != Tango::WRITE))) { @@ -930,7 +930,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam (*aid.data_5)[index].data_format = att.get_data_format(); (*aid.data_5)[index].data_type = att.get_data_type(); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if ((atsm != ATTR_NO_SYNC) && ((att.is_fwd_att() == true) || (w_type != Tango::WRITE))) { @@ -950,7 +950,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } catch (Tango::DevFailed &e) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { cout4 << "Asking CORBA structure to release attribute mutex for attribute " << att.get_name() << std::endl; if (att.get_writable() != Tango::WRITE) @@ -959,7 +959,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam } error_from_devfailed((*aid.data_5)[index],e,att.get_name().c_str()); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { cout4 << "Asking CORBA structure to release attribute mutex for attribute " << att.get_name() << std::endl; if (att.get_writable() != Tango::WRITE) @@ -982,7 +982,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam AttrSerialModel atsm = att.get_attr_serial_model(); - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if ((atsm != ATTR_NO_SYNC) && (att.get_writable() != Tango::WRITE)) { @@ -995,7 +995,7 @@ void Device_3Impl::read_attributes_no_except(const Tango::DevVarStringArray& nam (*aid.data_5)[index].data_format = att.get_data_format(); (*aid.data_5)[index].data_type = att.get_data_type(); } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if ((atsm != ATTR_NO_SYNC) && (att.get_writable() != Tango::WRITE)) { @@ -1091,9 +1091,9 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na } catch (Tango::DevFailed &e) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) error_from_devfailed((*aid.data_5)[i],e,names[i]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) error_from_devfailed((*aid.data_4)[i],e,names[i]); else error_from_devfailed((*aid.data_3)[i],e,names[i]); @@ -1156,12 +1156,12 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na for (i = 0;i < nb_names;i++) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { if ((*aid.data_5)[i].err_list.length() != 0) continue; } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if ((*aid.data_4)[i].err_list.length() != 0) continue; @@ -1204,12 +1204,12 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na const char *ori = "Device_3Impl::read_attributes_from_cache"; const char *reas = API_NoDataYet; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { one_error((*aid.data_5)[i],reas,ori,s,names[i]); (*aid.data_5)[i].data_format = FMT_UNKNOWN; } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { one_error((*aid.data_4)[i],reas,ori,s,names[i]); (*aid.data_4)[i].data_format = FMT_UNKNOWN; @@ -1233,9 +1233,9 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na const char *ori = "Device_3Impl::read_attributes_from_cache"; const char *reas = API_NoDataYet; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) one_error((*aid.data_5)[i],reas,ori,s,names[i]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) one_error((*aid.data_4)[i],reas,ori,s,names[i]); else one_error((*aid.data_3)[i],reas,ori,s,names[i]); @@ -1274,9 +1274,9 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na const char *ori = "Device_3Impl::read_attributes_from_cache"; const char *reas = API_NotUpdatedAnyMore; - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) one_error((*aid.data_5)[i],reas,ori,s,names[i]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) one_error((*aid.data_4)[i],reas,ori,s,names[i]); else one_error((*aid.data_3)[i],reas,ori,s,names[i]); @@ -1341,14 +1341,14 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na // Init remaining structure members according to IDL client (aid.xxxx) and IDL device (vers) // - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) { AttributeValue_5 &att_val = polled_attr->get_last_attr_value_5(false); init_polled_out_data((*aid.data_5)[i],att_val); (*aid.data_5)[i].data_format = att_val.data_format; (*aid.data_5)[i].data_type = att_val.data_type; } - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) { if (vers >= 5) { @@ -1385,9 +1385,9 @@ void Device_3Impl::read_attributes_from_cache(const Tango::DevVarStringArray& na } catch (Tango::DevFailed &e) { - if (aid.data_5 != Tango_nullptr) + if (aid.data_5 != nullptr) error_from_devfailed((*aid.data_5)[i],e,names[i]); - else if (aid.data_4 != Tango_nullptr) + else if (aid.data_4 != nullptr) error_from_devfailed((*aid.data_4)[i],e,names[i]); else error_from_devfailed((*aid.data_3)[i],e,names[i]); diff --git a/cppapi/server/device_4.cpp b/cppapi/server/device_4.cpp index 5822c943d..458c9a4fe 100644 --- a/cppapi/server/device_4.cpp +++ b/cppapi/server/device_4.cpp @@ -84,7 +84,7 @@ namespace Tango //-------------------------------------------------------------------------- Device_4Impl::Device_4Impl(DeviceClass *device_class,std::string &dev_name): -Device_3Impl(device_class,dev_name),ext_4(Tango_nullptr) +Device_3Impl(device_class,dev_name),ext_4(nullptr) { idl_version = 4; } @@ -92,7 +92,7 @@ Device_3Impl(device_class,dev_name),ext_4(Tango_nullptr) Device_4Impl::Device_4Impl(DeviceClass *device_class, std::string &dev_name, std::string &desc): -Device_3Impl(device_class,dev_name,desc),ext_4(Tango_nullptr) +Device_3Impl(device_class,dev_name,desc),ext_4(nullptr) { idl_version = 4; } @@ -100,7 +100,7 @@ Device_3Impl(device_class,dev_name,desc),ext_4(Tango_nullptr) Device_4Impl::Device_4Impl(DeviceClass *device_class, std::string &dev_name,std::string &desc, Tango::DevState dev_state,std::string &dev_status): -Device_3Impl(device_class,dev_name,desc,dev_state,dev_status),ext_4(Tango_nullptr) +Device_3Impl(device_class,dev_name,desc,dev_state,dev_status),ext_4(nullptr) { idl_version = 4; } @@ -110,7 +110,7 @@ Device_4Impl::Device_4Impl(DeviceClass *device_class, const char *desc, Tango::DevState dev_state, const char *dev_status): -Device_3Impl(device_class,dev_name,desc,dev_state,dev_status),ext_4(Tango_nullptr) +Device_3Impl(device_class,dev_name,desc,dev_state,dev_status),ext_4(nullptr) { idl_version = 4; } diff --git a/cppapi/server/device_5.cpp b/cppapi/server/device_5.cpp index decf51652..25c5811fd 100644 --- a/cppapi/server/device_5.cpp +++ b/cppapi/server/device_5.cpp @@ -78,7 +78,7 @@ namespace Tango //-------------------------------------------------------------------------------------------------------------------- Device_5Impl::Device_5Impl(DeviceClass *device_class,std::string &dev_name): -Device_4Impl(device_class,dev_name),ext_5(Tango_nullptr) +Device_4Impl(device_class,dev_name),ext_5(nullptr) { idl_version = 5; } @@ -86,7 +86,7 @@ Device_4Impl(device_class,dev_name),ext_5(Tango_nullptr) Device_5Impl::Device_5Impl(DeviceClass *device_class, std::string &dev_name, std::string &desc): -Device_4Impl(device_class,dev_name,desc),ext_5(Tango_nullptr) +Device_4Impl(device_class,dev_name,desc),ext_5(nullptr) { idl_version = 5; } @@ -94,7 +94,7 @@ Device_4Impl(device_class,dev_name,desc),ext_5(Tango_nullptr) Device_5Impl::Device_5Impl(DeviceClass *device_class, std::string &dev_name,std::string &desc, Tango::DevState dev_state,std::string &dev_status): -Device_4Impl(device_class,dev_name,desc,dev_state,dev_status),ext_5(Tango_nullptr) +Device_4Impl(device_class,dev_name,desc,dev_state,dev_status),ext_5(nullptr) { idl_version = 5; } @@ -104,7 +104,7 @@ Device_5Impl::Device_5Impl(DeviceClass *device_class, const char *desc, Tango::DevState dev_state, const char *dev_status): -Device_4Impl(device_class,dev_name,desc,dev_state,dev_status),ext_5(Tango_nullptr) +Device_4Impl(device_class,dev_name,desc,dev_state,dev_status),ext_5(nullptr) { idl_version = 5; } @@ -713,7 +713,7 @@ Tango::DevAttrHistory_5 *Device_5Impl::read_attribute_history_5(const char* name blackbox_ptr->insert_op(Op_Read_Attr_history_5); - Tango::DevAttrHistory_5 *back = Tango_nullptr; + Tango::DevAttrHistory_5 *back = nullptr; std::vector &poll_list = get_poll_obj_list(); long nb_poll = poll_list.size(); @@ -852,7 +852,7 @@ Tango::PipeConfigList *Device_5Impl::get_pipe_config_5(const Tango::DevVarString cout4 << "Device_5Impl::get_pipe_config_5 arrived" << std::endl; long nb_pipe = names.length(); - Tango::PipeConfigList *back = Tango_nullptr; + Tango::PipeConfigList *back = nullptr; bool all_pipe = false; // @@ -1045,7 +1045,7 @@ void Device_5Impl::set_pipe_config_5(const Tango::PipeConfigList& new_conf, Tango::DevPipeData *Device_5Impl::read_pipe_5(const char* name,const Tango::ClntIdent &cl_id) { cout4 << "Device_5Impl::read_pipe_5 arrived for pipe " << name << std::endl; - DevPipeData *back = Tango_nullptr; + DevPipeData *back = nullptr; // // Take dev monitor diff --git a/cppapi/server/dserver.cpp b/cppapi/server/dserver.cpp index 1f2652e0f..e4cb62686 100644 --- a/cppapi/server/dserver.cpp +++ b/cppapi/server/dserver.cpp @@ -875,10 +875,10 @@ void DServer::restart(std::string &d_name) if (dev_to_del->get_dev_idl_version() >= MIN_IDL_DEV_INTR) { - ZmqEventSupplier *event_supplier_zmq = Tango_nullptr; + ZmqEventSupplier *event_supplier_zmq = nullptr; event_supplier_zmq = Util::instance()->get_zmq_event_supplier(); - if (event_supplier_zmq != Tango_nullptr) + if (event_supplier_zmq != nullptr) ev_client = event_supplier_zmq->any_dev_intr_client(dev_to_del); if (ev_client == true) diff --git a/cppapi/server/dserverpoll.cpp b/cppapi/server/dserverpoll.cpp index 100259b10..fa567abed 100644 --- a/cppapi/server/dserverpoll.cpp +++ b/cppapi/server/dserverpoll.cpp @@ -1429,7 +1429,7 @@ void DServer::rem_obj_polling(const Tango::DevVarStringArray *argin,bool with_db std::vector::iterator ite = dev->get_polled_obj_by_type_name(type,obj_name); long tmp_upd = (*ite)->get_upd(); - PollingThreadInfo *th_info = Tango_nullptr; + PollingThreadInfo *th_info = nullptr; int poll_th_id = 0; int th_id = omni_thread::self()->id(); diff --git a/cppapi/server/encoded_attribute.cpp b/cppapi/server/encoded_attribute.cpp index 6f3862675..4e34de05f 100644 --- a/cppapi/server/encoded_attribute.cpp +++ b/cppapi/server/encoded_attribute.cpp @@ -41,7 +41,7 @@ using namespace Tango; // ---------------------------------------------------------------------------- -EncodedAttribute::EncodedAttribute():manage_exclusion(false),ext(Tango_nullptr) { +EncodedAttribute::EncodedAttribute():manage_exclusion(false),ext(nullptr) { buffer_array = (unsigned char **)calloc(1,sizeof(unsigned char *)); buffer_array[0] = NULL; @@ -53,7 +53,7 @@ EncodedAttribute::EncodedAttribute():manage_exclusion(false),ext(Tango_nullptr) buf_elt_nb = 1; } -EncodedAttribute::EncodedAttribute(int si,bool excl):manage_exclusion(excl),ext(Tango_nullptr) { +EncodedAttribute::EncodedAttribute(int si,bool excl):manage_exclusion(excl),ext(nullptr) { buffer_array = (unsigned char **)calloc(si,sizeof(unsigned char *)); buffSize_array = (int *)calloc(si,sizeof(int)); diff --git a/cppapi/server/eventcmds.cpp b/cppapi/server/eventcmds.cpp index be2738887..01564a15c 100644 --- a/cppapi/server/eventcmds.cpp +++ b/cppapi/server/eventcmds.cpp @@ -672,7 +672,7 @@ DevVarLongStringArray *DServer::zmq_event_subscription_change(const Tango::DevVa } Tango::Util *tg = Tango::Util::instance(); - Tango::DevVarLongStringArray *ret_data = Tango_nullptr; + Tango::DevVarLongStringArray *ret_data = nullptr; if (argin->length() == 1) { diff --git a/cppapi/server/eventsupplier.cpp b/cppapi/server/eventsupplier.cpp index d650e3b4a..3546a8a44 100644 --- a/cppapi/server/eventsupplier.cpp +++ b/cppapi/server/eventsupplier.cpp @@ -2643,14 +2643,14 @@ void EventSupplier::convert_att_event_to_5(struct EventSupplier::SuppliedEventDa struct EventSupplier::SuppliedEventData &sent_value, bool &need_free, Attribute &attr) { - if (attr_value.attr_val_3 != Tango_nullptr) + if (attr_value.attr_val_3 != nullptr) { AttributeValue_5 *tmp_attr_val_5 = new AttributeValue_5(); attr.AttributeValue_3_2_AttributeValue_5(attr_value.attr_val_3, tmp_attr_val_5); sent_value.attr_val_5 = tmp_attr_val_5; need_free = true; } - else if (attr_value.attr_val_4 != Tango_nullptr) + else if (attr_value.attr_val_4 != nullptr) { AttributeValue_5 *tmp_attr_val_5 = new AttributeValue_5(); attr.AttributeValue_4_2_AttributeValue_5(attr_value.attr_val_4, tmp_attr_val_5); @@ -2667,14 +2667,14 @@ void EventSupplier::convert_att_event_to_4(struct EventSupplier::SuppliedEventDa struct EventSupplier::SuppliedEventData &sent_value, bool &need_free, Attribute &attr) { - if (attr_value.attr_val_3 != Tango_nullptr) + if (attr_value.attr_val_3 != nullptr) { AttributeValue_4 *tmp_attr_val_4 = new AttributeValue_4(); attr.AttributeValue_3_2_AttributeValue_4(attr_value.attr_val_3, tmp_attr_val_4); sent_value.attr_val_4 = tmp_attr_val_4; need_free = true; } - else if (attr_value.attr_val_5 != Tango_nullptr) + else if (attr_value.attr_val_5 != nullptr) { AttributeValue_4 *tmp_attr_val_4 = new AttributeValue_4(); attr.AttributeValue_5_2_AttributeValue_4(attr_value.attr_val_5, tmp_attr_val_4); @@ -2691,14 +2691,14 @@ void EventSupplier::convert_att_event_to_3(struct EventSupplier::SuppliedEventDa struct EventSupplier::SuppliedEventData &sent_value, bool &need_free, Attribute &attr) { - if (attr_value.attr_val_4 != Tango_nullptr) + if (attr_value.attr_val_4 != nullptr) { AttributeValue_3 *tmp_attr_val_3 = new AttributeValue_3(); attr.AttributeValue_4_2_AttributeValue_3(attr_value.attr_val_4, tmp_attr_val_3); sent_value.attr_val_3 = tmp_attr_val_3; need_free = true; } - else if (attr_value.attr_val_5 != Tango_nullptr) + else if (attr_value.attr_val_5 != nullptr) { AttributeValue_3 *tmp_attr_val_3 = new AttributeValue_3(); attr.AttributeValue_5_2_AttributeValue_3(attr_value.attr_val_5, tmp_attr_val_3); diff --git a/cppapi/server/fwdattrdesc.cpp b/cppapi/server/fwdattrdesc.cpp index c81bfcd76..308adc048 100644 --- a/cppapi/server/fwdattrdesc.cpp +++ b/cppapi/server/fwdattrdesc.cpp @@ -60,7 +60,7 @@ namespace Tango FwdAttr::FwdAttr(const std::string &att_name,const std::string &root_attribute): -ImageAttr(att_name.c_str()),full_root_att(root_attribute),fwd_wrongly_conf(false),err_kind(FWD_ERR_UNKNOWN),ext(Tango_nullptr) +ImageAttr(att_name.c_str()),full_root_att(root_attribute),fwd_wrongly_conf(false),err_kind(FWD_ERR_UNKNOWN),ext(nullptr) { writable = Tango::READ; // Difficult to switch it to WT_UNKNOWN // type = DATA_TYPE_UNKNOWN; @@ -160,7 +160,7 @@ bool FwdAttr::validate_fwd_att(std::vector &prop_list,const std::s try { - if (db != Tango_nullptr) + if (db != nullptr) db->put_device_attribute_property(dev_name,db_dat); } catch(...) {} @@ -185,7 +185,7 @@ bool FwdAttr::validate_fwd_att(std::vector &prop_list,const std::s // std::string fq; - if (db != Tango_nullptr) + if (db != nullptr) { fq = "tango://"; std::string &h = db->get_db_host(); diff --git a/cppapi/server/fwdattrdesc.h b/cppapi/server/fwdattrdesc.h index 1c778e96c..a5e25814a 100644 --- a/cppapi/server/fwdattrdesc.h +++ b/cppapi/server/fwdattrdesc.h @@ -62,7 +62,7 @@ class UserDefaultFwdAttrProp /** * Constructs a newly allocated UserDefaultAttrProp object. */ - UserDefaultFwdAttrProp():ext(Tango_nullptr) {} + UserDefaultFwdAttrProp():ext(nullptr) {} //@} /**@name Set default property methods */ diff --git a/cppapi/server/fwdattribute.cpp b/cppapi/server/fwdattribute.cpp index 6738d7042..681a72236 100644 --- a/cppapi/server/fwdattribute.cpp +++ b/cppapi/server/fwdattribute.cpp @@ -649,7 +649,7 @@ void FwdAttribute::upd_att_config(const Tango::AttributeConfig_5 &conf) // Send new config to root attribute if received configuration if different than the one we already have // - if (new_att_conf(Tango_nullptr,&conf) == true) + if (new_att_conf(nullptr,&conf) == true) { AttributeInfoListEx aile; AttributeInfoEx aie; @@ -676,7 +676,7 @@ void FwdAttribute::upd_att_config(const Tango::AttributeConfig_3 &conf) // Send new config to root attribute if received configuration if different than the one we already have // - if (new_att_conf(&conf,Tango_nullptr) == true) + if (new_att_conf(&conf,nullptr) == true) { AttributeInfoListEx aile; AttributeInfoEx aie; @@ -714,7 +714,7 @@ bool FwdAttribute::new_att_conf(const Tango::AttributeConfig_3 *conf3,const Tang { bool ret = false; - if (conf3 != Tango_nullptr) + if (conf3 != nullptr) { ret = new_att_conf_base(*conf3); } @@ -909,7 +909,7 @@ DevAttrHistory_5 *FwdAttribute::read_root_att_history(long n) // Get data from root device (Reminder: we don't use the classical API. See above) // - DevAttrHistory_5 *hist_5 = Tango_nullptr; + DevAttrHistory_5 *hist_5 = nullptr; int ctr = 0; while (ctr < 2) @@ -1013,7 +1013,7 @@ AttributeValueList_5 *FwdAttribute::write_read_root_att(Tango::AttributeValueLis dvsa[0] = Tango::string_dup(get_fwd_att_name().c_str()); int ctr = 0; - AttributeValueList_5 *attr_value_list_5 = Tango_nullptr; + AttributeValueList_5 *attr_value_list_5 = nullptr; Tango::AccessControlType local_act; while (ctr < 2) diff --git a/cppapi/server/notifdeventsupplier.cpp b/cppapi/server/notifdeventsupplier.cpp index d10999580..01f7d5f8c 100644 --- a/cppapi/server/notifdeventsupplier.cpp +++ b/cppapi/server/notifdeventsupplier.cpp @@ -852,7 +852,7 @@ void NotifdEventSupplier::push_event(DeviceImpl *device_impl,std::string event_t // If we are called for IDL 5 (AttributeValue_5 or AttributeConfig_5), simply return. IDL 5 is only for ZMQ // - if (attr_value.attr_conf_5 != Tango_nullptr || attr_value.attr_val_5 != Tango_nullptr) + if (attr_value.attr_conf_5 != nullptr || attr_value.attr_val_5 != nullptr) return; // get the mutex to synchronize the sending of events diff --git a/cppapi/server/pipe.cpp b/cppapi/server/pipe.cpp index afdb386af..18a7adbab 100644 --- a/cppapi/server/pipe.cpp +++ b/cppapi/server/pipe.cpp @@ -836,7 +836,7 @@ void Pipe::fire_event(DeviceImpl *dev,DevicePipeBlob *p_data,struct timeval &t,b ad.pipe_val->data_blob.name = bl_name.c_str(); DevVarPipeDataEltArray *tmp_ptr = p_data->get_insert_data(); - if (tmp_ptr == Tango_nullptr) + if (tmp_ptr == nullptr) { Except::throw_exception(API_PipeNoDataElement,"No data in DevicePipeBlob!","Pipe::fire_event()"); } diff --git a/cppapi/server/pipedesc.h b/cppapi/server/pipedesc.h index 6d53fb24c..0314cc7ed 100644 --- a/cppapi/server/pipedesc.h +++ b/cppapi/server/pipedesc.h @@ -62,7 +62,7 @@ class UserDefaultPipeProp /** * Constructs a newly allocated UserDefaultPipeProp object. */ - UserDefaultPipeProp():ext(Tango_nullptr) {} + UserDefaultPipeProp():ext(nullptr) {} //@} /**@name Set default property methods */ diff --git a/cppapi/server/pollring.tpp b/cppapi/server/pollring.tpp index 3f070c902..b4442317c 100644 --- a/cppapi/server/pollring.tpp +++ b/cppapi/server/pollring.tpp @@ -235,7 +235,7 @@ void PollRing::get_attr_history(long n,T *ptr,long type) long error_nb = 0; long vers; - if (ring[index].attr_value_4 == Tango_nullptr) + if (ring[index].attr_value_4 == nullptr) vers = 5; else vers = 4; diff --git a/cppapi/server/rootattreg.cpp b/cppapi/server/rootattreg.cpp index a333df96a..f02970199 100644 --- a/cppapi/server/rootattreg.cpp +++ b/cppapi/server/rootattreg.cpp @@ -74,7 +74,7 @@ void RootAttRegistry::RootAttConfCallBack::push_event(Tango::AttrConfEventData * ite = map_attrdesc.find(att_name); if (ite != map_attrdesc.end()) { - if (ite->second.fwd_attr == Tango_nullptr || ite->second.fwd_attr_cl == Tango_nullptr) + if (ite->second.fwd_attr == nullptr || ite->second.fwd_attr_cl == nullptr) { // // Event received while everything is OK for the fwd attribute @@ -90,7 +90,7 @@ void RootAttRegistry::RootAttConfCallBack::push_event(Tango::AttrConfEventData * else { Device_5Impl *the_dev = static_cast(ite3->second); - if (the_dev != Tango_nullptr) + if (the_dev != nullptr) { // @@ -100,7 +100,7 @@ void RootAttRegistry::RootAttConfCallBack::push_event(Tango::AttrConfEventData * FwdAttrConfEventData *ev_fwd = static_cast(ev); AttributeConfig_5 *ptr = const_cast(ev_fwd->get_fwd_attr_conf()); - if (ptr == Tango_nullptr) + if (ptr == nullptr) { ptr = AttributeConfigList_5::allocbuf(1); ApiUtil::AttributeInfoEx_to_AttributeConfig(ev->attr_conf,ptr); @@ -165,7 +165,7 @@ void RootAttRegistry::RootAttConfCallBack::push_event(Tango::AttrConfEventData * MultiAttribute *m_att = the_dev->get_device_attr(); m_att->update(the_fwd_att,ite->second.local_name); - ite->second.fwd_attr = Tango_nullptr; + ite->second.fwd_attr = nullptr; the_dev->rem_wrong_fwd_att(att_name); the_dev->set_run_att_conf_loop(true); @@ -217,7 +217,7 @@ void RootAttRegistry::RootAttConfCallBack::push_event(Tango::AttrConfEventData * // ite->second.fwd_attr_cl->init_conf(ev); - ite->second.fwd_attr_cl = Tango_nullptr; + ite->second.fwd_attr_cl = nullptr; } } } @@ -286,7 +286,7 @@ void RootAttRegistry::RootAttUserCallBack::push_event(Tango::EventData *ev) const AttributeValue_5 *ptr = ev_fwd->get_av_5(); zmq::message_t *zmq_mess_ptr = ev_fwd->get_zmq_mess_ptr(); - if (ptr != Tango_nullptr || zmq_mess_ptr != Tango_nullptr) + if (ptr != nullptr || zmq_mess_ptr != nullptr) { // @@ -294,12 +294,12 @@ void RootAttRegistry::RootAttUserCallBack::push_event(Tango::EventData *ev) // - if (ptr != Tango_nullptr) + if (ptr != nullptr) ad.attr_val_5 = ptr; else ad.zmq_mess = zmq_mess_ptr; - zes->push_event(dev,event_name,dummy_vs,dummy_vd,dummy_vs,dummy_vl,ad,local_att_name,Tango_nullptr,true); + zes->push_event(dev,event_name,dummy_vs,dummy_vd,dummy_vs,dummy_vl,ad,local_att_name,nullptr,true); } } } @@ -378,7 +378,7 @@ void RootAttRegistry::RootAttConfCallBack::add_att(std::string &root_att_name,st DeviceImpl *the_local_dev; try { - the_local_dev = Tango_nullptr; + the_local_dev = nullptr; struct NameFwdAttr nf; nf.local_name = local_dev_name; @@ -412,7 +412,7 @@ void RootAttRegistry::RootAttConfCallBack::add_att(std::string &root_att_name,st local_dis.insert({local_dev_name,the_local_dev}); #else map_attrdesc.insert(make_pair(root_att_name,nf)); - if (the_local_dev != Tango_nullptr) + if (the_local_dev != nullptr) local_dis.insert(make_pair(local_dev_name,the_local_dev)); #endif } @@ -502,7 +502,7 @@ void RootAttRegistry::RootAttConfCallBack::clear_attrdesc(std::string &root_att_ ite = map_attrdesc.find(root_att_name); if (ite != map_attrdesc.end()) { - ite->second.fwd_attr = Tango_nullptr; + ite->second.fwd_attr = nullptr; } else { diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 331c161be..24e73213b 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -290,15 +290,7 @@ #define Tango_isnan(A) std::isnan(A) -// -// Define a common NULL constant -// - -#ifdef HAS_NULLPTR - #define Tango_nullptr nullptr -#else - #define Tango_nullptr NULL -#endif +#define Tango_nullptr nullptr // // Define a common sleep call diff --git a/cppapi/server/tango_const.h.in b/cppapi/server/tango_const.h.in index ae85ca729..44f029b4a 100644 --- a/cppapi/server/tango_const.h.in +++ b/cppapi/server/tango_const.h.in @@ -1219,9 +1219,9 @@ typedef struct _AttributeIdlData _AttributeIdlData() { - data_3 = Tango_nullptr; - data_4 = Tango_nullptr; - data_5 = Tango_nullptr; + data_3 = nullptr; + data_4 = nullptr; + data_5 = nullptr; } }AttributeIdlData; From ccf6d3b160bc8a2b2f315d27d653d73fb5eac975 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 28/48] Remove HAS_RANGE_BASE_FOR We now require C++11. Done with unifdef -DHAS_RANGE_BASE_FOR --- cpp_test_suite/new_tests/conf_devtest.cpp | 21 ---------------- cppapi/client/devapi_base.cpp | 17 ------------- cppapi/client/zmqeventconsumer.cpp | 12 ---------- cppapi/server/dserver.cpp | 29 ----------------------- cppapi/server/dserverpoll.cpp | 6 ----- cppapi/server/rootattreg.cpp | 20 ---------------- 6 files changed, 105 deletions(-) diff --git a/cpp_test_suite/new_tests/conf_devtest.cpp b/cpp_test_suite/new_tests/conf_devtest.cpp index bac51c87c..fcc8c9ad8 100644 --- a/cpp_test_suite/new_tests/conf_devtest.cpp +++ b/cpp_test_suite/new_tests/conf_devtest.cpp @@ -63,17 +63,10 @@ int main(int argc, char **argv) { try { db->add_server(str, db_dev_infos); -#ifdef HAS_RANGE_BASE_FOR for(auto info : db_dev_infos){ cout << "Added test server : " << str << " -> " << info.name << ", class : " << info._class << std::endl; } -#else - for(size_t i = 0; i < db_dev_infos.size(); i++){ - cout << "Added test server : " << str << " -> " << db_dev_infos[i].name - << ", class : " << db_dev_infos[i]._class << std::endl; - } -#endif cout << std::endl; } catch (...) { @@ -92,17 +85,10 @@ int main(int argc, char **argv) { try { db->add_server(str, db_dev_infos); -#ifdef HAS_RANGE_BASE_FOR for(auto info : db_dev_infos){ cout << "Added test server : " << str << " -> " << info.name << ", class : " << info._class << std::endl; } -#else - for(size_t i = 0; i < db_dev_infos.size(); i++){ - cout << "Added test server : " << str << " -> " << db_dev_infos[i].name - << ", class : " << db_dev_infos[i]._class << std::endl; - } -#endif cout << std::endl; } catch (...) { @@ -118,17 +104,10 @@ int main(int argc, char **argv) { db_dev_infos.push_back(fwdTestInfo); try { db->add_server(str, db_dev_infos); -#ifdef HAS_RANGE_BASE_FOR for(auto info : db_dev_infos){ cout << "Added test server : " << str << " -> " << info.name << ", class : " << info._class << std::endl; } -#else - for(size_t i = 0; i < db_dev_infos.size(); i++){ - cout << "Added test server : " << str << " -> " << db_dev_infos[i].name - << ", class : " << db_dev_infos[i]._class << std::endl; - } -#endif cout << std::endl; } catch (...) { diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index e71635ccb..10d3a52ba 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -10146,7 +10146,6 @@ int DeviceProxy::get_tango_lib_version() bool ecs = false; bool zesc = false; -#ifdef HAS_RANGE_BASE_FOR for (const auto &cmd : *cmd_list) { if (cmd.cmd_name == "EventConfirmSubscription") @@ -10160,22 +10159,6 @@ int DeviceProxy::get_tango_lib_version() zesc = true; } } -#else - std::vector::iterator pos, pos_end; - for (pos = (*cmd_list).begin(), pos_end = (*cmd_list).end(); pos != pos_end; ++pos) - { - if (pos->cmd_name == "EventConfirmSubscription") - { - ecs = true; - break; - } - - if (pos->cmd_name == "ZmqEventSubscriptionChange") - { - zesc = true; - } - } -#endif if (ecs == true) { ret = 810; diff --git a/cppapi/client/zmqeventconsumer.cpp b/cppapi/client/zmqeventconsumer.cpp index 6c78d91c0..b1a46a1b8 100644 --- a/cppapi/client/zmqeventconsumer.cpp +++ b/cppapi/client/zmqeventconsumer.cpp @@ -1242,7 +1242,6 @@ void ZmqEventConsumer::connect_event_channel(std::string &channel_name,TANGO_UNU std::string prefix = channel_name.substr(0,channel_name.find('/',8) + 1); bool found = false; -#ifdef HAS_RANGE_BASE_FOR for (const auto &elem:env_var_fqdn_prefix) { if (elem == prefix) @@ -1251,17 +1250,6 @@ void ZmqEventConsumer::connect_event_channel(std::string &channel_name,TANGO_UNU break; } } -#else - std::vector::iterator ite; - for (ite = env_var_fqdn_prefix.begin();ite != env_var_fqdn_prefix.end();++ite) - { - if (*ite == prefix) - { - found = true; - break; - } - } -#endif if (found == false && db != NULL) { diff --git a/cppapi/server/dserver.cpp b/cppapi/server/dserver.cpp index e4cb62686..c0eff10d0 100644 --- a/cppapi/server/dserver.cpp +++ b/cppapi/server/dserver.cpp @@ -482,7 +482,6 @@ void DServer::init_device() void DServer::server_init_hook() { -#ifdef HAS_RANGE_BASE_FOR for (DeviceClass *dclass : this->get_class_list()) { for (DeviceImpl *device : dclass->get_device_list()) @@ -505,34 +504,6 @@ void DServer::server_init_hook() } } } -#else - std::vector &dclass_vector = this->get_class_list(); - std::vector::iterator dclass_vector_pos, dclass_vector_end; - for (dclass_vector_pos = dclass_vector.begin(), dclass_vector_end = dclass_vector.end(); dclass_vector_pos != dclass_vector_end; ++dclass_vector_pos) - { - std::vector &device_vector = (*dclass_vector_pos)->get_device_list(); - std::vector::iterator device_vector_pos, device_vector_end; - for (device_vector_pos = device_vector.begin(), device_vector_end = device_vector.end(); device_vector_pos != device_vector_end; ++device_vector_pos) - { - DeviceImpl *device = *device_vector_pos; - cout4 << "Device " << device->get_name_lower() << " executes init_server_hook" << std::endl; - try - { - device->server_init_hook(); - } - catch(const DevFailed& devFailed){ - device->set_state(FAULT); - - std::ostringstream ss; - ss << "Device[" << device->get_name_lower() << "] server_init_hook has failed due to DevFailed:" - << std::endl; - ss << devFailed; - - device->set_status(ss.str()); - } - } - } -#endif } //+---------------------------------------------------------------------------------------------------------------- diff --git a/cppapi/server/dserverpoll.cpp b/cppapi/server/dserverpoll.cpp index fa567abed..3b1dc3b71 100644 --- a/cppapi/server/dserverpoll.cpp +++ b/cppapi/server/dserverpoll.cpp @@ -246,14 +246,8 @@ Tango::DevVarStringArray *DServer::dev_poll_status(std::string &dev_name) if (i == nb_poll_obj - 1) { -#ifdef HAS_RANGE_BASE_FOR for (auto &elem:root_dev_poll_status) delete elem.second; -#else - std::map *>::iterator pos; - for (pos = root_dev_poll_status.begin();pos != root_dev_poll_status.end();++pos) - delete pos->second; -#endif } // diff --git a/cppapi/server/rootattreg.cpp b/cppapi/server/rootattreg.cpp index f02970199..ae67b96fc 100644 --- a/cppapi/server/rootattreg.cpp +++ b/cppapi/server/rootattreg.cpp @@ -847,18 +847,10 @@ void RootAttRegistry::remove_root_att(std::string &root_dev_name,std::string &ro if (it != map_event_id_user.end()) { -#ifdef HAS_RANGE_BASE_FOR for (const auto &elem:it->second) { pos->second->unsubscribe_event(elem.event_id); } -#else - std::vector::iterator posi; - for (posi = it->second.begin();posi != it->second.end();++posi) - { - pos->second->unsubscribe_event(posi->event_id); - } -#endif map_event_id_user.erase(it); } } @@ -1075,7 +1067,6 @@ bool RootAttRegistry::is_event_subscribed(std::string &ev,EventType et) pos = map_event_id_user.find(ev); if (pos != map_event_id_user.end()) { -#ifdef HAS_RANGE_BASE_FOR for (const auto &elem:pos->second) { if (elem.event_type == et) @@ -1084,17 +1075,6 @@ bool RootAttRegistry::is_event_subscribed(std::string &ev,EventType et) break; } } -#else - std::vector::iterator posi; - for (posi = pos->second.begin();posi != pos->second.end();++posi) - { - if (posi->event_type == et) - { - ret = true; - break; - } - } -#endif } } From 02b174ca8b70dd91a765ffb782cc59567cb6500d Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 29/48] Remove INIT_LIST We now require C++11. Done with unifdef -DINIT_LIST --- cppapi/client/event.cpp | 4 ---- cppapi/server/classpipe.cpp | 4 ---- cppapi/server/rootattreg.cpp | 18 ------------------ 3 files changed, 26 deletions(-) diff --git a/cppapi/client/event.cpp b/cppapi/client/event.cpp index 297c718a0..561d61b5a 100644 --- a/cppapi/client/event.cpp +++ b/cppapi/client/event.cpp @@ -275,11 +275,7 @@ void EventConsumer::get_cs_tango_host(Database *db) { if (alias_map.find(tg_host) == alias_map.end()) { -#ifdef INIT_LIST alias_map.insert({lower_vs,tg_host}); -#else - alias_map.insert(std::make_pair(lower_vs,tg_host)); -#endif } } } diff --git a/cppapi/server/classpipe.cpp b/cppapi/server/classpipe.cpp index f1eb57340..7b89cc556 100644 --- a/cppapi/server/classpipe.cpp +++ b/cppapi/server/classpipe.cpp @@ -171,11 +171,7 @@ void MultiClassPipe::init_class_pipe(DeviceClass *cl_ptr) if (nb_prop != 0) { -#ifdef INIT_LIST pipe_prop_list.insert({pipe_name,prop_list}); -#else - pipe_prop_list.insert(make_pair(pipe_name,prop_list)); -#endif } } } diff --git a/cppapi/server/rootattreg.cpp b/cppapi/server/rootattreg.cpp index ae67b96fc..0469c526a 100644 --- a/cppapi/server/rootattreg.cpp +++ b/cppapi/server/rootattreg.cpp @@ -406,15 +406,9 @@ void RootAttRegistry::RootAttConfCallBack::add_att(std::string &root_att_name,st { omni_mutex_lock oml(the_lock); -#ifdef INIT_LIST map_attrdesc.insert({root_att_name,nf}); if (the_local_dev != nullptr) local_dis.insert({local_dev_name,the_local_dev}); -#else - map_attrdesc.insert(make_pair(root_att_name,nf)); - if (the_local_dev != nullptr) - local_dis.insert(make_pair(local_dev_name,the_local_dev)); -#endif } } catch (DevFailed &e) {} @@ -710,11 +704,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam desc = desc + device_name + " is too old to support forwarded attribute. It requires IDL >= 5"; Except::throw_exception(API_AttrNotAllowed,desc,"RootAttRegistry::add_root_att"); } -#ifdef INIT_LIST dps.insert({device_name,the_dev}); -#else - dps.insert(make_pair(device_name,the_dev)); -#endif } else the_dev = ite->second; @@ -736,11 +726,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam try { event_id = the_dev->subscribe_event(att_name,Tango::ATTR_CONF_EVENT,&cbp); -#ifdef INIT_LIST map_event_id.insert({a_name,event_id}); -#else - map_event_id.insert(make_pair(a_name,event_id)); -#endif } catch (Tango::DevFailed &e) { @@ -770,11 +756,7 @@ void RootAttRegistry::add_root_att(std::string &device_name,std::string &att_nam attdesc->set_err_kind(FWD_WRONG_DEV); event_id = the_dev->subscribe_event(att_name,Tango::ATTR_CONF_EVENT,&cbp,true); -#ifdef INIT_LIST map_event_id.insert({a_name,event_id}); -#else - map_event_id.insert(make_pair(a_name,event_id)); -#endif cbp.update_err_kind(a_name,attdesc->get_err_kind()); Tango::Except::re_throw_exception(e,"API_DummyException","nothing","RootAttRegistry::add_root_att"); From 03bccb902df64836323b959194074566df5560bd Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:30:26 +0100 Subject: [PATCH 30/48] Remove HAS_UNDERLYING We now require C++11. Done with unifdef -DHAS_UNDERLYING --- cppapi/client/devapi_attr.tpp | 2 -- cppapi/server/attrsetval.tpp | 2 -- cppapi/server/w_attrsetval.tpp | 2 -- 3 files changed, 6 deletions(-) diff --git a/cppapi/client/devapi_attr.tpp b/cppapi/client/devapi_attr.tpp index b08532b79..b6da61ebf 100644 --- a/cppapi/client/devapi_attr.tpp +++ b/cppapi/client/devapi_attr.tpp @@ -408,7 +408,6 @@ void DeviceAttribute::insert(std::vector &_datum,int _x,int _y) template bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) { -#ifdef HAS_UNDERLYING bool short_enum = std::is_same::type>::value; bool uns_int_enum = std::is_same::type>::value; @@ -423,7 +422,6 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) return false; } -#endif // HAS_UNDERLYING if (std::is_enum::value == false) { diff --git a/cppapi/server/attrsetval.tpp b/cppapi/server/attrsetval.tpp index 0bb6dcb2c..c68417a87 100644 --- a/cppapi/server/attrsetval.tpp +++ b/cppapi/server/attrsetval.tpp @@ -77,7 +77,6 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) Except::throw_exception(API_AttrOptProp,o.str(),"Attribute::set_value()"); } -#ifdef HAS_UNDERLYING bool short_enum = std::is_same::type>::value; bool uns_int_enum = std::is_same::type>::value; @@ -91,7 +90,6 @@ void Attribute::set_value(T *enum_ptr,long x,long y,bool release) Except::throw_exception(API_IncompatibleArgumentType,ss.str(),"Attribute::set_value()"); } -#endif // HAS_UNDERLYING // // Check if the input type is an enum and if it is from the valid type diff --git a/cppapi/server/w_attrsetval.tpp b/cppapi/server/w_attrsetval.tpp index b03e63da8..429fda3b4 100644 --- a/cppapi/server/w_attrsetval.tpp +++ b/cppapi/server/w_attrsetval.tpp @@ -106,7 +106,6 @@ void WAttribute::get_write_value(const T *&ptr) template void WAttribute::check_type(T &TANGO_UNUSED(dummy), const std::string &origin) { -#ifdef HAS_UNDERLYING bool short_enum = std::is_same::type>::value; bool uns_int_enum = std::is_same::type>::value; @@ -118,7 +117,6 @@ void WAttribute::check_type(T &TANGO_UNUSED(dummy), const std::string &origin) Except::throw_exception(API_IncompatibleArgumentType,ss.str(),origin); } -#endif // HAS_UNDERLYING // // Check if the input type is an enum and if it is from the valid type From 893c56c69acec634449226e2420b250526e51e7e Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:40:28 +0100 Subject: [PATCH 31/48] cppapi/server/tango_config.h: Map TANGO_NORETURN always to [[noreturn]] We now always require C++11. --- cppapi/server/tango_config.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 24e73213b..c1c69bde0 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -388,11 +388,7 @@ #define TANGO_LONG32 #endif -#ifdef HAS_ATTRIBUTE_SPECIFIERS - #define TANGO_NORETURN [[noreturn]] -#else - #define TANGO_NORETURN -#endif +#define TANGO_NORETURN [[noreturn]] // C++14 style constexpr #ifdef HAS_CONSTEXPR From 2b5f357b4ff2d70b1c6e4a524bbddb007e379d98 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sat, 11 Jan 2020 02:32:10 +0100 Subject: [PATCH 32/48] cppapi/server/tango_config.h: Remove #ifdef spaghetti used for C++11 feature checking We now always require C++11. --- cppapi/server/tango_config.h | 102 +---------------------------------- 1 file changed, 1 insertion(+), 101 deletions(-) diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index c1c69bde0..96786da16 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -131,121 +131,21 @@ // // Some C++11 feature -// map::at() -> gcc 4.1.0 (See C++ Standard Library Defect Report 464) -// Unique_ptr -> gcc 4.3 -// rvalues -> gcc 4.3 -// Lambda function -> gcc 4.5 -// nullptr -> gcc 4.6 -// attributes -> gcc 4.8 // constexpr -> gcc 5.0 (C++14 style constexpr) #ifndef _TG_WINDOWS_ #if defined(__GNUC__) - #if __GNUC__ == 4 - #if __GNUC_MINOR__ > 0 - #define HAS_MAP_AT - #endif - #if __GNUC_MINOR__ > 3 - #define HAS_UNIQUE_PTR - #define HAS_RVALUE - #define HAS_THREAD - #define HAS_TYPE_TRAITS - #define HAS_VARIADIC_TEMPLATE - #endif - #if __GNUC_MINOR__ > 4 - #define HAS_LAMBDA_FUNC - #define HAS_ISNAN_IN_STD - #endif - #if __GNUC_MINOR__ > 5 - #define HAS_NULLPTR - #define HAS_RANGE_BASE_FOR - #define INIT_LIST - #endif - #if __GNUC_MINOR__ > 6 - #define HAS_OVERRIDE - #endif - #if __GNUC_MINOR__ > 7 - #define HAS_UNDERLYING - #define HAS_ATTRIBUTE_SPECIFIERS - #endif - #elif __GNUC__ > 4 - #define HAS_UNIQUE_PTR - #define HAS_RVALUE - #define HAS_LAMBDA_FUNC - #define HAS_ISNAN_IN_STD - #define HAS_NULLPTR - #define HAS_RANGE_BASE_FOR - #define INIT_LIST - #define HAS_THREAD - #define HAS_TYPE_TRAITS - #define HAS_UNDERLYING - #define HAS_VARIADIC_TEMPLATE - #define HAS_MAP_AT - #define HAS_ATTRIBUTE_SPECIFIERS + #if __GNUC__ > 4 #define HAS_CONSTEXPR #endif #if defined(__clang__) #if __clang_major__ > 3 - #define HAS_UNIQUE_PTR - #define HAS_RVALUE - #define HAS_LAMBDA_FUNC - #define HAS_ISNAN_IN_STD - #define HAS_NULLPTR - #define HAS_RANGE_BASE_FOR - #define INIT_LIST - #define HAS_THREAD - #define HAS_TYPE_TRAITS - #define HAS_UNDERLYING - #define HAS_VARIADIC_TEMPLATE - #define HAS_MAP_AT - #define HAS_ATTRIBUTE_SPECIFIERS #define HAS_CONSTEXPR #endif #endif #endif #else - #ifdef WIN32_VC10 - #define HAS_UNIQUE_PTR - #define HAS_LAMBDA_FUNC - #define HAS_NULLPTR - #define HAS_RVALUE - #define HAS_TYPE_TRAITS - #define HAS_MAP_AT - #endif - #ifdef WIN32_VC11 - #define HAS_UNIQUE_PTR - #define HAS_LAMBDA_FUNC - #define HAS_NULLPTR - #define HAS_RVALUE - #define HAS_RANGE_BASE_FOR - #define HAS_TYPE_TRAITS - #define HAS_UNDERLYING - #define HAS_MAP_AT - #endif - #ifdef WIN32_VC12 - #define HAS_UNIQUE_PTR - #define HAS_LAMBDA_FUNC - #define HAS_NULLPTR - #define HAS_RVALUE - #define HAS_RANGE_BASE_FOR - #define HAS_TYPE_TRAITS - #define HAS_UNDERLYING - #define HAS_VARIADIC_TEMPLATE - #define HAS_MAP_AT - #define HAS_OVERRIDE - #endif #ifdef WIN32_VC14 - #define HAS_UNIQUE_PTR - #define HAS_LAMBDA_FUNC - #define HAS_NULLPTR - #define HAS_RVALUE - #define HAS_RANGE_BASE_FOR - #define HAS_TYPE_TRAITS - #define HAS_UNDERLYING - #define HAS_VARIADIC_TEMPLATE - #define HAS_MAP_AT - #define HAS_ATTRIBUTE_SPECIFIERS - #define HAS_OVERRIDE #define HAS_CONSTEXPR #endif #endif From 1cb8f1b660d1baf07872801cbf20e7dea00f40c2 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 20:30:24 +0100 Subject: [PATCH 33/48] cppapi/client/ApiUtil.h: Remove unused _KillProc_ class --- cppapi/client/ApiUtil.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cppapi/client/ApiUtil.h b/cppapi/client/ApiUtil.h index 169ce2a79..a9e85587d 100644 --- a/cppapi/client/ApiUtil.h +++ b/cppapi/client/ApiUtil.h @@ -252,10 +252,4 @@ class ApiUtil template static void attr_to_device_base(const T *,DeviceAttribute *); }; -class _KillProc_: public omni_thread -{ -public: - void run(void *) {::exit(-1);} -}; - #endif /* _APIUTIL_H */ From 69e5138ebd6663a30d9e55c23760befd5dba94fd Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 20:47:21 +0100 Subject: [PATCH 34/48] Travis: Install newer cmake on debian 8 --- .travis/debian8/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis/debian8/Dockerfile b/.travis/debian8/Dockerfile index 30004da17..5fcc76cdc 100644 --- a/.travis/debian8/Dockerfile +++ b/.travis/debian8/Dockerfile @@ -11,7 +11,6 @@ RUN sed -i '/jessie-updates/d' /etc/apt/sources.list # Now archived RUN apt-get update && apt-get install -y \ apt-utils \ build-essential \ - cmake \ curl \ git \ lsb-release \ @@ -19,7 +18,12 @@ RUN apt-get update && apt-get install -y \ libomniorb4-dev \ libcos4-dev \ libomnithread3-dev \ - libzmq3-dev + libzmq3-dev \ + wget + +RUN wget --no-check-certificate https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh -O /tmp/cmake-install.sh \ + && chmod +x /tmp/cmake-install.sh \ + && /tmp/cmake-install.sh --skip-license --exclude-subdir RUN apt-get install -y \ apt-transport-https \ From 285860279612d1ed690970b354abef7496553532 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 20:47:33 +0100 Subject: [PATCH 35/48] .travis: Remove testing for debian wheezy This is just too old as it has only GCC 4.7.2. --- .travis.yml | 1 - .travis/debian7/Dockerfile | 55 -------------------------------------- 2 files changed, 56 deletions(-) delete mode 100644 .travis/debian7/Dockerfile diff --git a/.travis.yml b/.travis.yml index 1205e8593..09b7eaa69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,6 @@ env: - OS_TYPE=debian10 CMAKE_BUILD_TYPE=Release - OS_TYPE=debian9 - OS_TYPE=debian8 SONAR_SCANNER=ON COVERALLS=ON STOCK_CPPZMQ=OFF - - OS_TYPE=debian7 notifications: email: false diff --git a/.travis/debian7/Dockerfile b/.travis/debian7/Dockerfile deleted file mode 100644 index 1bab58876..000000000 --- a/.travis/debian7/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -FROM debian/eol:wheezy - -ARG APP_UID=2000 - -ARG APP_GID=2000 - -MAINTAINER TANGO Controls team - -RUN echo 'deb http://archive.debian.org/debian wheezy-backports main contrib' > /etc/apt/sources.list.d/backports.list - -RUN echo "Acquire::Check-Valid-Until false;" > /etc/apt/apt.conf - -RUN apt-get update && apt-get install -y \ - apt-utils \ - build-essential \ - curl \ - git \ - libcos4-dev \ - libomniorb4-dev \ - libomnithread3-dev \ - libzmq3-dev \ - lsb-release \ - omniidl \ - procps \ - wget - -RUN wget --no-check-certificate https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh -O /tmp/cmake-install.sh \ - && chmod +x /tmp/cmake-install.sh \ - && /tmp/cmake-install.sh --skip-license --exclude-subdir - -RUN apt-get install -y \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg2 \ - software-properties-common \ - python-software-properties \ - && curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - \ - && add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/debian wheezy stable" \ - && sed -i -e '/^deb-src.*docker.*/d' /etc/apt/sources.list \ - && apt-get update \ - && apt-get install -y docker-ce - -RUN groupadd -g "$APP_GID" tango - -RUN useradd -u "$APP_UID" -g "$APP_GID" -ms /bin/bash tango - -RUN usermod -a -G docker tango - -ENV PKG_CONFIG_PATH=/home/tango/lib/pkgconfig - -USER tango - -WORKDIR /home/tango From 5424da3925c2d994506e62f1f5d6bced02f6ee56 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 21:25:46 +0100 Subject: [PATCH 36/48] cppapi/server/idl: Ignore unused-parameter for clang as well Exposed with the new C++11 compilation, but ultimately forgotten in cc8f943a (cppapi/server: Ignore warnings for generated code, 2019-11-15). --- cppapi/server/idl/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cppapi/server/idl/CMakeLists.txt b/cppapi/server/idl/CMakeLists.txt index 7951ea52b..0d8e61bca 100644 --- a/cppapi/server/idl/CMakeLists.txt +++ b/cppapi/server/idl/CMakeLists.txt @@ -82,7 +82,7 @@ else(WIN32) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(idl_objects PRIVATE -Wno-maybe-uninitialized -Wno-unused-parameter) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(idl_objects PRIVATE -Wno-sometimes-uninitialized -Wno-unused-variable) + target_compile_options(idl_objects PRIVATE -Wno-sometimes-uninitialized -Wno-unused-variable -Wno-unused-parameter) endif() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tango.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/tango/idl") From 64dc2a742e777e7daab6047efc9d82b0f799fbff Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 21:28:58 +0100 Subject: [PATCH 37/48] cppapi/client/eventconsumer.h: Add missing override keywords Found with -Winconsistent-missing-override using latest clang 9.0. --- cppapi/client/eventconsumer.h | 44 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/cppapi/client/eventconsumer.h b/cppapi/client/eventconsumer.h index f6ce32681..ac3b8f4e1 100644 --- a/cppapi/client/eventconsumer.h +++ b/cppapi/client/eventconsumer.h @@ -518,23 +518,23 @@ public : static NotifdEventConsumer *create(); TANGO_IMP_EXP static void cleanup() {if (_instance != NULL){_instance=NULL;}} - void push_structured_event(const CosNotification::StructuredEvent&); - virtual void cleanup_EventChannel_map(); + void push_structured_event(const CosNotification::StructuredEvent&) override; + virtual void cleanup_EventChannel_map() override; - void disconnect_structured_push_consumer(); - void offer_change(const CosNotification::EventTypeSeq &,const CosNotification::EventTypeSeq &); + void disconnect_structured_push_consumer() override; + void offer_change(const CosNotification::EventTypeSeq &,const CosNotification::EventTypeSeq &) override; - virtual void get_subscription_command_name(std::string &cmd) {cmd="EventSubscriptionChange";} + virtual void get_subscription_command_name(std::string &cmd) override {cmd="EventSubscriptionChange";} CORBA::ORB_var orb_; protected : NotifdEventConsumer(ApiUtil *ptr); - virtual void connect_event_channel(std::string &,Database *,bool,DeviceData &); - virtual void connect_event_system(std::string &,std::string &,std::string &e,const std::vector &,EvChanIte &,EventCallBackStruct &,DeviceData &,size_t); + virtual void connect_event_channel(std::string &,Database *,bool,DeviceData &) override; + virtual void connect_event_system(std::string &,std::string &,std::string &e,const std::vector &,EvChanIte &,EventCallBackStruct &,DeviceData &,size_t) override; - virtual void set_channel_type(EventChannelStruct &ecs) {ecs.channel_type = NOTIFD;} - virtual void zmq_specific(DeviceData &,std::string &,DeviceProxy *,const std::string &) {} + virtual void set_channel_type(EventChannelStruct &ecs) override {ecs.channel_type = NOTIFD;} + virtual void zmq_specific(DeviceData &,std::string &,DeviceProxy *,const std::string &) override {} ReceivedFromAdmin initialize_received_from_admin(const Tango::DevVarLongStringArray *pArray, const std::string &local_callback_key, const std::string &adm_name, @@ -551,7 +551,7 @@ private : CosNotifyChannelAdmin::StructuredProxyPushSupplier_var structuredProxyPushSupplier; CosNotifyChannelAdmin::EventChannelFactory_var eventChannelFactory; - void *run_undetached(void *arg); + void *run_undetached(void *arg) override; }; @@ -566,12 +566,12 @@ class ZmqEventConsumer : public EventConsumer , { public : static ZmqEventConsumer *create(); - TANGO_IMP_EXP static void cleanup() {if (_instance != NULL){_instance=NULL;}} + TANGO_IMP_EXP static void cleanup() {if (_instance != NULL){_instance=NULL;}} - virtual void cleanup_EventChannel_map(); - virtual void get_subscription_command_name(std::string &cmd) {cmd="ZmqEventSubscriptionChange";} + virtual void cleanup_EventChannel_map() override; + virtual void get_subscription_command_name(std::string &cmd) override {cmd="ZmqEventSubscriptionChange";} - void get_subscribed_event_ids(DeviceProxy *,std::vector &); + void get_subscribed_event_ids(DeviceProxy *,std::vector &); enum UserDataEventType { @@ -590,13 +590,13 @@ public : protected : ZmqEventConsumer(ApiUtil *ptr); - virtual void connect_event_channel(std::string &,Database *,bool,DeviceData &); - virtual void disconnect_event_channel(std::string &channel_name,std::string &endpoint,std::string &endpoint_event); - virtual void connect_event_system(std::string &,std::string &,std::string &e,const std::vector &,EvChanIte &,EventCallBackStruct &,DeviceData &,size_t); - virtual void disconnect_event(std::string &,std::string &); + virtual void connect_event_channel(std::string &,Database *,bool,DeviceData &) override; + virtual void disconnect_event_channel(std::string &channel_name,std::string &endpoint,std::string &endpoint_event) override; + virtual void connect_event_system(std::string &,std::string &,std::string &e,const std::vector &,EvChanIte &,EventCallBackStruct &,DeviceData &,size_t) override; + virtual void disconnect_event(std::string &,std::string &) override; - virtual void set_channel_type(EventChannelStruct &ecs) {ecs.channel_type = ZMQ;} - virtual void zmq_specific(DeviceData &,std::string &,DeviceProxy *,const std::string &); + virtual void set_channel_type(EventChannelStruct &ecs) override {ecs.channel_type = ZMQ;} + virtual void zmq_specific(DeviceData &,std::string &,DeviceProxy *,const std::string &) override; ReceivedFromAdmin initialize_received_from_admin(const Tango::DevVarLongStringArray *pArray, const std::string &local_callback_key, @@ -632,7 +632,7 @@ private : bool ctrl_socket_bound; - void *run_undetached(void *arg); + void *run_undetached(void *arg) override; void push_heartbeat_event(std::string &); void push_zmq_event(std::string &,unsigned char,zmq::message_t &,bool,const DevULong &); bool process_ctrl(zmq::message_t &,zmq::pollitem_t *,int &); @@ -697,7 +697,7 @@ protected : KeepAliveThCmd &shared_cmd; private : - void *run_undetached(void *arg); + void *run_undetached(void *arg) override; bool reconnect_to_channel(EvChanIte &,EventConsumer *); void reconnect_to_event(EvChanIte &,EventConsumer *); void re_subscribe_event(EvCbIte &,EvChanIte &); From 33910b89d21d13a64b0305eed0e2b8304223308c Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 21:49:19 +0100 Subject: [PATCH 38/48] cppapi/server/tango.h: Simplify TANGO_UNUSED handling We don't support GCC < 4 anymore. --- cppapi/server/tango_config.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 96786da16..2f67c7b47 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -241,15 +241,9 @@ // #ifdef _TG_WINDOWS_ -#define TANGO_UNUSED(var) var + #define TANGO_UNUSED(var) var #else - #if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 - #define TANGO_UNUSED(var) var __attribute__ ((unused)) - #elif __GNUC__ > 3 - #define TANGO_UNUSED(var) var __attribute__ ((unused)) - #else - #define TANGO_UNUSED(var) var - #endif + #define TANGO_UNUSED(var) var __attribute__ ((unused)) #endif // From c15e1c4eb1a2b9d025e2d5a8d1060b788e854f3e Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Mon, 20 Jan 2020 22:51:12 +0100 Subject: [PATCH 39/48] cmake: Rework C++ compiler feature detection The only C++ feature we are currently using which is not supported by C++11 is C++14 relaxed constexpr. Instead of using the old school ifdef magic we now use a real feature test. This also requires to move the definition of TANGO_CONSTEXPR to tango_const.h.in. --- configure/CMakeLists.txt | 8 ++++++++ cppapi/server/tango_config.h | 28 ---------------------------- cppapi/server/tango_const.h.in | 9 +++++++++ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt index 2de129228..01f0ad53d 100644 --- a/configure/CMakeLists.txt +++ b/configure/CMakeLists.txt @@ -221,6 +221,14 @@ if(WARNINGS_AS_ERRORS) endif() endif() +if(cxx_relaxed_constexpr IN_LIST CMAKE_CXX_COMPILE_FEATURES) + set(TANGO_CXX_HAS_RELAXED_CONSTEXPR TRUE) +else() + set(TANGO_CXX_HAS_RELAXED_CONSTEXPR FALSE) +endif() + +message(STATUS "Check if the compiler supports C++14 relaxed constexpr: ${TANGO_CXX_HAS_RELAXED_CONSTEXPR}") + include(GNUInstallDirs) include(configure/coveralls.cmake) diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 2f67c7b47..6f60922d2 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -129,27 +129,6 @@ #define TANGO_IMP #endif /* _WINDOWS_ */ -// -// Some C++11 feature -// constexpr -> gcc 5.0 (C++14 style constexpr) - -#ifndef _TG_WINDOWS_ - #if defined(__GNUC__) - #if __GNUC__ > 4 - #define HAS_CONSTEXPR - #endif - #if defined(__clang__) - #if __clang_major__ > 3 - #define HAS_CONSTEXPR - #endif - #endif - #endif -#else - #ifdef WIN32_VC14 - #define HAS_CONSTEXPR - #endif -#endif - // // For gcc 5 new ABI // @@ -284,11 +263,4 @@ #define TANGO_NORETURN [[noreturn]] -// C++14 style constexpr -#ifdef HAS_CONSTEXPR - #define TANGO_CONSTEXPR constexpr -#else - #define TANGO_CONSTEXPR -#endif - #endif /* _TANGO_CONFIG_H */ diff --git a/cppapi/server/tango_const.h.in b/cppapi/server/tango_const.h.in index 44f029b4a..20b459fad 100644 --- a/cppapi/server/tango_const.h.in +++ b/cppapi/server/tango_const.h.in @@ -147,6 +147,15 @@ const int SUB_SEND_HWM = 10000; #cmakedefine TANGO_ZMQ_HAS_DISCONNECT +#cmakedefine TANGO_CXX_HAS_RELAXED_CONSTEXPR + +// C++14 style relaxed constexpr +#ifdef TANGO_CXX_HAS_RELAXED_CONSTEXPR + #define TANGO_CONSTEXPR constexpr +#else + #define TANGO_CONSTEXPR +#endif + // // Event when using a file as database stuff // From a52d8b67ad294000530be00779da07584c8d092c Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 21 Jan 2020 17:36:27 +0100 Subject: [PATCH 40/48] CMakeLists.txt: Unify and add more version output on configuring We now output cmake/compiler and platform versions for easier debugging. Output like the CMAKE_BUILD_TYPE was also changed to be outputted always regardless if default or not. --- CMakeLists.txt | 1 - configure/CMakeLists.txt | 32 +++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0ac0f5c6..5ff570e54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,6 @@ endif() set(LIBRARY_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") set(SO_VERSION "${MAJOR_VERSION}") -message("System TANGO_HOST=$ENV{TANGO_HOST}") set(TANGO_HOST $ENV{TANGO_HOST}) include(configure/CMakeLists.txt) diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt index 01f0ad53d..34e98406b 100644 --- a/configure/CMakeLists.txt +++ b/configure/CMakeLists.txt @@ -3,10 +3,28 @@ include(FindDoxygen) include(GNUInstallDirs) if(NOT CMAKE_BUILD_TYPE) - message("No build type specified - default is Release") set(CMAKE_BUILD_TYPE Release) endif() +#assuming build platform == target +set(PLATFORM 32) +if(WIN32) + if(CMAKE_CL_64) + set(PLATFORM 64) + endif(CMAKE_CL_64) +else(WIN32) + if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(PLATFORM 64) + endif() +endif(WIN32) + +message(STATUS "CMake: version ${CMAKE_VERSION}") +message(STATUS "Target platform: ${CMAKE_SYSTEM_NAME} ${PLATFORM}-bit") +message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER_ID} with version ${CMAKE_CXX_COMPILER_VERSION}") +message(STATUS "C Compiler: ${CMAKE_C_COMPILER_ID} with version ${CMAKE_C_COMPILER_VERSION}") +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +message(STATUS "Environment: TANGO_HOST=$ENV{TANGO_HOST}") + if(NOT TANGO_DEVICE_SERVER_PATH) #TODO windows set(TANGO_DEVICE_SERVER_PATH ${CMAKE_INSTALL_FULL_BINDIR}) @@ -174,18 +192,6 @@ if(${FAILED}) message(SEND_ERROR " No omniidl was found! rv=${FAILED}") endif() -#assuming build platform == target -set(PLATFORM 32) -if(WIN32) - if(CMAKE_CL_64) - set(PLATFORM 64) - endif(CMAKE_CL_64) -else(WIN32) - if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(PLATFORM 64) - endif() -endif(WIN32) - if(NOT WIN32) include(CheckCXXCompilerFlag) # C++17 and higher support is currently not possible as omniorb uses From 9904f75c77b1dde5eef8d963805a09582f286139 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 21 Jan 2020 19:24:43 +0100 Subject: [PATCH 41/48] appveyor.yml: Remove support for old MSVC versions MSVC versions prior to VS 2015 (aka msvc14) don't have usable C++11 support. So we can't build on those anymore. This was also decided in [2] which said: > Decision was taken to stop support for MSVC9, MSVC10 and MSVC12. The > builds for these MSVC compiler versions will be removed from appveyor. > If some users still need to compile cppTango using these compilers, they > will need to fork cppTango and maintain a version compatible with these > old compilers. [1]: https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)?redirectedfrom=MSDN#featurelist [2]: https://github.com/tango-controls/tango-kernel-followup/blob/master/2019-02-04/outcomes.md --- appveyor.yml | 145 +-------------------------------------------------- 1 file changed, 1 insertion(+), 144 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 88e24aecc..a1edcf666 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,96 +40,6 @@ environment: OMNI_BASE: C:\projects\omniORB-4.2.1 PYVER: "py37" USE_PCH: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: win32 - ARCH: win32-msvc9 - configuration: Release - CMAKE_GENERATOR: "Visual Studio 9 2008" - MSVCVERSION: v90 - MSVCYEAR: "vs2008" - MSVCABR: "9" - VC_VER: 9.0 - PYTHONPATH: c:\Python27\ - PYTHONPATHOMNI: "/cygdrive/c/Python27/python" - BOOST_ROOT: C:\Libraries\boost_1_63_0 - ZMQ_BASE: C:\projects\libzmq - IDL_BASE: C:\projects\tangoidl - IDL_BIN: C:\Program Files (x86)\tangoidl - OMNI_BASE: C:\projects\omniORB-4.2.1 - PYVER: "py27" - USE_PCH: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: x64 - ARCH: x64-msvc9 - configuration: Release - CMAKE_GENERATOR: "Visual Studio 9 2008 Win64" - MSVCVERSION: v90 - MSVCYEAR: "vs2008" - MSVCABR: "9" - VC_VER: 9.0 - PYTHONPATH: c:\Python27-x64\ - PYTHONPATHOMNI: "/cygdrive/c/Python27-x64/python" - BOOST_ROOT: C:\Libraries\boost_1_63_0 - ZMQ_BASE: C:\projects\libzmq - IDL_BASE: C:\projects\tangoidl - IDL_BIN: C:\Program Files\tangoidl - OMNI_BASE: C:\projects\omniORB-4.2.1 - PYVER: "py27" - USE_PCH: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: win32 - ARCH: win32-msvc10 - configuration: Release - CMAKE_GENERATOR: "Visual Studio 10 2010" - MSVCVERSION: v100 - MSVCYEAR: "vs2010" - MSVCABR: "10" - VC_VER: 10.0 - PYTHONPATH: c:\Python33\ - PYTHONPATHOMNI: "/cygdrive/c/Python33/python" - BOOST_ROOT: C:\Libraries\boost_1_63_0 - ZMQ_BASE: C:\projects\libzmq - IDL_BASE: C:\projects\tangoidl - IDL_BIN: C:\Program Files (x86)\tangoidl - OMNI_BASE: C:\projects\omniORB-4.2.1 - PYVER: "py33" - USE_PCH: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: x64 - ARCH: x64-msvc10 - configuration: Release - CMAKE_GENERATOR: "Visual Studio 10 2010 Win64" - MSVCVERSION: v100 - MSVCYEAR: "vs2010" - MSVCABR: "10" - VC_VER: 10.0 - PYTHONPATH: c:\Python33-x64\ - PYTHONPATHOMNI: "/cygdrive/c/Python33-x64/python" - BOOST_ROOT: C:\Libraries\boost_1_63_0 - ZMQ_BASE: C:\projects\libzmq - IDL_BASE: C:\projects\tangoidl - IDL_BIN: C:\Program Files\tangoidl - OMNI_BASE: C:\projects\omniORB-4.2.1 - PYVER: "py33" - USE_PCH: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: x64 - ARCH: x64-msvc12 - configuration: Release - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - MSVCVERSION: v120 - MSVCYEAR: "vs2013" - MSVCABR: "13" - VC_VER: 13.0 - PYTHONPATH: c:\Python33-x64\ - PYTHONPATHOMNI: "/cygdrive/c/Python33-x64/python" - BOOST_ROOT: C:\Libraries\boost_1_63_0 - ZMQ_BASE: C:\projects\libzmq - IDL_BASE: C:\projects\tangoidl - IDL_BIN: C:\Program Files\tangoidl - OMNI_BASE: C:\projects\omniORB-4.2.1 - PYVER: "py33" - USE_PCH: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 platform: x64 ARCH: x64-msvc14 @@ -148,24 +58,6 @@ environment: OMNI_BASE: C:\projects\omniORB-4.2.1 PYVER: "py36" USE_PCH: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - platform: win32 - ARCH: win32-msvc12 - configuration: Release - CMAKE_GENERATOR: "Visual Studio 12 2013" - MSVCVERSION: v120 - MSVCYEAR: "vs2013" - MSVCABR: "13" - VC_VER: 13.0 - PYTHONPATH: c:\Python33\ - PYTHONPATHOMNI: "/cygdrive/c/Python33/python" - BOOST_ROOT: C:\Libraries\boost_1_63_0 - ZMQ_BASE: C:\projects\libzmq - IDL_BASE: C:\projects\tangoidl - IDL_BIN: C:\Program Files (x86)\tangoidl - OMNI_BASE: C:\projects\omniORB-4.2.1 - PYVER: "py33" - USE_PCH: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 platform: win32 ARCH: win32-msvc14 @@ -215,15 +107,8 @@ init: - cmd: cd "C:\projects\" - appveyor DownloadFile https://github.com/tango-controls/Pthread_WIN32/releases/download/2.9.1/pthreads-win32-2.9.1_%ARCH%.zip - cmd: 7z -y x pthreads-win32-2.9.1_%ARCH%.zip -oC:\projects\pthreads-win32\ - #VS2008 patch - - cmd: cd "C:\projects\" - - cmd: appveyor DownloadFile https://github.com/menpo/condaci/raw/master/vs2008_patch.zip - - cmd: 7z -y x vs2008_patch.zip -oC:\projects\vs2008_patch\ - - cmd: if %ARCH%==x64-msvc9 call C:\projects\vs2008_patch\setup_x64.bat - - cmd: if %ARCH%==x32-msvc9 call C:\projects\vs2008_patch\setup_x86.bat - - cmd: if "%APPVEYOR_BUILD_WORKER_IMAGE%" NEQ "Visual Studio 2017" copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat" - - cmd: cd "C:\projects\cppTango" + install: #copy tree for debug build - cmd: cd c:/projects/ @@ -233,14 +118,6 @@ install: - cmd: xcopy "C:/projects/cppTango" "c:/projects/debug_build" /c /g /d /i /e /r /h /y # Setting Visual Compiler - cmd: cd "C:\projects\" - - cmd: if %ARCH%==win32-msvc9 call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" - - cmd: if %ARCH%==win32-msvc9 set path=C:\Windows\Microsoft.NET\Framework\v4.0.30319;%path% - - cmd: if %ARCH%==x64-msvc9 call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" - - cmd: if %ARCH%==win32-msvc10 call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" - - cmd: if %ARCH%==win32-msvc10 set path=C:\Windows\Microsoft.NET\Framework\v4.0.30319;%path% - - cmd: if %ARCH%==x64-msvc10 call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 - - cmd: if %ARCH%==win32-msvc12 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" - - cmd: if %ARCH%==x64-msvc12 call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64 - cmd: if %ARCH%==win32-msvc14 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" - cmd: if %ARCH%==x64-msvc14 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 - cmd: if %ARCH%==win32-msvc15 call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" @@ -253,7 +130,6 @@ install: - cmd: cd "C:\projects\tangoidl" - cmd: cmake -G "%CMAKE_GENERATOR%" . - cmd: cmake --build ./ --target install --config Debug - - cmd: if %ARCH%==x64-msvc10 call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /Release - cmd: cmake --build ./ --target install --config Release # Tango API - cmd: cd "C:\projects\cppTango" @@ -279,7 +155,6 @@ build: build_script: - cmd: cd C:/projects/cppTango - cmake --build ./ --config Release - - cmd: if %ARCH%==x64-msvc10 call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 - cmd: cd c:/projects/debug_build - cmake --build ./ --config Debug #- cmake --build ./ --target install --config Debug @@ -296,28 +171,10 @@ after_build: # Generating installer - cmd: cpack -C Debug -G WIX - cmd: cpack -C Debug -G ZIP - #rename x64-msvc10 - - cmd: if %ARCH%==x64-msvc10 move libtango_%TANGO_LIB_VER%_Windows7.1SDK_x64_debug.msi libtango_%TANGO_LIB_VER%_v100_x64_debug.msi - - cmd: if %ARCH%==x64-msvc10 move libtango_%TANGO_LIB_VER%_Windows7.1SDK_x64_debug.zip libtango_%TANGO_LIB_VER%_v100_x64_debug.zip - - cmd: cd C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc10 move libtango_%TANGO_LIB_VER%_Windows7.1SDK_x64.msi libtango_%TANGO_LIB_VER%_v100_x64.msi - - cmd: if %ARCH%==x64-msvc10 move libtango_%TANGO_LIB_VER%_Windows7.1SDK_x64.zip libtango_%TANGO_LIB_VER%_v100_x64.zip # copying debug versions for upload - cmd: cd c:/projects/debug_build - - cmd: if %ARCH%==win32-msvc9 move libtango_%TANGO_LIB_VER%_v90_x86_debug.msi C:/projects/cppTango - - cmd: if %ARCH%==win32-msvc9 move libtango_%TANGO_LIB_VER%_v90_x86_debug.zip C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc9 move libtango_%TANGO_LIB_VER%_v90_x64_debug.msi C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc9 move libtango_%TANGO_LIB_VER%_v90_x64_debug.zip C:/projects/cppTango - - cmd: if %ARCH%==win32-msvc10 move libtango_%TANGO_LIB_VER%_v100_x86_debug.msi C:/projects/cppTango - - cmd: if %ARCH%==win32-msvc10 move libtango_%TANGO_LIB_VER%_v100_x86_debug.zip C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc10 move libtango_%TANGO_LIB_VER%_v100_x64_debug.msi C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc10 move libtango_%TANGO_LIB_VER%_v100_x64_debug.zip C:/projects/cppTango - - cmd: if %ARCH%==win32-msvc12 move libtango_%TANGO_LIB_VER%_v120_x86_debug.msi C:/projects/cppTango - - cmd: if %ARCH%==win32-msvc12 move libtango_%TANGO_LIB_VER%_v120_x86_debug.zip C:/projects/cppTango - cmd: if %ARCH%==win32-msvc14 move libtango_%TANGO_LIB_VER%_v140_x86_debug.msi C:/projects/cppTango - cmd: if %ARCH%==win32-msvc14 move libtango_%TANGO_LIB_VER%_v140_x86_debug.zip C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc12 move libtango_%TANGO_LIB_VER%_v120_x64_debug.msi C:/projects/cppTango - - cmd: if %ARCH%==x64-msvc12 move libtango_%TANGO_LIB_VER%_v120_x64_debug.zip C:/projects/cppTango - cmd: if %ARCH%==x64-msvc14 move libtango_%TANGO_LIB_VER%_v140_x64_debug.msi C:/projects/cppTango - cmd: if %ARCH%==x64-msvc14 move libtango_%TANGO_LIB_VER%_v140_x64_debug.zip C:/projects/cppTango - cmd: if %ARCH%==win32-msvc15 move libtango_%TANGO_LIB_VER%_v141_x86_debug.msi C:/projects/cppTango From 54adedc5573ab71214c95cb19264de84a24b7af0 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 21 Jan 2020 20:00:01 +0100 Subject: [PATCH 42/48] Remove conditional code for _MSC_VER < 1900 Removed with unifdef -D_MSC_VER=1900 and manual fixup of false matches. We also remove the predefined WIN32_VC* definitions as nobody is using them. --- cppapi/client/helpers/DeviceProxyHelper.h | 83 ---------------------- cppapi/server/tango_config.h | 37 ++-------- cppapi/server/tango_monitor.h | 12 ---- cppapi/server/utils.cpp | 5 -- log4tango/include/log4tango/config-win32.h | 49 +++---------- 5 files changed, 16 insertions(+), 170 deletions(-) diff --git a/cppapi/client/helpers/DeviceProxyHelper.h b/cppapi/client/helpers/DeviceProxyHelper.h index d5a53f494..56013ddc3 100644 --- a/cppapi/client/helpers/DeviceProxyHelper.h +++ b/cppapi/client/helpers/DeviceProxyHelper.h @@ -172,26 +172,9 @@ #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" #endif -// For VC++ 6 VA_ARG macro is not supported so ==>, we cannot override command_out functions -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_out internal_command_out -#else // For compilers that support variable number of arguments #define command_out(CMD_NAME, OUT, ...) internal_command_out (CMD_NAME, OUT, ## __VA_ARGS__, __FILE__, __LINE__ ) -#endif - -// For VC++ 6 VA_ARG macro is not supported so ==>, we cannot override command_in functions -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_in internal_command_in -#else // For compilers that support variable number of arguments #define command_in(CMD_NAME, IN, ...) internal_command_in (CMD_NAME, IN, ## __VA_ARGS__, __FILE__, __LINE__ ) -#endif - -// For VC++ 6 VA_ARG macro is not supported so ==>, we cannot override command_inout functions -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#else // For compilers that support variable number of arguments #define command_inout(CMD_NAME, ...) internal_command_inout (CMD_NAME, ## __VA_ARGS__, __FILE__, __LINE__ ) -#endif #if defined(__clang__) #pragma clang diagnostic pop @@ -290,9 +273,6 @@ namespace Tango // exec a DEV_VOID/DEV_VOID TANGO command on the underlying device // cmd_name : The name of the TANGO command //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif void internal_command (const std::string& cmd_name, std::string file, int line) @@ -314,9 +294,6 @@ namespace Tango ); } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif //--------------------------------------------------------------------------- // CommandInOutHelper::command_inout // exec a ARG_OUT/ARG_IN TANGO command on the underlying device @@ -329,9 +306,6 @@ namespace Tango // template arg _IN must be supported by DeviceData::operator<< // template arg _OUT must be supported by DeviceData::operator>> //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif template void internal_command_inout (const std::string& cmd_name, const _IN& argin, _OUT& argout, std::string file= __FILE__, int line= __LINE__) @@ -364,9 +338,6 @@ namespace Tango ); } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif //--------------------------------------------------------------------------- // CommandInOutHelper::command_inout // exec a DEVVARSTRINGARRAY/DEVVARSTRINGARRAY command on the underlying device @@ -379,9 +350,6 @@ namespace Tango // template arg _IN must be supported by DeviceData::.insert // template arg _OUT must be supported by DeviceData::.insert //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif template void internal_command_inout (const std::string& cmd_name, const std::vector<_IN>& _nv_in, @@ -421,9 +389,6 @@ namespace Tango ); } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif //--------------------------------------------------------------------------- // CommandInOutHelper::command_inout // Overloaded commands to avoid usage of DevVarXX ARRAY for argout @@ -431,9 +396,6 @@ namespace Tango template void internal_command_inout (const std::string& TANGO_UNUSED(cmd_name), const _IN& TANGO_UNUSED(argin), DevVarDoubleStringArray* TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_inout:Use only STL vector instead of DevVarDoubleStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; Tango::Except::throw_exception(static_cast("TANGO_WRONG_DATA_ERROR"), @@ -448,9 +410,6 @@ namespace Tango template void internal_command_inout (const std::string& TANGO_UNUSED(cmd_name), const _IN& TANGO_UNUSED(argin), DevVarLongStringArray* TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_inout:Use only STL vector instead of DevVarLongStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; Tango::Except::throw_exception(static_cast("TANGO_WRONG_DATA_ERROR"), @@ -464,9 +423,6 @@ namespace Tango template void internal_command_inout (const std::string& TANGO_UNUSED(cmd_name), const _IN& TANGO_UNUSED(argin), DevVarDoubleStringArray& TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_inout:Use only STL vector instead of DevVarDoubleStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; Tango::Except::throw_exception(static_cast("TANGO_WRONG_DATA_ERROR"), @@ -481,9 +437,6 @@ namespace Tango template void internal_command_inout (const std::string& TANGO_UNUSED(cmd_name), const _IN& TANGO_UNUSED(argin), DevVarLongStringArray& TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_inout:Use only STL vector instead of DevVarLongStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; Tango::Except::throw_exception(static_cast("TANGO_WRONG_DATA_ERROR"), @@ -502,9 +455,6 @@ namespace Tango //--------------------------------------------------------------------------- // template arg _IN must be supported by DeviceData::operator<< //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif template void internal_command_in (const std::string& cmd_name, const _IN& argin, std::string file= __FILE__, int line= __LINE__) { @@ -525,9 +475,6 @@ namespace Tango ); } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif //--------------------------------------------------------------------------- // CommandInOutHelper::command_in // exec a DEV_VOID/DEVVARSTRINGARRAY command on the underlying device @@ -537,9 +484,6 @@ namespace Tango //--------------------------------------------------------------------------- // template arg _IN must be supported by DeviceData::.insert //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif template void internal_command_in (const std::string& cmd_name, const std::vector<_IN>& _nv_in, @@ -564,9 +508,6 @@ namespace Tango } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif //--------------------------------------------------------------------------- // CommandInOutHelper::command_out // exec a ARG_OUT/DEV_VOID TANGO command on the underlying device @@ -575,9 +516,6 @@ namespace Tango //--------------------------------------------------------------------------- // template arg _OUT must be supported by DeviceData::operator>> //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif template void internal_command_out (const std::string& cmd_name, _OUT& argout, std::string file= __FILE__, int line= __LINE__) { @@ -608,9 +546,6 @@ namespace Tango ); } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif //--------------------------------------------------------------------------- // CommandInOutHelper::command_out @@ -619,9 +554,6 @@ namespace Tango template void internal_command_out(_OUT TANGO_UNUSED(dummy), DevVarDoubleStringArray* TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_out:Use only STL vector instead of DevVarDoubleStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; @@ -637,9 +569,6 @@ namespace Tango template void internal_command_out (_OUT TANGO_UNUSED(dummy), DevVarLongStringArray* TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_out:Use only STL vector instead of DevVarLongStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; Tango::Except::throw_exception(static_cast("TANGO_WRONG_DATA_ERROR"), @@ -653,9 +582,6 @@ namespace Tango template void internal_command_out(_OUT TANGO_UNUSED(dummy), DevVarDoubleStringArray& TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_out:Use only STL vector instead of DevVarDoubleStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; Tango::Except::throw_exception(static_cast("TANGO_WRONG_DATA_ERROR"), @@ -669,9 +595,6 @@ namespace Tango template void internal_command_out (_OUT TANGO_UNUSED(dummy), DevVarLongStringArray& TANGO_UNUSED(argout), std::string file= __FILE__, int line= __LINE__) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#pragma message (" TANGO WARNING ***** command_out:Use only STL vector instead of DevVarLongStringArray *****") -#endif TangoSys_OMemStream o; o << " [" << file << "::" << line << "]" << std::ends; @@ -688,9 +611,6 @@ namespace Tango //--------------------------------------------------------------------------- // template arg _OUT must be supported by DeviceData::.extract //--------------------------------------------------------------------------- -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#undef command_inout // Must avoid macro expansion -#endif template void internal_command_out (const std::string& cmd_name, std::vector<_OUT>& _nv_out, @@ -724,9 +644,6 @@ namespace Tango ); } } -#if (defined(_MSC_VER) && _MSC_VER < 1300) -#define command_inout internal_command_inout -#endif private: //- placed here as a workaround due to CORBA::any_var limitations diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 6f60922d2..ac16c4375 100644 --- a/cppapi/server/tango_config.h +++ b/cppapi/server/tango_config.h @@ -76,29 +76,6 @@ #endif #endif -// -// Check Win32 VC release -// - -#ifdef _WIN32 - #ifdef _MSC_VER - #if ((_MSC_VER >= 1400) && (_MSC_VER < 1500)) - #define WIN32_VC8 - #elif ((_MSC_VER >= 1500) && (_MSC_VER < 1600)) - #define WIN32_VC9 - #elif ((_MSC_VER >= 1600) && (_MSC_VER < 1700)) - #define WIN32_VC10 - #elif ((_MSC_VER >= 1700) && (_MSC_VER < 1800)) - #define WIN32_VC11 - #elif ((_MSC_VER >= 1800) && (_MSC_VER < 1900)) - #define WIN32_VC12 - #elif (_MSC_VER >= 1900) - #define WIN32_VC14 - #endif // VC8+/VC9/VC10/VC11/VC12/VC14 - #endif -#endif - - // // Define a common preprocessor macros for all Windows (32 or 64 bits) // @@ -153,14 +130,12 @@ // #ifdef _TG_WINDOWS_ - #pragma warning(disable : 4355) - #pragma warning(disable : 4715) - #pragma warning(disable : 4786) - #pragma warning(disable : 4267) // var : conversion from size_t to type, possible loss of data - #pragma warning(disable : 4244) // conversion conversion from type1 to type2, possible loss of data - #if (_MSC_VER >= 1400) // VC8+ - #pragma warning(disable : 4996) // disable all deprecation warnings - #endif // VC8+ + #pragma warning(disable : 4355) + #pragma warning(disable : 4715) + #pragma warning(disable : 4786) + #pragma warning(disable : 4267) // var : conversion from size_t to type, possible loss of data + #pragma warning(disable : 4244) // conversion conversion from type1 to type2, possible loss of data + #pragma warning(disable : 4996) // disable all deprecation warnings #endif // diff --git a/cppapi/server/tango_monitor.h b/cppapi/server/tango_monitor.h index ca28bc5f7..6d679e58b 100644 --- a/cppapi/server/tango_monitor.h +++ b/cppapi/server/tango_monitor.h @@ -121,9 +121,7 @@ inline void TangoMonitor::get_monitor() omni_mutex_lock synchronized(*this); -#if !defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER >= 1300) cout4 << "In get_monitor() " << name << ", thread = " << th->id() << ", ctr = " << locked_ctr << std::endl; -#endif if (locked_ctr == 0) { @@ -133,17 +131,13 @@ inline void TangoMonitor::get_monitor() { while(locked_ctr > 0) { -#if !defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER >= 1300) cout4 << "Thread " << th->id() << ": waiting !!" << std::endl; -#endif int interupted; interupted = wait(_timeout); if (interupted == false) { -#if !defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER >= 1300) cout4 << "TIME OUT for thread " << th->id() << std::endl; -#endif Except::throw_exception((const char *)API_CommandTimedOut, (const char *)"Not able to acquire serialization (dev, class or process) monitor", (const char *)"TangoMonitor::get_monitor"); @@ -153,9 +147,7 @@ inline void TangoMonitor::get_monitor() } else { -#if !defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER >= 1300) cout4 << "owner_thread !!" << std::endl; -#endif } locked_ctr++; @@ -178,18 +170,14 @@ inline void TangoMonitor::rel_monitor() omni_thread *th = omni_thread::self(); omni_mutex_lock synchronized(*this); -#if !defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER >= 1300) cout4 << "In rel_monitor() " << name << ", ctr = " << locked_ctr << ", thread = " << th->id() << std::endl; -#endif if ((locked_ctr == 0) || (th != locking_thread)) return; locked_ctr--; if (locked_ctr == 0) { -#if !defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER >= 1300) cout4 << "Signalling !" << std::endl; -#endif locking_thread = NULL; cond.signal(); } diff --git a/cppapi/server/utils.cpp b/cppapi/server/utils.cpp index ea038a430..dd35a6ec8 100644 --- a/cppapi/server/utils.cpp +++ b/cppapi/server/utils.cpp @@ -54,11 +54,6 @@ #include #include #include -#ifdef _MSC_VER -#if _MSC_VER < 1900 -#include -#endif -#endif #endif /* _TG_WINDOWS_ */ #include diff --git a/log4tango/include/log4tango/config-win32.h b/log4tango/include/log4tango/config-win32.h index 427a49337..081c37ca7 100644 --- a/log4tango/include/log4tango/config-win32.h +++ b/log4tango/include/log4tango/config-win32.h @@ -3,8 +3,8 @@ // // Copyright (C) : 2000 - 2002 // LifeLine Networks BV (www.lifeline.nl). All rights reserved. -// Bastiaan Bakker. All rights reserved. -// +// Bastiaan Bakker. All rights reserved. +// // 2004,2005,2006,2007,2008,2009,2010,2011,2012 // Synchrotron SOLEIL // L'Orme des Merisiers @@ -16,40 +16,37 @@ // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // Log4tango 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. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with Log4Tango. If not, see . #ifndef _INCLUDE_LOG4TANGO_CONFIG_WIN32_H #define _INCLUDE_LOG4TANGO_CONFIG_WIN32_H 1 - + /* manually edited from include/log4tango/config.h */ /* Define if you have the syslog function. */ /* #undef LOG4TANGO_HAVE_SYSLOG */ /* Define if you have the `ftime' function. */ -#ifndef LOG4TANGO_HAVE_FTIME -# define LOG4TANGO_HAVE_FTIME 1 +#ifndef LOG4TANGO_HAVE_FTIME +# define LOG4TANGO_HAVE_FTIME 1 #endif /* Define if you have the `gettimeofday' function. */ -/* #undef LOG4TANGO_HAVE_GETTIMEOFDAY */ +/* #undef LOG4TANGO_HAVE_GETTIMEOFDAY */ /* define if the compiler has int64_t */ -#ifndef LOG4TANGO_HAVE_INT64_T +#ifndef LOG4TANGO_HAVE_INT64_T #define LOG4TANGO_HAVE_INT64_T -//#define int64_t __int64 +//#define int64_t __int64 typedef __int64 int64_t; -#if defined(_MSC_VER) && _MSC_VER < 1300 -# define LOG4TANGO_MISSING_INT64_OSTREAM_OP -#endif #endif @@ -117,32 +114,6 @@ typedef __int64 int64_t; # define LOG4TANGO_SUPPLY_DLLMAIN #endif -/* MSVCs and headers are broken in the sense that they - put functions in the global namespace instead of std:: - The #defines below enable a workaround for MSVC 6 and lower. If MSVC 7 - is still broken please adjust the _MSC_VER version check and report it. - See also bug report #628211. -*/ -#if defined(_MSC_VER) && _MSC_VER < 1300 - -#ifndef LOG4TANGO_CSTDLIB_NOT_IN_STD -# define LOG4TANGO_CSTDLIB_NOT_IN_STD -#endif - -#ifndef LOG4TANGO_CSTRING_NOT_IN_STD -# define LOG4TANGO_CSTRING_NOT_IN_STD -#endif - -#ifndef LOG4TANGO_CTIME_NOT_IN_STD -# define LOG4TANGO_CTIME_NOT_IN_STD -#endif - -#ifndef LOG4TANGO_CMATH_NOT_IN_STD -# define LOG4TANGO_CMATH_NOT_IN_STD -#endif - -#endif - /* define mode_t. Move to Portability.hh if more platforms need it */ namespace log4tango { From 435aa9f05b4dbacfc59757f2c23a5f806a433906 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 21 Jan 2020 20:04:48 +0100 Subject: [PATCH 43/48] log4tango: Remove fallback code for old MSVC versions Support for MSVC below 2015 (aka vc14 aka _MSC_VER 1900) was removed in a previous commit. --- log4tango/src/PatternLayout.cpp | 10 ---------- log4tango/src/PortabilityImpl.hh | 34 -------------------------------- 2 files changed, 44 deletions(-) diff --git a/log4tango/src/PatternLayout.cpp b/log4tango/src/PatternLayout.cpp index c6b7093e6..a865b3987 100644 --- a/log4tango/src/PatternLayout.cpp +++ b/log4tango/src/PatternLayout.cpp @@ -46,16 +46,6 @@ # ifdef LOG4TANGO_HAVE_STDINT_H # include # endif // LOG4TANGO_HAVE_STDINT_H -# ifdef LOG4TANGO_MISSING_INT64_OSTREAM_OP - // workaround suggested at: - // http://support.microsoft.com/default.aspx?scid=kb;EN-US;q168440 - #include - std::ostream& operator<<(std::ostream& os, int64_t i) { - char buf[20]; - ::sprintf(buf,"%I64d", i); - return os << buf; - } -# endif // LOG4TANGO_MISSING_INT64_OSTREAM_OP #endif // LOG4TANGO_HAVE_INT64_T namespace log4tango { diff --git a/log4tango/src/PortabilityImpl.hh b/log4tango/src/PortabilityImpl.hh index 8f52b2cec..5d1714102 100644 --- a/log4tango/src/PortabilityImpl.hh +++ b/log4tango/src/PortabilityImpl.hh @@ -30,42 +30,8 @@ #include -#ifdef LOG4TANGO_CSTDLIB_NOT_IN_STD -#include -namespace std { - static inline char *getenv(const char *name) { return ::getenv(name); }; - static inline int atoi(const char *nptr) { return ::atoi(nptr); }; - static inline unsigned long int - strtoul(const char *nptr, char **endptr, int base) { - return ::strtol(nptr, endptr, base); - }; -} -#endif -#ifdef LOG4TANGO_CSTRING_NOT_IN_STD -#include -namespace std { - static inline void *memmove(void *dest, const void *src, size_t n) { - return ::memmove(dest, src, n); - }; -} -#endif -#ifdef LOG4TANGO_CTIME_NOT_IN_STD -#include -namespace std { - static inline size_t strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr ) { - return ::strftime(strDest,maxsize,format,timeptr); - } - static inline struct tm *localtime( const time_t *timer ) { return ::localtime(timer); } - } -#endif -#ifdef LOG4TANGO_CMATH_NOT_IN_STD -#include -namespace std { - static inline int abs(int i) { return ::abs(i); } -} -#endif #endif // _LOG4TANGO_PORTABILITYIMPL_H From 17abaedb4ea38b1bb788faa2917be54cef1f938f Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 21 Jan 2020 20:09:33 +0100 Subject: [PATCH 44/48] cppapi/server/device.cpp: Remove compiler silencing return values We nowadays alwas mark Except::throw_exception as [[noreturn]] therefore all compiler should be able to figure out that the function does not need a return value here. --- cppapi/server/device.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cppapi/server/device.cpp b/cppapi/server/device.cpp index db9472e63..d9834374c 100644 --- a/cppapi/server/device.cpp +++ b/cppapi/server/device.cpp @@ -909,15 +909,6 @@ std::vector::iterator DeviceImpl::get_polled_obj_by_type_name( o << obj_name << " not found in list of polled object" << std::ends; Except::throw_exception((const char *) API_PollObjNotFound, o.str(), (const char *) "DeviceImpl::get_polled_obj_by_type_name"); - -// -// Only to make compiler quiet. Should never pass here -// - -// exclude the return value for VC8+ -#if not defined(_TG_WINDOWS_) || (defined(_MSC_VER) && _MSC_VER < 1400) - return (std::vector::iterator) NULL; -#endif } //+----------------------------------------------------------------------------------------------------------------- From 5251bee5fd72752bd6d380ddc4a7254aa67a36cb Mon Sep 17 00:00:00 2001 From: mliszcz Date: Mon, 16 Dec 2019 14:13:20 +0100 Subject: [PATCH 45/48] Protect storing last attribute value with mutex Fixes data race between: * polling thread (EventSupplier::detect_and_push_xxx_event) * and user thread pushing events (Attribute::fire_xxx_event) --- cppapi/server/attribute.cpp | 139 ++++++++++++++++---------------- cppapi/server/attribute.h | 10 ++- cppapi/server/eventsupplier.cpp | 131 ++++++------------------------ 3 files changed, 102 insertions(+), 178 deletions(-) diff --git a/cppapi/server/attribute.cpp b/cppapi/server/attribute.cpp index 9c2d15c75..e29e0fbc0 100644 --- a/cppapi/server/attribute.cpp +++ b/cppapi/server/attribute.cpp @@ -64,6 +64,47 @@ static bool WantedProp_f(AttrProperty a,const char *n) return (a.get_name() == n); } +void LastAttrValue::store( + const AttributeValue_5* attr_5, + const AttributeValue_4* attr_4, + const AttributeValue_3* attr_3, + const AttributeValue* attr, + DevFailed* error) +{ + if (error) + { + except = *error; + err = true; + } + else + { + if (attr_5) + { + quality = attr_5->quality; + value_4 = attr_5->value; + } + else if (attr_4) + { + quality = attr_4->quality; + value_4 = attr_4->value; + } + else if (attr_3) + { + quality = attr_3->quality; + value = attr_3->value; + } + else if (attr) + { + quality = attr->quality; + value = attr->value; + } + + err = false; + } + + inited = true; +} + //-------------------------------------------------------------------------------------------------------------------- // @@ -4029,54 +4070,34 @@ void Attribute::fire_change_event(DevFailed *except) bool force_change = false; bool quality_change = false; - if ((except != NULL) || - (quality == Tango::ATTR_INVALID) || - ((except == NULL) && (prev_change_event.err == true)) || - ((quality != Tango::ATTR_INVALID) && - (prev_change_event.quality == Tango::ATTR_INVALID))) { - force_change = true; - } + omni_mutex_lock oml(EventSupplier::get_event_mutex()); - std::vector filterable_names; - std::vector filterable_data; - std::vector filterable_names_lg; - std::vector filterable_data_lg; + const AttrQuality old_quality = prev_change_event.quality; - if (except != NULL) - { - prev_change_event.err = true; - prev_change_event.except = *except; - } - else - { - Tango::AttrQuality the_quality; - - if (send_attr_5 != NULL) - { - the_quality = send_attr_5->quality; - prev_change_event.value_4 = send_attr_5->value; - } - else if (send_attr_4 != NULL) + if (except + || quality == Tango::ATTR_INVALID + || ((! except) && prev_change_event.err) + || (quality != Tango::ATTR_INVALID && old_quality == Tango::ATTR_INVALID)) { - the_quality = send_attr_4->quality; - prev_change_event.value_4 = send_attr_4->value; - } - else - { - the_quality = send_attr->quality; - prev_change_event.value = send_attr->value; + force_change = true; } - if (prev_change_event.quality != the_quality) - { - quality_change = true; - } + prev_change_event.store( + send_attr_5, + send_attr_4, + send_attr, + Tango_nullptr, + except); - prev_change_event.quality = the_quality; - prev_change_event.err = false; + quality_change = (old_quality != prev_change_event.quality); } - prev_change_event.inited = true; + + + std::vector filterable_names; + std::vector filterable_data; + std::vector filterable_names_lg; + std::vector filterable_data_lg; filterable_names.push_back("forced_event"); if (force_change == true) @@ -4490,40 +4511,20 @@ void Attribute::fire_archive_event(DevFailed *except) std::vector filterable_names_lg; std::vector filterable_data_lg; - if (except != NULL) - { - prev_archive_event.err = true; - prev_archive_event.except = *except; - } - else { - Tango::AttrQuality the_quality; + omni_mutex_lock oml(EventSupplier::get_event_mutex()); - if (send_attr_5 != nullptr) - { - prev_archive_event.value_4 = send_attr_5->value; - the_quality = send_attr_5->quality; - } - else if (send_attr_4 != nullptr) - { - prev_archive_event.value_4 = send_attr_4->value; - the_quality = send_attr_4->quality; - } - else - { - prev_archive_event.value = send_attr->value; - the_quality = send_attr->quality; - } + const AttrQuality old_quality = prev_archive_event.quality; - if (prev_archive_event.quality != the_quality) - { - quality_change = true; - } + prev_archive_event.store( + send_attr_5, + send_attr_4, + send_attr, + Tango_nullptr, + except); - prev_archive_event.quality = the_quality; - prev_archive_event.err = false; + quality_change = (old_quality != prev_archive_event.quality); } - prev_archive_event.inited = true; filterable_names.push_back("forced_event"); if (force_change == true) diff --git a/cppapi/server/attribute.h b/cppapi/server/attribute.h index e524842ab..2a89a3d63 100644 --- a/cppapi/server/attribute.h +++ b/cppapi/server/attribute.h @@ -102,7 +102,7 @@ typedef union _Attr_Value }Attr_Value; -typedef struct last_attr_value +struct LastAttrValue { bool inited; Tango::AttrQuality quality; @@ -110,7 +110,13 @@ typedef struct last_attr_value bool err; DevFailed except; AttrValUnion value_4; -} LastAttrValue; + void store( + const AttributeValue_5*, + const AttributeValue_4*, + const AttributeValue_3*, + const AttributeValue*, + DevFailed*); +}; typedef enum prop_type { diff --git a/cppapi/server/eventsupplier.cpp b/cppapi/server/eventsupplier.cpp index 3546a8a44..a57cfbbc6 100644 --- a/cppapi/server/eventsupplier.cpp +++ b/cppapi/server/eventsupplier.cpp @@ -335,34 +335,12 @@ bool EventSupplier::detect_and_push_change_event(DeviceImpl *device_impl, struct if (attr.prev_change_event.inited == false) { - if (except != NULL) - { - attr.prev_change_event.err = true; - attr.prev_change_event.except = *except; - } - else - { - if (attr_value.attr_val_5 != NULL) - { - attr.prev_change_event.value_4 = attr_value.attr_val_5->value; - } - else if (attr_value.attr_val_4 != NULL) - { - attr.prev_change_event.value_4 = attr_value.attr_val_4->value; - } - else if (attr_value.attr_val_3 != NULL) - { - attr.prev_change_event.value = attr_value.attr_val_3->value; - } - else - { - attr.prev_change_event.value = attr_value.attr_val->value; - } - - attr.prev_change_event.quality = the_quality; - attr.prev_change_event.err = false; - } - attr.prev_change_event.inited = true; + attr.prev_change_event.store( + attr_value.attr_val_5, + attr_value.attr_val_4, + attr_value.attr_val_3, + attr_value.attr_val, + except); is_change = true; } else @@ -401,32 +379,12 @@ bool EventSupplier::detect_and_push_change_event(DeviceImpl *device_impl, struct std::vector filterable_names_lg; std::vector filterable_data_lg; - if (except != NULL) - { - attr.prev_change_event.err = true; - attr.prev_change_event.except = *except; - } - else - { - if (attr_value.attr_val_5 != NULL) - { - attr.prev_change_event.value_4 = attr_value.attr_val_5->value; - } - else if (attr_value.attr_val_4 != NULL) - { - attr.prev_change_event.value_4 = attr_value.attr_val_4->value; - } - else if (attr_value.attr_val_3 != NULL) - { - attr.prev_change_event.value = attr_value.attr_val_3->value; - } - else - { - attr.prev_change_event.value = attr_value.attr_val->value; - } - attr.prev_change_event.quality = the_quality; - attr.prev_change_event.err = false; - } + attr.prev_change_event.store( + attr_value.attr_val_5, + attr_value.attr_val_4, + attr_value.attr_val_3, + attr_value.attr_val, + except); // // Prepare to push the event @@ -692,36 +650,15 @@ bool EventSupplier::detect_and_push_archive_event(DeviceImpl *device_impl, if (attr.prev_archive_event.inited == false) { - if (except != NULL) - { - attr.prev_archive_event.err = true; - attr.prev_archive_event.except = *except; - } - else - { - if (attr_value.attr_val_5 != NULL) - { - attr.prev_archive_event.value_4 = attr_value.attr_val_5->value; - } - else if (attr_value.attr_val_4 != NULL) - { - attr.prev_archive_event.value_4 = attr_value.attr_val_4->value; - } - else if (attr_value.attr_val_3 != NULL) - { - attr.prev_archive_event.value = attr_value.attr_val_3->value; - } - else - { - attr.prev_archive_event.value = attr_value.attr_val->value; - } + attr.prev_archive_event.store( + attr_value.attr_val_5, + attr_value.attr_val_4, + attr_value.attr_val_3, + attr_value.attr_val, + except); - attr.prev_archive_event.quality = the_quality; - attr.prev_archive_event.err = false; - } attr.archive_last_periodic = now_ms; attr.archive_last_event = now_ms; - attr.prev_archive_event.inited = true; is_change = true; } else @@ -764,32 +701,12 @@ bool EventSupplier::detect_and_push_archive_event(DeviceImpl *device_impl, domain_name = device_impl->get_name() + "/" + attr_name; - if (except != NULL) - { - attr.prev_archive_event.err = true; - attr.prev_archive_event.except = *except; - } - else - { - if (attr_value.attr_val_5 != NULL) - { - attr.prev_archive_event.value_4 = attr_value.attr_val_5->value; - } - else if (attr_value.attr_val_4 != NULL) - { - attr.prev_archive_event.value_4 = attr_value.attr_val_4->value; - } - else if (attr_value.attr_val_3 != NULL) - { - attr.prev_archive_event.value = attr_value.attr_val_3->value; - } - else - { - attr.prev_archive_event.value = attr_value.attr_val->value; - } - attr.prev_archive_event.quality = the_quality; - attr.prev_archive_event.err = false; - } + attr.prev_archive_event.store( + attr_value.attr_val_5, + attr_value.attr_val_4, + attr_value.attr_val_3, + attr_value.attr_val, + except); // // Prepare to push the event From 8d4a1bbe68a75e6cf1a35f7945626fc821374afc Mon Sep 17 00:00:00 2001 From: mliszcz Date: Mon, 16 Dec 2019 14:36:24 +0100 Subject: [PATCH 46/48] Change mutex used for EventSupplier::detect_change Remove detect_mutex and protect detect_change method with event_mutex to synchronize access to the old attribute value. Fixes data race between: * polling thread (EventSupplier::detect_and_push_xxx_event) * and user thread pushing events (EventSupplier::detect_change) --- cppapi/server/attribute.cpp | 39 ++++++++++++++++++--------------- cppapi/server/eventsupplier.cpp | 8 ------- cppapi/server/eventsupplier.h | 5 ----- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/cppapi/server/attribute.cpp b/cppapi/server/attribute.cpp index e29e0fbc0..643c0c90f 100644 --- a/cppapi/server/attribute.cpp +++ b/cppapi/server/attribute.cpp @@ -4489,32 +4489,30 @@ void Attribute::fire_archive_event(DevFailed *except) } else { - -// -// Execute detect_change only to calculate the delta_change_rel and -// delta_change_abs and force_change ! -// - bool force_change = false; bool quality_change = false; double delta_change_rel = 0.0; double delta_change_abs = 0.0; - if (event_supplier_nd != NULL) - event_supplier_nd->detect_change(*this, ad,true,delta_change_rel,delta_change_abs,except,force_change,dev); - else if (event_supplier_zmq != NULL) - event_supplier_zmq->detect_change(*this, ad,true,delta_change_rel,delta_change_abs,except,force_change,dev); - - - std::vector filterable_names; - std::vector filterable_data; - std::vector filterable_names_lg; - std::vector filterable_data_lg; - { omni_mutex_lock oml(EventSupplier::get_event_mutex()); - const AttrQuality old_quality = prev_archive_event.quality; + // Execute detect_change only to calculate the delta_change_rel and + // delta_change_abs and force_change ! + + if (event_supplier_nd || event_supplier_zmq) + { + EventSupplier* event_supplier = event_supplier_nd ? event_supplier_nd : event_supplier_zmq; + event_supplier->detect_change( + *this, + ad, + true, + delta_change_rel, + delta_change_abs, + except, + force_change, + dev); + } prev_archive_event.store( send_attr_5, @@ -4526,6 +4524,11 @@ void Attribute::fire_archive_event(DevFailed *except) quality_change = (old_quality != prev_archive_event.quality); } + std::vector filterable_names; + std::vector filterable_data; + std::vector filterable_names_lg; + std::vector filterable_data_lg; + filterable_names.push_back("forced_event"); if (force_change == true) filterable_data.push_back((double)1.0); diff --git a/cppapi/server/eventsupplier.cpp b/cppapi/server/eventsupplier.cpp index a57cfbbc6..674acf9a3 100644 --- a/cppapi/server/eventsupplier.cpp +++ b/cppapi/server/eventsupplier.cpp @@ -43,8 +43,6 @@ namespace Tango omni_mutex EventSupplier::event_mutex; -omni_mutex EventSupplier::detect_mutex; - omni_mutex EventSupplier::push_mutex; omni_condition EventSupplier::push_cond(&EventSupplier::push_mutex); @@ -1098,12 +1096,6 @@ bool EventSupplier::detect_change(Attribute &attr, struct SuppliedEventData &att the_new_any = &(attr_value.attr_val->value); } -// -// get the mutex to synchronize the sending of events -// - - omni_mutex_lock l(detect_mutex); - // // Send event, if the read_attribute failed or if it is the first time that the read_attribute succeed after a failure. // Same thing if the attribute quality factor changes to INVALID diff --git a/cppapi/server/eventsupplier.h b/cppapi/server/eventsupplier.h index bcda2ec85..11554a157 100644 --- a/cppapi/server/eventsupplier.h +++ b/cppapi/server/eventsupplier.h @@ -173,11 +173,6 @@ protected : static omni_mutex push_mutex; static omni_condition push_cond; - // Added a mutex to synchronize the access to - // detect_event which is used - // from different threads - static omni_mutex detect_mutex; - private: bool one_subscription_cmd; }; From ee262d4fc3349be074fef3e86e74a5c6706e648e Mon Sep 17 00:00:00 2001 From: mliszcz Date: Mon, 16 Dec 2019 14:46:53 +0100 Subject: [PATCH 47/48] Protect event subscription timestamps with mutex Fixes data race between: * omni worker thread (DServer::event_subscription) * and user thread pushing events (Attribute::fire_xxx_event) --- cppapi/server/attribute.cpp | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/cppapi/server/attribute.cpp b/cppapi/server/attribute.cpp index 643c0c90f..448b919dc 100644 --- a/cppapi/server/attribute.cpp +++ b/cppapi/server/attribute.cpp @@ -3827,9 +3827,13 @@ void Attribute::fire_change_event(DevFailed *except) time_t change3_subscription,change4_subscription,change5_subscription; now = time(NULL); - change3_subscription = now - event_change3_subscription; - change4_subscription = now - event_change4_subscription; - change5_subscription = now - event_change5_subscription; + + { + omni_mutex_lock oml(EventSupplier::get_event_mutex()); + change3_subscription = now - event_change3_subscription; + change4_subscription = now - event_change4_subscription; + change5_subscription = now - event_change5_subscription; + } // // Get the event supplier(s) @@ -4232,9 +4236,12 @@ void Attribute::fire_archive_event(DevFailed *except) now = time(NULL); - archive3_subscription = now - event_archive3_subscription; - archive4_subscription = now - event_archive4_subscription; - archive5_subscription = now - event_archive5_subscription; + { + omni_mutex_lock oml(EventSupplier::get_event_mutex()); + archive3_subscription = now - event_archive3_subscription; + archive4_subscription = now - event_archive4_subscription; + archive5_subscription = now - event_archive5_subscription; + } // // Get the event supplier(s) @@ -4658,9 +4665,12 @@ void Attribute::fire_event(std::vector &filt_names,std::vector client_libs = get_client_lib(PERIODIC_EVENT); // We want a copy From 3bea45cbbb00a289ba447b22395431789c6376a1 Mon Sep 17 00:00:00 2001 From: mliszcz Date: Thu, 23 Jan 2020 16:23:03 +0100 Subject: [PATCH 48/48] Simplify condition for enforcing change event Redundant checks are removed to simplify the condition for enforcing sending of change event. New condition is equivalent to the original one. This is non-functional change. --- cppapi/server/attribute.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cppapi/server/attribute.cpp b/cppapi/server/attribute.cpp index 448b919dc..8c8e3a941 100644 --- a/cppapi/server/attribute.cpp +++ b/cppapi/server/attribute.cpp @@ -4081,8 +4081,8 @@ void Attribute::fire_change_event(DevFailed *except) if (except || quality == Tango::ATTR_INVALID - || ((! except) && prev_change_event.err) - || (quality != Tango::ATTR_INVALID && old_quality == Tango::ATTR_INVALID)) + || prev_change_event.err + || old_quality == Tango::ATTR_INVALID) { force_change = true; }