diff --git a/.travis.yml b/.travis.yml index 17f6c1a46..09b7eaa69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,12 @@ 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 - OS_TYPE=debian9 - - OS_TYPE=debian8 STOCK_CPPZMQ=OFF - - OS_TYPE=debian7 + - OS_TYPE=debian8 SONAR_SCANNER=ON COVERALLS=ON STOCK_CPPZMQ=OFF notifications: email: false @@ -50,49 +50,32 @@ before_install: 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) --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} - --link tango_cs -v `pwd`:/home/tango/src -v `pwd`/idl:/home/tango/idl -v `pwd`/cppzmq:/home/tango/cppzmq -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 + - > + 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 @@ -118,5 +101,3 @@ deploy: after-script: - docker stop cpp_tango - - docker stop tango_cs - - docker stop mysql_db 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/debian8/Dockerfile b/.travis/debian8/Dockerfile index 7f364e2aa..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,12 +18,31 @@ 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 \ + 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 diff --git a/.travis/test.sh b/.travis/test.sh index 2ec8fb145..91276b2bc 100755 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -6,29 +6,20 @@ 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 "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" -if [ $? -ne "0" ] -then - exit -1 -fi +function run_in_container { + docker exec \ + -w "${build_dir}" \ + -e CTEST_PARALLEL_LEVEL=$(nproc) \ + -e CTEST_OUTPUT_ON_FAILURE=ON \ + cpp_tango "$@" +} -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 +set -e + +if [[ "$COVERALLS" == "ON" ]]; then + run_in_container make coveralls +else + run_in_container ctest fi diff --git a/.travis/debian7/Dockerfile b/.travis/ubuntu-20.04/Dockerfile similarity index 53% rename from .travis/debian7/Dockerfile rename to .travis/ubuntu-20.04/Dockerfile index f16f6a0c7..791659a4f 100644 --- a/.travis/debian7/Dockerfile +++ b/.travis/ubuntu-20.04/Dockerfile @@ -1,4 +1,4 @@ -FROM debian/eol:wheezy +FROM ubuntu:focal ARG APP_UID=2000 @@ -6,32 +6,27 @@ 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 \ + cmake \ curl \ git \ libcos4-dev \ libomniorb4-dev \ - libomnithread3-dev \ + libomnithread4-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 + 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ae9a2675..5ff570e54 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) @@ -29,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/INSTALL.md b/INSTALL.md index ac664421c..38b530b21 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -112,128 +112,94 @@ $ 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 +From `build/` directory run: -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 - - - -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 -``` -$ cd build -$ cat tango_host -#!/bin/bash -export TANGO_HOST=172.17.0.3:10000 +Total Test time (real) = 546.93 sec ``` -TANGO_HOST must be the same as what `start-tango` has returned. +Test output and device server logs are collected in `build/cpp_test_suite/test_results`. -``` -$ . tango_host -``` +For more details on testing with CTest, [see the guide](https://cmake.org/Wiki/CMake/Testing_With_CTest). -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) +### Setting environment up manually -### Stop TANGO environment +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: -``` -$ make stop-tango +```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/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 diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt index 72d74bad4..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,34 +192,14 @@ 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 # 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") @@ -229,6 +227,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/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) 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/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/cxxtest/CMakeLists.txt b/cpp_test_suite/cxxtest/CMakeLists.txt index 82ca5da20..9c981d0ad 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} @@ -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/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/environment/CMakeLists.txt b/cpp_test_suite/environment/CMakeLists.txt index f22e4b28b..fa64b382e 100644 --- a/cpp_test_suite/environment/CMakeLists.txt +++ b/cpp_test_suite/environment/CMakeLists.txt @@ -1,23 +1,14 @@ #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) +SET(SCRIPTS + run_with_fixture.sh + setup_database.sh + setup_devices.sh + start_server.sh + 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/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/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/run_with_fixture.sh.cmake b/cpp_test_suite/environment/run_with_fixture.sh.cmake new file mode 100755 index 000000000..1d52699c0 --- /dev/null +++ b/cpp_test_suite/environment/run_with_fixture.sh.cmake @@ -0,0 +1,53 @@ +#!/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_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" + +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 + 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.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/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 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/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}" 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 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/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/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/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/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}) 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/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/ApiUtil.h b/cppapi/client/ApiUtil.h index b82af9de2..a9e85587d 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; @@ -256,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 */ 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..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 &); @@ -1313,11 +1311,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..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; @@ -640,11 +638,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..886390485 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 &); @@ -738,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;} @@ -774,11 +772,7 @@ class DevicePipeBlob DevicePipeBlobExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DevicePipeBlobExt *ext; // Class extension -#endif }; @@ -1082,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;} @@ -1104,11 +1096,7 @@ public : DevicePipeExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext; -#else - DevicePipeExt *ext; // Class extension -#endif }; /**************************************************************************************** @@ -1204,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); \ @@ -1268,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); \ @@ -1332,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); \ @@ -1398,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); \ @@ -1450,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); \ @@ -1504,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); \ @@ -1561,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 bf5be689f..2e2f96aca 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; @@ -199,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/api_util.cpp b/cppapi/client/api_util.cpp index 7d7346727..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); } @@ -207,11 +198,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 +207,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..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) { // @@ -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..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; @@ -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 } @@ -425,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; @@ -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_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 59049651d..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) { } @@ -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/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.h b/cppapi/client/devapi.h index 4692ec814..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(); @@ -603,11 +601,7 @@ public : DeviceDataHistoryExt() {}; }; -#ifdef HAS_UNIQUE_PTR std::unique_ptr ext_hist; -#else - DeviceDataHistoryExt *ext_hist; // Class extension -#endif }; typedef std::vector DeviceDataHistoryList; @@ -641,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 @@ -701,11 +693,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..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; @@ -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,54 +112,15 @@ 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; -#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 } //----------------------------------------------------------------------------- @@ -169,8 +129,7 @@ DeviceAttribute::DeviceAttribute(const DeviceAttribute & source):ext(Tango_nullp // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE -DeviceAttribute::DeviceAttribute(DeviceAttribute &&source):ext(Tango_nullptr) +DeviceAttribute::DeviceAttribute(DeviceAttribute &&source):ext(nullptr) { name = std::move(source.name); exceptions_flags = source.exceptions_flags; @@ -217,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) { @@ -250,7 +208,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 +215,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 } //----------------------------------------------------------------------------- @@ -332,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; @@ -346,79 +292,10 @@ 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; -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) { ext.reset(new DeviceAttributeExt); @@ -426,16 +303,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; @@ -447,7 +314,6 @@ DeviceAttribute & DeviceAttribute::operator=(const DeviceAttribute &rval) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceAttribute & DeviceAttribute::operator=(DeviceAttribute &&rval) { name = std::move(rval.name); @@ -465,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; @@ -539,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) { @@ -1355,9 +1220,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_attr.tpp b/cppapi/client/devapi_attr.tpp index 05e64a614..b6da61ebf 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 { @@ -410,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; @@ -425,9 +422,7 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) return false; } -#endif // HAS_UNDERLYING -#ifdef HAS_TYPE_TRAITS if (std::is_enum::value == false) { if (exceptions_flags.test(wrongtype_flag)) @@ -439,7 +434,6 @@ bool DeviceAttribute::template_type_check(T &TANGO_UNUSED(_datum)) return false; } -#endif // HAS_TYPE_TRAITS return true; } diff --git a/cppapi/client/devapi_base.cpp b/cppapi/client/devapi_base.cpp index 06c0d5985..10d3a52ba 100644 --- a/cppapi/client/devapi_base.cpp +++ b/cppapi/client/devapi_base.cpp @@ -127,16 +127,12 @@ 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) { -#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 } //----------------------------------------------------------------------------- @@ -160,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; @@ -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); @@ -279,19 +259,8 @@ Connection &Connection::operator=(const Connection &rval) } else { - ext.reset(Tango_nullptr); - } -#else - if (rval.ext != NULL) - { - ext = new ConnectionExt(); - *ext = *(rval.ext); - } - else - { - ext = NULL; + ext.reset(nullptr); } -#endif return *this; } @@ -1894,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) { // @@ -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() @@ -5426,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()"); } @@ -10179,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; @@ -10216,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") @@ -10230,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/devapi_data.cpp b/cppapi/client/devapi_data.cpp index 8d8f5d97a..9e1cf9fce 100644 --- a/cppapi/client/devapi_data.cpp +++ b/cppapi/client/devapi_data.cpp @@ -71,27 +71,13 @@ 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 -#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 } //----------------------------------------------------------------------------- @@ -100,7 +86,6 @@ DeviceData::DeviceData(const DeviceData &source) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceData::DeviceData(DeviceData &&source) : ext(new DeviceDataExt) { @@ -112,7 +97,6 @@ DeviceData::DeviceData(DeviceData &&source) ext = std::move(source.ext); } } -#endif //----------------------------------------------------------------------------- // @@ -125,13 +109,8 @@ 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 -#ifdef HAS_UNIQUE_PTR if (rval.ext.get() != NULL) { ext.reset(new DeviceDataExt); @@ -141,17 +120,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; } @@ -162,7 +130,6 @@ DeviceData &DeviceData::operator=(const DeviceData &rval) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceData &DeviceData::operator=(DeviceData &&rval) { exceptions_flags = rval.exceptions_flags; @@ -179,7 +146,6 @@ DeviceData &DeviceData::operator=(DeviceData &&rval) return *this; } -#endif //----------------------------------------------------------------------------- // @@ -189,9 +155,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..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; @@ -84,28 +84,15 @@ 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 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; @@ -123,7 +110,6 @@ DeviceDataHistory::DeviceDataHistory(DeviceDataHistory &&source) ext_hist.reset(); } } -#endif //----------------------------------------------------------------------------- // @@ -146,9 +132,6 @@ DeviceDataHistory::~DeviceDataHistory() } } -#ifndef HAS_UNIQUE_PTR - delete ext_hist; -#endif } @@ -176,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) { @@ -196,7 +175,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 +184,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; @@ -229,7 +195,6 @@ DeviceDataHistory &DeviceDataHistory::operator=(const DeviceDataHistory &rval) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DeviceDataHistory &DeviceDataHistory::operator=(DeviceDataHistory &&rval) { @@ -282,7 +247,6 @@ DeviceDataHistory &DeviceDataHistory::operator=(DeviceDataHistory &&rval) return *this; } -#endif //+------------------------------------------------------------------------- // @@ -365,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; @@ -521,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; @@ -672,32 +636,19 @@ 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; -#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 DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) - : DeviceAttribute(std::move(source)), ext_hist(Tango_nullptr) + : DeviceAttribute(std::move(source)), ext_hist(nullptr) { fail = source.fail; @@ -707,7 +658,6 @@ DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) } } -#endif //----------------------------------------------------------------------------- // @@ -717,9 +667,6 @@ DeviceAttributeHistory::DeviceAttributeHistory(DeviceAttributeHistory &&source) DeviceAttributeHistory::~DeviceAttributeHistory() { -#ifndef HAS_UNIQUE_PTR - delete ext_hist; -#endif } @@ -746,7 +693,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,24 +702,11 @@ 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; } -#ifdef HAS_RVALUE DeviceAttributeHistory &DeviceAttributeHistory::operator=(DeviceAttributeHistory &&rval) { @@ -800,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 ebf1c60a0..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,27 +67,17 @@ 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; 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; } @@ -129,8 +109,7 @@ DevicePipe &DevicePipe::operator=(const DevicePipe &rhs) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE -DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) +DevicePipe::DevicePipe(DevicePipe && source):ext(nullptr) { name = std::move(source.name); time = source.time; @@ -141,7 +120,6 @@ DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) ext = std::move(source.ext); } } -#endif // HAS_RVALUE //----------------------------------------------------------------------------- // @@ -149,7 +127,6 @@ DevicePipe::DevicePipe(DevicePipe && source):ext(Tango_nullptr) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DevicePipe &DevicePipe::operator=(DevicePipe &&rhs) { name = std::move(rhs.name); @@ -165,7 +142,6 @@ DevicePipe &DevicePipe::operator=(DevicePipe &&rhs) return *this; } -#endif //---------------------------------------------------------------------------------------------------------------- // @@ -175,9 +151,6 @@ DevicePipe &DevicePipe::operator=(DevicePipe &&rhs) DevicePipe::~DevicePipe() { -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } DevicePipe &DevicePipe::operator[](const std::string &_na) @@ -202,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(); @@ -213,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(); @@ -233,9 +206,6 @@ DevicePipeBlob::~DevicePipeBlob() if (extract_delete == true) delete extract_elt_array; -#ifndef HAS_UNIQUE_PTR - delete ext; -#endif } //----------------------------------------------------------------------------- @@ -244,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; @@ -253,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); @@ -275,21 +245,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 } //----------------------------------------------------------------------------- @@ -309,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); @@ -331,7 +291,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 +298,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; } @@ -359,8 +308,7 @@ DevicePipeBlob &DevicePipeBlob::operator=(const DevicePipeBlob &rhs) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE -DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) +DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(nullptr) { name = std::move(source.name); exceptions_flags = source.exceptions_flags; @@ -369,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); @@ -396,7 +344,6 @@ DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) ext = std::move(source.ext); } } -#endif //----------------------------------------------------------------------------- // @@ -404,7 +351,6 @@ DevicePipeBlob::DevicePipeBlob(DevicePipeBlob && source):ext(Tango_nullptr) // //----------------------------------------------------------------------------- -#ifdef HAS_RVALUE DevicePipeBlob &DevicePipeBlob::operator=(DevicePipeBlob &&rhs) { name = std::move(rhs.name); @@ -414,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; @@ -438,7 +384,6 @@ DevicePipeBlob &DevicePipeBlob::operator=(DevicePipeBlob &&rhs) return *this; } -#endif //+------------------------------------------------------------------------------------------------------------------ // @@ -455,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; @@ -493,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; @@ -533,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; @@ -712,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", @@ -758,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", @@ -968,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); @@ -1009,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(); @@ -1099,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); @@ -1164,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); @@ -1214,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); @@ -1226,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(); @@ -1272,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); @@ -1405,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); @@ -1717,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); @@ -1796,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); @@ -2122,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; @@ -2262,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++) { @@ -2445,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/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/event.cpp b/cppapi/client/event.cpp index 7ca32d76c..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 } } } @@ -293,7 +289,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 +303,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(...) {} @@ -3155,8 +3134,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 @@ -3293,8 +3272,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 @@ -3305,9 +3284,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; } @@ -3365,7 +3344,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 @@ -3613,17 +3592,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) { } /************************************************************************/ @@ -3742,14 +3721,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/eventconsumer.h b/cppapi/client/eventconsumer.h index 74e8202d5..ac3b8f4e1 100644 --- a/cppapi/client/eventconsumer.h +++ b/cppapi/client/eventconsumer.h @@ -518,34 +518,27 @@ 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 &) {} -#ifdef HAS_OVERRIDE + 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, 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 : @@ -558,7 +551,7 @@ private : CosNotifyChannelAdmin::StructuredProxyPushSupplier_var structuredProxyPushSupplier; CosNotifyChannelAdmin::EventChannelFactory_var eventChannelFactory; - void *run_undetached(void *arg); + void *run_undetached(void *arg) override; }; @@ -573,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 { @@ -597,25 +590,18 @@ 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; -#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; @@ -646,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 &); @@ -711,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 &); 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 9c7a0ffc5..96bd77b66 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 } // **************************************************** @@ -2377,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/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/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/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/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/attrdesc.cpp b/cppapi/server/attrdesc.cpp index 0d5f2959d..0dbb38688 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 } //+------------------------------------------------------------------------------------------------------------------ @@ -702,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) @@ -731,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) @@ -760,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) @@ -789,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) @@ -833,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) @@ -852,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) @@ -871,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) @@ -890,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 16574d733..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 */ @@ -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/attribute.cpp b/cppapi/server/attribute.cpp index 74c6c7d63..8c8e3a941 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; +} + //-------------------------------------------------------------------------------------------------------------------- // @@ -84,7 +125,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 +2905,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 +3817,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 { @@ -3786,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) @@ -3952,7 +3997,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 +4019,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; @@ -4029,54 +4074,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 + || prev_change_event.err + || 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) @@ -4090,9 +4115,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 +4148,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 +4172,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 +4225,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 { @@ -4211,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) @@ -4393,9 +4421,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 +4436,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; @@ -4468,62 +4496,45 @@ 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; - - 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 != Tango_nullptr) - { - prev_archive_event.value_4 = send_attr_5->value; - the_quality = send_attr_5->quality; - } - else if (send_attr_4 != Tango_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; - } + // Execute detect_change only to calculate the delta_change_rel and + // delta_change_abs and force_change ! - if (prev_archive_event.quality != the_quality) + if (event_supplier_nd || event_supplier_zmq) { - quality_change = true; + 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.quality = the_quality; - prev_archive_event.err = false; + prev_archive_event.store( + send_attr_5, + send_attr_4, + send_attr, + Tango_nullptr, + except); + + quality_change = (old_quality != prev_archive_event.quality); } - prev_archive_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) @@ -4563,9 +4574,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 +4598,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 +4649,9 @@ void Attribute::fire_event(std::vector &filt_names,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 +4887,9 @@ void Attribute::fire_event(std::vector &filt_names,std::vector client_libs = get_client_lib(PERIODIC_EVENT); // We want a copy 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/attrprop.h b/cppapi/server/attrprop.h index 4e983e762..bf9a5d9cc 100644 --- a/cppapi/server/attrprop.h +++ b/cppapi/server/attrprop.h @@ -71,13 +71,13 @@ class AttrProp /** * Default constructor. */ - AttrProp() : is_value(false),ext(Tango_nullptr) {} + AttrProp() : is_value(false),ext(nullptr) {} /** * Create a new AttrProp object. * * @param value The attribute property value. */ - AttrProp(const T &value) : val(value), is_value(true), ext(Tango_nullptr) + AttrProp(const T &value) : val(value), is_value(true), ext(nullptr) { TangoSys_MemStream st; st.precision(TANGO_FLOAT_PRECISION); @@ -89,13 +89,13 @@ class AttrProp * * @param value_str The 'C string' representation of attribute property. */ - AttrProp(const char *value_str) : str(std::string(value_str)), is_value(false), ext(Tango_nullptr) {} + AttrProp(const char *value_str) : str(std::string(value_str)), is_value(false), ext(nullptr) {} /** * Create a new AttrProp object. * * @param value_str The string representation of attribute property value. */ - AttrProp(const std::string &value_str) : str(value_str), is_value(false), ext(Tango_nullptr) {} + AttrProp(const std::string &value_str) : str(value_str), is_value(false), ext(nullptr) {} //@} /**@name Assignment operators @@ -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..957c98a00 100644 --- a/cppapi/server/attrprop.tpp +++ b/cppapi/server/attrprop.tpp @@ -41,7 +41,7 @@ namespace Tango // template<> -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); @@ -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/attrsetval.tpp b/cppapi/server/attrsetval.tpp index 34eb9a074..c68417a87 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 { @@ -79,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; @@ -93,13 +90,11 @@ 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 // -#ifdef HAS_TYPE_TRAITS if (std::is_enum::value == false) { SAFE_DELETE(enum_ptr); @@ -107,7 +102,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/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/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/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 28a424e1b..030b24940 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 &); @@ -216,11 +194,7 @@ class Command /** * The object desctructor. */ -#ifdef HAS_UNIQUE_PTR virtual ~Command() {} -#else - virtual ~Command() {delete ext;} -#endif //@} /**@name Miscellaneous methods */ @@ -1244,11 +1218,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 @@ -1295,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 @@ -1631,11 +1601,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 +1970,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 }; //+------------------------------------------------------------------------- @@ -2021,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(); @@ -2029,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(); @@ -2037,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(); @@ -2045,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(); @@ -2053,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(); @@ -2061,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(); @@ -2069,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(); @@ -2077,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(); @@ -2085,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(); @@ -2093,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(); @@ -2101,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(); @@ -2109,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(); @@ -2117,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(); @@ -2125,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(); @@ -2133,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(); @@ -2141,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(); @@ -2559,11 +2521,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 }; //+------------------------------------------------------------------------- @@ -2576,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(); @@ -2584,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(); @@ -2592,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(); @@ -2600,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(); @@ -2608,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(); @@ -2616,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(); @@ -2624,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(); @@ -2632,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(); @@ -2640,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(); @@ -2648,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(); @@ -2656,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(); @@ -2664,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(); @@ -2672,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(); @@ -2680,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(); @@ -2688,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(); @@ -2696,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(); @@ -3093,11 +3051,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 }; //+------------------------------------------------------------------------- @@ -3110,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(); @@ -3118,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(); @@ -3126,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(); @@ -3134,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(); @@ -3142,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(); @@ -3150,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(); @@ -3158,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(); @@ -3166,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(); @@ -3174,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(); @@ -3182,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(); @@ -3190,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(); @@ -3198,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(); @@ -3206,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(); @@ -3214,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(); @@ -3222,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(); @@ -3230,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 3d28cb1fb..d9834374c 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; @@ -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 @@ -912,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 } //+----------------------------------------------------------------------------------------------------------------- @@ -5246,7 +5234,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; @@ -5261,7 +5249,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(); @@ -5445,7 +5433,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) @@ -5459,7 +5447,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) { @@ -5551,7 +5539,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(); @@ -5570,7 +5558,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) { @@ -6042,7 +6030,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 { @@ -6054,10 +6041,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()) { @@ -6085,7 +6068,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 { @@ -6095,10 +6077,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/device.h b/cppapi/server/device.h index 74d76361a..ed856a49b 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; @@ -3610,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) \ { \ @@ -3668,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(); \ @@ -3676,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_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.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_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.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_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.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/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..f812ae20d 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; } @@ -1536,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 { @@ -1546,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()) { @@ -1594,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 { @@ -1604,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()) { @@ -1639,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 { @@ -1647,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/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/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 diff --git a/cppapi/server/dserver.cpp b/cppapi/server/dserver.cpp index 1f2652e0f..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 } //+---------------------------------------------------------------------------------------------------------------- @@ -875,10 +846,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..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 } // @@ -1429,7 +1423,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/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/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..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); @@ -335,34 +333,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 +377,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 +648,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 +699,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 @@ -1181,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 @@ -2643,14 +2552,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 +2576,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 +2600,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/eventsupplier.h b/cppapi/server/eventsupplier.h index c6eb4e55f..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; }; @@ -245,30 +240,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..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; @@ -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(); @@ -169,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(...) {} @@ -194,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 342a1ada6..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 */ @@ -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/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/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") diff --git a/cppapi/server/multiattribute.cpp b/cppapi/server/multiattribute.cpp index a9ed886a7..2d85d9c37 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 } //+----------------------------------------------------------------------------------------------------------------- @@ -1151,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; @@ -1166,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; } @@ -1206,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; @@ -1221,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)) @@ -1274,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; @@ -1289,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; } 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/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/pipe.h b/cppapi/server/pipe.h index 2f16687c2..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 /** @@ -103,11 +82,7 @@ class Pipe /** * The object desctructor. */ -#ifdef HAS_UNIQUE_PTR virtual ~Pipe() {} -#else - virtual ~Pipe() {delete ext;} -#endif //@} /**@name Miscellaneous methods */ @@ -449,11 +424,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..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 */ @@ -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/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/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/rootattreg.cpp b/cppapi/server/rootattreg.cpp index a333df96a..0469c526a 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; @@ -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 != Tango_nullptr) - local_dis.insert(make_pair(local_dev_name,the_local_dev)); -#endif } } catch (DevFailed &e) {} @@ -502,7 +496,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 { @@ -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"); @@ -847,18 +829,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 +1049,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 +1057,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 } } diff --git a/cppapi/server/tango_config.h b/cppapi/server/tango_config.h index 1389f6f88..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) // @@ -129,137 +106,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) -// 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 - #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 - // // For gcc 5 new ABI // @@ -284,39 +130,21 @@ // #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 // // 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 a common NULL constant -// +#define Tango_isnan(A) std::isnan(A) -#ifdef HAS_NULLPTR - #define Tango_nullptr nullptr -#else - #define Tango_nullptr NULL -#endif +#define Tango_nullptr nullptr // // Define a common sleep call @@ -367,15 +195,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 // @@ -414,17 +236,6 @@ #define TANGO_LONG32 #endif -#ifdef HAS_ATTRIBUTE_SPECIFIERS - #define TANGO_NORETURN [[noreturn]] -#else - #define TANGO_NORETURN -#endif - -// C++14 style constexpr -#ifdef HAS_CONSTEXPR - #define TANGO_CONSTEXPR constexpr -#else - #define TANGO_CONSTEXPR -#endif +#define TANGO_NORETURN [[noreturn]] #endif /* _TANGO_CONFIG_H */ diff --git a/cppapi/server/tango_const.h.in b/cppapi/server/tango_const.h.in index ae85ca729..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 // @@ -1219,9 +1228,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; 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 c271f562a..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 @@ -1613,9 +1608,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_attrsetval.tpp b/cppapi/server/w_attrsetval.tpp index a714aee1c..429fda3b4 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 { @@ -108,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; @@ -120,19 +117,16 @@ 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 // -#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 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 }; 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; } 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 { 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)]) 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