diff -Nru mdds-2.0.2/aclocal.m4 mdds-2.0.3/aclocal.m4 --- mdds-2.0.2/aclocal.m4 2022-02-12 00:45:22.000000000 +0000 +++ mdds-2.0.3/aclocal.m4 2022-05-11 01:41:21.000000000 +0000 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -398,7 +400,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -426,6 +428,10 @@ # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -462,7 +468,7 @@ [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -514,6 +520,20 @@ [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -595,7 +615,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +636,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -638,7 +658,7 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -673,7 +693,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -716,7 +736,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -737,12 +757,7 @@ [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -755,7 +770,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -784,7 +799,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -831,7 +846,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -850,7 +865,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -931,7 +946,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -991,7 +1006,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1019,7 +1034,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1038,7 +1053,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -Nru mdds-2.0.2/CHANGELOG mdds-2.0.3/CHANGELOG --- mdds-2.0.2/CHANGELOG 2022-02-16 00:56:05.000000000 +0000 +++ mdds-2.0.3/CHANGELOG 2022-05-11 01:40:16.000000000 +0000 @@ -1,3 +1,17 @@ +mdds 2.0.3 + + * general + + * defined clang-format rules, and globally applied them to all active + source files. + + * multi_type_vector + + * revised the block position lookup implementation to avoid using the + internal STL iterators. The new implementation should be able to handle + invalid position hints more gracefully without potential process + termination. + mdds 2.0.2 * multi_type_vector diff -Nru mdds-2.0.2/compile mdds-2.0.3/compile --- mdds-2.0.2/compile 2022-02-12 00:45:22.000000000 +0000 +++ mdds-2.0.3/compile 2022-05-11 01:41:21.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff -Nru mdds-2.0.2/configure mdds-2.0.3/configure --- mdds-2.0.2/configure 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/configure 2022-05-11 01:41:21.000000000 +0000 @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for mdds 2.0.2. +# Generated by GNU Autoconf 2.71 for mdds 2.0.3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,53 @@ as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +223,21 @@ esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +255,19 @@ exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: kohei.yoshida@gmail.com about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script @@ -294,6 +295,7 @@ } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +313,14 @@ as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +335,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +344,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +383,13 @@ # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +401,27 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +433,9 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +462,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +506,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +520,10 @@ exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +537,13 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -580,47 +611,43 @@ # Identity of this package. PACKAGE_NAME='mdds' PACKAGE_TARNAME='mdds' -PACKAGE_VERSION='2.0.2' -PACKAGE_STRING='mdds 2.0.2' +PACKAGE_VERSION='2.0.3' +PACKAGE_STRING='mdds 2.0.3' PACKAGE_BUGREPORT='kohei.yoshida@gmail.com' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -637,9 +664,6 @@ EXPECT GDB CPPFLAGS_NODEBUG -EGREP -GREP -CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -675,6 +699,9 @@ AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -764,8 +791,7 @@ CPPFLAGS CCC CC -CFLAGS -CPP' +CFLAGS' # Initialize some variables set by options. @@ -834,8 +860,6 @@ *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -876,9 +900,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -902,9 +926,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1115,9 +1139,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1131,9 +1155,9 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1177,9 +1201,9 @@ *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1195,7 +1219,7 @@ case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1259,7 +1283,7 @@ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1316,7 +1340,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mdds 2.0.2 to adapt to many kinds of systems. +\`configure' configures mdds 2.0.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1383,7 +1407,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mdds 2.0.2:";; + short | recursive ) echo "Configuration of mdds 2.0.3:";; esac cat <<\_ACEOF @@ -1428,7 +1452,6 @@ you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1449,9 +1472,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1479,7 +1502,8 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1487,7 +1511,7 @@ echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1496,10 +1520,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mdds configure 2.0.2 -generated by GNU Autoconf 2.69 +mdds configure 2.0.3 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1516,14 +1540,14 @@ ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1531,14 +1555,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1554,14 +1579,14 @@ ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1569,14 +1594,15 @@ cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1588,8 +1614,8 @@ # ac_fn_c_try_run LINENO # ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack @@ -1599,25 +1625,26 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status @@ -1642,7 +1669,7 @@ /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; @@ -1652,14 +1679,15 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -1669,9 +1697,10 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid; break -else +else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= @@ -1679,14 +1708,14 @@ fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; @@ -1696,14 +1725,15 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; @@ -1713,9 +1743,10 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=$ac_mid; break -else +else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= @@ -1723,14 +1754,14 @@ fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop ac_lo= ac_hi= fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val @@ -1738,7 +1769,7 @@ /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -1748,12 +1779,13 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid -else +else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; @@ -1763,12 +1795,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } #include #include int -main () +main (void) { FILE *f = fopen ("conftest.val", "w"); @@ -1796,9 +1828,10 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : echo >>conftest.val; read $3 &5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1855,37 +1851,59 @@ ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mdds $as_me 2.0.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by mdds $as_me 2.0.3, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1918,8 +1936,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -1954,7 +1976,7 @@ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1989,11 +2011,13 @@ # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2004,8 +2028,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2029,7 +2053,7 @@ ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2037,14 +2061,14 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2052,15 +2076,15 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2068,8 +2092,8 @@ echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2083,63 +2107,48 @@ # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2149,192 +2158,802 @@ # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} -am__api_version='1.16' +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi +} // anonymous namespace +' -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac +namespace cxx11test +{ + constexpr int get_val() { return 20; } - done -IFS=$as_save_IFS + struct testinit + { + int i; + double d; + }; -rm -rf conftest.one conftest.two conftest.dir + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am__api_version='1.16' + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will @@ -2343,8 +2962,8 @@ INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2354,8 +2973,8 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -2409,8 +3028,8 @@ as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -2429,26 +3048,23 @@ # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -2468,11 +3084,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -2480,11 +3097,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2495,11 +3116,11 @@ fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2508,11 +3129,12 @@ ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -2520,11 +3142,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2535,11 +3161,11 @@ fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -2547,8 +3173,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -2560,25 +3186,31 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -2589,7 +3221,7 @@ fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -2599,18 +3231,19 @@ MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -2618,11 +3251,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2633,24 +3270,25 @@ fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -2666,12 +3304,12 @@ rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2685,7 +3323,8 @@ rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -2695,12 +3334,13 @@ *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -2712,8 +3352,8 @@ am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -2745,17 +3385,13 @@ # Define the identity of the package. PACKAGE='mdds' - VERSION='2.0.2' + VERSION='2.0.3' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -2795,6 +3431,20 @@ +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2839,17 +3489,18 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then : +if test ${enable_maintainer_mode+y} +then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else +else $as_nop USE_MAINTAINER_MODE=no fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' @@ -2862,7 +3513,7 @@ -VERSION=2.0.2 +VERSION=2.0.3 API_VERSION=2.0 @@ -2881,12 +3532,18 @@ + + + + + + DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -2922,11 +3579,12 @@ fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -2954,15 +3612,16 @@ CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -2970,11 +3629,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2985,11 +3648,11 @@ fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2998,15 +3661,16 @@ fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -3014,11 +3678,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3029,11 +3697,11 @@ fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3045,8 +3713,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -3056,7 +3724,7 @@ fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -3066,7 +3734,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3076,7 +3744,7 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -3084,7 +3752,7 @@ /* end confdefs.h. */ int -main () +main (void) { ; @@ -3096,9 +3764,9 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -$as_echo_n "checking whether the C++ compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +printf %s "checking whether the C++ compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -3119,11 +3787,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3140,7 +3809,7 @@ # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3156,44 +3825,46 @@ done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -$as_echo_n "checking for C++ compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +printf %s "checking for C++ compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3207,15 +3878,15 @@ * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3224,7 +3895,7 @@ /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3236,8 +3907,8 @@ ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3245,10 +3916,10 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3256,39 +3927,40 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C++ compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3302,11 +3974,12 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3315,31 +3988,32 @@ break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3349,29 +4023,33 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -3380,57 +4058,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -3445,6 +4126,100 @@ CXXFLAGS= fi fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3453,11 +4228,12 @@ depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -3564,8 +4340,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if @@ -3593,12 +4369,13 @@ if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=`$as_echo "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5 -$as_echo_n "checking whether $CXX supports C++17 features with $switch... " >&6; } -if eval \${$cachevar+:} false; then : - $as_echo_n "(cached) " >&6 -else + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5 +printf %s "checking whether $CXX supports C++17 features with $switch... " >&6; } +if eval test \${$cachevar+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4390,17 +5167,18 @@ _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : eval $cachevar=yes -else +else $as_nop eval $cachevar=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then @@ -4428,12 +5206,12 @@ fi if test x$ac_success = xno; then HAVE_CXX17=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++17 support was found" >&5 -$as_echo "$as_me: No compiler with C++17 support was found" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++17 support was found" >&5 +printf "%s\n" "$as_me: No compiler with C++17 support was found" >&6;} else HAVE_CXX17=1 -$as_echo "#define HAVE_CXX17 1" >>confdefs.h +printf "%s\n" "#define HAVE_CXX17 1" >>confdefs.h fi @@ -4442,6 +5220,15 @@ CPPFLAGS="$CPPFLAGS -Wall -Wshadow -g -pedantic-errors" CPPFLAGS="$CPPFLAGS -I/usr/include -I/usr/local/include" + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4450,11 +5237,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4462,11 +5250,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4477,11 +5269,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4490,11 +5282,12 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -4502,11 +5295,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4517,11 +5314,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -4529,8 +5326,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -4543,11 +5340,12 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4555,11 +5353,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4570,11 +5372,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4583,11 +5385,12 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4596,15 +5399,19 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4620,18 +5427,18 @@ # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4642,11 +5449,12 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4654,11 +5462,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4669,11 +5481,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4686,11 +5498,12 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -4698,11 +5511,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4713,11 +5530,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4729,34 +5546,138 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -4766,20 +5687,21 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -4789,29 +5711,33 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -4820,57 +5746,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -4885,94 +5814,144 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -4981,21 +5960,23 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -5023,8 +6004,8 @@ rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -5042,11 +6023,12 @@ depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -5068,519 +6050,153 @@ mkdir sub am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi + cd .. + rm -rf conftest.dir else - ac_cv_path_EGREP=$EGREP -fi - - fi + am_cv_CC_dependencies_compiler_type=none fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' else - ac_cv_header_stdc=no + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done -else - ac_cv_header_stdc=no -fi -rm -f conftest* -fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h -fi +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi - -done - - # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +printf %s "checking size of void *... " >&6; } +if test ${ac_cv_sizeof_void_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default" +then : -else +else $as_nop if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) See \`config.log' for more details" "$LINENO" 5; } else @@ -5589,82 +6205,90 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +printf "%s\n" "$ac_cv_sizeof_void_p" >&6; } -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF +printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h CXXFLAGS="$CXXFLAGS -DSIZEOF_VOID_P=$ac_cv_sizeof_void_p" # Check whether --enable-debug-stdcxx was given. -if test "${enable_debug_stdcxx+set}" = set; then : +if test ${enable_debug_stdcxx+y} +then : enableval=$enable_debug_stdcxx; debug_stdcxx=yes fi -if test x"$debug_stdcxx" == "xyes"; then : +if test x"$debug_stdcxx" == "xyes" +then : CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG" fi # Check whether --enable-release-tests was given. -if test "${enable_release_tests+set}" = set; then : +if test ${enable_release_tests+y} +then : enableval=$enable_release_tests; release_tests=yes fi -if test x"$release_tests" == "xyes"; then : +if test x"$release_tests" == "xyes" +then : CXXFLAGS="$CXXFLAGS -DNDEBUG -O2" fi # Check whether --enable-gcov was given. -if test "${enable_gcov+set}" = set; then : +if test ${enable_gcov+y} +then : enableval=$enable_gcov; enable_gcov="$enableval" -else +else $as_nop enable_gcov=no fi # Check whether --enable-loop-unrolling was given. -if test "${enable_loop_unrolling+set}" = set; then : +if test ${enable_loop_unrolling+y} +then : enableval=$enable_loop_unrolling; enable_loop_unrolling="$enableval" -else +else $as_nop enable_loop_unrolling=yes fi -if test x"$enable_loop_unrolling" == "xno"; then : +if test x"$enable_loop_unrolling" == "xno" +then : CXXFLAGS="$CXXFLAGS -DMDDS_LOOP_UNROLLING=0" fi -if test x"$enable_gcov" == "xyes"; then : +if test x"$enable_gcov" == "xyes" +then : CXXFLAGS="$CXXFLAGS --coverage -O0" fi # Check whether --enable-openmp was given. -if test "${enable_openmp+set}" = set; then : +if test ${enable_openmp+y} +then : enableval=$enable_openmp; enable_openmp="$enableval" -else +else $as_nop enable_openmp=no fi -if test x"$enable_openmp" == "xyes"; then : +if test x"$enable_openmp" == "xyes" +then : CXXFLAGS="$CXXFLAGS -fopenmp -DMDDS_USE_OPENMP=1" LDFLAGS="$LDFLAGS -fopenmp" @@ -5672,15 +6296,17 @@ fi # Check whether --enable-sanitizer-coverage was given. -if test "${enable_sanitizer_coverage+set}" = set; then : +if test ${enable_sanitizer_coverage+y} +then : enableval=$enable_sanitizer_coverage; enable_sanitizer_coverage="$enableval" -else +else $as_nop enable_sanitizer_coverage=no fi -if test x"$enable_sanitizer_coverage" == "xyes"; then : +if test x"$enable_sanitizer_coverage" == "xyes" +then : CXXFLAGS="$CXXFLAGS -fprofile-instr-generate -fcoverage-mapping -O0" @@ -5699,15 +6325,16 @@ CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -5715,11 +6342,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5730,11 +6361,11 @@ fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5743,15 +6374,16 @@ fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -5759,11 +6391,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5774,11 +6410,11 @@ fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5790,8 +6426,8 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -5801,7 +6437,7 @@ fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -5811,7 +6447,7 @@ *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -5821,20 +6457,21 @@ cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -5844,29 +6481,33 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -5875,57 +6516,60 @@ /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -5940,6 +6584,100 @@ CXXFLAGS= fi fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5948,11 +6686,12 @@ depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -6059,8 +6798,8 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if @@ -6076,11 +6815,12 @@ # Extract the first word of "gdb", so it can be a program name with args. set dummy gdb; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GDB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_GDB+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $GDB in [\\/]* | ?:[\\/]*) ac_cv_path_GDB="$GDB" # Let the user override the test with a path. @@ -6090,11 +6830,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GDB="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_GDB="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6106,21 +6850,22 @@ fi GDB=$ac_cv_path_GDB if test -n "$GDB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GDB" >&5 -$as_echo "$GDB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GDB" >&5 +printf "%s\n" "$GDB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi # Extract the first word of "expect", so it can be a program name with args. set dummy expect; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_EXPECT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_EXPECT+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $EXPECT in [\\/]* | ?:[\\/]*) ac_cv_path_EXPECT="$EXPECT" # Let the user override the test with a path. @@ -6130,11 +6875,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_EXPECT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_EXPECT="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6146,21 +6895,22 @@ fi EXPECT=$ac_cv_path_EXPECT if test -n "$EXPECT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXPECT" >&5 -$as_echo "$EXPECT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $EXPECT" >&5 +printf "%s\n" "$EXPECT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi # Extract the first word of "runtest", so it can be a program name with args. set dummy runtest; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RUNTEST_BIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_RUNTEST_BIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $RUNTEST_BIN in [\\/]* | ?:[\\/]*) ac_cv_path_RUNTEST_BIN="$RUNTEST_BIN" # Let the user override the test with a path. @@ -6170,11 +6920,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RUNTEST_BIN="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_RUNTEST_BIN="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6186,31 +6940,34 @@ fi RUNTEST_BIN=$ac_cv_path_RUNTEST_BIN if test -n "$RUNTEST_BIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNTEST_BIN" >&5 -$as_echo "$RUNTEST_BIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RUNTEST_BIN" >&5 +printf "%s\n" "$RUNTEST_BIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi # Check whether --enable-memory-tests was given. -if test "${enable_memory_tests+set}" = set; then : +if test ${enable_memory_tests+y} +then : enableval=$enable_memory_tests; enable_memory_tests=$enableval -else +else $as_nop enable_memory_tests=no fi -if test "$enable_memory_tests" = yes; then : +if test "$enable_memory_tests" = yes +then : # Extract the first word of "valgrind", so it can be a program name with args. set dummy valgrind; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_VALGRIND+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_VALGRIND+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $VALGRIND in [\\/]* | ?:[\\/]*) ac_cv_path_VALGRIND="$VALGRIND" # Let the user override the test with a path. @@ -6220,11 +6977,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_VALGRIND="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_VALGRIND="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6236,15 +6997,16 @@ fi VALGRIND=$ac_cv_path_VALGRIND if test -n "$VALGRIND"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 -$as_echo "$VALGRIND" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 +printf "%s\n" "$VALGRIND" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi - if test -z "$VALGRIND"; then : + if test -z "$VALGRIND" +then : as_fn_error $? "valgrind not found" "$LINENO" 5 fi @@ -6259,22 +7021,25 @@ # Check whether --enable-docs was given. -if test "${enable_docs+set}" = set; then : +if test ${enable_docs+y} +then : enableval=$enable_docs; enable_docs=$enableval -else +else $as_nop enable_docs=no fi -if test "$enable_docs" = yes; then : +if test "$enable_docs" = yes +then : # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_DOXYGEN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_DOXYGEN+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path. @@ -6284,11 +7049,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_DOXYGEN="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6300,24 +7069,26 @@ fi DOXYGEN=$ac_cv_path_DOXYGEN if test -n "$DOXYGEN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 -$as_echo "$DOXYGEN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 +printf "%s\n" "$DOXYGEN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi - if test -z "$DOXYGEN"; then : + if test -z "$DOXYGEN" +then : as_fn_error $? "doxygen not found" "$LINENO" 5 fi # Extract the first word of "sphinx-build", so it can be a program name with args. set dummy sphinx-build; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SPHINX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_SPHINX+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $SPHINX in [\\/]* | ?:[\\/]*) ac_cv_path_SPHINX="$SPHINX" # Let the user override the test with a path. @@ -6327,11 +7098,15 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SPHINX="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_SPHINX="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6343,15 +7118,16 @@ fi SPHINX=$ac_cv_path_SPHINX if test -n "$SPHINX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SPHINX" >&5 -$as_echo "$SPHINX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SPHINX" >&5 +printf "%s\n" "$SPHINX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi - if test -z "$SPHINX"; then : + if test -z "$SPHINX" +then : as_fn_error $? "sphinx-build not found" "$LINENO" 5 fi @@ -6367,14 +7143,16 @@ # Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then : +if test ${enable_werror+y} +then : enableval=$enable_werror; enable_werror="$enableval" -else +else $as_nop enable_werror=no fi -if test x"$enable_werror" == "xyes"; then : +if test x"$enable_werror" == "xyes" +then : CXXFLAGS="$CXXFLAGS -Werror" @@ -6412,8 +7190,8 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -6443,15 +7221,15 @@ /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -6465,8 +7243,8 @@ fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -6519,7 +7297,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -6530,14 +7308,14 @@ LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -6579,8 +7357,8 @@ ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -6603,14 +7381,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -6620,46 +7400,46 @@ fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -6668,13 +7448,6 @@ fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -6683,8 +7456,12 @@ for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -6696,30 +7473,10 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -6732,13 +7489,14 @@ as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -6765,18 +7523,20 @@ { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -6788,12 +7548,13 @@ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -6824,7 +7585,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -6846,6 +7607,10 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -6859,6 +7624,12 @@ ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -6900,7 +7671,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -6909,7 +7680,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6971,8 +7742,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mdds $as_me 2.0.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by mdds $as_me 2.0.3, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7025,14 +7796,16 @@ Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -mdds config.status 2.0.2 -configured by $0, generated by GNU Autoconf 2.69, +mdds config.status 2.0.3 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -7072,21 +7845,21 @@ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -7114,7 +7887,7 @@ if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -7128,7 +7901,7 @@ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -7195,8 +7968,8 @@ # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -7424,7 +8197,7 @@ esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -7432,17 +8205,17 @@ # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -7459,7 +8232,7 @@ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7483,9 +8256,9 @@ case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -7547,8 +8320,8 @@ case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -7592,9 +8365,9 @@ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -7606,8 +8379,8 @@ ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -7633,7 +8406,7 @@ for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -7645,7 +8418,7 @@ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7667,7 +8440,7 @@ $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -7692,10 +8465,12 @@ (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -7741,12 +8516,12 @@ $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: ============================================================================== Build configuration: gcov $enable_gcov @@ -7757,7 +8532,7 @@ CXXFLAGS $CXXFLAGS ============================================================================== " >&5 -$as_echo "$as_me: +printf "%s\n" "$as_me: ============================================================================== Build configuration: gcov $enable_gcov @@ -7768,3 +8543,4 @@ CXXFLAGS $CXXFLAGS ============================================================================== " >&6;} + diff -Nru mdds-2.0.2/configure.ac mdds-2.0.3/configure.ac --- mdds-2.0.2/configure.ac 2022-02-12 00:45:00.000000000 +0000 +++ mdds-2.0.3/configure.ac 2022-05-11 01:35:35.000000000 +0000 @@ -1,4 +1,4 @@ -AC_INIT(mdds, 2.0.2, kohei.yoshida@gmail.com) +AC_INIT(mdds, 2.0.3, kohei.yoshida@gmail.com) AM_INIT_AUTOMAKE([foreign dist-bzip2 dist-xz subdir-objects]) AM_MAINTAINER_MODE diff -Nru mdds-2.0.2/debian/changelog mdds-2.0.3/debian/changelog --- mdds-2.0.2/debian/changelog 2022-02-18 07:37:45.000000000 +0000 +++ mdds-2.0.3/debian/changelog 2022-05-11 16:01:37.000000000 +0000 @@ -1,3 +1,9 @@ +mdds (2.0.3-1) unstable; urgency=medium + + * New upstream version 2.0.3 + + -- Rene Engelhard Wed, 11 May 2022 18:01:37 +0200 + mdds (2.0.2-1) unstable; urgency=medium * New upstream version 2.0.2 diff -Nru mdds-2.0.2/depcomp mdds-2.0.3/depcomp --- mdds-2.0.2/depcomp 2022-02-12 00:45:22.000000000 +0000 +++ mdds-2.0.3/depcomp 2022-05-11 01:41:21.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru mdds-2.0.2/doc/conf.py mdds-2.0.3/doc/conf.py --- mdds-2.0.2/doc/conf.py 2022-02-12 00:45:00.000000000 +0000 +++ mdds-2.0.3/doc/conf.py 2022-05-11 01:36:04.000000000 +0000 @@ -51,7 +51,7 @@ # General information about the project. project = 'mdds' -copyright = '2021, Kohei Yoshida' +copyright = '2022, Kohei Yoshida' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -60,7 +60,7 @@ # The short X.Y version. version = '2.0' # The full version, including alpha/beta/rc tags. -release = '2.0.2' +release = '2.0.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru mdds-2.0.2/example/Makefile.in mdds-2.0.3/example/Makefile.in --- mdds-2.0.2/example/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/example/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -278,8 +278,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -462,6 +460,7 @@ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log @@ -498,9 +497,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -512,11 +512,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -936,7 +935,7 @@ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -1117,7 +1116,6 @@ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/example/mtv_collection.cpp mdds-2.0.3/example/mtv_collection.cpp --- mdds-2.0.2/example/mtv_collection.cpp 2022-02-11 14:50:43.000000000 +0000 +++ mdds-2.0.3/example/mtv_collection.cpp 2022-05-11 00:33:24.000000000 +0000 @@ -44,42 +44,47 @@ //!code-start: header-row // Populate the header row. - std::array headers = { "ID", "Make", "Model", "Year", "Color" }; + const char* headers[] = { "ID", "Make", "Model", "Year", "Color" }; size_t i = 0; - std::for_each(headers.begin(), headers.end(), [&](const char* v) { columns[i++].push_back(v); }); + for (const char* v : headers) + columns[i++].push_back(v); //!code-end: header-row //!code-start: column-1 // Fill column 1. - std::array c1_values = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; - std::for_each(c1_values.begin(), c1_values.end(), [&columns](int v) { columns[0].push_back(v); }); + int c1_values[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; + + for (int v : c1_values) + columns[0].push_back(v); //!code-end: column-1 //!code-start: column-2 // Fill column 2. - std::array c2_values = + const char* c2_values[] = { "Nissan", "Mercedes-Benz", "Nissan", "Suzuki", "Saab", "Subaru", "GMC", "Mercedes-Benz", "Toyota", "Nissan", "Mazda", "Dodge", "Ford", "Bentley", "GMC", "Audi", "GMC", "Mercury", "Pontiac", "BMW", }; - std::for_each(c2_values.begin(), c2_values.end(), [&columns](const char* v) { columns[1].push_back(v); }); + for (const char* v : c2_values) + columns[1].push_back(v); //!code-end: column-2 //!code-start: column-3 // Fill column 3. - std::array c3_values = + const char* c3_values[] = { "Frontier", "W201", "Frontier", "Equator", "9-5", "Tribeca", "Yukon XL 2500", "E-Class", "Camry Hybrid", "Frontier", "MX-5", "Ram Van 1500", "Edge", "Azure", "Sonoma Club Coupe", "S4", "3500 Club Coupe", "Villager", "Sunbird", "3 Series", }; - std::for_each(c3_values.begin(), c3_values.end(), [&columns](const char* v) { columns[2].push_back(v); }); + for (const char* v : c3_values) + columns[2].push_back(v); //!code-end: column-3 //!code-start: column-4 // Fill column 4. Replace -1 with "unknown". - std::array c4_values = + int32_t c4_values[] = { 1998, 1986, 2009, -1, -1, 2008, 2009, 2008, 2010, 2001, 2008, 2000, -1, 2009, 1998, 2013, 1994, 2000, 1990, 1993, @@ -97,13 +102,14 @@ //!code-start: column-5 // Fill column 5 - std::array c5_values = + const char* c5_values[] = { "Turquoise", "Fuscia", "Teal", "Fuscia", "Green", "Khaki", "Pink", "Goldenrod", "Turquoise", "Yellow", "Orange", "Goldenrod", "Fuscia", "Goldenrod", "Mauv", "Crimson", "Turquoise", "Teal", "Indigo", "LKhaki", }; - std::for_each(c5_values.begin(), c5_values.end(), [&columns](const char* v) { columns[4].push_back(v); }); + for (const char* v : c5_values) + columns[4].push_back(v); //!code-end: column-5 //!code-start: wrap diff -Nru mdds-2.0.2/include/Makefile.in mdds-2.0.3/include/Makefile.in --- mdds-2.0.2/include/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/include/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -148,8 +148,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -189,9 +187,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -203,11 +202,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -417,7 +415,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/include/mdds/flat_segment_tree_def.inl mdds-2.0.3/include/mdds/flat_segment_tree_def.inl --- mdds-2.0.2/include/mdds/flat_segment_tree_def.inl 2018-10-12 23:58:20.000000000 +0000 +++ mdds-2.0.3/include/mdds/flat_segment_tree_def.inl 2022-05-11 00:33:24.000000000 +0000 @@ -27,27 +27,21 @@ namespace mdds { -template -typename flat_segment_tree<_Key, _Value>::const_segment_iterator -flat_segment_tree<_Key, _Value>::begin_segment() const +template +typename flat_segment_tree::const_segment_iterator flat_segment_tree::begin_segment() const { return const_segment_iterator(m_left_leaf.get(), m_left_leaf->next.get()); } -template -typename flat_segment_tree<_Key, _Value>::const_segment_iterator -flat_segment_tree<_Key, _Value>::end_segment() const +template +typename flat_segment_tree::const_segment_iterator flat_segment_tree::end_segment() const { return const_segment_iterator(m_right_leaf.get(), nullptr); } -template -flat_segment_tree<_Key, _Value>::flat_segment_tree(key_type min_val, key_type max_val, value_type init_val) : - m_root_node(nullptr), - m_left_leaf(new node), - m_right_leaf(new node), - m_init_val(init_val), - m_valid_tree(false) +template +flat_segment_tree::flat_segment_tree(key_type min_val, key_type max_val, value_type init_val) + : m_root_node(nullptr), m_left_leaf(new node), m_right_leaf(new node), m_init_val(init_val), m_valid_tree(false) { // we need to create two end nodes during initialization. m_left_leaf->value_leaf.key = min_val; @@ -63,13 +57,11 @@ m_right_leaf->value_leaf.value = init_val; } -template -flat_segment_tree<_Key, _Value>::flat_segment_tree(const flat_segment_tree<_Key, _Value>& r) : - m_root_node(nullptr), - m_left_leaf(new node(static_cast(*r.m_left_leaf))), - m_right_leaf(static_cast(nullptr)), - m_init_val(r.m_init_val), - m_valid_tree(false) // tree is invalid because we only copy the leaf nodes. +template +flat_segment_tree::flat_segment_tree(const flat_segment_tree& r) + : m_root_node(nullptr), m_left_leaf(new node(static_cast(*r.m_left_leaf))), + m_right_leaf(static_cast(nullptr)), m_init_val(r.m_init_val), + m_valid_tree(false) // tree is invalid because we only copy the leaf nodes. { // Copy all the leaf nodes from the original instance. node* src_node = r.m_left_leaf.get(); @@ -96,24 +88,22 @@ } } -template -flat_segment_tree<_Key, _Value>::~flat_segment_tree() +template +flat_segment_tree::~flat_segment_tree() { destroy(); } -template -flat_segment_tree<_Key, _Value>& -flat_segment_tree<_Key, _Value>::operator=(const flat_segment_tree<_Key, _Value>& other) +template +flat_segment_tree& flat_segment_tree::operator=(const flat_segment_tree& other) { - flat_segment_tree<_Key, _Value> copy(other); + flat_segment_tree copy(other); swap(copy); return *this; } -template -void -flat_segment_tree<_Key, _Value>::swap(flat_segment_tree<_Key, _Value>& other) +template +void flat_segment_tree::swap(flat_segment_tree& other) { m_nonleaf_node_pool.swap(other.m_nonleaf_node_pool); std::swap(m_root_node, other.m_root_node); @@ -123,9 +113,8 @@ std::swap(m_valid_tree, other.m_valid_tree); } -template -void -flat_segment_tree<_Key, _Value>::clear() +template +void flat_segment_tree::clear() { // the border nodes should not be destroyed--add a ref to keep them alive node_ptr left(m_left_leaf); @@ -140,11 +129,11 @@ m_valid_tree = false; } -template -::std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::insert_segment_impl(key_type start_key, key_type end_key, value_type val, bool forward) +template +::std::pair::const_iterator, bool> flat_segment_tree< + Key, Value>::insert_segment_impl(key_type start_key, key_type end_key, value_type val, bool forward) { - typedef std::pair::const_iterator, bool> ret_type; + typedef std::pair::const_iterator, bool> ret_type; if (!adjust_segment_range(start_key, end_key)) return ret_type(const_iterator(this, true), false); @@ -176,9 +165,8 @@ return insert_to_pos(start_pos, start_key, end_key, val); } -template -::std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::insert_to_pos( +template +::std::pair::const_iterator, bool> flat_segment_tree::insert_to_pos( node_ptr& start_pos, key_type start_key, key_type end_key, value_type val) { node_ptr end_pos; @@ -303,13 +291,11 @@ if (changed) m_valid_tree = false; - return ::std::pair( - const_iterator(this, new_start_node.get()), changed); + return ::std::pair(const_iterator(this, new_start_node.get()), changed); } -template -::std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::insert( +template +::std::pair::const_iterator, bool> flat_segment_tree::insert( const const_iterator& pos, key_type start_key, key_type end_key, value_type val) { const node* p = pos.get_pos(); @@ -329,7 +315,7 @@ if (!adjust_segment_range(start_key, end_key)) { - typedef std::pair::const_iterator, bool> ret_type; + typedef std::pair::const_iterator, bool> ret_type; return ret_type(const_iterator(this, true), false); } @@ -338,8 +324,8 @@ return insert_to_pos(start_pos, start_key, end_key, val); } -template -void flat_segment_tree<_Key, _Value>::shift_left(key_type start_key, key_type end_key) +template +void flat_segment_tree::shift_left(key_type start_key, key_type end_key) { if (start_key >= end_key) return; @@ -435,8 +421,8 @@ append_new_segment(right_leaf_key - segment_size); } -template -void flat_segment_tree<_Key, _Value>::shift_right(key_type pos, key_type size, bool skip_start_node) +template +void flat_segment_tree::shift_right(key_type pos, key_type size, bool skip_start_node) { if (size <= 0) return; @@ -497,10 +483,9 @@ m_valid_tree = false; } -template -::std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::search_impl(const node* pos, - key_type key, value_type& value, key_type* start_key, key_type* end_key) const +template +::std::pair::const_iterator, bool> flat_segment_tree::search_impl( + const node* pos, key_type key, value_type& value, key_type* start_key, key_type* end_key) const { typedef ::std::pair ret_type; @@ -526,9 +511,8 @@ return ret_type(const_iterator(this, true), false); } -template -::std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::search( +template +::std::pair::const_iterator, bool> flat_segment_tree::search( key_type key, value_type& value, key_type* start_key, key_type* end_key) const { typedef ::std::pair ret_type; @@ -541,10 +525,9 @@ return search_impl(pos, key, value, start_key, end_key); } -template -::std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::search(const const_iterator& pos, - key_type key, value_type& value, key_type* start_key, key_type* end_key) const +template +::std::pair::const_iterator, bool> flat_segment_tree::search( + const const_iterator& pos, key_type key, value_type& value, key_type* start_key, key_type* end_key) const { typedef ::std::pair ret_type; @@ -572,9 +555,8 @@ return search_impl(p, key, value, start_key, end_key); } -template -std::pair::const_iterator, bool> -flat_segment_tree<_Key, _Value>::search_tree( +template +std::pair::const_iterator, bool> flat_segment_tree::search_tree( key_type key, value_type& value, key_type* start_key, key_type* end_key) const { typedef std::pair ret_type; @@ -670,8 +652,8 @@ return ret_type(const_iterator(this, dest_node), true); } -template -void flat_segment_tree<_Key, _Value>::build_tree() +template +void flat_segment_tree::build_tree() { if (!m_left_leaf) return; @@ -690,15 +672,14 @@ m_valid_tree = true; } -template -typename flat_segment_tree<_Key, _Value>::size_type -flat_segment_tree<_Key, _Value>::leaf_size() const +template +typename flat_segment_tree::size_type flat_segment_tree::leaf_size() const { return __st::count_leaf_nodes(m_left_leaf.get(), m_right_leaf.get()); } -template -bool flat_segment_tree<_Key, _Value>::operator==(const flat_segment_tree& r) const +template +bool flat_segment_tree::operator==(const flat_segment_tree& r) const { const node* n1 = m_left_leaf.get(); const node* n2 = r.m_left_leaf.get(); @@ -727,9 +708,8 @@ return true; } -template -const typename flat_segment_tree<_Key, _Value>::node* -flat_segment_tree<_Key, _Value>::get_insertion_pos_leaf_reverse( +template +const typename flat_segment_tree::node* flat_segment_tree::get_insertion_pos_leaf_reverse( key_type key, const node* start_pos) const { const node* cur_node = start_pos; @@ -745,9 +725,9 @@ return nullptr; } -template -const typename flat_segment_tree<_Key, _Value>::node* -flat_segment_tree<_Key, _Value>::get_insertion_pos_leaf(key_type key, const node* start_pos) const +template +const typename flat_segment_tree::node* flat_segment_tree::get_insertion_pos_leaf( + key_type key, const node* start_pos) const { const node* cur_node = start_pos; while (cur_node) @@ -762,17 +742,16 @@ return nullptr; } -template -void -flat_segment_tree<_Key, _Value>::destroy() +template +void flat_segment_tree::destroy() { disconnect_leaf_nodes(m_left_leaf.get(), m_right_leaf.get()); m_nonleaf_node_pool.clear(); m_root_node = nullptr; } -template -bool flat_segment_tree<_Key, _Value>::adjust_segment_range(key_type& start_key, key_type& end_key) const +template +bool flat_segment_tree::adjust_segment_range(key_type& start_key, key_type& end_key) const { if (start_key >= end_key) // Invalid order of segment range. @@ -793,4 +772,4 @@ return true; } -} +} // namespace mdds diff -Nru mdds-2.0.2/include/mdds/flat_segment_tree.hpp mdds-2.0.3/include/mdds/flat_segment_tree.hpp --- mdds-2.0.2/include/mdds/flat_segment_tree.hpp 2018-10-12 23:41:08.000000000 +0000 +++ mdds-2.0.3/include/mdds/flat_segment_tree.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -2,7 +2,7 @@ /************************************************************************* * * Copyright (c) 2008-2017 Kohei Yoshida - * + * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without @@ -11,10 +11,10 @@ * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -45,46 +45,40 @@ namespace mdds { -template +template class flat_segment_tree { public: - typedef _Key key_type; - typedef _Value value_type; - typedef size_t size_type; + typedef Key key_type; + typedef Value value_type; + typedef size_t size_type; struct nonleaf_value_type { - key_type low; /// low range value (inclusive) - key_type high; /// high range value (non-inclusive) + key_type low; /// low range value (inclusive) + key_type high; /// high range value (non-inclusive) - bool operator== (const nonleaf_value_type& r) const + bool operator==(const nonleaf_value_type& r) const { return low == r.low && high == r.high; } - - nonleaf_value_type() - : low(0) - , high(0) - { - } + + nonleaf_value_type() : low(0), high(0) + {} }; struct leaf_value_type { - key_type key; - value_type value; - - bool operator== (const leaf_value_type& r) const + key_type key; + value_type value; + + bool operator==(const leaf_value_type& r) const { return key == r.key && value == r.value; } - leaf_value_type() - : key(0) - , value() - { - } + leaf_value_type() : key(0), value() + {} }; // Handlers required by the node template class. @@ -102,24 +96,26 @@ struct fill_nonleaf_value_handler { - void operator() (__st::nonleaf_node& _self, const __st::node_base* left_node, const __st::node_base* right_node) + void operator()( + __st::nonleaf_node& _self, const __st::node_base* left_node, + const __st::node_base* right_node) { // Parent node should carry the range of all of its child nodes. if (left_node) { - _self.value_nonleaf.low = - left_node->is_leaf ? - static_cast(left_node)->value_leaf.key : - static_cast(left_node)->value_nonleaf.low; + _self.value_nonleaf.low = left_node->is_leaf + ? static_cast(left_node)->value_leaf.key + : static_cast(left_node)->value_nonleaf.low; } else { // Having a left node is prerequisite. - throw general_error("flat_segment_tree::fill_nonleaf_value_handler: Having a left node is prerequisite."); + throw general_error( + "flat_segment_tree::fill_nonleaf_value_handler: Having a left node is prerequisite."); } if (right_node) - { + { if (right_node->is_leaf) { // When the child nodes are leaf nodes, the upper bound @@ -138,10 +134,9 @@ } else { - _self.value_nonleaf.high = - left_node->is_leaf ? - static_cast(left_node)->value_leaf.key : - static_cast(left_node)->value_nonleaf.high; + _self.value_nonleaf.high = left_node->is_leaf + ? static_cast(left_node)->value_leaf.key + : static_cast(left_node)->value_nonleaf.high; } } }; @@ -149,14 +144,14 @@ #ifdef MDDS_UNIT_TEST struct to_string_handler { - std::string operator() (const node& _self) const + std::string operator()(const node& _self) const { std::ostringstream os; os << "(" << _self.value_leaf.key << ") "; return os.str(); } - std::string operator() (const mdds::__st::nonleaf_node& _self) const + std::string operator()(const mdds::__st::nonleaf_node& _self) const { std::ostringstream os; os << "(" << _self.value_nonleaf.low << "-" << _self.value_nonleaf.high << ") "; @@ -167,54 +162,60 @@ struct init_handler { - void operator() (node& /*_self*/) {} - void operator() (__st::nonleaf_node& /*_self*/) {} + void operator()(node& /*_self*/) + {} + void operator()(__st::nonleaf_node& /*_self*/) + {} }; struct dispose_handler { - void operator() (node& /*_self*/) {} - void operator() (__st::nonleaf_node& /*_self*/) {} + void operator()(node& /*_self*/) + {} + void operator()(__st::nonleaf_node& /*_self*/) + {} }; private: - friend struct ::mdds::__fst::itr_forward_handler; friend struct ::mdds::__fst::itr_reverse_handler; public: class const_iterator : public ::mdds::__fst::const_iterator_base< - flat_segment_tree, ::mdds::__fst::itr_forward_handler > + flat_segment_tree, ::mdds::__fst::itr_forward_handler> { typedef ::mdds::__fst::const_iterator_base< - flat_segment_tree, ::mdds::__fst::itr_forward_handler > - base_type; + flat_segment_tree, ::mdds::__fst::itr_forward_handler> + base_type; friend class flat_segment_tree; + public: - const_iterator() : - base_type(nullptr, false) {} + const_iterator() : base_type(nullptr, false) + {} private: - explicit const_iterator(const typename base_type::fst_type* _db, bool _end) : - base_type(_db, _end) {} + explicit const_iterator(const typename base_type::fst_type* _db, bool _end) : base_type(_db, _end) + {} - explicit const_iterator(const typename base_type::fst_type* _db, const node* p) : - base_type(_db, p) {} + explicit const_iterator(const typename base_type::fst_type* _db, const node* p) : base_type(_db, p) + {} }; class const_reverse_iterator : public ::mdds::__fst::const_iterator_base< - flat_segment_tree, ::mdds::__fst::itr_reverse_handler > + flat_segment_tree, ::mdds::__fst::itr_reverse_handler> { typedef ::mdds::__fst::const_iterator_base< - flat_segment_tree, ::mdds::__fst::itr_reverse_handler > - base_type; + flat_segment_tree, ::mdds::__fst::itr_reverse_handler> + base_type; friend class flat_segment_tree; + public: - const_reverse_iterator() : - base_type(nullptr, false) {} + const_reverse_iterator() : base_type(nullptr, false) + {} + private: - explicit const_reverse_iterator(const typename base_type::fst_type* _db, bool _end) : - base_type(_db, _end) {} + explicit const_reverse_iterator(const typename base_type::fst_type* _db, bool _end) : base_type(_db, _end) + {} }; using const_segment_iterator = mdds::__fst::const_segment_iterator; @@ -309,18 +310,17 @@ */ flat_segment_tree(key_type min_val, key_type max_val, value_type init_val); - /** - * Copy constructor only copies the leaf nodes. + /** + * Copy constructor only copies the leaf nodes. */ flat_segment_tree(const flat_segment_tree& r); ~flat_segment_tree(); /** - * Assignment only copies the leaf nodes. - */ - flat_segment_tree& - operator=(const flat_segment_tree& other); + * Assignment only copies the leaf nodes. + */ + flat_segment_tree& operator=(const flat_segment_tree& other); /** * Swap the content of the tree with another instance. @@ -336,43 +336,41 @@ */ void clear(); - /** - * Insert a new segment into the tree. It searches for the point of - * insertion from the first leaf node. + /** + * Insert a new segment into the tree. It searches for the point of + * insertion from the first leaf node. * - * @param start_key start value of the segment being inserted. The value + * @param start_key start value of the segment being inserted. The value * is inclusive. - * @param end_key end value of the segment being inserted. The value is + * @param end_key end value of the segment being inserted. The value is * not inclusive. - * @param val value associated with this segment. - * - * @return pair of const_iterator corresponding to the start position of + * @param val value associated with this segment. + * + * @return pair of const_iterator corresponding to the start position of * the inserted segment, and a boolean value indicating whether or * not the insertion has modified the tree. */ - std::pair - insert_front(key_type start_key, key_type end_key, value_type val) + std::pair insert_front(key_type start_key, key_type end_key, value_type val) { return insert_segment_impl(start_key, end_key, val, true); } - /** + /** * Insert a new segment into the tree. Unlike the insert_front() * counterpart, this method searches for the point of insertion from the * last leaf node toward the first. - * - * @param start_key start value of the segment being inserted. The value + * + * @param start_key start value of the segment being inserted. The value * is inclusive. - * @param end_key end value of the segment being inserted. The value is + * @param end_key end value of the segment being inserted. The value is * not inclusive. - * @param val value associated with this segment. - * - * @return pair of const_iterator corresponding to the start position of + * @param val value associated with this segment. + * + * @return pair of const_iterator corresponding to the start position of * the inserted segment, and a boolean value indicating whether or * not the insertion has modified the tree. */ - std::pair - insert_back(key_type start_key, key_type end_key, value_type val) + std::pair insert_back(key_type start_key, key_type end_key, value_type val) { return insert_segment_impl(start_key, end_key, val, false); } @@ -380,39 +378,39 @@ /** * Insert a new segment into the tree at or after specified point of * insertion. - * + * * @param pos specified insertion point - * @param start_key start value of the segment being inserted. The value + * @param start_key start value of the segment being inserted. The value * is inclusive. - * @param end_key end value of the segment being inserted. The value is + * @param end_key end value of the segment being inserted. The value is * not inclusive. - * @param val value associated with this segment. - * - * @return pair of const_iterator corresponding to the start position of + * @param val value associated with this segment. + * + * @return pair of const_iterator corresponding to the start position of * the inserted segment, and a boolean value indicating whether or * not the insertion has modified the tree. */ - std::pair - insert(const const_iterator& pos, key_type start_key, key_type end_key, value_type val); + std::pair insert( + const const_iterator& pos, key_type start_key, key_type end_key, value_type val); - /** - * Remove a segment specified by the start and end key values, and shift + /** + * Remove a segment specified by the start and end key values, and shift * the remaining segments (i.e. those segments that come after the removed - * segment) to left. Note that the start and end positions of the segment + * segment) to left. Note that the start and end positions of the segment * being removed must be within the base segment span. * * @param start_key start position of the segment being removed. - * @param end_key end position of the segment being removed. + * @param end_key end position of the segment being removed. */ void shift_left(key_type start_key, key_type end_key); - /** - * Shift all segments that occur at or after the specified start position + /** + * Shift all segments that occur at or after the specified start position * to right by the size specified. * * @param pos position where the right-shift occurs. - * @param size amount of shift (must be greater than 0) - * @param skip_start_node if true, and the specified position is at an + * @param size amount of shift (must be greater than 0) + * @param skip_start_node if true, and the specified position is at an * existing node position, that node will * not be shifted. This argument has no * effect if the position specified does not @@ -422,7 +420,7 @@ /** * Perform leaf-node search for a value associated with a key. - * + * * @param key key value * @param value value associated with key specified gets stored upon * successful search. @@ -435,15 +433,15 @@ * @return a pair of const_iterator corresponding to the start position of * the segment containing the key, and a boolean value indicating * whether or not the search has been successful. - * + * */ - std::pair - search(key_type key, value_type& value, key_type* start_key = nullptr, key_type* end_key = nullptr) const; + std::pair search( + key_type key, value_type& value, key_type* start_key = nullptr, key_type* end_key = nullptr) const; /** * Perform leaf-node search for a value associated with a key. - * - * @param pos position from which the search should start. When the + * + * @param pos position from which the search should start. When the * position is invalid, it falls back to the normal search. * @param key key value * @param value value associated with key specified gets stored upon @@ -458,15 +456,16 @@ * the segment containing the key, and a boolean value indicating * whether or not the search has been successful. */ - std::pair - search(const const_iterator& pos, key_type key, value_type& value, key_type* start_key = nullptr, key_type* end_key = nullptr) const; + std::pair search( + const const_iterator& pos, key_type key, value_type& value, key_type* start_key = nullptr, + key_type* end_key = nullptr) const; /** - * Perform tree search for a value associated with a key. This method + * Perform tree search for a value associated with a key. This method * assumes that the tree is valid. Call is_tree_valid() to find out * whether the tree is valid, and build_tree() to build a new tree in case * it's not. - * + * * @param key key value * @param value value associated with key specified gets stored upon * successful search. @@ -480,8 +479,8 @@ * the segment containing the key, and a boolean value indicating * whether or not the search has been successful. */ - std::pair - search_tree(key_type key, value_type& value, key_type* start_key = nullptr, key_type* end_key = nullptr) const; + std::pair search_tree( + key_type key, value_type& value, key_type* start_key = nullptr, key_type* end_key = nullptr) const; /** * Build a tree of non-leaf nodes based on the values stored in the leaf @@ -499,14 +498,14 @@ return m_valid_tree; } - /** - * Equality between two flat_segment_tree instances is evaluated by - * comparing the keys and the values of the leaf nodes only. Neither the - * non-leaf nodes nor the validity of the tree is evaluated. + /** + * Equality between two flat_segment_tree instances is evaluated by + * comparing the keys and the values of the leaf nodes only. Neither the + * non-leaf nodes nor the validity of the tree is evaluated. */ bool operator==(const flat_segment_tree& r) const; - bool operator !=(const flat_segment_tree& r) const + bool operator!=(const flat_segment_tree& r) const { return !operator==(r); } @@ -551,8 +550,8 @@ size_t node_instance_count = node::get_instance_count(); size_t leaf_count = leaf_size(); - cout << "tree node count = " << node_count << "; node instance count = " - << node_instance_count << "; leaf node count = " << leaf_count << endl; + cout << "tree node count = " << node_count << "; node instance count = " << node_instance_count + << "; leaf node count = " << leaf_count << endl; assert(leaf_count == node_instance_count); } @@ -569,17 +568,16 @@ while (cur_node) { cout << " node " << node_id++ << ": key = " << cur_node->value_leaf.key - << "; value = " << cur_node->value_leaf.value - << endl; + << "; value = " << cur_node->value_leaf.value << endl; cur_node = cur_node->next; } cout << endl << " node instance count = " << node::get_instance_count() << endl; } - /** + /** * Verify keys in the leaf nodes. * - * @param key_values vector containing key values in the left-to-right + * @param key_values vector containing key values in the left-to-right * order, including the key value of the rightmost leaf * node. */ @@ -594,11 +592,11 @@ if (!cur_node) // Position past the right-mode node. Invalid. return false; - + if (cur_node->value_leaf.key != *itr) // Key values differ. return false; - + cur_node = cur_node->next.get(); } @@ -611,17 +609,18 @@ { // Start from the right-most node, and traverse left. node* cur_node = m_right_leaf.get(); - typename ::std::vector::const_reverse_iterator itr = key_values.rbegin(), itr_end = key_values.rend(); + typename ::std::vector::const_reverse_iterator itr = key_values.rbegin(), + itr_end = key_values.rend(); for (; itr != itr_end; ++itr) { if (!cur_node) // Position past the left-mode node. Invalid. return false; - + if (cur_node->value_leaf.key != *itr) // Key values differ. return false; - + cur_node = cur_node->prev.get(); } @@ -630,14 +629,14 @@ // left-most node, in which case the node value is nullptr. return false; } - + return true; } - /** + /** * Verify values in the leaf nodes. * - * @param values vector containing values to verify against, in the + * @param values vector containing values to verify against, in the * left-to-right order, not including the value of * the rightmost leaf node. */ @@ -659,7 +658,7 @@ } if (cur_node != end_node) - // At this point, we expect the current node to be at the end of + // At this point, we expect the current node to be at the end of // range. return false; @@ -679,18 +678,18 @@ } #ifdef MDDS_UNIT_TEST - // The start position must come after the position of the last node + // The start position must come after the position of the last node // before the right-most node. assert(m_right_leaf->prev->value_leaf.key < start_key); #endif if (m_right_leaf->prev->value_leaf.value == m_init_val) - // The existing segment has the same value. No need to insert a + // The existing segment has the same value. No need to insert a // new segment. return; node_ptr new_node(new node); - new_node->value_leaf.key = start_key; + new_node->value_leaf.key = start_key; new_node->value_leaf.value = m_init_val; new_node->prev = m_right_leaf->prev; new_node->next = m_right_leaf; @@ -699,14 +698,14 @@ m_valid_tree = false; } - ::std::pair - insert_segment_impl(key_type start_key, key_type end_key, value_type val, bool forward); + ::std::pair insert_segment_impl( + key_type start_key, key_type end_key, value_type val, bool forward); - ::std::pair - insert_to_pos(node_ptr& start_pos, key_type start_key, key_type end_key, value_type val); + ::std::pair insert_to_pos( + node_ptr& start_pos, key_type start_key, key_type end_key, value_type val); - ::std::pair - search_impl(const node* pos, key_type key, value_type& value, key_type* start_key, key_type* end_key) const; + ::std::pair search_impl( + const node* pos, key_type key, value_type& value, key_type* start_key, key_type* end_key) const; const node* get_insertion_pos_leaf_reverse(key_type key, const node* start_pos) const; @@ -768,15 +767,14 @@ std::vector m_nonleaf_node_pool; nonleaf_node* m_root_node; - node_ptr m_left_leaf; - node_ptr m_right_leaf; + node_ptr m_left_leaf; + node_ptr m_right_leaf; value_type m_init_val; - bool m_valid_tree; + bool m_valid_tree; }; -template -void -swap(flat_segment_tree<_Key, _Value>& left, flat_segment_tree<_Key, _Value>& right) +template +void swap(flat_segment_tree& left, flat_segment_tree& right) { left.swap(right); } diff -Nru mdds-2.0.2/include/mdds/flat_segment_tree_itr.hpp mdds-2.0.3/include/mdds/flat_segment_tree_itr.hpp --- mdds-2.0.2/include/mdds/flat_segment_tree_itr.hpp 2021-11-23 01:01:25.000000000 +0000 +++ mdds-2.0.3/include/mdds/flat_segment_tree_itr.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * Copyright (c) 2010-2017 Kohei Yoshida - * + * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without @@ -10,10 +10,10 @@ * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -93,19 +93,19 @@ template class const_iterator_base { - typedef _Hdl handler_type; + typedef _Hdl handler_type; + public: typedef _FstType fst_type; // iterator traits typedef ::std::pair value_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef ptrdiff_t difference_type; typedef ::std::bidirectional_iterator_tag iterator_category; - explicit const_iterator_base(const fst_type* _db, bool _end) : - m_db(_db), m_pos(nullptr), m_end_pos(_end) + explicit const_iterator_base(const fst_type* _db, bool _end) : m_db(_db), m_pos(nullptr), m_end_pos(_end) { if (!_db) return; @@ -113,11 +113,12 @@ m_pos = handler_type::init_pos(_db, _end); } - explicit const_iterator_base(const fst_type* _db, const typename fst_type::node* pos) : - m_db(_db), m_pos(pos), m_end_pos(false) {} + explicit const_iterator_base(const fst_type* _db, const typename fst_type::node* pos) + : m_db(_db), m_pos(pos), m_end_pos(false) + {} - const_iterator_base(const const_iterator_base& r) : - m_db(r.m_db), m_pos(r.m_pos), m_end_pos(r.m_end_pos) {} + const_iterator_base(const const_iterator_base& r) : m_db(r.m_db), m_pos(r.m_pos), m_end_pos(r.m_end_pos) + {} const_iterator_base& operator=(const const_iterator_base& r) { @@ -165,8 +166,14 @@ } protected: - const typename fst_type::node* get_pos() const { return m_pos; } - const fst_type* get_parent() const { return m_db; } + const typename fst_type::node* get_pos() const + { + return m_pos; + } + const fst_type* get_parent() const + { + return m_db; + } private: const value_type& get_current_node_pair() @@ -177,8 +184,8 @@ const fst_type* m_db; const typename fst_type::node* m_pos; - value_type m_current_pair; - bool m_end_pos; + value_type m_current_pair; + bool m_end_pos; }; template @@ -187,11 +194,12 @@ typedef _FstType fst_type; friend fst_type; - const_segment_iterator(const typename fst_type::node* start, const typename fst_type::node* end) : - m_start(start), m_end(end) + const_segment_iterator(const typename fst_type::node* start, const typename fst_type::node* end) + : m_start(start), m_end(end) { update_node(); } + public: struct value_type { @@ -199,31 +207,33 @@ typename fst_type::key_type end; typename fst_type::value_type value; - value_type() : start(), end(), value() {} + value_type() : start(), end(), value() + {} }; - const_segment_iterator() : m_start(nullptr), m_end(nullptr) {} - const_segment_iterator(const const_segment_iterator& other) : - m_start(other.m_start), m_end(other.m_end) + const_segment_iterator() : m_start(nullptr), m_end(nullptr) + {} + const_segment_iterator(const const_segment_iterator& other) : m_start(other.m_start), m_end(other.m_end) { if (m_start) update_node(); } - const_segment_iterator(const_segment_iterator&& other) : - m_start(std::move(other.m_start)), m_end(std::move(other.m_end)) + const_segment_iterator(const_segment_iterator&& other) + : m_start(std::move(other.m_start)), m_end(std::move(other.m_end)) { if (m_start) update_node(); } - ~const_segment_iterator() {} + ~const_segment_iterator() + {} - bool operator== (const const_segment_iterator& other) const + bool operator==(const const_segment_iterator& other) const { return m_start == other.m_start && m_end == other.m_end; } - bool operator!= (const const_segment_iterator& other) const + bool operator!=(const const_segment_iterator& other) const { return !operator==(other); } @@ -312,6 +322,6 @@ value_type m_node; }; -}} +}} // namespace mdds::__fst #endif diff -Nru mdds-2.0.2/include/mdds/global.hpp mdds-2.0.3/include/mdds/global.hpp --- mdds-2.0.2/include/mdds/global.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/include/mdds/global.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -44,22 +44,24 @@ * does not work with pointer values that point to strings defined * elsewhere. */ -#define MDDS_ASCII(literal) literal, sizeof(literal)-1 +#define MDDS_ASCII(literal) literal, sizeof(literal) - 1 /** * \def MDDS_N_ELEMENTS(name) * * Calculates the length of \a name array provided that the array definition * is given in the same compilation unit. + * + * @deprecated Please use \c std::size instead. */ -#define MDDS_N_ELEMENTS(name) sizeof(name)/sizeof(name[0]) +#define MDDS_N_ELEMENTS(name) sizeof(name) / sizeof(name[0]) #ifdef __GNUC__ - #define MDDS_DEPRECATED __attribute__ ((deprecated)) +#define MDDS_DEPRECATED __attribute__((deprecated)) #elif defined(_MSC_VER) - #define MDDS_DEPRECATED __declspec(deprecated) +#define MDDS_DEPRECATED __declspec(deprecated) #else - #define MDDS_DEPRECATED +#define MDDS_DEPRECATED #endif #ifndef MDDS_LOOP_UNROLLING @@ -71,9 +73,9 @@ #endif #if defined(__AVX__) || defined(__AVX2__) - #ifndef __SSE2__ - #define __SSE2__ 1 - #endif +#ifndef __SSE2__ +#define __SSE2__ 1 +#endif #endif namespace mdds { @@ -81,13 +83,16 @@ class general_error : public ::std::exception { public: - general_error(const ::std::string& msg) : m_msg(msg) {} - virtual ~general_error() throw() {} + general_error(const ::std::string& msg) : m_msg(msg) + {} + virtual ~general_error() noexcept + {} - virtual const char* what() const throw() + virtual const char* what() const noexcept { return m_msg.c_str(); } + private: ::std::string m_msg; }; @@ -95,74 +100,80 @@ class invalid_arg_error : public general_error { public: - invalid_arg_error(const ::std::string& msg) : general_error(msg) {} + invalid_arg_error(const ::std::string& msg) : general_error(msg) + {} }; class size_error : public general_error { public: - size_error(const std::string& msg) : general_error(msg) {} + size_error(const std::string& msg) : general_error(msg) + {} }; class type_error : public general_error { public: - type_error(const std::string& msg) : general_error(msg) {} + type_error(const std::string& msg) : general_error(msg) + {} }; class integrity_error : public general_error { public: - integrity_error(const std::string& msg) : general_error(msg) {} + integrity_error(const std::string& msg) : general_error(msg) + {} }; template using bool_constant = std::integral_constant; -template +template class has_value_type { using y_type = char; using n_type = long; - template static y_type test(typename U::value_type); - template static n_type test(...); + template + static y_type test(typename U::value_type); + template + static n_type test(...); public: static constexpr bool value = sizeof(test(0)) == sizeof(y_type); }; -template +template struct const_or_not; -template -struct const_or_not<_T, std::true_type> +template +struct const_or_not { - using type = typename std::add_const<_T>::type; + using type = typename std::add_const::type; }; -template -struct const_or_not<_T, std::false_type> +template +struct const_or_not { - using type = _T; + using type = T; }; -template -using const_t = typename const_or_not<_T, bool_constant<_Const>>::type; +template +using const_t = typename const_or_not>::type; -template +template struct get_iterator_type; -template -struct get_iterator_type<_T, std::true_type> +template +struct get_iterator_type { - using type = typename _T::const_iterator; + using type = typename T::const_iterator; }; -template -struct get_iterator_type<_T, std::false_type> +template +struct get_iterator_type { - using type = typename _T::iterator; + using type = typename T::iterator; }; template @@ -171,6 +182,6 @@ return false; } -} +} // namespace mdds #endif diff -Nru mdds-2.0.2/include/mdds/Makefile.in mdds-2.0.3/include/mdds/Makefile.in --- mdds-2.0.2/include/mdds/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/include/mdds/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -179,8 +179,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -220,9 +218,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -234,11 +233,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -499,7 +497,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/include/mdds/multi_type_matrix_def.inl mdds-2.0.3/include/mdds/multi_type_matrix_def.inl --- mdds-2.0.2/include/mdds/multi_type_matrix_def.inl 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_matrix_def.inl 2022-04-22 00:12:40.000000000 +0000 @@ -28,12 +28,14 @@ namespace mdds { template -multi_type_matrix<_MtxTrait>::element_block_node_type::element_block_node_type() : - type(mtm::element_empty), offset(0), size(0), data(nullptr) {} +multi_type_matrix<_MtxTrait>::element_block_node_type::element_block_node_type() + : type(mtm::element_empty), offset(0), size(0), data(nullptr) +{} template -multi_type_matrix<_MtxTrait>::element_block_node_type::element_block_node_type(const element_block_node_type& other) : - type(other.type), offset(other.offset), size(other.size), data(other.data) {} +multi_type_matrix<_MtxTrait>::element_block_node_type::element_block_node_type(const element_block_node_type& other) + : type(other.type), offset(other.offset), size(other.size), data(other.data) +{} template void multi_type_matrix<_MtxTrait>::element_block_node_type::assign( @@ -49,8 +51,7 @@ template template -typename _Blk::const_iterator -multi_type_matrix<_MtxTrait>::element_block_node_type::begin() const +typename _Blk::const_iterator multi_type_matrix<_MtxTrait>::element_block_node_type::begin() const { typename _Blk::const_iterator it = _Blk::begin(*data); std::advance(it, offset); @@ -59,45 +60,46 @@ template template -typename _Blk::const_iterator -multi_type_matrix<_MtxTrait>::element_block_node_type::end() const +typename _Blk::const_iterator multi_type_matrix<_MtxTrait>::element_block_node_type::end() const { typename _Blk::const_iterator it = _Blk::begin(*data); - std::advance(it, offset+size); + std::advance(it, offset + size); return it; } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::next_position(const position_type& pos) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::next_position( + const position_type& pos) { return store_type::next_position(pos); } template -typename multi_type_matrix<_MtxTrait>::const_position_type -multi_type_matrix<_MtxTrait>::next_position(const const_position_type& pos) +typename multi_type_matrix<_MtxTrait>::const_position_type multi_type_matrix<_MtxTrait>::next_position( + const const_position_type& pos) { return store_type::next_position(pos); } template -multi_type_matrix<_MtxTrait>::multi_type_matrix() : m_size(0, 0) {} +multi_type_matrix<_MtxTrait>::multi_type_matrix() : m_size(0, 0) +{} template -multi_type_matrix<_MtxTrait>::multi_type_matrix(size_type rows, size_type cols) : - m_store(rows*cols), m_size(rows, cols) {} +multi_type_matrix<_MtxTrait>::multi_type_matrix(size_type rows, size_type cols) + : m_store(rows * cols), m_size(rows, cols) +{} template template -multi_type_matrix<_MtxTrait>::multi_type_matrix(size_type rows, size_type cols, const _T& value) : - m_store(rows*cols, value), m_size(rows, cols) {} +multi_type_matrix<_MtxTrait>::multi_type_matrix(size_type rows, size_type cols, const _T& value) + : m_store(rows * cols, value), m_size(rows, cols) +{} template template -multi_type_matrix<_MtxTrait>::multi_type_matrix( - size_type rows, size_type cols, const _T& it_begin, const _T& it_end) : - m_store(rows*cols, it_begin, it_end), m_size(rows, cols) +multi_type_matrix<_MtxTrait>::multi_type_matrix(size_type rows, size_type cols, const _T& it_begin, const _T& it_end) + : m_store(rows * cols, it_begin, it_end), m_size(rows, cols) { if (m_store.empty()) return; @@ -108,27 +110,27 @@ } template -multi_type_matrix<_MtxTrait>::multi_type_matrix(const multi_type_matrix& r) : - m_store(r.m_store), m_size(r.m_size) {} +multi_type_matrix<_MtxTrait>::multi_type_matrix(const multi_type_matrix& r) : m_store(r.m_store), m_size(r.m_size) +{} template -multi_type_matrix<_MtxTrait>::~multi_type_matrix() {} +multi_type_matrix<_MtxTrait>::~multi_type_matrix() +{} template -bool multi_type_matrix<_MtxTrait>::operator== (const multi_type_matrix& r) const +bool multi_type_matrix<_MtxTrait>::operator==(const multi_type_matrix& r) const { return m_size == r.m_size && m_store == r.m_store; } template -bool multi_type_matrix<_MtxTrait>::operator!= (const multi_type_matrix& r) const +bool multi_type_matrix<_MtxTrait>::operator!=(const multi_type_matrix& r) const { - return !operator== (r); + return !operator==(r); } template -multi_type_matrix<_MtxTrait>& -multi_type_matrix<_MtxTrait>::operator= (const multi_type_matrix& r) +multi_type_matrix<_MtxTrait>& multi_type_matrix<_MtxTrait>::operator=(const multi_type_matrix& r) { if (this == &r) return *this; @@ -140,36 +142,36 @@ } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::position(size_type row, size_type col) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::position( + size_type row, size_type col) { - return m_store.position(get_pos(row,col)); + return m_store.position(get_pos(row, col)); } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::position(const position_type& pos_hint, size_type row, size_type col) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::position( + const position_type& pos_hint, size_type row, size_type col) { - return m_store.position(pos_hint.first, get_pos(row,col)); + return m_store.position(pos_hint.first, get_pos(row, col)); } template -typename multi_type_matrix<_MtxTrait>::const_position_type -multi_type_matrix<_MtxTrait>::position(size_type row, size_type col) const +typename multi_type_matrix<_MtxTrait>::const_position_type multi_type_matrix<_MtxTrait>::position( + size_type row, size_type col) const { - return m_store.position(get_pos(row,col)); + return m_store.position(get_pos(row, col)); } template -typename multi_type_matrix<_MtxTrait>::const_position_type -multi_type_matrix<_MtxTrait>::position(const const_position_type& pos_hint, size_type row, size_type col) const +typename multi_type_matrix<_MtxTrait>::const_position_type multi_type_matrix<_MtxTrait>::position( + const const_position_type& pos_hint, size_type row, size_type col) const { - return m_store.position(pos_hint.first, get_pos(row,col)); + return m_store.position(pos_hint.first, get_pos(row, col)); } template -typename multi_type_matrix<_MtxTrait>::size_pair_type -multi_type_matrix<_MtxTrait>::matrix_position(const const_position_type& pos) const +typename multi_type_matrix<_MtxTrait>::size_pair_type multi_type_matrix<_MtxTrait>::matrix_position( + const const_position_type& pos) const { size_type mtv_pos = store_type::logical_position(pos); size_type col = mtv_pos / m_size.row; @@ -178,37 +180,33 @@ } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::end_position() +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::end_position() { return position_type(m_store.end(), 0); } template -typename multi_type_matrix<_MtxTrait>::const_position_type -multi_type_matrix<_MtxTrait>::end_position() const +typename multi_type_matrix<_MtxTrait>::const_position_type multi_type_matrix<_MtxTrait>::end_position() const { return const_position_type(m_store.end(), 0); } template -mtm::element_t -multi_type_matrix<_MtxTrait>::get_type(const const_position_type& pos) const +mtm::element_t multi_type_matrix<_MtxTrait>::get_type(const const_position_type& pos) const { return to_mtm_type(pos.first->type); } template -mtm::element_t -multi_type_matrix<_MtxTrait>::get_type(size_type row, size_type col) const +mtm::element_t multi_type_matrix<_MtxTrait>::get_type(size_type row, size_type col) const { - return to_mtm_type(m_store.get_type(get_pos(row,col))); + return to_mtm_type(m_store.get_type(get_pos(row, col))); } template double multi_type_matrix<_MtxTrait>::get_numeric(size_type row, size_type col) const { - return get_numeric(m_store.position(get_pos(row,col))); + return get_numeric(m_store.position(get_pos(row, col))); } template @@ -237,15 +235,15 @@ } template -typename multi_type_matrix<_MtxTrait>::integer_type -multi_type_matrix<_MtxTrait>::get_integer(size_type row, size_type col) const +typename multi_type_matrix<_MtxTrait>::integer_type multi_type_matrix<_MtxTrait>::get_integer( + size_type row, size_type col) const { - return get_integer(m_store.position(get_pos(row,col))); + return get_integer(m_store.position(get_pos(row, col))); } template -typename multi_type_matrix<_MtxTrait>::integer_type -multi_type_matrix<_MtxTrait>::get_integer(const const_position_type& pos) const +typename multi_type_matrix<_MtxTrait>::integer_type multi_type_matrix<_MtxTrait>::get_integer( + const const_position_type& pos) const { return static_cast(get_numeric(pos)); } @@ -263,15 +261,15 @@ } template -const typename multi_type_matrix<_MtxTrait>::string_type& -multi_type_matrix<_MtxTrait>::get_string(size_type row, size_type col) const +const typename multi_type_matrix<_MtxTrait>::string_type& multi_type_matrix<_MtxTrait>::get_string( + size_type row, size_type col) const { - return get_string(m_store.position(get_pos(row,col))); + return get_string(m_store.position(get_pos(row, col))); } template -const typename multi_type_matrix<_MtxTrait>::string_type& -multi_type_matrix<_MtxTrait>::get_string(const const_position_type& pos) const +const typename multi_type_matrix<_MtxTrait>::string_type& multi_type_matrix<_MtxTrait>::get_string( + const const_position_type& pos) const { if (pos.first->type != string_block_type::block_type) throw general_error("multi_type_matrix: unknown element type."); @@ -281,11 +279,10 @@ template template -_T -multi_type_matrix<_MtxTrait>::get(size_type row, size_type col) const +_T multi_type_matrix<_MtxTrait>::get(size_type row, size_type col) const { _T val; - m_store.get(get_pos(row,col), val); + m_store.get(get_pos(row, col), val); return val; } @@ -302,12 +299,11 @@ throw general_error("multi_type_matrix::set_empty: length of zero is not permitted."); size_type pos1 = get_pos(row, col); - m_store.set_empty(pos1, pos1+length-1); + m_store.set_empty(pos1, pos1 + length - 1); } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::set_empty(const position_type& pos) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::set_empty(const position_type& pos) { size_type store_pos = get_pos(pos); typename store_type::iterator it = m_store.set_empty(pos.first, store_pos, store_pos); @@ -317,7 +313,7 @@ template void multi_type_matrix<_MtxTrait>::set_column_empty(size_type col) { - m_store.set_empty(get_pos(0, col), get_pos(m_size.row-1, col)); + m_store.set_empty(get_pos(0, col), get_pos(m_size.row - 1, col)); } template @@ -333,12 +329,12 @@ template void multi_type_matrix<_MtxTrait>::set(size_type row, size_type col, double val) { - m_store.set(get_pos(row,col), val); + m_store.set(get_pos(row, col), val); } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::set(const position_type& pos, double val) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::set( + const position_type& pos, double val) { size_type store_pos = get_pos(pos); typename store_type::iterator it = m_store.set(pos.first, store_pos, val); @@ -348,12 +344,12 @@ template void multi_type_matrix<_MtxTrait>::set(size_type row, size_type col, bool val) { - m_store.set(get_pos(row,col), val); + m_store.set(get_pos(row, col), val); } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::set(const position_type& pos, bool val) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::set( + const position_type& pos, bool val) { size_type store_pos = get_pos(pos); typename store_type::iterator it = m_store.set(pos.first, store_pos, val); @@ -363,12 +359,12 @@ template void multi_type_matrix<_MtxTrait>::set(size_type row, size_type col, const string_type& str) { - m_store.set(get_pos(row,col), str); + m_store.set(get_pos(row, col), str); } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::set(const position_type& pos, const string_type& str) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::set( + const position_type& pos, const string_type& str) { size_type store_pos = get_pos(pos); typename store_type::iterator it = m_store.set(pos.first, store_pos, str); @@ -378,12 +374,12 @@ template void multi_type_matrix<_MtxTrait>::set(size_type row, size_type col, integer_type val) { - m_store.set(get_pos(row,col), val); + m_store.set(get_pos(row, col), val); } template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::set(const position_type& pos, integer_type val) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::set( + const position_type& pos, integer_type val) { size_type store_pos = get_pos(pos); typename store_type::iterator it = m_store.set(pos.first, store_pos, val); @@ -394,13 +390,13 @@ template void multi_type_matrix<_MtxTrait>::set(size_type row, size_type col, const _T& it_begin, const _T& it_end) { - m_store.set(get_pos(row,col), it_begin, it_end); + m_store.set(get_pos(row, col), it_begin, it_end); } template template -typename multi_type_matrix<_MtxTrait>::position_type -multi_type_matrix<_MtxTrait>::set(const position_type& pos, const _T& it_begin, const _T& it_end) +typename multi_type_matrix<_MtxTrait>::position_type multi_type_matrix<_MtxTrait>::set( + const position_type& pos, const _T& it_begin, const _T& it_end) { size_type store_pos = get_pos(pos); typename store_type::iterator it = m_store.set(pos.first, store_pos, it_begin, it_end); @@ -426,46 +422,44 @@ } template -typename multi_type_matrix<_MtxTrait>::size_pair_type -multi_type_matrix<_MtxTrait>::size() const +typename multi_type_matrix<_MtxTrait>::size_pair_type multi_type_matrix<_MtxTrait>::size() const { return m_size; } template -multi_type_matrix<_MtxTrait>& -multi_type_matrix<_MtxTrait>::transpose() +multi_type_matrix<_MtxTrait>& multi_type_matrix<_MtxTrait>::transpose() { multi_type_matrix tmp(m_size.column, m_size.row); for (size_type old_row_new_col = 0; old_row_new_col < m_size.row; ++old_row_new_col) { for (size_type old_col_new_row = 0; old_col_new_row < m_size.column; ++old_col_new_row) { - switch (get_type(old_row_new_col,old_col_new_row)) + switch (get_type(old_row_new_col, old_col_new_row)) { case mtm::element_numeric: { double val; - m_store.get(get_pos(old_row_new_col,old_col_new_row), val); + m_store.get(get_pos(old_row_new_col, old_col_new_row), val); tmp.set(old_col_new_row, old_row_new_col, val); } break; case mtm::element_boolean: { bool val; - m_store.get(get_pos(old_row_new_col,old_col_new_row), val); + m_store.get(get_pos(old_row_new_col, old_col_new_row), val); tmp.set(old_col_new_row, old_row_new_col, val); } break; case mtm::element_string: { string_type val; - m_store.get(get_pos(old_row_new_col,old_col_new_row), val); + m_store.get(get_pos(old_row_new_col, old_col_new_row), val); tmp.set(old_col_new_row, old_row_new_col, val); } break; case mtm::element_empty: - break; + break; default: throw general_error("multi_type_matrix: unknown element type."); } @@ -558,27 +552,23 @@ // Move source to the head of the next block in the column. pos_src = const_position_type(++pos_src.first, 0); - } - while (remaining_rows); + } while (remaining_rows); } } template template -void multi_type_matrix<_MtxTrait>::copy( - size_type rows, size_type cols, const _T& it_begin, const _T& it_end) +void multi_type_matrix<_MtxTrait>::copy(size_type rows, size_type cols, const _T& it_begin, const _T& it_end) { size_t n = std::distance(it_begin, it_end); if (!n || empty()) return; - if (n != rows*cols) - throw size_error( - "multi_type_matrix: size of the array does not match the destination size."); + if (n != rows * cols) + throw size_error("multi_type_matrix: size of the array does not match the destination size."); if (rows > m_size.row || cols > m_size.column) - throw size_error( - "multi_type_matrix: specified destination size is larger than the current matrix."); + throw size_error("multi_type_matrix: specified destination size is larger than the current matrix."); // Ensure that the passed array is supported by this matrix. to_mtm_type(store_type::get_element_type(*it_begin)); @@ -593,7 +583,7 @@ auto it_this_end = it; std::advance(it_this_end, rows); - pos_dest.first = m_store.set(pos_dest.first, get_pos(0,col), it, it_this_end); + pos_dest.first = m_store.set(pos_dest.first, get_pos(0, col), it, it_this_end); it = it_this_end; } } @@ -693,14 +683,13 @@ template template -_Func multi_type_matrix<_MtxTrait>::walk( - _Func func, const size_pair_type& start, const size_pair_type& end) const +_Func multi_type_matrix<_MtxTrait>::walk(_Func func, const size_pair_type& start, const size_pair_type& end) const { if (end.row < start.row || end.column < start.column) { std::ostringstream os; - os << "multi_type_matrix: invalid start/end position pair: (row=" - << start.row << "; column=" << start.column << ") - (row=" << end.row << "; column=" << end.column << ")"; + os << "multi_type_matrix: invalid start/end position pair: (row=" << start.row << "; column=" << start.column + << ") - (row=" << end.row << "; column=" << end.column << ")"; throw size_error(os.str()); } @@ -734,8 +723,7 @@ // Move to the head of the next block in the column. pos = const_position_type(++pos.first, 0); - } - while (remaining_rows != 0); + } while (remaining_rows != 0); } return func; @@ -760,9 +748,7 @@ while (remaining_size) { - size_t section_size = std::min( - pos1.first->size - pos1.second, - pos2.first->size - pos2.second); + size_t section_size = std::min(pos1.first->size - pos1.second, pos2.first->size - pos2.second); node1.assign(pos1, section_size); node2.assign(pos2, section_size); @@ -781,19 +767,18 @@ template template _Func multi_type_matrix<_MtxTrait>::walk( - _Func func, const multi_type_matrix& right, - const size_pair_type& start, const size_pair_type& end) const + _Func func, const multi_type_matrix& right, const size_pair_type& start, const size_pair_type& end) const { if (end.row < start.row || end.column < start.column) { std::ostringstream os; - os << "multi_type_matrix: invalid start/end position pair: (row=" - << start.row << "; column=" << start.column << ") - (row=" << end.row << "; column=" << end.column << ")"; + os << "multi_type_matrix: invalid start/end position pair: (row=" << start.row << "; column=" << start.column + << ") - (row=" << end.row << "; column=" << end.column << ")"; throw size_error(os.str()); } - if (end.row > m_size.row || end.column > m_size.column || - end.row > right.size().row || end.column > right.size().column) + if (end.row > m_size.row || end.column > m_size.column || end.row > right.size().row || + end.column > right.size().column) throw size_error("multi_type_matrix: end position is out-of-bound."); size_t rows = end.row - start.row + 1; @@ -826,11 +811,10 @@ pos2 = store_type::advance_position(pos2, section_size); remaining_rows -= section_size; - } - while (remaining_rows); + } while (remaining_rows); } return func; } -} +} // namespace mdds diff -Nru mdds-2.0.2/include/mdds/multi_type_matrix.hpp mdds-2.0.3/include/mdds/multi_type_matrix.hpp --- mdds-2.0.2/include/mdds/multi_type_matrix.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_matrix.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -46,9 +46,9 @@ */ enum element_t { - element_empty = mdds::mtv::element_type_empty, + element_empty = mdds::mtv::element_type_empty, element_boolean = mdds::mtv::element_type_boolean, - element_string = mdds::mtv::element_type_string, + element_string = mdds::mtv::element_type_string, element_numeric = mdds::mtv::element_type_double, element_integer = mdds::mtv::element_type_int32 }; @@ -64,7 +64,7 @@ typedef mdds::mtv::element_block_func element_block_func; }; -} +} // namespace mtm /** * Matrix that can store numeric, integer, boolean, empty and string types. @@ -79,13 +79,14 @@ class multi_type_matrix { typedef _MtxTrait matrix_trait; + public: typedef typename matrix_trait::string_element_block string_block_type; typedef typename matrix_trait::integer_element_block integer_block_type; typedef typename string_block_type::value_type string_type; typedef typename integer_block_type::value_type integer_type; - typedef size_t size_type; + typedef size_t size_type; private: typedef mdds::multi_type_vector store_type; @@ -103,22 +104,30 @@ { size_type row; size_type column; - size_pair_type() : row(0), column(0) {} - size_pair_type(size_type _row, size_type _column) : row(_row), column(_column) {} + size_pair_type() : row(0), column(0) + {} + size_pair_type(size_type _row, size_type _column) : row(_row), column(_column) + {} size_pair_type(std::initializer_list vs) { if (vs.size() != 2) throw invalid_arg_error("size_pair_type requires exactly 2 elements."); - size_type* ptrs[2] = { &row, &column }; + size_type* ptrs[2] = {&row, &column}; size_type** p = ptrs; for (size_type v : vs) **p++ = v; } - bool operator== (const size_pair_type& r) const { return row == r.row && column == r.column; } - bool operator!= (const size_pair_type& r) const { return !operator== (r); } + bool operator==(const size_pair_type& r) const + { + return row == r.row && column == r.column; + } + bool operator!=(const size_pair_type& r) const + { + return !operator==(r); + } }; struct element_block_node_type @@ -166,9 +175,10 @@ struct walk_func { _Func& m_func; - walk_func(_Func& func) : m_func(func) {} + walk_func(_Func& func) : m_func(func) + {} - void operator() (const typename store_type::const_iterator::value_type& mtv_node) + void operator()(const typename store_type::const_iterator::value_type& mtv_node) { element_block_node_type mtm_node; mtm_node.type = to_mtm_type(mtv_node.type); @@ -250,10 +260,10 @@ */ ~multi_type_matrix(); - bool operator== (const multi_type_matrix& other) const; - bool operator!= (const multi_type_matrix& other) const; + bool operator==(const multi_type_matrix& other) const; + bool operator!=(const multi_type_matrix& other) const; - multi_type_matrix& operator= (const multi_type_matrix& r); + multi_type_matrix& operator=(const multi_type_matrix& r); /** * Get a mutable reference of an element (position object) at specified @@ -787,9 +797,8 @@ * those of the start position. */ template - _Func walk(_Func func, const multi_type_matrix& right, - const size_pair_type& start, const size_pair_type& end) const; - + _Func walk( + _Func func, const multi_type_matrix& right, const size_pair_type& start, const size_pair_type& end) const; #ifdef MDDS_MULTI_TYPE_MATRIX_DEBUG void dump() const @@ -799,7 +808,6 @@ #endif private: - /** * Get an array position of the data referenced by the row and column * indices. The array consists of multiple columns, the content of column @@ -825,7 +833,7 @@ size_pair_type m_size; }; -} +} // namespace mdds #include "multi_type_matrix_def.inl" diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/aos/block_util.hpp mdds-2.0.3/include/mdds/multi_type_vector/aos/block_util.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/aos/block_util.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/aos/block_util.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,9 +32,7 @@ #include "mdds/global.hpp" #include "../types.hpp" -namespace mdds { namespace mtv { namespace aos { - -namespace detail { +namespace mdds { namespace mtv { namespace aos { namespace detail { template struct adjust_block_positions @@ -56,7 +54,7 @@ return; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < n; ++i) blocks[i].position += delta; @@ -79,14 +77,14 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 4) { blocks[i].position += delta; - blocks[i+1].position += delta; - blocks[i+2].position += delta; - blocks[i+3].position += delta; + blocks[i + 1].position += delta; + blocks[i + 2].position += delta; + blocks[i + 3].position += delta; } rem += len; @@ -111,18 +109,18 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 8) { blocks[i].position += delta; - blocks[i+1].position += delta; - blocks[i+2].position += delta; - blocks[i+3].position += delta; - blocks[i+4].position += delta; - blocks[i+5].position += delta; - blocks[i+6].position += delta; - blocks[i+7].position += delta; + blocks[i + 1].position += delta; + blocks[i + 2].position += delta; + blocks[i + 3].position += delta; + blocks[i + 4].position += delta; + blocks[i + 5].position += delta; + blocks[i + 6].position += delta; + blocks[i + 7].position += delta; } rem += len; @@ -147,26 +145,26 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 16) { blocks[i].position += delta; - blocks[i+1].position += delta; - blocks[i+2].position += delta; - blocks[i+3].position += delta; - blocks[i+4].position += delta; - blocks[i+5].position += delta; - blocks[i+6].position += delta; - blocks[i+7].position += delta; - blocks[i+8].position += delta; - blocks[i+9].position += delta; - blocks[i+10].position += delta; - blocks[i+11].position += delta; - blocks[i+12].position += delta; - blocks[i+13].position += delta; - blocks[i+14].position += delta; - blocks[i+15].position += delta; + blocks[i + 1].position += delta; + blocks[i + 2].position += delta; + blocks[i + 3].position += delta; + blocks[i + 4].position += delta; + blocks[i + 5].position += delta; + blocks[i + 6].position += delta; + blocks[i + 7].position += delta; + blocks[i + 8].position += delta; + blocks[i + 9].position += delta; + blocks[i + 10].position += delta; + blocks[i + 11].position += delta; + blocks[i + 12].position += delta; + blocks[i + 13].position += delta; + blocks[i + 14].position += delta; + blocks[i + 15].position += delta; } rem += len; @@ -191,42 +189,42 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 32) { blocks[i].position += delta; - blocks[i+1].position += delta; - blocks[i+2].position += delta; - blocks[i+3].position += delta; - blocks[i+4].position += delta; - blocks[i+5].position += delta; - blocks[i+6].position += delta; - blocks[i+7].position += delta; - blocks[i+8].position += delta; - blocks[i+9].position += delta; - blocks[i+10].position += delta; - blocks[i+11].position += delta; - blocks[i+12].position += delta; - blocks[i+13].position += delta; - blocks[i+14].position += delta; - blocks[i+15].position += delta; - blocks[i+16].position += delta; - blocks[i+17].position += delta; - blocks[i+18].position += delta; - blocks[i+19].position += delta; - blocks[i+20].position += delta; - blocks[i+21].position += delta; - blocks[i+22].position += delta; - blocks[i+23].position += delta; - blocks[i+24].position += delta; - blocks[i+25].position += delta; - blocks[i+26].position += delta; - blocks[i+27].position += delta; - blocks[i+28].position += delta; - blocks[i+29].position += delta; - blocks[i+30].position += delta; - blocks[i+31].position += delta; + blocks[i + 1].position += delta; + blocks[i + 2].position += delta; + blocks[i + 3].position += delta; + blocks[i + 4].position += delta; + blocks[i + 5].position += delta; + blocks[i + 6].position += delta; + blocks[i + 7].position += delta; + blocks[i + 8].position += delta; + blocks[i + 9].position += delta; + blocks[i + 10].position += delta; + blocks[i + 11].position += delta; + blocks[i + 12].position += delta; + blocks[i + 13].position += delta; + blocks[i + 14].position += delta; + blocks[i + 15].position += delta; + blocks[i + 16].position += delta; + blocks[i + 17].position += delta; + blocks[i + 18].position += delta; + blocks[i + 19].position += delta; + blocks[i + 20].position += delta; + blocks[i + 21].position += delta; + blocks[i + 22].position += delta; + blocks[i + 23].position += delta; + blocks[i + 24].position += delta; + blocks[i + 25].position += delta; + blocks[i + 26].position += delta; + blocks[i + 27].position += delta; + blocks[i + 28].position += delta; + blocks[i + 29].position += delta; + blocks[i + 30].position += delta; + blocks[i + 31].position += delta; } rem += len; @@ -235,11 +233,8 @@ } }; -} // namespace detail - -}}} +}}}} // namespace mdds::mtv::aos::detail #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/aos/iterator.hpp mdds-2.0.3/include/mdds/multi_type_vector/aos/iterator.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/aos/iterator.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/aos/iterator.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -39,35 +39,31 @@ * and dec() methods have non-const return type, and the derived classes * wrap them and return values with their respective const modifiers. */ -template +template class iterator_common_base { protected: - typedef typename _Trait::parent parent_type; - typedef typename _Trait::blocks blocks_type; - typedef typename _Trait::base_iterator base_iterator_type; + typedef typename Trait::parent parent_type; + typedef typename Trait::blocks blocks_type; + typedef typename Trait::base_iterator base_iterator_type; typedef typename parent_type::size_type size_type; - typedef mdds::detail::mtv::iterator_value_node node; + typedef mdds::detail::mtv::iterator_value_node node; - iterator_common_base() : m_cur_node(0) {} + iterator_common_base() : m_cur_node(nullptr, 0) + {} iterator_common_base( - const base_iterator_type& pos, const base_iterator_type& end, size_type block_index) : - m_cur_node(block_index), - m_pos(pos), - m_end(end) + const base_iterator_type& pos, const base_iterator_type& end, const parent_type* parent, size_type block_index) + : m_cur_node(parent, block_index), m_pos(pos), m_end(end) { if (m_pos != m_end) update_node(); } - iterator_common_base(const iterator_common_base& other) : - m_cur_node(other.m_cur_node), - m_pos(other.m_pos), - m_end(other.m_end) - { - } + iterator_common_base(const iterator_common_base& other) + : m_cur_node(other.m_cur_node), m_pos(other.m_pos), m_end(other.m_end) + {} void update_node() { @@ -109,7 +105,7 @@ base_iterator_type m_end; public: - bool operator== (const iterator_common_base& other) const + bool operator==(const iterator_common_base& other) const { if (m_pos != m_end && other.m_pos != other.m_end) { @@ -121,12 +117,12 @@ return m_pos == other.m_pos && m_end == other.m_end; } - bool operator!= (const iterator_common_base& other) const + bool operator!=(const iterator_common_base& other) const { return !operator==(other); } - iterator_common_base& operator= (const iterator_common_base& other) + iterator_common_base& operator=(const iterator_common_base& other) { m_cur_node = other.m_cur_node; m_pos = other.m_pos; @@ -141,42 +137,52 @@ std::swap(m_end, other.m_end); } - const node& get_node() const { return m_cur_node; } - const base_iterator_type& get_pos() const { return m_pos; } - const base_iterator_type& get_end() const { return m_end; } + const node& get_node() const + { + return m_cur_node; + } + const base_iterator_type& get_pos() const + { + return m_pos; + } + const base_iterator_type& get_end() const + { + return m_end; + } }; -template -class iterator_base : public iterator_common_base<_Trait> +template +class iterator_base : public iterator_common_base { - typedef _Trait trait; - typedef _NodeUpdateFunc node_update_func; - typedef iterator_common_base common_base; + using parent_type = typename Trait::parent; + typedef NodeUpdateFunc node_update_func; + typedef iterator_common_base common_base; - typedef typename trait::base_iterator base_iterator_type; + typedef typename Trait::base_iterator base_iterator_type; typedef typename common_base::size_type size_type; - using common_base::inc; using common_base::dec; + using common_base::inc; using common_base::m_cur_node; public: - - using common_base::get_pos; using common_base::get_end; + using common_base::get_pos; // iterator traits typedef typename common_base::node value_type; typedef value_type* pointer; typedef value_type& reference; - typedef ptrdiff_t difference_type; + typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; public: - iterator_base() {} + iterator_base() + {} iterator_base( - const base_iterator_type& pos, const base_iterator_type& end, size_type block_index) : - common_base(pos, end, block_index) {} + const base_iterator_type& pos, const base_iterator_type& end, const parent_type* parent, size_type block_index) + : common_base(pos, end, parent, block_index) + {} value_type& operator*() { @@ -213,48 +219,49 @@ } }; -template -class const_iterator_base : public iterator_common_base<_Trait> +template +class const_iterator_base : public iterator_common_base { - typedef _Trait trait; - typedef _NodeUpdateFunc node_update_func; - typedef iterator_common_base common_base; + using parent_type = typename Trait::parent; + typedef NodeUpdateFunc node_update_func; + typedef iterator_common_base common_base; - typedef typename trait::base_iterator base_iterator_type; + typedef typename Trait::base_iterator base_iterator_type; typedef typename common_base::size_type size_type; - using common_base::inc; using common_base::dec; + using common_base::inc; using common_base::m_cur_node; public: - - using common_base::get_pos; using common_base::get_end; + using common_base::get_pos; - typedef _NonConstItrBase iterator_base; + typedef NonConstItrBase iterator_base; // iterator traits typedef typename common_base::node value_type; typedef value_type* pointer; typedef value_type& reference; - typedef ptrdiff_t difference_type; + typedef ptrdiff_t difference_type; typedef std::bidirectional_iterator_tag iterator_category; public: - const_iterator_base() : common_base() {} + const_iterator_base() : common_base() + {} const_iterator_base( - const base_iterator_type& pos, const base_iterator_type& end, size_type block_index) : - common_base(pos, end, block_index) {} + const base_iterator_type& pos, const base_iterator_type& end, const parent_type* parent, size_type block_index) + : common_base(pos, end, parent, block_index) + {} /** * Take the non-const iterator counterpart to create a const iterator. */ - const_iterator_base(const iterator_base& other) : - common_base( - other.get_pos(), - other.get_end(), - other.get_node().__private_data.block_index) {} + const_iterator_base(const iterator_base& other) + : common_base( + other.get_pos(), other.get_end(), other.get_node().__private_data.parent, + other.get_node().__private_data.block_index) + {} const value_type& operator*() const { @@ -280,17 +287,17 @@ return *this; } - bool operator== (const const_iterator_base& other) const + bool operator==(const const_iterator_base& other) const { - return iterator_common_base<_Trait>::operator==(other); + return iterator_common_base::operator==(other); } - bool operator!= (const const_iterator_base& other) const + bool operator!=(const const_iterator_base& other) const { - return iterator_common_base<_Trait>::operator!=(other); + return iterator_common_base::operator!=(other); } }; -}}}} +}}}} // namespace mdds::mtv::aos::detail #endif diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/aos/main_def.inl mdds-2.0.3/include/mdds/multi_type_vector/aos/main_def.inl --- mdds-2.0.2/include/mdds/multi_type_vector/aos/main_def.inl 2021-11-23 23:48:31.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/aos/main_def.inl 2022-05-11 00:33:24.000000000 +0000 @@ -69,18 +69,22 @@ MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint64_t, mdds::mtv::element_type_uint64, 0, mdds::mtv::uint64_element_block) MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(float, mdds::mtv::element_type_float, 0.0, mdds::mtv::float_element_block) MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(double, mdds::mtv::element_type_double, 0.0, mdds::mtv::double_element_block) -MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(std::string, mdds::mtv::element_type_string, std::string(), mdds::mtv::string_element_block) +MDDS_MTV_DEFINE_ELEMENT_CALLBACKS( + std::string, mdds::mtv::element_type_string, std::string(), mdds::mtv::string_element_block) template -multi_type_vector::block::block() : position(0), size(0), data(nullptr) {} +multi_type_vector::block::block() : position(0), size(0), data(nullptr) +{} template -multi_type_vector::block::block(size_type _position, size_type _size) : - position(_position), size(_size), data(nullptr) {} +multi_type_vector::block::block(size_type _position, size_type _size) + : position(_position), size(_size), data(nullptr) +{} template -multi_type_vector::block::block(size_type _position, size_type _size, element_block_type* _data) : - position(_position), size(_size), data(_data) {} +multi_type_vector::block::block(size_type _position, size_type _size, element_block_type* _data) + : position(_position), size(_size), data(_data) +{} template void multi_type_vector::block::swap(block& other) @@ -102,11 +106,12 @@ } template -multi_type_vector::blocks_to_transfer::blocks_to_transfer() : insert_index(0) {} +multi_type_vector::blocks_to_transfer::blocks_to_transfer() : insert_index(0) +{} template -typename multi_type_vector::position_type -multi_type_vector::next_position(const position_type& pos) +typename multi_type_vector::position_type multi_type_vector::next_position( + const position_type& pos) { position_type ret = pos; if (pos.second + 1 < pos.first->size) @@ -124,15 +129,15 @@ } template -typename multi_type_vector::position_type -multi_type_vector::advance_position(const position_type& pos, int steps) +typename multi_type_vector::position_type multi_type_vector< + ElemBlockFunc, Trait>::advance_position(const position_type& pos, int steps) { return mdds::detail::mtv::advance_position(pos, steps); } template -typename multi_type_vector::const_position_type -multi_type_vector::next_position(const const_position_type& pos) +typename multi_type_vector::const_position_type multi_type_vector< + ElemBlockFunc, Trait>::next_position(const const_position_type& pos) { const_position_type ret = pos; if (pos.second + 1 < pos.first->size) @@ -150,135 +155,127 @@ } template -typename multi_type_vector::const_position_type -multi_type_vector::advance_position(const const_position_type& pos, int steps) +typename multi_type_vector::const_position_type multi_type_vector< + ElemBlockFunc, Trait>::advance_position(const const_position_type& pos, int steps) { return mdds::detail::mtv::advance_position(pos, steps); } template -typename multi_type_vector::size_type -multi_type_vector::logical_position(const const_position_type& pos) +typename multi_type_vector::size_type multi_type_vector::logical_position( + const const_position_type& pos) { return pos.first->position + pos.second; } template template -typename Blk::value_type -multi_type_vector::get(const const_position_type& pos) +typename Blk::value_type multi_type_vector::get(const const_position_type& pos) { return mdds::detail::mtv::get_block_element_at(*pos.first->data, pos.second); } template -typename multi_type_vector::iterator -multi_type_vector::begin() +typename multi_type_vector::iterator multi_type_vector::begin() { - return iterator(m_blocks.begin(), m_blocks.end(), 0); + return iterator(m_blocks.begin(), m_blocks.end(), this, 0); } template -typename multi_type_vector::iterator -multi_type_vector::end() +typename multi_type_vector::iterator multi_type_vector::end() { - return iterator(m_blocks.end(), m_blocks.end(), m_blocks.size()); + return iterator(m_blocks.end(), m_blocks.end(), this, m_blocks.size()); } template -typename multi_type_vector::const_iterator -multi_type_vector::begin() const +typename multi_type_vector::const_iterator multi_type_vector::begin() const { return cbegin(); } template -typename multi_type_vector::const_iterator -multi_type_vector::end() const +typename multi_type_vector::const_iterator multi_type_vector::end() const { return cend(); } template -typename multi_type_vector::const_iterator -multi_type_vector::cbegin() const +typename multi_type_vector::const_iterator multi_type_vector::cbegin() const { - return const_iterator(m_blocks.cbegin(), m_blocks.cend(), 0); + return const_iterator(m_blocks.cbegin(), m_blocks.cend(), this, 0); } template -typename multi_type_vector::const_iterator -multi_type_vector::cend() const +typename multi_type_vector::const_iterator multi_type_vector::cend() const { - return const_iterator(m_blocks.end(), m_blocks.end(), m_blocks.size()); + return const_iterator(m_blocks.end(), m_blocks.end(), this, m_blocks.size()); } template -typename multi_type_vector::reverse_iterator -multi_type_vector::rbegin() +typename multi_type_vector::reverse_iterator multi_type_vector::rbegin() { - return reverse_iterator(m_blocks.rbegin(), m_blocks.rend(), 0); + return reverse_iterator(m_blocks.rbegin(), m_blocks.rend(), this, 0); } template -typename multi_type_vector::reverse_iterator -multi_type_vector::rend() +typename multi_type_vector::reverse_iterator multi_type_vector::rend() { - return reverse_iterator(m_blocks.rend(), m_blocks.rend(), 0); + return reverse_iterator(m_blocks.rend(), m_blocks.rend(), this, 0); } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::rbegin() const +typename multi_type_vector::const_reverse_iterator multi_type_vector< + ElemBlockFunc, Trait>::rbegin() const { - return const_reverse_iterator(m_blocks.rbegin(), m_blocks.rend(), 0); + return const_reverse_iterator(m_blocks.rbegin(), m_blocks.rend(), this, 0); } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::rend() const +typename multi_type_vector::const_reverse_iterator multi_type_vector::rend() + const { - return const_reverse_iterator(m_blocks.rend(), m_blocks.rend(), 0); + return const_reverse_iterator(m_blocks.rend(), m_blocks.rend(), this, 0); } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::crbegin() const +typename multi_type_vector::const_reverse_iterator multi_type_vector< + ElemBlockFunc, Trait>::crbegin() const { - return const_reverse_iterator(m_blocks.crbegin(), m_blocks.crend(), 0); + return const_reverse_iterator(m_blocks.crbegin(), m_blocks.crend(), this, 0); } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::crend() const +typename multi_type_vector::const_reverse_iterator multi_type_vector< + ElemBlockFunc, Trait>::crend() const { - return const_reverse_iterator(m_blocks.crend(), m_blocks.crend(), 0); + return const_reverse_iterator(m_blocks.crend(), m_blocks.crend(), this, 0); } template -typename multi_type_vector::event_func& -multi_type_vector::event_handler() +typename multi_type_vector::event_func& multi_type_vector::event_handler() { return m_hdl_event; } template -const typename multi_type_vector::event_func& -multi_type_vector::event_handler() const +const typename multi_type_vector::event_func& multi_type_vector< + ElemBlockFunc, Trait>::event_handler() const { return m_hdl_event; } template -multi_type_vector::multi_type_vector() : m_cur_size(0) {} +multi_type_vector::multi_type_vector() : m_cur_size(0) +{} template -multi_type_vector::multi_type_vector(const event_func& hdl) : - m_hdl_event(hdl), m_cur_size(0) {} +multi_type_vector::multi_type_vector(const event_func& hdl) : m_hdl_event(hdl), m_cur_size(0) +{} template -multi_type_vector::multi_type_vector(event_func&& hdl) : - m_hdl_event(std::move(hdl)), m_cur_size(0) {} +multi_type_vector::multi_type_vector(event_func&& hdl) + : m_hdl_event(std::move(hdl)), m_cur_size(0) +{} template multi_type_vector::multi_type_vector(size_type init_size) : m_cur_size(init_size) @@ -292,8 +289,7 @@ template template -multi_type_vector::multi_type_vector(size_type init_size, const T& value) : - m_cur_size(init_size) +multi_type_vector::multi_type_vector(size_type init_size, const T& value) : m_cur_size(init_size) { if (!init_size) return; @@ -305,8 +301,8 @@ template template -multi_type_vector::multi_type_vector(size_type init_size, const T& it_begin, const T& it_end) : - m_cur_size(init_size) +multi_type_vector::multi_type_vector(size_type init_size, const T& it_begin, const T& it_end) + : m_cur_size(init_size) { if (!m_cur_size) return; @@ -321,8 +317,8 @@ } template -multi_type_vector::multi_type_vector(const multi_type_vector& other) : - m_hdl_event(other.m_hdl_event), m_cur_size(other.m_cur_size) +multi_type_vector::multi_type_vector(const multi_type_vector& other) + : m_hdl_event(other.m_hdl_event), m_cur_size(other.m_cur_size) { // Clone all the blocks. m_blocks.reserve(other.m_blocks.size()); @@ -353,10 +349,8 @@ } template -multi_type_vector::multi_type_vector(multi_type_vector&& other) : - m_hdl_event(std::move(other.m_hdl_event)), - m_blocks(std::move(other.m_blocks)), - m_cur_size(other.m_cur_size) +multi_type_vector::multi_type_vector(multi_type_vector&& other) + : m_hdl_event(std::move(other.m_hdl_event)), m_blocks(std::move(other.m_blocks)), m_cur_size(other.m_cur_size) { #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG try @@ -382,12 +376,13 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(size_type pos, const T& value) +typename multi_type_vector::iterator multi_type_vector::set( + size_type pos, const T& value) { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::set", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::set", __LINE__, pos, block_size(), size()); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -418,12 +413,13 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(const iterator& pos_hint, size_type pos, const T& value) +typename multi_type_vector::iterator multi_type_vector::set( + const iterator& pos_hint, size_type pos, const T& value) { - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::set", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::set", __LINE__, pos, block_size(), size()); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -468,18 +464,13 @@ void multi_type_vector::delete_element_blocks( typename blocks_type::iterator it, typename blocks_type::iterator it_end) { - std::for_each(it, it_end, - [&](block& r) - { - delete_element_block(r); - } - ); + std::for_each(it, it_end, [&](block& r) { delete_element_block(r); }); } template template -typename multi_type_vector::iterator -multi_type_vector::set_impl(size_type pos, size_type block_index, const T& value) +typename multi_type_vector::iterator multi_type_vector::set_impl( + size_type pos, size_type block_index, const T& value) { size_type start_row = m_blocks[block_index].position; element_category_type cat = mdds_mtv_get_element_type(value); @@ -508,7 +499,7 @@ size_type i = pos - start_row; element_block_func::overwrite_values(*blk->data, i, 1); mdds_mtv_set_value(*blk->data, i, value); - return iterator(block_pos, m_blocks.end(), block_index); + return iterator(block_pos, m_blocks.end(), this, block_index); } assert(blk_cat != cat); @@ -532,7 +523,7 @@ element_block_func::erase(*blk->data, 0); blk_prev->size += 1; mdds_mtv_append_value(*blk_prev->data, value); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } set_cell_to_top_of_data_block(block_index, value); @@ -576,19 +567,19 @@ // Pop the last cell off the current block, and prepend the // new value to the next block. - element_block_func::overwrite_values(*blk->data, blk->size-1, 1); - element_block_func::erase(*blk->data, blk->size-1); + element_block_func::overwrite_values(*blk->data, blk->size - 1, 1); + element_block_func::erase(*blk->data, blk->size - 1); blk->size -= 1; mdds_mtv_prepend_value(*blk_next->data, value); blk_next->size += 1; blk_next->position -= 1; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } assert(block_index > 0); - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) { // This is the last block. set_cell_to_bottom_of_data_block(block_index, value); @@ -602,25 +593,25 @@ { // Next block is either empty or of different type than that of the cell being inserted. set_cell_to_bottom_of_data_block(block_index, value); // This invalidates m_blocks. - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Pop the last element from the current block, and prepend the cell // into the next block. - element_block_func::overwrite_values(*blk->data, blk->size-1, 1); - element_block_func::erase(*blk->data, blk->size-1); + element_block_func::overwrite_values(*blk->data, blk->size - 1, 1); + element_block_func::erase(*blk->data, blk->size - 1); blk->size -= 1; mdds_mtv_prepend_value(*blk_next->data, value); blk_next->size += 1; blk_next->position -= 1; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template template -typename multi_type_vector::iterator -multi_type_vector::release_impl(size_type pos, size_type block_index, T& value) +typename multi_type_vector::iterator multi_type_vector::release_impl( + size_type pos, size_type block_index, T& value) { const block& blk = m_blocks[block_index]; size_type start_pos = blk.position; @@ -643,8 +634,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::set( + size_type pos, const T& it_begin, const T& it_end) { auto res = mdds::detail::mtv::calc_input_end_position(it_begin, it_end, pos, m_cur_size); @@ -655,7 +646,8 @@ size_type block_index1 = get_block_position(pos); if (block_index1 == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::set", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::set", __LINE__, pos, block_size(), size()); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -686,8 +678,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::set( + const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) { auto res = mdds::detail::mtv::calc_input_end_position(it_begin, it_end, pos, m_cur_size); if (!res.second) @@ -695,14 +687,14 @@ size_type end_pos = res.first; - size_type block_index1 = get_block_position(pos_hint, pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, pos); return set_cells_impl(pos, end_pos, block_index1, it_begin, it_end); } template template -typename multi_type_vector::iterator -multi_type_vector::push_back(const T& value) +typename multi_type_vector::iterator multi_type_vector::push_back( + const T& value) { #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -733,8 +725,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::push_back_impl(const T& value) +typename multi_type_vector::iterator multi_type_vector::push_back_impl( + const T& value) { element_category_type cat = mdds_mtv_get_element_type(value); @@ -768,8 +760,7 @@ } template -typename multi_type_vector::iterator -multi_type_vector::push_back_empty() +typename multi_type_vector::iterator multi_type_vector::push_back_empty() { size_type block_index = m_blocks.size(); @@ -783,17 +774,18 @@ typename blocks_type::iterator block_pos = m_blocks.end(); --block_pos; - return iterator(block_pos, m_blocks.end(), block_index); + return iterator(block_pos, m_blocks.end(), this, block_index); } template template -typename multi_type_vector::iterator -multi_type_vector::insert(size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::insert( + size_type pos, const T& it_begin, const T& it_end) { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::insert", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::insert", __LINE__, pos, block_size(), size()); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -812,7 +804,8 @@ std::ostringstream os; os << e.what() << std::endl; element_category_type cat = mdds_mtv_get_element_type(*it_begin); - os << "block integrity check failed in insert (pos=" << pos << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; + os << "block integrity check failed in insert (pos=" << pos + << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; os << "previous block state:" << std::endl; os << os_prev_block.str(); std::cerr << os.str() << std::endl; @@ -825,12 +818,13 @@ template template -typename multi_type_vector::iterator -multi_type_vector::insert(const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::insert( + const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) { - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::insert", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::insert", __LINE__, pos, block_size(), size()); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -849,7 +843,8 @@ std::ostringstream os; os << e.what() << std::endl; element_category_type cat = mdds_mtv_get_element_type(*it_begin); - os << "block integrity check failed in insert (pos=" << pos << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; + os << "block integrity check failed in insert (pos=" << pos + << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; os << "previous block state:" << std::endl; os << os_prev_block.str(); std::cerr << os.str() << std::endl; @@ -861,8 +856,8 @@ } template -typename multi_type_vector::size_type -multi_type_vector::get_block_position(size_type row, size_type start_block_index) const +typename multi_type_vector::size_type multi_type_vector::get_block_position( + size_type row, size_type start_block_index) const { if (row >= m_cur_size || start_block_index >= m_blocks.size()) return m_blocks.size(); @@ -886,17 +881,12 @@ } template -typename multi_type_vector::size_type -multi_type_vector::get_block_position(const const_iterator& pos_hint, size_type row) const +typename multi_type_vector::size_type multi_type_vector::get_block_position( + const typename value_type::private_data& pos_data, size_type row) const { size_type block_index = 0; - if (pos_hint.get_end() == m_blocks.end()) - { - // Iterator is valid. Get the block position from it unless it's the - // end position. - if (pos_hint.get_pos() != pos_hint.get_end()) - block_index = pos_hint->__private_data.block_index; - } + if (pos_data.parent == this && pos_data.block_index < m_blocks.size()) + block_index = pos_data.block_index; size_type start_row = m_blocks[block_index].position; if (row < start_row) @@ -945,15 +935,14 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cell_to_middle_of_block( - size_type block_index, size_type pos_in_block, const T& cell) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_cell_to_middle_of_block(size_type block_index, size_type pos_in_block, const T& cell) { block& blk_new = set_new_block_to_middle(block_index, pos_in_block, 1, true); create_new_block_with_new_cell(blk_new.data, cell); // Return the iterator referencing the inserted block. - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template @@ -966,9 +955,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cell_to_empty_block( - size_type block_index, size_type pos_in_block, const T& cell) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_cell_to_empty_block(size_type block_index, size_type pos_in_block, const T& cell) { block* blk = &m_blocks[block_index]; assert(!blk->data); // In this call, the current block is an empty block. @@ -1026,7 +1014,7 @@ if (pos_in_block == 0) { - assert(block_index < m_blocks.size()-1); + assert(block_index < m_blocks.size() - 1); if (blk->size == 1) { // Top empty block with only one cell size. @@ -1080,15 +1068,15 @@ // Shrink the current empty block by one, and create a new block of size 1 to store the new value. blk->size -= 1; typename blocks_type::iterator it = m_blocks.begin(); - std::advance(it, block_index+1); + std::advance(it, block_index + 1); size_type new_position = detail::calc_next_block_position(*blk); m_blocks.emplace(it, new_position, 1); blk = &m_blocks[block_index]; // old pointer is invalid. - block* blk2 = &m_blocks[block_index+1]; + block* blk2 = &m_blocks[block_index + 1]; create_new_block_with_new_cell(blk2->data, cell); } - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Inserting into the middle of an empty block. @@ -1096,12 +1084,12 @@ } // This empty block is right below a non-empty block. - assert(block_index > 0 && m_blocks[block_index-1].data != nullptr); + assert(block_index > 0 && m_blocks[block_index - 1].data != nullptr); if (pos_in_block == 0) { // New cell is right below the non-empty block. - element_category_type blk_cat_prev = mdds::mtv::get_block_type(*m_blocks[block_index-1].data); + element_category_type blk_cat_prev = mdds::mtv::get_block_type(*m_blocks[block_index - 1].data); element_category_type cat = mdds_mtv_get_element_type(cell); if (blk_cat_prev == cat) { @@ -1110,13 +1098,13 @@ if (blk->size == 1) { // Check if we need to merge with the following block. - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) { // Last block. Delete this block and extend the previous // block by one. delete_element_block(m_blocks[block_index]); m_blocks.pop_back(); - append_cell_to_block(block_index-1, cell); + append_cell_to_block(block_index - 1, cell); } else { @@ -1130,7 +1118,7 @@ // delete the current and next blocks. Be sure to // resize the next block to zero to prevent the // transferred cells to be deleted. - block& blk_prev = m_blocks[block_index-1]; + block& blk_prev = m_blocks[block_index - 1]; // Check if the next block is bigger. if (blk_prev.size < blk_next->size) @@ -1146,7 +1134,8 @@ mdds_mtv_prepend_value(*blk_next->data, cell); // Preprend the content of previous block to the next block. - element_block_func::prepend_values_from_block(*blk_next->data, *blk_prev.data, 0, blk_prev.size); + element_block_func::prepend_values_from_block( + *blk_next->data, *blk_prev.data, 0, blk_prev.size); blk_next->size += blk_prev.size; blk_next->position = position; @@ -1162,7 +1151,7 @@ typename blocks_type::iterator it = m_blocks.begin() + block_index - 1; // So we can use it to remove the two blocks - m_blocks.erase(it, it+2); + m_blocks.erase(it, it + 2); } else { @@ -1176,7 +1165,7 @@ element_block_func::delete_block(blk->data); element_block_func::delete_block(blk_next->data); typename blocks_type::iterator it = m_blocks.begin() + block_index; - m_blocks.erase(it, it+2); + m_blocks.erase(it, it + 2); } } else @@ -1184,7 +1173,7 @@ // Ignore the next block. Just extend the previous block. delete_element_block(m_blocks[block_index]); m_blocks.erase(m_blocks.begin() + block_index); - append_cell_to_block(block_index-1, cell); + append_cell_to_block(block_index - 1, cell); } } } @@ -1194,17 +1183,17 @@ assert(blk->size > 1); blk->size -= 1; blk->position += 1; - append_cell_to_block(block_index-1, cell); + append_cell_to_block(block_index - 1, cell); } - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } else { // Cell type is different from the type of the previous block. if (blk->size == 1) { - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) { // There is no more block below. Simply turn this empty block into a non-empty one. create_new_block_with_new_cell(blk->data, cell); @@ -1212,7 +1201,7 @@ else { // Check the type of the following non-empty block. - assert(block_index < m_blocks.size()-1); + assert(block_index < m_blocks.size() - 1); block* blk_next = get_next_block_of_type(block_index, cat); if (blk_next) { @@ -1221,7 +1210,7 @@ blk_next->position -= 1; mdds_mtv_prepend_value(*blk_next->data, cell); delete_element_block(m_blocks[block_index]); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); } else { @@ -1240,7 +1229,7 @@ size_type new_block_position = blk->position + 1; blk->size = 1; create_new_block_with_new_cell(blk->data, cell); - m_blocks.emplace(m_blocks.begin()+block_index+1, new_block_position, new_block_size); + m_blocks.emplace(m_blocks.begin() + block_index + 1, new_block_position, new_block_size); } return get_iterator(block_index); @@ -1250,7 +1239,7 @@ { // New cell is at the end of the current block. assert(blk->size > 1); - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) { // The current block is the last block. blk->size -= 1; @@ -1281,13 +1270,13 @@ // block of size 1 below it to store the new value. blk->size -= 1; size_type new_position = detail::calc_next_block_position(*blk); - m_blocks.emplace(m_blocks.begin()+block_index+1, new_position, 1); + m_blocks.emplace(m_blocks.begin() + block_index + 1, new_position, 1); blk = &m_blocks[block_index]; // old pointer is invalid. - block& blk2 = m_blocks[block_index+1]; + block& blk2 = m_blocks[block_index + 1]; create_new_block_with_new_cell(blk2.data, cell); } - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } } @@ -1297,8 +1286,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cell_to_block_of_size_one(size_type block_index, const T& cell) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_cell_to_block_of_size_one(size_type block_index, const T& cell) { block* blk = &m_blocks[block_index]; assert(blk->size == 1); @@ -1309,7 +1298,7 @@ if (block_index == 0) { // This is the topmost block of size 1. - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) { // This is the only block. create_new_block_with_new_cell(blk->data, cell); @@ -1330,16 +1319,16 @@ blk_next->position -= 1; mdds_mtv_prepend_value(*blk_next->data, cell); delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); return begin(); } assert(block_index > 0); - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) { // This is the last block, and a block exists above. - block* blk_prev = &m_blocks[block_index-1]; + block* blk_prev = &m_blocks[block_index - 1]; if (!blk_prev->data || mdds::mtv::get_block_type(*blk_prev->data) != cat) { // Previous block is empty. Replace the current block with a new one. @@ -1352,7 +1341,7 @@ mdds_mtv_append_value(*blk_prev->data, cell); blk_prev->size += 1; delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); } iterator itr = end(); @@ -1364,8 +1353,8 @@ // to the previous block, or prepended to the following block. // Also check if the blocks above and below need to be combined. - block* blk_prev = &m_blocks[block_index-1]; - block* blk_next = &m_blocks[block_index+1]; + block* blk_prev = &m_blocks[block_index - 1]; + block* blk_next = &m_blocks[block_index + 1]; if (!blk_prev->data) { // Previous block is empty. @@ -1382,7 +1371,7 @@ { // Delete the current block, and prepend the new cell to the next block. delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); blk = &m_blocks[block_index]; blk->size += 1; blk->position -= 1; @@ -1406,8 +1395,8 @@ blk_prev->size += 1; mdds_mtv_append_value(*blk_prev->data, cell); delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); - return get_iterator(block_index-1); + m_blocks.erase(m_blocks.begin() + block_index); + return get_iterator(block_index - 1); } // Just overwrite the current block. @@ -1438,7 +1427,7 @@ typename blocks_type::iterator it = m_blocks.begin() + block_index; typename blocks_type::iterator it_last = it + 2; m_blocks.erase(it, it_last); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Just overwrite the current block. @@ -1454,8 +1443,8 @@ blk_prev->size += 1; mdds_mtv_append_value(*blk_prev->data, cell); delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); - return get_iterator(block_index-1); + m_blocks.erase(m_blocks.begin() + block_index); + return get_iterator(block_index - 1); } if (blk_cat_next == cat) @@ -1465,7 +1454,7 @@ blk_next->position -= 1; mdds_mtv_prepend_value(*blk_next->data, cell); delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); return get_iterator(block_index); } @@ -1489,7 +1478,7 @@ element_block_func::erase(*blk.data, 0); } - m_blocks.emplace(m_blocks.begin()+block_index, position, 1); + m_blocks.emplace(m_blocks.begin() + block_index, position, 1); create_new_block_with_new_cell(m_blocks[block_index].data, cell); } @@ -1501,13 +1490,13 @@ block& blk = m_blocks[block_index]; if (blk.data) { - element_block_func::overwrite_values(*blk.data, blk.size-1, 1); - element_block_func::erase(*blk.data, blk.size-1); + element_block_func::overwrite_values(*blk.data, blk.size - 1, 1); + element_block_func::erase(*blk.data, blk.size - 1); } blk.size -= 1; size_type next_position = detail::calc_next_block_position(blk); - m_blocks.emplace(m_blocks.begin()+block_index+1, next_position, 1); - create_new_block_with_new_cell(m_blocks[block_index+1].data, cell); + m_blocks.emplace(m_blocks.begin() + block_index + 1, next_position, 1); + create_new_block_with_new_cell(m_blocks[block_index + 1].data, cell); } template @@ -1516,7 +1505,8 @@ { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::get", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::get", __LINE__, pos, block_size(), size()); const block* blk = &m_blocks[block_index]; assert(blk); @@ -1550,7 +1540,8 @@ { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::release", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::release", __LINE__, pos, block_size(), size()); T value; release_impl(pos, block_index, value); @@ -1559,8 +1550,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::release(size_type pos, T& value) +typename multi_type_vector::iterator multi_type_vector::release( + size_type pos, T& value) { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) @@ -1572,10 +1563,10 @@ template template -typename multi_type_vector::iterator -multi_type_vector::release(const iterator& pos_hint, size_type pos, T& value) +typename multi_type_vector::iterator multi_type_vector::release( + const iterator& pos_hint, size_type pos, T& value) { - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::release", __LINE__, pos, block_size(), size()); @@ -1603,8 +1594,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::release_range(size_type start_pos, size_type end_pos) +typename multi_type_vector::iterator multi_type_vector::release_range( + size_type start_pos, size_type end_pos) { size_type block_index1 = get_block_position(start_pos); if (block_index1 == m_blocks.size()) @@ -1615,11 +1606,10 @@ } template -typename multi_type_vector::iterator -multi_type_vector::release_range( +typename multi_type_vector::iterator multi_type_vector::release_range( const iterator& pos_hint, size_type start_pos, size_type end_pos) { - size_type block_index1 = get_block_position(pos_hint, start_pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, start_pos); if (block_index1 == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::release_range", __LINE__, start_pos, block_size(), size()); @@ -1628,8 +1618,8 @@ } template -typename multi_type_vector::position_type -multi_type_vector::position(size_type pos) +typename multi_type_vector::position_type multi_type_vector::position( + size_type pos) { if (pos == m_cur_size) { @@ -1650,8 +1640,8 @@ } template -typename multi_type_vector::position_type -multi_type_vector::position(const iterator& pos_hint, size_type pos) +typename multi_type_vector::position_type multi_type_vector::position( + const iterator& pos_hint, size_type pos) { if (pos == m_cur_size) { @@ -1660,7 +1650,7 @@ return position_type(end(), 0); } - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::position", __LINE__, pos, block_size(), size()); @@ -1671,8 +1661,8 @@ } template -typename multi_type_vector::const_position_type -multi_type_vector::position(size_type pos) const +typename multi_type_vector::const_position_type multi_type_vector::position( + size_type pos) const { if (pos == m_cur_size) { @@ -1690,13 +1680,13 @@ typename blocks_type::const_iterator block_pos = m_blocks.begin(); std::advance(block_pos, block_index); - const_iterator it = const_iterator(block_pos, m_blocks.end(), block_index); + const_iterator it = const_iterator(block_pos, m_blocks.end(), this, block_index); return const_position_type(it, pos - start_row); } template -typename multi_type_vector::const_position_type -multi_type_vector::position(const const_iterator& pos_hint, size_type pos) const +typename multi_type_vector::const_position_type multi_type_vector::position( + const const_iterator& pos_hint, size_type pos) const { if (pos == m_cur_size) { @@ -1705,7 +1695,7 @@ return const_position_type(cend(), 0); } - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::position", __LINE__, pos, block_size(), size()); @@ -1716,8 +1706,7 @@ } template -typename multi_type_vector::iterator -multi_type_vector::transfer( +typename multi_type_vector::iterator multi_type_vector::transfer( size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos) { if (&dest == this) @@ -1750,7 +1739,9 @@ { std::ostringstream os; os << e.what() << std::endl; - os << std::endl << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest_pos=" << dest_pos << ")" << std::endl; + os << std::endl + << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos + << "; dest_pos=" << dest_pos << ")" << std::endl; os << std::endl << "previous block state (source):" << std::endl; os << os_prev_block.str(); os << std::endl << "previous block state (destination):" << std::endl; @@ -1768,12 +1759,10 @@ } template -typename multi_type_vector::iterator -multi_type_vector::transfer( - const iterator& pos_hint, size_type start_pos, size_type end_pos, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector::transfer( + const iterator& pos_hint, size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos) { - size_type block_index1 = get_block_position(pos_hint, start_pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, start_pos); if (block_index1 == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::transfer", __LINE__, start_pos, block_size(), size()); @@ -1800,7 +1789,9 @@ { std::ostringstream os; os << e.what() << std::endl; - os << std::endl << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest_pos=" << dest_pos << ")" << std::endl; + os << std::endl + << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos + << "; dest_pos=" << dest_pos << ")" << std::endl; os << std::endl << "previous block state (source):" << std::endl; os << os_prev_block.str(); os << std::endl << "previous block state (destination):" << std::endl; @@ -1822,7 +1813,8 @@ { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::get_type", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::get_type", __LINE__, pos, block_size(), size()); const block* blk = &m_blocks[block_index]; if (!blk->data) @@ -1836,14 +1828,15 @@ { size_type block_index = get_block_position(pos); if (block_index == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::is_empty", __LINE__, pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::is_empty", __LINE__, pos, block_size(), size()); return m_blocks[block_index].data == nullptr; } template -typename multi_type_vector::iterator -multi_type_vector::set_empty(size_type start_pos, size_type end_pos) +typename multi_type_vector::iterator multi_type_vector::set_empty( + size_type start_pos, size_type end_pos) { size_type block_index1 = get_block_position(start_pos); if (block_index1 == m_blocks.size()) @@ -1854,10 +1847,10 @@ } template -typename multi_type_vector::iterator -multi_type_vector::set_empty(const iterator& pos_hint, size_type start_pos, size_type end_pos) +typename multi_type_vector::iterator multi_type_vector::set_empty( + const iterator& pos_hint, size_type start_pos, size_type end_pos) { - size_type block_index1 = get_block_position(pos_hint, start_pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, start_pos); if (block_index1 == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::set_empty", __LINE__, start_pos, block_size(), size()); @@ -1866,10 +1859,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::transfer_impl( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector::transfer_impl( + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos) { if (start_pos > end_pos) { @@ -1881,7 +1872,8 @@ size_type block_index2 = get_block_position(end_pos, block_index1); if (block_index2 == m_blocks.size()) - mdds::detail::mtv::throw_block_position_not_found("multi_type_vector::transfer_impl", __LINE__, end_pos, block_size(), size()); + mdds::detail::mtv::throw_block_position_not_found( + "multi_type_vector::transfer_impl", __LINE__, end_pos, block_size(), size()); size_type len = end_pos - start_pos + 1; size_type last_dest_pos = dest_pos + len - 1; @@ -1896,15 +1888,13 @@ return transfer_single_block(start_pos, end_pos, block_index1, dest, dest_pos); } - return transfer_multi_blocks( - start_pos, end_pos, block_index1, block_index2, dest, dest_pos); + return transfer_multi_blocks(start_pos, end_pos, block_index1, block_index2, dest, dest_pos); } template -typename multi_type_vector::iterator -multi_type_vector::transfer_single_block( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector:: + transfer_single_block( + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos) { size_type len = end_pos - start_pos + 1; size_type last_dest_pos = dest_pos + len - 1; @@ -1940,7 +1930,7 @@ size_type position = blk_dest->position; blk_dest->position += len; blk_dest->size -= len; - dest.m_blocks.emplace(dest.m_blocks.begin()+dest_block_index, position, len); + dest.m_blocks.emplace(dest.m_blocks.begin() + dest_block_index, position, len); blk_dest = &dest.m_blocks[dest_block_index]; // The old pointer is invalid. } } @@ -1951,8 +1941,8 @@ // Insert a new block below current, and shrink the current block. dest.m_blocks[dest_block_index].size -= len; size_type position = detail::calc_next_block_position(dest.m_blocks, dest_block_index); - dest.m_blocks.emplace(dest.m_blocks.begin()+dest_block_index+1, position, len); - blk_dest = &dest.m_blocks[dest_block_index+1]; + dest.m_blocks.emplace(dest.m_blocks.begin() + dest_block_index + 1, position, len); + blk_dest = &dest.m_blocks[dest_block_index + 1]; ++dest_block_index; // Must point to the new copied block. } else @@ -1961,15 +1951,17 @@ // Insert two new blocks below current. size_type blk2_size = blk_dest->size - dest_pos_in_block - len; - dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index+1, 2u, block()); + dest.m_blocks.insert(dest.m_blocks.begin() + dest_block_index + 1, 2u, block()); dest.m_blocks[dest_block_index].size = dest_pos_in_block; - dest.m_blocks[dest_block_index+1].size = len; - dest.m_blocks[dest_block_index+2].size = blk2_size; + dest.m_blocks[dest_block_index + 1].size = len; + dest.m_blocks[dest_block_index + 2].size = blk2_size; - dest.m_blocks[dest_block_index+1].position = detail::calc_next_block_position(dest.m_blocks, dest_block_index); - dest.m_blocks[dest_block_index+2].position = detail::calc_next_block_position(dest.m_blocks, dest_block_index+1); + dest.m_blocks[dest_block_index + 1].position = + detail::calc_next_block_position(dest.m_blocks, dest_block_index); + dest.m_blocks[dest_block_index + 2].position = + detail::calc_next_block_position(dest.m_blocks, dest_block_index + 1); - blk_dest = &dest.m_blocks[dest_block_index+1]; + blk_dest = &dest.m_blocks[dest_block_index + 1]; ++dest_block_index; // Must point to the new copied block. } @@ -2010,10 +2002,10 @@ } template -typename multi_type_vector::iterator -multi_type_vector::transfer_multi_blocks( - size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector:: + transfer_multi_blocks( + size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, multi_type_vector& dest, + size_type dest_pos) { assert(block_index1 < block_index2); size_type start_pos_in_block1 = m_blocks[block_index1].position; @@ -2046,7 +2038,7 @@ // Shrink the existing block and insert slots for the new blocks before it. blk_dest->size -= len; blk_dest->position += len; - dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index, block_len, block()); + dest.m_blocks.insert(dest.m_blocks.begin() + dest_block_index, block_len, block()); } else { @@ -2054,14 +2046,14 @@ dest.delete_element_block(*blk_dest); blk_dest->size = 0; if (block_len > 1) - dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index, block_len-1, block()); + dest.m_blocks.insert(dest.m_blocks.begin() + dest_block_index, block_len - 1, block()); } } else if (dest_pos_in_block + len - 1 == it_dest_blk->size - 1) { // Copy to the bottom part of destination block. Insert slots for new // blocks below current, and shrink the current block. - dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index+1, block_len, block()); + dest.m_blocks.insert(dest.m_blocks.begin() + dest_block_index + 1, block_len, block()); blk_dest = &dest.m_blocks[dest_block_index]; blk_dest->size -= len; @@ -2073,13 +2065,13 @@ // new blocks (plus one extra for the bottom empty block) below the // current block. size_type blk2_size = blk_dest->size - dest_pos_in_block - len; - dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index+1, block_len+1, block()); + dest.m_blocks.insert(dest.m_blocks.begin() + dest_block_index + 1, block_len + 1, block()); blk_dest = &dest.m_blocks[dest_block_index]; - assert(dest.m_blocks.size() > dest_block_index+block_len+1); + assert(dest.m_blocks.size() > dest_block_index + block_len + 1); blk_dest->size = dest_pos_in_block; // Re-calculate the size and position of the lower part of the destination block. - block& blk_dest_lower = dest.m_blocks[dest_block_index+block_len+1]; + block& blk_dest_lower = dest.m_blocks[dest_block_index + block_len + 1]; blk_dest_lower.position = detail::calc_next_block_position(*blk_dest) + len; blk_dest_lower.size = blk2_size; @@ -2100,7 +2092,8 @@ assert(dest.m_blocks[dest_block_index1].size == 0); dest.m_blocks[dest_block_index1].size = blk->size - offset; if (dest_block_index1 > 0) - dest.m_blocks[dest_block_index1].position = detail::calc_next_block_position(dest.m_blocks, dest_block_index1-1); + dest.m_blocks[dest_block_index1].position = + detail::calc_next_block_position(dest.m_blocks, dest_block_index1 - 1); if (blk->data) { @@ -2112,7 +2105,7 @@ // Shallow-copy the elements to the destination block, and shrink // the source block to remove the transferred elements. - element_block_func::assign_values_from_block(*blk_dest->data, *blk->data, offset, blk->size-offset); + element_block_func::assign_values_from_block(*blk_dest->data, *blk->data, offset, blk->size - offset); element_block_func::resize_block(*blk->data, offset); } @@ -2125,7 +2118,7 @@ block& blk = m_blocks[block_index1]; dest.m_blocks[dest_block_index1] = blk; // copied. dest.m_blocks[dest_block_index1].position = - dest_block_index1 > 0 ? detail::calc_next_block_position(dest.m_blocks, dest_block_index1-1) : 0; + dest_block_index1 > 0 ? detail::calc_next_block_position(dest.m_blocks, dest_block_index1 - 1) : 0; if (blk.data) { @@ -2173,7 +2166,8 @@ { // Transfer the upper part of this block. assert(dest_block_pos > 0); - dest.m_blocks[dest_block_pos].position = detail::calc_next_block_position(dest.m_blocks, dest_block_pos-1); + dest.m_blocks[dest_block_pos].position = + detail::calc_next_block_position(dest.m_blocks, dest_block_pos - 1); dest.m_blocks[dest_block_pos].size = size_to_trans; blk_dest = &dest.m_blocks[dest_block_pos]; if (blk.data) @@ -2195,7 +2189,7 @@ // Just move the whole block over. dest.m_blocks[dest_block_pos] = blk; dest.m_blocks[dest_block_pos].position = - dest_block_pos > 0 ? detail::calc_next_block_position(dest.m_blocks, dest_block_pos-1) : 0; + dest_block_pos > 0 ? detail::calc_next_block_position(dest.m_blocks, dest_block_pos - 1) : 0; if (blk.data) { @@ -2210,7 +2204,7 @@ // Now that all the elements have been transferred, check the bordering // blocks in the destination and merge them as needed. if (block_len > 1) - dest.merge_with_adjacent_blocks(dest_block_index1+block_len-1); + dest.merge_with_adjacent_blocks(dest_block_index1 + block_len - 1); dest.merge_with_adjacent_blocks(dest_block_index1); // Delete all transferred blocks, and replace it with one empty block. @@ -2245,16 +2239,16 @@ // between them. After the insertion, the old block2 position becomes // the position of the inserted block. size_type position = detail::calc_next_block_position(blk1); - m_blocks.emplace(m_blocks.begin()+block_index2, position, len); + m_blocks.emplace(m_blocks.begin() + block_index2, position, len); // No need to adjust local index vars return get_iterator(block_index2); } - if (del_index1 > 0 && !m_blocks[del_index1-1].data) + if (del_index1 > 0 && !m_blocks[del_index1 - 1].data) { // The block before the first block to be deleted is empty. Simply // extend that block to cover the deleted block segment. - block& blk_prev = m_blocks[del_index1-1]; + block& blk_prev = m_blocks[del_index1 - 1]; // Extend the previous block. blk_prev.size += len; @@ -2274,7 +2268,7 @@ typename blocks_type::iterator it_blk = m_blocks.begin(); typename blocks_type::iterator it_blk_end = m_blocks.begin(); std::advance(it_blk, del_index1); - std::advance(it_blk_end, del_index2+1); + std::advance(it_blk_end, del_index2 + 1); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG typename blocks_type::iterator it_test = it_blk; @@ -2296,14 +2290,13 @@ assert(!start_pos_offset); m_blocks[ret_block_index].position = - ret_block_index > 0 ? detail::calc_next_block_position(m_blocks, ret_block_index-1) : 0; + ret_block_index > 0 ? detail::calc_next_block_position(m_blocks, ret_block_index - 1) : 0; return get_iterator(ret_block_index); } template -typename multi_type_vector::iterator -multi_type_vector::set_empty_impl( +typename multi_type_vector::iterator multi_type_vector::set_empty_impl( size_type start_pos, size_type end_pos, size_type block_index1, bool overwrite) { if (start_pos > end_pos) @@ -2323,8 +2316,7 @@ if (block_index1 == block_index2) ret_it = set_empty_in_single_block(start_pos, end_pos, block_index1, overwrite); else - ret_it = set_empty_in_multi_blocks( - start_pos, end_pos, block_index1, block_index2, overwrite); + ret_it = set_empty_in_multi_blocks(start_pos, end_pos, block_index1, block_index2, overwrite); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG try @@ -2335,7 +2327,8 @@ { std::ostringstream os; os << e.what() << std::endl; - os << "block integrity check failed in set_empty(start_pos=" << start_pos << "; end_pos=" << end_pos << ")" << std::endl; + os << "block integrity check failed in set_empty(start_pos=" << start_pos << "; end_pos=" << end_pos << ")" + << std::endl; os << "previous block state:" << std::endl; os << os_prev_block.str(); std::cerr << os.str() << std::endl; @@ -2347,8 +2340,8 @@ template void multi_type_vector::swap_impl( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2) { if (block_index1 == block_index2) { @@ -2356,15 +2349,13 @@ if (dblock_index1 == dblock_index2) { // Destination range is also in a single block. - swap_single_block( - other, start_pos, end_pos, other_pos, block_index1, dblock_index1); + swap_single_block(other, start_pos, end_pos, other_pos, block_index1, dblock_index1); } else { // Source is single-, and destination is multi-blocks. swap_single_to_multi_blocks( - other, start_pos, end_pos, other_pos, block_index1, - dblock_index1, dblock_index2); + other, start_pos, end_pos, other_pos, block_index1, dblock_index1, dblock_index2); } } else if (dblock_index1 == dblock_index2) @@ -2372,22 +2363,20 @@ // Destination range is over a single block. Switch source and destination. size_type len = end_pos - start_pos + 1; other.swap_single_to_multi_blocks( - *this, other_pos, other_pos+len-1, start_pos, dblock_index1, - block_index1, block_index2); + *this, other_pos, other_pos + len - 1, start_pos, dblock_index1, block_index1, block_index2); } else { // Both source and destinations are multi-block. swap_multi_to_multi_blocks( - other, start_pos, end_pos, other_pos, - block_index1, block_index2, dblock_index1, dblock_index2); + other, start_pos, end_pos, other_pos, block_index1, block_index2, dblock_index1, dblock_index2); } } template void multi_type_vector::swap_single_block( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type other_block_index) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type other_block_index) { block* blk_src = &m_blocks[block_index]; block* blk_dst = &other.m_blocks[other_block_index]; @@ -2447,8 +2436,7 @@ // the whole block needs to be replaced. std::unique_ptr src_data(blk_src->data); m_hdl_event.element_block_released(blk_src->data); - blk_src->data = other.exchange_elements( - *src_data, src_offset, other_block_index, dst_offset, len); + blk_src->data = other.exchange_elements(*src_data, src_offset, other_block_index, dst_offset, len); m_hdl_event.element_block_acquired(blk_src->data); // Release elements in the source block to prevent double-deletion. @@ -2478,7 +2466,7 @@ { // Insert a new block to store the new elements. size_type position = blk_src->position - len; - m_blocks.emplace(m_blocks.begin()+block_index, position, len); + m_blocks.emplace(m_blocks.begin() + block_index, position, len); block& blk = m_blocks[block_index]; blk.data = dst_data.release(); m_hdl_event.element_block_acquired(blk.data); @@ -2510,8 +2498,8 @@ else { size_type position = detail::calc_next_block_position(*blk_src); - m_blocks.emplace(m_blocks.begin()+block_index+1, position, len); - block& blk = m_blocks[block_index+1]; + m_blocks.emplace(m_blocks.begin() + block_index + 1, position, len); + block& blk = m_blocks[block_index + 1]; blk.data = dst_data.release(); m_hdl_event.element_block_acquired(blk.data); } @@ -2527,8 +2515,8 @@ template void multi_type_vector::swap_single_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type dst_block_index1, size_type dst_block_index2) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type dst_block_index1, size_type dst_block_index2) { block* blk_src = &m_blocks[block_index]; size_type start_pos_in_block = blk_src->position; @@ -2545,7 +2533,7 @@ { // The source block is empty. Use transfer. other.transfer_multi_blocks( - other_pos, other_pos+len-1, dst_block_index1, dst_block_index2, *this, start_pos); + other_pos, other_pos + len - 1, dst_block_index1, dst_block_index2, *this, start_pos); return; } @@ -2577,7 +2565,7 @@ // have been transferred over to the destination block. element_block_func::resize_block(*blk_src->data, 0); delete_element_block(*blk_src); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); } else { @@ -2588,9 +2576,9 @@ } insert_blocks_at(src_position, block_index, new_blocks); - merge_with_next_block(block_index+new_blocks.size()-1); // last block inserted. + merge_with_next_block(block_index + new_blocks.size() - 1); // last block inserted. if (block_index > 0) - merge_with_next_block(block_index-1); // block before the first block inserted. + merge_with_next_block(block_index - 1); // block before the first block inserted. return; } @@ -2615,20 +2603,20 @@ // we will immediately remove. The new blocks from the other // container will be inserted at the removed slot. set_new_block_to_middle(block_index, src_offset, len, false); - delete_element_block(m_blocks[block_index+1]); - m_blocks.erase(m_blocks.begin()+block_index+1); + delete_element_block(m_blocks[block_index + 1]); + m_blocks.erase(m_blocks.begin() + block_index + 1); position = detail::calc_next_block_position(m_blocks, block_index); } - insert_blocks_at(position, block_index+1, new_blocks); - merge_with_next_block(block_index+new_blocks.size()); // last block inserted. + insert_blocks_at(position, block_index + 1, new_blocks); + merge_with_next_block(block_index + new_blocks.size()); // last block inserted. merge_with_next_block(block_index); // block before the first block inserted. } template void multi_type_vector::swap_multi_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2) { assert(block_index1 < block_index2); assert(dblock_index1 < dblock_index2); @@ -2648,39 +2636,38 @@ prepare_blocks_to_transfer(src_bucket, block_index1, src_offset1, block_index2, src_offset2); other.prepare_blocks_to_transfer(dst_bucket, dblock_index1, dst_offset1, dblock_index2, dst_offset2); - size_type position = src_bucket.insert_index > 0 ? detail::calc_next_block_position(m_blocks, src_bucket.insert_index-1) : 0; + size_type position = + src_bucket.insert_index > 0 ? detail::calc_next_block_position(m_blocks, src_bucket.insert_index - 1) : 0; insert_blocks_at(position, src_bucket.insert_index, dst_bucket.blocks); // Merge the boundary blocks in the source. - merge_with_next_block(src_bucket.insert_index + dst_bucket.blocks.size()-1); + merge_with_next_block(src_bucket.insert_index + dst_bucket.blocks.size() - 1); if (src_bucket.insert_index > 0) merge_with_next_block(src_bucket.insert_index - 1); - position = dst_bucket.insert_index > 0 ? detail::calc_next_block_position(other.m_blocks, dst_bucket.insert_index-1) : 0; + position = + dst_bucket.insert_index > 0 ? detail::calc_next_block_position(other.m_blocks, dst_bucket.insert_index - 1) : 0; other.insert_blocks_at(position, dst_bucket.insert_index, src_bucket.blocks); // Merge the boundary blocks in the destination. - other.merge_with_next_block(dst_bucket.insert_index + src_bucket.blocks.size()-1); + other.merge_with_next_block(dst_bucket.insert_index + src_bucket.blocks.size() - 1); if (dst_bucket.insert_index > 0) - other.merge_with_next_block(dst_bucket.insert_index-1); + other.merge_with_next_block(dst_bucket.insert_index - 1); } template void multi_type_vector::insert_blocks_at( size_type position, size_type insert_pos, blocks_type& new_blocks) { - std::for_each(new_blocks.begin(), new_blocks.end(), - [&](block& r) - { - r.position = position; - position += r.size; - - if (r.data) - m_hdl_event.element_block_acquired(r.data); - } - ); + std::for_each(new_blocks.begin(), new_blocks.end(), [&](block& r) { + r.position = position; + position += r.size; + + if (r.data) + m_hdl_event.element_block_acquired(r.data); + }); - m_blocks.insert(m_blocks.begin()+insert_pos, new_blocks.begin(), new_blocks.end()); + m_blocks.insert(m_blocks.begin() + insert_pos, new_blocks.begin(), new_blocks.end()); } template @@ -2696,9 +2683,9 @@ typename blocks_type::iterator it_begin = m_blocks.begin(); typename blocks_type::iterator it_end = m_blocks.begin(); - std::advance(it_begin, block_index1+1); + std::advance(it_begin, block_index1 + 1); std::advance(it_end, block_index2); - bucket.insert_index = block_index1+1; + bucket.insert_index = block_index1 + 1; if (offset1 == 0) { @@ -2725,7 +2712,7 @@ } block* blk = &m_blocks[block_index2]; - if (offset2 == blk->size-1) + if (offset2 == blk->size - 1) { // The whole last block needs to be swapped. ++it_end; @@ -2752,14 +2739,11 @@ if (block_first.size) bucket.blocks.push_back(std::move(block_first)); - std::for_each(it_begin, it_end, - [&](block& r) - { - if (r.data) - m_hdl_event.element_block_released(r.data); - bucket.blocks.push_back(r); - } - ); + std::for_each(it_begin, it_end, [&](block& r) { + if (r.data) + m_hdl_event.element_block_released(r.data); + bucket.blocks.push_back(r); + }); if (block_last.size) bucket.blocks.push_back(std::move(block_last)); @@ -2830,7 +2814,7 @@ // Initially, we set to erase all blocks between the first and the last. typename blocks_type::iterator it_erase_begin = m_blocks.begin() + block_pos1 + 1; - typename blocks_type::iterator it_erase_end = m_blocks.begin() + block_pos2; + typename blocks_type::iterator it_erase_end = m_blocks.begin() + block_pos2; // First, inspect the first block. if (start_row_in_block1 == start_row) @@ -2846,7 +2830,7 @@ if (blk->data) { // Shrink the data array. - element_block_func::overwrite_values(*blk->data, new_size, blk->size-new_size); + element_block_func::overwrite_values(*blk->data, new_size, blk->size - new_size); element_block_func::resize_block(*blk->data, new_size); } blk->size = new_size; @@ -2918,13 +2902,13 @@ if (blk->size) { // Block still contains data. Bail out. - adjust_block_positions_func{}(m_blocks, block_pos+1, -size_to_erase); + adjust_block_positions_func{}(m_blocks, block_pos + 1, -size_to_erase); return; } // Delete the current block since it's become empty. delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_pos); + m_blocks.erase(m_blocks.begin() + block_pos); // No need to update blk_index which is not used again. if (block_pos == 0) @@ -2939,7 +2923,7 @@ return; // Check the previous and next blocks to see if they should be merged. - block* blk_prev = &m_blocks[block_pos-1]; + block* blk_prev = &m_blocks[block_pos - 1]; block* blk_next = &m_blocks[block_pos]; if (blk_prev->data) { @@ -2961,7 +2945,7 @@ // Resize to 0 to prevent deletion of cells in case of managed cells. element_block_func::resize_block(*blk_next->data, 0); delete_element_block(*blk_next); - m_blocks.erase(m_blocks.begin()+block_pos); + m_blocks.erase(m_blocks.begin() + block_pos); } adjust_block_positions_func{}(m_blocks, block_pos, -size_to_erase); @@ -2980,14 +2964,14 @@ // previous block. blk_prev->size += blk_next->size; delete_element_block(*blk_next); - m_blocks.erase(m_blocks.begin()+block_pos); + m_blocks.erase(m_blocks.begin() + block_pos); adjust_block_positions_func{}(m_blocks, block_pos, -size_to_erase); } } template -typename multi_type_vector::iterator -multi_type_vector::insert_empty(size_type pos, size_type length) +typename multi_type_vector::iterator multi_type_vector::insert_empty( + size_type pos, size_type length) { if (!length) // Nothing to insert. @@ -3026,14 +3010,14 @@ } template -typename multi_type_vector::iterator -multi_type_vector::insert_empty(const iterator& pos_hint, size_type pos, size_type length) +typename multi_type_vector::iterator multi_type_vector::insert_empty( + const iterator& pos_hint, size_type pos, size_type length) { if (!length) // Nothing to insert. return end(); - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_blocks.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::insert_empty", __LINE__, pos, block_size(), size()); @@ -3066,8 +3050,7 @@ } template -typename multi_type_vector::iterator -multi_type_vector::insert_empty_impl( +typename multi_type_vector::iterator multi_type_vector::insert_empty_impl( size_type pos, size_type block_index, size_type length) { assert(pos < m_cur_size); @@ -3079,7 +3062,7 @@ // with it. blk->size += length; m_cur_size += length; - adjust_block_positions_func{}(m_blocks, block_index+1, length); + adjust_block_positions_func{}(m_blocks, block_index + 1, length); return get_iterator(block_index); } @@ -3097,13 +3080,13 @@ blk_prev->size += length; m_cur_size += length; adjust_block_positions_func{}(m_blocks, block_index, length); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Insert a new empty block. - m_blocks.emplace(m_blocks.begin()+block_index, blk->position, length); + m_blocks.emplace(m_blocks.begin() + block_index, blk->position, length); m_cur_size += length; - adjust_block_positions_func{}(m_blocks, block_index+1, length); + adjust_block_positions_func{}(m_blocks, block_index + 1, length); return get_iterator(block_index); } @@ -3116,15 +3099,14 @@ // Insert two new blocks below the current; one for the empty block being // inserted, and the other for the lower part of the current non-empty // block. - m_blocks.insert(m_blocks.begin()+block_index+1, 2u, block()); + m_blocks.insert(m_blocks.begin() + block_index + 1, 2u, block()); blk = &m_blocks[block_index]; // The old pointer is invalid. - m_blocks[block_index+1].size = length; - m_blocks[block_index+2].size = size_blk_next; + m_blocks[block_index + 1].size = length; + m_blocks[block_index + 2].size = size_blk_next; - block* blk_next = &m_blocks[block_index+2]; - blk_next->data = - element_block_func::create_new_block(mdds::mtv::get_block_type(*blk->data), 0); + block* blk_next = &m_blocks[block_index + 2]; + blk_next->data = element_block_func::create_new_block(mdds::mtv::get_block_type(*blk->data), 0); m_hdl_event.element_block_acquired(blk_next->data); // Check if the previous block is the bigger one @@ -3156,17 +3138,16 @@ } m_cur_size += length; - m_blocks[block_index+1].position = detail::calc_next_block_position(m_blocks, block_index); - m_blocks[block_index+2].position = detail::calc_next_block_position(m_blocks, block_index+1); - adjust_block_positions_func{}(m_blocks, block_index+3, length); + m_blocks[block_index + 1].position = detail::calc_next_block_position(m_blocks, block_index); + m_blocks[block_index + 2].position = detail::calc_next_block_position(m_blocks, block_index + 1); + adjust_block_positions_func{}(m_blocks, block_index + 3, length); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_impl( +typename multi_type_vector::iterator multi_type_vector::set_cells_impl( size_type row, size_type end_row, size_type block_index1, const T& it_begin, const T& it_end) { size_type block_index2 = get_block_position(end_row, block_index1); @@ -3180,14 +3161,12 @@ return set_cells_to_single_block(row, end_row, block_index1, it_begin, it_end); } - return set_cells_to_multi_blocks( - row, end_row, block_index1, block_index2, it_begin, it_end); + return set_cells_to_multi_blocks(row, end_row, block_index1, block_index2, it_begin, it_end); } template template -typename multi_type_vector::iterator -multi_type_vector::insert_cells_impl( +typename multi_type_vector::iterator multi_type_vector::insert_cells_impl( size_type row, size_type block_index, const T& it_begin, const T& it_end) { size_type start_row = m_blocks[block_index].position; @@ -3214,18 +3193,18 @@ m_cur_size += length; adjust_block_positions_func{}(m_blocks, block_index, length); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Just insert a new block before the current block. size_type position = m_blocks[block_index].position; - m_blocks.emplace(m_blocks.begin()+block_index, position, length); + m_blocks.emplace(m_blocks.begin() + block_index, position, length); blk = &m_blocks[block_index]; blk->data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk->data); mdds_mtv_assign_values(*blk->data, *it_begin, it_begin, it_end); m_cur_size += length; - adjust_block_positions_func{}(m_blocks, block_index+1, length); + adjust_block_positions_func{}(m_blocks, block_index + 1, length); return get_iterator(block_index); } @@ -3233,7 +3212,7 @@ insert_cells_to_middle(row, block_index, it_begin, it_end); m_cur_size += length; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } assert(blk->data); @@ -3242,10 +3221,10 @@ { // Simply insert the new data series into existing block. assert(it_begin != it_end); - mdds_mtv_insert_values(*blk->data, row-start_row, *it_begin, it_begin, it_end); + mdds_mtv_insert_values(*blk->data, row - start_row, *it_begin, it_begin, it_end); blk->size += length; m_cur_size += length; - adjust_block_positions_func{}(m_blocks, block_index+1, length); + adjust_block_positions_func{}(m_blocks, block_index + 1, length); return get_iterator(block_index); } @@ -3263,18 +3242,18 @@ m_cur_size += length; adjust_block_positions_func{}(m_blocks, block_index, length); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Just insert a new block before the current block. - m_blocks.emplace(m_blocks.begin()+block_index, blk->position, length); + m_blocks.emplace(m_blocks.begin() + block_index, blk->position, length); blk = &m_blocks[block_index]; blk->data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk->data); mdds_mtv_assign_values(*blk->data, *it_begin, it_begin, it_end); blk->size = length; m_cur_size += length; - adjust_block_positions_func{}(m_blocks, block_index+1, length); + adjust_block_positions_func{}(m_blocks, block_index + 1, length); return get_iterator(block_index); } @@ -3282,7 +3261,7 @@ insert_cells_to_middle(row, block_index, it_begin, it_end); m_cur_size += length; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template @@ -3297,17 +3276,17 @@ // Insert two new blocks after the specified block position. size_type n1 = row - start_row; size_type n2 = m_blocks[block_index].size - n1; - m_blocks.insert(m_blocks.begin()+block_index+1, 2u, block()); + m_blocks.insert(m_blocks.begin() + block_index + 1, 2u, block()); block* blk = &m_blocks[block_index]; blk->size = n1; - m_blocks[block_index+1].size = length; - m_blocks[block_index+1].position = detail::calc_next_block_position(*blk); - m_blocks[block_index+2].size = n2; - m_blocks[block_index+2].position = detail::calc_next_block_position(m_blocks[block_index+1]); + m_blocks[block_index + 1].size = length; + m_blocks[block_index + 1].position = detail::calc_next_block_position(*blk); + m_blocks[block_index + 2].size = n2; + m_blocks[block_index + 2].position = detail::calc_next_block_position(m_blocks[block_index + 1]); // block for data series. - block* blk2 = &m_blocks[block_index+1]; + block* blk2 = &m_blocks[block_index + 1]; blk2->data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk2->data); mdds_mtv_assign_values(*blk2->data, *it_begin, it_begin, it_end); @@ -3317,7 +3296,7 @@ element_category_type blk_cat = mdds::mtv::get_block_type(*blk->data); // block to hold data from the lower part of the existing block. - block* blk3 = &m_blocks[block_index+2]; + block* blk3 = &m_blocks[block_index + 2]; blk3->data = element_block_func::create_new_block(blk_cat, 0); m_hdl_event.element_block_acquired(blk3->data); @@ -3327,28 +3306,27 @@ element_block_func::resize_block(*blk->data, blk->size); } - adjust_block_positions_func{}(m_blocks, block_index+3, length); + adjust_block_positions_func{}(m_blocks, block_index + 3, length); } template -typename multi_type_vector::block& -multi_type_vector::set_new_block_to_middle( - size_type block_index, size_type offset, size_type new_block_size, bool overwrite) +typename multi_type_vector::block& multi_type_vector:: + set_new_block_to_middle(size_type block_index, size_type offset, size_type new_block_size, bool overwrite) { assert(block_index < m_blocks.size()); // First, insert two new blocks at position past the current block. size_type lower_block_size = m_blocks[block_index].size - offset - new_block_size; - m_blocks.insert(m_blocks.begin()+block_index+1, 2u, block()); - m_blocks[block_index+1].size = new_block_size; // empty block. - m_blocks[block_index+2].size = lower_block_size; + m_blocks.insert(m_blocks.begin() + block_index + 1, 2u, block()); + m_blocks[block_index + 1].size = new_block_size; // empty block. + m_blocks[block_index + 2].size = lower_block_size; block& blk = m_blocks[block_index]; if (blk.data) { size_type lower_data_start = offset + new_block_size; - block& blk_lower = m_blocks[block_index+2]; + block& blk_lower = m_blocks[block_index + 2]; assert(blk_lower.size == lower_block_size); element_category_type cat = mtv::get_block_type(*blk.data); blk_lower.data = element_block_func::create_new_block(cat, 0); @@ -3407,22 +3385,21 @@ } // Re-calculate the block positions. - m_blocks[block_index+1].position = detail::calc_next_block_position(m_blocks, block_index); - m_blocks[block_index+2].position = detail::calc_next_block_position(m_blocks, block_index+1); + m_blocks[block_index + 1].position = detail::calc_next_block_position(m_blocks, block_index); + m_blocks[block_index + 2].position = detail::calc_next_block_position(m_blocks, block_index + 1); - return m_blocks[block_index+1]; + return m_blocks[block_index + 1]; } template -typename multi_type_vector::block* -multi_type_vector::get_previous_block_of_type( - size_type block_index, element_category_type cat) +typename multi_type_vector::block* multi_type_vector< + ElemBlockFunc, Trait>::get_previous_block_of_type(size_type block_index, element_category_type cat) { if (block_index == 0) // No previous block. return nullptr; - block& blk = m_blocks[block_index-1]; + block& blk = m_blocks[block_index - 1]; if (blk.data) return (cat == mtv::get_block_type(*blk.data)) ? &blk : nullptr; @@ -3430,15 +3407,14 @@ } template -typename multi_type_vector::block* -multi_type_vector::get_next_block_of_type( - size_type block_index, element_category_type cat) +typename multi_type_vector::block* multi_type_vector< + ElemBlockFunc, Trait>::get_next_block_of_type(size_type block_index, element_category_type cat) { - if (block_index == m_blocks.size()-1) + if (block_index == m_blocks.size() - 1) // No next block. return nullptr; - block* blk = &m_blocks[block_index+1]; + block* blk = &m_blocks[block_index + 1]; if (blk->data) return (cat == mtv::get_block_type(*blk->data)) ? blk : nullptr; @@ -3446,10 +3422,10 @@ } template -typename multi_type_vector::element_block_type* -multi_type_vector::exchange_elements( - const element_block_type& src_data, size_type src_offset, size_type dst_index, - size_type dst_offset, size_type len) +typename multi_type_vector::element_block_type* multi_type_vector:: + exchange_elements( + const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset, + size_type len) { assert(dst_index < m_blocks.size()); block* blk = &m_blocks[dst_index]; @@ -3503,7 +3479,7 @@ element_block_func::prepend_values_from_block(*blk_next->data, src_data, src_offset, len); blk_next->position -= len; blk_next->size += len; - m_blocks.erase(m_blocks.begin()+dst_index); + m_blocks.erase(m_blocks.begin() + dst_index); } else { @@ -3543,7 +3519,7 @@ else { // Insert a new block to house the new elements. - m_blocks.emplace(m_blocks.begin()+dst_index, position, len); + m_blocks.emplace(m_blocks.begin() + dst_index, position, len); blk = &m_blocks[dst_index]; blk->data = element_block_func::create_new_block(cat_src, 0); m_hdl_event.element_block_acquired(blk->data); @@ -3585,8 +3561,8 @@ { // Insert a new block to store the new elements. size_type position = blk->position + dst_offset; - m_blocks.emplace(m_blocks.begin()+dst_index+1, position, len); - blk = &m_blocks[dst_index+1]; + m_blocks.emplace(m_blocks.begin() + dst_index + 1, position, len); + blk = &m_blocks[dst_index + 1]; blk->data = element_block_func::create_new_block(cat_src, 0); assert(blk->data); m_hdl_event.element_block_acquired(blk->data); @@ -3643,9 +3619,8 @@ template void multi_type_vector::exchange_elements( - const element_block_type& src_data, size_type src_offset, - size_type dst_index1, size_type dst_offset1, size_type dst_index2, size_type dst_offset2, - size_type len, blocks_type& new_blocks) + const element_block_type& src_data, size_type src_offset, size_type dst_index1, size_type dst_offset1, + size_type dst_index2, size_type dst_offset2, size_type len, blocks_type& new_blocks) { assert(dst_index1 < dst_index2); assert(dst_offset1 < m_blocks[dst_index1].size); @@ -3654,10 +3629,10 @@ blocks_to_transfer bucket; prepare_blocks_to_transfer(bucket, dst_index1, dst_offset1, dst_index2, dst_offset2); - m_blocks.emplace(m_blocks.begin()+bucket.insert_index, 0, len); + m_blocks.emplace(m_blocks.begin() + bucket.insert_index, 0, len); block* blk = &m_blocks[bucket.insert_index]; if (bucket.insert_index > 0) - blk->position = detail::calc_next_block_position(m_blocks, bucket.insert_index-1); + blk->position = detail::calc_next_block_position(m_blocks, bucket.insert_index - 1); blk->data = element_block_func::create_new_block(mtv::get_block_type(src_data), 0); m_hdl_event.element_block_acquired(blk->data); @@ -3669,10 +3644,9 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_single_block( - size_type start_row, size_type end_row, size_type block_index, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_single_block( + size_type start_row, size_type end_row, size_type block_index, const T& it_begin, const T& it_end) { assert(it_begin != it_end); assert(!m_blocks.empty()); @@ -3702,10 +3676,10 @@ if (end_row == end_row_in_block) { // Check if we could append it to the previous block. - if (append_to_prev_block(block_index, cat, end_row-start_row+1, it_begin, it_end)) + if (append_to_prev_block(block_index, cat, end_row - start_row + 1, it_begin, it_end)) { delete_element_block(*blk); - m_blocks.erase(m_blocks.begin()+block_index); + m_blocks.erase(m_blocks.begin() + block_index); // Check if we need to merge it with the next block. --block_index; @@ -3760,14 +3734,14 @@ { // The new values have been successfully appended to the previous block. blk->position += length; - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Insert a new block before the current block, and populate it with // the new data. size_type position = blk->position; blk->position += length; - m_blocks.emplace(m_blocks.begin()+block_index, position, length); + m_blocks.emplace(m_blocks.begin() + block_index, position, length); blk = &m_blocks[block_index]; blk->data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk->data); @@ -3800,49 +3774,49 @@ mdds_mtv_prepend_values(*blk_next->data, *it_begin, it_begin, it_end); blk_next->size += new_size; blk_next->position -= new_size; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Next block has a different data type. Do the normal insertion. size_type position = detail::calc_next_block_position(*blk); - m_blocks.emplace(m_blocks.begin()+block_index+1, position, new_size); - blk = &m_blocks[block_index+1]; + m_blocks.emplace(m_blocks.begin() + block_index + 1, position, new_size); + blk = &m_blocks[block_index + 1]; blk->data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk->data); mdds_mtv_assign_values(*blk->data, *it_begin, it_begin, it_end); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Last block. assert(block_index == m_blocks.size() - 1); - m_blocks.emplace_back(m_cur_size-new_size, new_size); + m_blocks.emplace_back(m_cur_size - new_size, new_size); blk = &m_blocks.back(); blk->data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk->data); mdds_mtv_assign_values(*blk->data, *it_begin, it_begin, it_end); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // new data array will be in the middle of the current block. assert(start_row_in_block < start_row && end_row < end_row_in_block); - block& blk_new = set_new_block_to_middle( - block_index, start_row-start_row_in_block, end_row-start_row+1, true); + block& blk_new = + set_new_block_to_middle(block_index, start_row - start_row_in_block, end_row - start_row + 1, true); blk_new.data = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk_new.data); mdds_mtv_assign_values(*blk_new.data, *it_begin, it_begin, it_end); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_multi_blocks( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_multi_blocks( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end) { assert(block_index1 < block_index2); assert(it_begin != it_end); @@ -3858,16 +3832,15 @@ // Block 1 is empty. assert(!blk1->data); - return set_cells_to_multi_blocks_block1_non_equal( - start_row, end_row, block_index1, block_index2, it_begin, it_end); + return set_cells_to_multi_blocks_block1_non_equal(start_row, end_row, block_index1, block_index2, it_begin, it_end); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_multi_blocks_block1_non_equal( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_multi_blocks_block1_non_equal( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end) { element_category_type cat = mdds_mtv_get_element_type(*it_begin); block* blk1 = &m_blocks[block_index1]; @@ -3894,7 +3867,7 @@ // Check the type of the previous block (block 0) if exists. if (block_index1 > 0) { - block* blk0 = &m_blocks[block_index1-1]; + block* blk0 = &m_blocks[block_index1 - 1]; if (blk0->data && cat == mdds::mtv::get_block_type(*blk0->data)) { // Transfer the whole data from block 0 to data block. @@ -3935,10 +3908,10 @@ // Remove block 2. ++it_erase_end; - if (block_index2+1 < m_blocks.size()) + if (block_index2 + 1 < m_blocks.size()) { // There is at least one block after block 2. - block* blk3 = &m_blocks[block_index2+1]; + block* blk3 = &m_blocks[block_index2 + 1]; if (blk3->data && mdds::mtv::get_block_type(*blk3->data) == cat) { // Merge the whole block 3 with the new data. Remove block 3 @@ -3963,8 +3936,7 @@ // copied portion of the block. size_type copy_pos = end_row - start_row_in_block2 + 1; size_type size_to_copy = end_row_in_block2 - end_row; - element_block_func::append_values_from_block( - *data_blk.data, *blk2->data, copy_pos, size_to_copy); + element_block_func::append_values_from_block(*data_blk.data, *blk2->data, copy_pos, size_to_copy); element_block_func::resize_block(*blk2->data, copy_pos); data_blk.size += size_to_copy; @@ -3994,17 +3966,17 @@ m_blocks.erase(it_erase_begin, it_erase_end); // Insert the new data block. - m_blocks.insert(m_blocks.begin()+insert_pos, std::move(data_blk)); + m_blocks.insert(m_blocks.begin() + insert_pos, std::move(data_blk)); return get_iterator(insert_pos); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_multi_blocks_block1_non_empty( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_multi_blocks_block1_non_empty( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end) { size_type start_row_in_block1 = m_blocks[block_index1].position; size_type start_row_in_block2 = m_blocks[block_index2].position; @@ -4028,7 +4000,7 @@ // Extend the first block to store the new data set. // Shrink it first to remove the old values, then append new values. - element_block_func::overwrite_values(*blk1->data, offset, blk1->size-offset); + element_block_func::overwrite_values(*blk1->data, offset, blk1->size - offset); element_block_func::resize_block(*blk1->data, offset); mdds_mtv_append_values(*blk1->data, *it_begin, it_begin, it_end); blk1->size = offset + length; @@ -4081,17 +4053,16 @@ // The first block type is different. assert(blk_cat1 != cat); - return set_cells_to_multi_blocks_block1_non_equal( - start_row, end_row, block_index1, block_index2, it_begin, it_end); + return set_cells_to_multi_blocks_block1_non_equal(start_row, end_row, block_index1, block_index2, it_begin, it_end); } template -typename multi_type_vector::size_type -multi_type_vector::merge_with_adjacent_blocks(size_type block_index) +typename multi_type_vector::size_type multi_type_vector< + ElemBlockFunc, Trait>::merge_with_adjacent_blocks(size_type block_index) { assert(!m_blocks.empty()); assert(block_index < m_blocks.size()); - block* blk_prev = block_index > 0 ? &m_blocks[block_index-1] : nullptr; + block* blk_prev = block_index > 0 ? &m_blocks[block_index - 1] : nullptr; if (!blk_prev) { @@ -4102,7 +4073,7 @@ size_type size_prev = blk_prev->size; // size of previous block. block* blk = &m_blocks[block_index]; - block* blk_next = block_index < (m_blocks.size()-1) ? &m_blocks[block_index+1] : nullptr; + block* blk_next = block_index < (m_blocks.size() - 1) ? &m_blocks[block_index + 1] : nullptr; // Check the previous block. if (blk_prev->data) @@ -4139,7 +4110,7 @@ } // Merge only the previous and current blocks. - bool merged = merge_with_next_block(block_index-1); + bool merged = merge_with_next_block(block_index - 1); if (!merged) assert(!"Blocks were not merged!"); @@ -4173,7 +4144,7 @@ } // Next block is not empty, or does not exist. Merge the current block with the previous one. - bool merged = merge_with_next_block(block_index-1); + bool merged = merge_with_next_block(block_index - 1); if (!merged) assert(!"Blocks were not merged!"); @@ -4186,13 +4157,13 @@ assert(!m_blocks.empty()); assert(block_index < m_blocks.size()); - if (block_index >= m_blocks.size()-1) + if (block_index >= m_blocks.size() - 1) // No more block below this one. return false; // Block exists below. block* blk = &m_blocks[block_index]; - block* blk_next = &m_blocks[block_index+1]; + block* blk_next = &m_blocks[block_index + 1]; if (!blk->data) { // Empty block. Merge only if the next block is also empty. @@ -4202,7 +4173,7 @@ // Merge the two blocks. blk->size += blk_next->size; - m_blocks.erase(m_blocks.begin()+block_index+1); + m_blocks.erase(m_blocks.begin() + block_index + 1); return true; } @@ -4218,15 +4189,14 @@ element_block_func::resize_block(*blk_next->data, 0); blk->size += blk_next->size; delete_element_block(*blk_next); - m_blocks.erase(m_blocks.begin()+block_index+1); + m_blocks.erase(m_blocks.begin() + block_index + 1); return true; } template template bool multi_type_vector::append_to_prev_block( - size_type block_index, element_category_type cat, size_type length, - const T& it_begin, const T& it_end) + size_type block_index, element_category_type cat, size_type length, const T& it_begin, const T& it_end) { block* blk_prev = get_previous_block_of_type(block_index, cat); if (!blk_prev) @@ -4247,15 +4217,13 @@ } template -typename multi_type_vector::size_type -multi_type_vector::size() const +typename multi_type_vector::size_type multi_type_vector::size() const { return m_cur_size; } template -typename multi_type_vector::size_type -multi_type_vector::block_size() const +typename multi_type_vector::size_type multi_type_vector::block_size() const { return m_blocks.size(); } @@ -4332,7 +4300,7 @@ size_type new_block_size = new_end_row - start_row_in_block + 1; if (blk->data) { - element_block_func::overwrite_values(*blk->data, new_end_row+1, end_row_in_block-new_end_row); + element_block_func::overwrite_values(*blk->data, new_end_row + 1, end_row_in_block - new_end_row); element_block_func::resize_block(*blk->data, new_block_size); } blk->size = new_block_size; @@ -4354,7 +4322,8 @@ } template -void multi_type_vector::swap(size_type start_pos, size_type end_pos, multi_type_vector& other, size_type other_pos) +void multi_type_vector::swap( + size_type start_pos, size_type end_pos, multi_type_vector& other, size_type other_pos) { if (start_pos > end_pos) throw std::out_of_range("multi_type_vector::swap: start position is larger than the end position!"); @@ -4386,8 +4355,7 @@ other.dump_blocks(os_prev_block_other); #endif - swap_impl( - other, start_pos, end_pos, other_pos, block_index1, block_index2, dest_block_index1, dest_block_index2); + swap_impl(other, start_pos, end_pos, other_pos, block_index1, block_index2, dest_block_index1, dest_block_index2); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_block, os_block_other; @@ -4403,7 +4371,9 @@ { std::ostringstream os; os << e.what() << std::endl; - os << std::endl << "block integrity check failed in swap (start_pos=" << start_pos << "; end_pos=" << end_pos << "; other_pos=" << other_pos << ")" << std::endl; + os << std::endl + << "block integrity check failed in swap (start_pos=" << start_pos << "; end_pos=" << end_pos + << "; other_pos=" << other_pos << ")" << std::endl; os << std::endl << "previous block state (source):" << std::endl; os << os_prev_block.str(); os << std::endl << "previous block state (destination):" << std::endl; @@ -4432,7 +4402,7 @@ } template -bool multi_type_vector::operator== (const multi_type_vector& other) const +bool multi_type_vector::operator==(const multi_type_vector& other) const { if (this == &other) // Comparing to self is always equal. @@ -4485,13 +4455,14 @@ } template -bool multi_type_vector::operator!= (const multi_type_vector& other) const +bool multi_type_vector::operator!=(const multi_type_vector& other) const { - return !operator== (other); + return !operator==(other); } template -multi_type_vector& multi_type_vector::operator= (const multi_type_vector& other) +multi_type_vector& multi_type_vector::operator=( + const multi_type_vector& other) { multi_type_vector assigned(other); swap(assigned); @@ -4499,7 +4470,7 @@ } template -multi_type_vector& multi_type_vector::operator= (multi_type_vector&& other) +multi_type_vector& multi_type_vector::operator=(multi_type_vector&& other) { multi_type_vector assigned(std::move(other)); swap(assigned); @@ -4514,8 +4485,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::set_whole_block_empty(size_type block_index, bool overwrite) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_whole_block_empty(size_type block_index, bool overwrite) { block* blk = &m_blocks[block_index]; if (!overwrite) @@ -4548,7 +4519,7 @@ std::advance(it_end, 2); m_blocks.erase(it, it_end); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Only the preceding block is empty. Merge the current block with the previous. @@ -4557,7 +4528,7 @@ std::advance(it, block_index); m_blocks.erase(it); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } else if (blk_next) { @@ -4566,7 +4537,7 @@ // Only the next block is empty. Merge the next block with the current. blk->size += blk_next->size; typename blocks_type::iterator it = m_blocks.begin(); - std::advance(it, block_index+1); + std::advance(it, block_index + 1); m_blocks.erase(it); return get_iterator(block_index); @@ -4576,9 +4547,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::set_empty_in_single_block( - size_type start_row, size_type end_row, size_type block_index, bool overwrite) +typename multi_type_vector::iterator multi_type_vector:: + set_empty_in_single_block(size_type start_row, size_type end_row, size_type block_index, bool overwrite) { // Range is within a single block. block* blk = &m_blocks[block_index]; @@ -4611,13 +4581,13 @@ // Extend the previous empty block. blk_prev->size += empty_block_size; blk->position += empty_block_size; - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Insert a new empty block before the current one. size_type block_position = blk->position; blk->position += empty_block_size; - m_blocks.emplace(m_blocks.begin()+block_index, block_position, empty_block_size); + m_blocks.emplace(m_blocks.begin() + block_index, block_position, empty_block_size); return get_iterator(block_index); } @@ -4644,24 +4614,23 @@ else { // Insert a new empty block after the current one. - m_blocks.emplace(m_blocks.begin()+block_index+1, start_row, empty_block_size); + m_blocks.emplace(m_blocks.begin() + block_index + 1, start_row, empty_block_size); } - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Empty the middle part of a block. assert(end_row_in_block - end_row > 0); - set_new_block_to_middle(block_index, start_row-start_row_in_block, empty_block_size, overwrite); + set_new_block_to_middle(block_index, start_row - start_row_in_block, empty_block_size, overwrite); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template -typename multi_type_vector::iterator -multi_type_vector::set_empty_in_multi_blocks( - size_type start_row, size_type end_row, - size_type block_index1, size_type block_index2, bool overwrite) +typename multi_type_vector::iterator multi_type_vector:: + set_empty_in_multi_blocks( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, bool overwrite) { assert(block_index1 < block_index2); size_type start_row_in_block1 = m_blocks[block_index1].position; @@ -4680,7 +4649,7 @@ block* blk_prev = nullptr; if (block_index1 > 0) { - blk_prev = &m_blocks[block_index1-1]; + blk_prev = &m_blocks[block_index1 - 1]; if (blk_prev->data) // Not empty. Ignore it. blk_prev = nullptr; @@ -4708,7 +4677,7 @@ // Empty the lower part. size_type new_size = start_row - start_row_in_block1; if (overwrite) - element_block_func::overwrite_values(*blk->data, new_size, blk->size-new_size); + element_block_func::overwrite_values(*blk->data, new_size, blk->size - new_size); element_block_func::resize_block(*blk->data, new_size); blk->size = new_size; @@ -4737,9 +4706,9 @@ // Check if the following block (if exists) is also empty. block* blk_next = nullptr; - if (block_index2+1 < m_blocks.size()) + if (block_index2 + 1 < m_blocks.size()) { - blk_next = &m_blocks[block_index2+1]; + blk_next = &m_blocks[block_index2 + 1]; if (blk_next->data) // Not empty. Ignore it. blk_next = nullptr; @@ -4796,8 +4765,8 @@ if (blk->data) { // Insert a new empty block after the first block. - m_blocks.emplace(m_blocks.begin()+block_index1+1, start_row, empty_block_size); - return get_iterator(block_index1+1); + m_blocks.emplace(m_blocks.begin() + block_index1 + 1, start_row, empty_block_size); + return get_iterator(block_index1 + 1); } // Current block is already empty. Just extend its size. @@ -4860,9 +4829,8 @@ if (blk->position != cur_position) { std::ostringstream os; - os << "position of the current block is wrong! (expected=" - << cur_position << "; actual=" << blk->position << ")" - << std::endl; + os << "position of the current block is wrong! (expected=" << cur_position << "; actual=" << blk->position + << ")" << std::endl; dump_blocks(os); throw mdds::integrity_error(os.str()); @@ -4874,8 +4842,7 @@ cat = mtv::get_block_type(*blk->data); if (element_block_func::size(*blk->data) != blk->size) - throw mdds::integrity_error( - "block size cache and the actual element block size differ!"); + throw mdds::integrity_error("block size cache and the actual element block size differ!"); } if (cat_prev == cat) @@ -4904,7 +4871,6 @@ } #endif -}}} +}}} // namespace mdds::mtv::aos /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/aos/main.hpp mdds-2.0.3/include/mdds/multi_type_vector/aos/main.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/aos/main.hpp 2022-01-22 01:07:37.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/aos/main.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -98,7 +98,6 @@ using event_func = typename Trait::event_func; private: - struct block { size_type position; @@ -119,7 +118,7 @@ struct element_block_deleter { - void operator() (const element_block_type* p) + void operator()(const element_block_type* p) { element_block_func::delete_block(p); } @@ -163,17 +162,17 @@ typedef typename blocks_type::const_reverse_iterator base_iterator; }; - typedef mdds::detail::mtv::iterator_value_node itr_node; - typedef mdds::detail::mtv::private_data_forward_update itr_forward_update; - typedef mdds::detail::mtv::private_data_no_update itr_no_update; + typedef mdds::detail::mtv::iterator_value_node itr_node; + typedef mdds::detail::mtv::private_data_forward_update itr_forward_update; + typedef mdds::detail::mtv::private_data_no_update itr_no_update; public: - typedef detail::iterator_base iterator; typedef detail::iterator_base reverse_iterator; typedef detail::const_iterator_base const_iterator; - typedef detail::const_iterator_base const_reverse_iterator; + typedef detail::const_iterator_base + const_reverse_iterator; /** * value_type is the type of a block stored in the primary array. It @@ -333,7 +332,7 @@ * @param it_end iterator that points to the end position of the values * the container is being initialized to. The end position * is not inclusive. - */ + */ template multi_type_vector(size_type init_size, const T& it_begin, const T& it_end); @@ -822,7 +821,8 @@ * @return iterator referencing the block where the moved elements were * prior to the transfer. */ - iterator transfer(const iterator& pos_hint, size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos); + iterator transfer( + const iterator& pos_hint, size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos); /** * Get the type of an element at specified position. @@ -1035,11 +1035,11 @@ */ void shrink_to_fit(); - bool operator== (const multi_type_vector& other) const; - bool operator!= (const multi_type_vector& other) const; + bool operator==(const multi_type_vector& other) const; + bool operator!=(const multi_type_vector& other) const; - multi_type_vector& operator= (const multi_type_vector& other); - multi_type_vector& operator= (multi_type_vector&& other); + multi_type_vector& operator=(const multi_type_vector& other); + multi_type_vector& operator=(multi_type_vector&& other); /** * Return the numerical identifier that represents passed element. @@ -1058,7 +1058,6 @@ #endif private: - /** * Delete only the element block owned by an outer block. * @@ -1094,13 +1093,13 @@ * * @return index of the block that contains the specified logical row ID. */ - size_type get_block_position(size_type row, size_type start_block_index=0) const; + size_type get_block_position(size_type row, size_type start_block_index = 0) const; /** - * Same as above, but try to infer block position from the iterator first - * before trying full search. + * Same as above, but try to infer block position from the private position + * data stored in the iterator first before trying full search. */ - size_type get_block_position(const const_iterator& pos_hint, size_type row) const; + size_type get_block_position(const typename value_type::private_data& pos_data, size_type row) const; void resize_impl(size_type new_size); @@ -1108,8 +1107,7 @@ void create_new_block_with_new_cell(element_block_type*& data, const T& cell); template - iterator set_cell_to_middle_of_block( - size_type block_index, size_type pos_in_block, const T& cell); + iterator set_cell_to_middle_of_block(size_type block_index, size_type pos_in_block, const T& cell); template void append_cell_to_block(size_type block_index, const T& cell); @@ -1118,35 +1116,30 @@ iterator set_cell_to_empty_block(size_type block_index, size_type pos_in_block, const T& cell); template - iterator set_cell_to_block_of_size_one( - size_type block_index, const T& cell); + iterator set_cell_to_block_of_size_one(size_type block_index, const T& cell); template - void set_cell_to_top_of_data_block( - size_type block_index, const T& cell); + void set_cell_to_top_of_data_block(size_type block_index, const T& cell); template - void set_cell_to_bottom_of_data_block( - size_type block_index, const T& cell); + void set_cell_to_bottom_of_data_block(size_type block_index, const T& cell); iterator transfer_impl( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos); + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos); /** * All elements to transfer to the other container is in the same block. */ iterator transfer_single_block( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos); + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos); /** * Elements to transfer to the other container span across multiple * blocks. */ iterator transfer_multi_blocks( - size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, - multi_type_vector& dest, size_type dest_pos); + size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, multi_type_vector& dest, + size_type dest_pos); /** * @param start_pos logical start position. @@ -1156,33 +1149,33 @@ * heap objects, objects pointed to by the overwritten * pointers should be freed from memory. */ - iterator set_empty_impl( - size_type start_pos, size_type end_pos, size_type block_index1, bool overwrite); + iterator set_empty_impl(size_type start_pos, size_type end_pos, size_type block_index1, bool overwrite); void swap_impl( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2); void swap_single_block( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type other_block_index); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type other_block_index); void swap_single_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type dst_block_index1, size_type dst_block_index2); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type dst_block_index1, size_type dst_block_index2); void swap_multi_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2); void insert_blocks_at(size_type position, size_type insert_pos, blocks_type& new_blocks); - void prepare_blocks_to_transfer(blocks_to_transfer& bucket, size_type block_index1, size_type offset1, size_type block_index2, size_type offset2); + void prepare_blocks_to_transfer( + blocks_to_transfer& bucket, size_type block_index1, size_type offset1, size_type block_index2, + size_type offset2); iterator set_whole_block_empty(size_type block_index, bool overwrite); - iterator set_empty_in_single_block( - size_type start_row, size_type end_row, size_type block_index, bool overwrite); + iterator set_empty_in_single_block(size_type start_row, size_type end_row, size_type block_index, bool overwrite); /** * @param start_row logical start position. @@ -1194,8 +1187,7 @@ * pointers should be freed from memory. */ iterator set_empty_in_multi_blocks( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - bool overwrite); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, bool overwrite); void erase_impl(size_type start_pos, size_type end_pos); void erase_in_single_block(size_type start_pos, size_type end_pos, size_type block_pos); @@ -1216,23 +1208,22 @@ template iterator set_cells_to_single_block( - size_type start_row, size_type end_row, size_type block_index, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index, const T& it_begin, const T& it_end); template iterator set_cells_to_multi_blocks( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end); template iterator set_cells_to_multi_blocks_block1_non_equal( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end); template iterator set_cells_to_multi_blocks_block1_non_empty( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end); /** * Merge with previous or next block as needed. @@ -1255,12 +1246,10 @@ template bool append_to_prev_block( - size_type block_index, element_category_type cat, size_type length, - const T& it_begin, const T& it_end); + size_type block_index, element_category_type cat, size_type length, const T& it_begin, const T& it_end); template - void insert_cells_to_middle( - size_type row, size_type block_index, const T& it_begin, const T& it_end); + void insert_cells_to_middle(size_type row, size_type block_index, const T& it_begin, const T& it_end); /** * Set a new block in the middle of an existing block. This call inserts @@ -1275,8 +1264,7 @@ * the new block. * @return reference to the middle block */ - block& set_new_block_to_middle( - size_type block_index, size_type offset, size_type new_block_size, bool overwrite); + block& set_new_block_to_middle(size_type block_index, size_type offset, size_type new_block_size, bool overwrite); block* get_previous_block_of_type(size_type block_index, element_category_type cat); @@ -1307,12 +1295,12 @@ * its life cycle. */ element_block_type* exchange_elements( - const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset, size_type len); + const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset, + size_type len); void exchange_elements( - const element_block_type& src_data, size_type src_offset, - size_type dst_index1, size_type dst_offset1, size_type dst_index2, size_type dst_offset2, - size_type len, blocks_type& new_blocks); + const element_block_type& src_data, size_type src_offset, size_type dst_index1, size_type dst_offset1, + size_type dst_index2, size_type dst_offset2, size_type len, blocks_type& new_blocks); bool append_empty(size_type len); @@ -1320,30 +1308,28 @@ { typename blocks_type::iterator block_pos = m_blocks.begin(); std::advance(block_pos, block_index); - return iterator(block_pos, m_blocks.end(), block_index); + return iterator(block_pos, m_blocks.end(), this, block_index); } inline const_iterator get_const_iterator(size_type block_index) const { typename blocks_type::const_iterator block_pos = m_blocks.begin(); std::advance(block_pos, block_index); - return const_iterator(block_pos, m_blocks.end(), block_index); + return const_iterator(block_pos, m_blocks.end(), this, block_index); } private: - using adjust_block_positions_func = - detail::adjust_block_positions; + using adjust_block_positions_func = detail::adjust_block_positions; event_func m_hdl_event; blocks_type m_blocks; size_type m_cur_size; }; -}}} +}}} // namespace mdds::mtv::aos #include "main_def.inl" #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/aos/Makefile.in mdds-2.0.3/include/mdds/multi_type_vector/aos/Makefile.in --- mdds-2.0.2/include/mdds/multi_type_vector/aos/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/aos/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -163,8 +163,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -178,9 +176,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -192,11 +191,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -386,7 +384,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/collection_def.inl mdds-2.0.3/include/mdds/multi_type_vector/collection_def.inl --- mdds-2.0.2/include/mdds/multi_type_vector/collection_def.inl 2018-12-07 03:25:32.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/collection_def.inl 2022-04-22 00:12:40.000000000 +0000 @@ -32,18 +32,15 @@ namespace detail { template -side_iterator<_MtvT>::side_iterator() : - m_elem_pos(0), m_elem_pos_end(0), m_index_offset(0), m_identity(0) {} +side_iterator<_MtvT>::side_iterator() : m_elem_pos(0), m_elem_pos_end(0), m_index_offset(0), m_identity(0) +{} template side_iterator<_MtvT>::side_iterator( - std::vector&& vectors, size_type elem_pos, size_type elem_size, - size_type index_offset, uintptr_t identity, begin_state_type) : - m_vectors(std::move(vectors)), - m_elem_pos(elem_pos), - m_elem_pos_end(elem_pos+elem_size), - m_index_offset(index_offset), - m_identity(identity) + std::vector&& vectors, size_type elem_pos, size_type elem_size, size_type index_offset, + uintptr_t identity, begin_state_type) + : m_vectors(std::move(vectors)), m_elem_pos(elem_pos), m_elem_pos_end(elem_pos + elem_size), + m_index_offset(index_offset), m_identity(identity) { m_cur_node.index = index_offset; @@ -60,13 +57,10 @@ template side_iterator<_MtvT>::side_iterator( - std::vector&& vectors, size_type elem_pos, size_type elem_size, - size_type index_offset, uintptr_t identity, end_state_type) : - m_vectors(std::move(vectors)), - m_elem_pos(elem_pos), - m_elem_pos_end(elem_pos+elem_size), - m_index_offset(index_offset), - m_identity(identity) + std::vector&& vectors, size_type elem_pos, size_type elem_size, size_type index_offset, + uintptr_t identity, end_state_type) + : m_vectors(std::move(vectors)), m_elem_pos(elem_pos), m_elem_pos_end(elem_pos + elem_size), + m_index_offset(index_offset), m_identity(identity) { m_elem_pos = m_elem_pos_end; m_cur_node.index = index_offset; @@ -113,7 +107,7 @@ } template -bool side_iterator<_MtvT>::operator== (const side_iterator& other) const +bool side_iterator<_MtvT>::operator==(const side_iterator& other) const { if (m_identity != other.m_identity) return false; @@ -128,22 +122,20 @@ } template -bool side_iterator<_MtvT>::operator!= (const side_iterator& other) const +bool side_iterator<_MtvT>::operator!=(const side_iterator& other) const { return !operator==(other); } -} +} // namespace detail template -collection<_MtvT>::collection() : - m_mtv_size(0), m_identity(0) +collection<_MtvT>::collection() : m_mtv_size(0), m_identity(0) {} template template -collection<_MtvT>::collection(const _T& begin, const _T& end) : - m_mtv_size(0), m_identity(0) +collection<_MtvT>::collection(const _T& begin, const _T& end) : m_mtv_size(0), m_identity(0) { size_type n = std::distance(begin, end); m_vectors.reserve(n); @@ -155,14 +147,11 @@ auto it = m_vectors.begin(); uintptr_t identity = reinterpret_cast(*it); ++it; - std::for_each(it, m_vectors.end(), - [&](const mtv_type* p0) - { - uintptr_t p = reinterpret_cast(p0); - identity = identity << 1; - identity ^= p; - } - ); + std::for_each(it, m_vectors.end(), [&](const mtv_type* p0) { + uintptr_t p = reinterpret_cast(p0); + identity = identity << 1; + identity ^= p; + }); m_identity = identity; assert(m_mtv_size); // This should have been set by this point. @@ -174,26 +163,23 @@ } template -typename collection<_MtvT>::const_iterator -collection<_MtvT>::begin() const +typename collection<_MtvT>::const_iterator collection<_MtvT>::begin() const { return const_iterator( - build_iterator_state(), m_elem_range.start, m_elem_range.size, - m_col_range.start, m_identity, const_iterator::begin_state); + build_iterator_state(), m_elem_range.start, m_elem_range.size, m_col_range.start, m_identity, + const_iterator::begin_state); } template -typename collection<_MtvT>::const_iterator -collection<_MtvT>::end() const +typename collection<_MtvT>::const_iterator collection<_MtvT>::end() const { return const_iterator( - build_iterator_state(), m_elem_range.start, m_elem_range.size, - m_col_range.start, m_identity, const_iterator::end_state); + build_iterator_state(), m_elem_range.start, m_elem_range.size, m_col_range.start, m_identity, + const_iterator::end_state); } template -typename collection<_MtvT>::size_type -collection<_MtvT>::size() const +typename collection<_MtvT>::size_type collection<_MtvT>::size() const { return m_mtv_size; } @@ -237,7 +223,7 @@ if (!size) throw invalid_arg_error("size of 0 is not allowed."); - if ((start+size) > m_vectors.size()) + if ((start + size) > m_vectors.size()) throw invalid_arg_error("size is too large."); } @@ -254,13 +240,12 @@ if (!size) throw invalid_arg_error("size of 0 is not allowed."); - if ((start+size) > m_mtv_size) + if ((start + size) > m_mtv_size) throw invalid_arg_error("size is too large."); } template -std::vector::const_iterator::mtv_item> -collection<_MtvT>::build_iterator_state() const +std::vector::const_iterator::mtv_item> collection<_MtvT>::build_iterator_state() const { std::vector cols; cols.reserve(m_col_range.size); @@ -270,20 +255,14 @@ auto it_end = it; std::advance(it_end, m_col_range.size); - std::for_each(it, it_end, - [&](const mtv_type* p) - { - cols.emplace_back(p, p->cbegin(), p->cend()); - } - ); + std::for_each(it, it_end, [&](const mtv_type* p) { cols.emplace_back(p, p->cbegin(), p->cend()); }); return cols; } template template -void collection<_MtvT>::init_insert_vector( - const _T& t, typename std::enable_if::value>::type*) +void collection<_MtvT>::init_insert_vector(const _T& t, typename std::enable_if::value>::type*) { check_vector_size(*t); m_vectors.emplace_back(t); @@ -305,8 +284,7 @@ template template -void collection<_MtvT>::init_insert_vector( - const _T& t, typename std::enable_if::value>::type*) +void collection<_MtvT>::init_insert_vector(const _T& t, typename std::enable_if::value>::type*) { check_vector_size(t); m_vectors.emplace_back(&t); @@ -324,4 +302,4 @@ throw invalid_arg_error("All multi_type_vector instances must be of the same length."); } -}} +}} // namespace mdds::mtv diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/collection.hpp mdds-2.0.3/include/mdds/multi_type_vector/collection.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/collection.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/collection.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -58,8 +58,9 @@ const_iterator block_pos; const_iterator block_end; - mtv_item(const mtv_type* v, const const_iterator& bp, const const_iterator& be) : - vector(v), block_pos(bp), block_end(be) {} + mtv_item(const mtv_type* v, const const_iterator& bp, const const_iterator& be) + : vector(v), block_pos(bp), block_end(be) + {} }; /** single element value. */ @@ -87,8 +88,14 @@ const_position_type __position; }; - enum begin_state_type { begin_state }; - enum end_state_type { end_state }; + enum begin_state_type + { + begin_state + }; + enum end_state_type + { + end_state + }; std::vector m_vectors; node m_cur_node; @@ -98,12 +105,12 @@ uintptr_t m_identity; side_iterator( - std::vector&& vectors, size_type elem_pos, size_type elem_size, - size_type index_offset, uintptr_t identity, begin_state_type); + std::vector&& vectors, size_type elem_pos, size_type elem_size, size_type index_offset, + uintptr_t identity, begin_state_type); side_iterator( - std::vector&& vectors, size_type elem_pos, size_type elem_size, - size_type index_offset, uintptr_t identity, end_state_type); + std::vector&& vectors, size_type elem_pos, size_type elem_size, size_type index_offset, + uintptr_t identity, end_state_type); public: typedef node value_type; @@ -127,11 +134,11 @@ side_iterator operator++(int); - bool operator== (const side_iterator& other) const; - bool operator!= (const side_iterator& other) const; + bool operator==(const side_iterator& other) const; + bool operator!=(const side_iterator& other) const; }; -} +} // namespace detail /** * Special-purpose collection of multiple multi_type_vector instances to @@ -147,13 +154,13 @@ typedef typename mtv_type::size_type size_type; private: - struct range { size_type start; size_type size; - range() : start(0), size(0) {} + range() : start(0), size(0) + {} }; std::vector m_vectors; @@ -161,10 +168,9 @@ uintptr_t m_identity; range m_elem_range; /// element range. - range m_col_range; /// collection range. + range m_col_range; /// collection range. public: - typedef detail::side_iterator const_iterator; collection(); @@ -249,7 +255,6 @@ void set_element_range(size_type start, size_type size); private: - void check_collection_range(size_type start, size_type size) const; void check_element_range(size_type start, size_type size) const; @@ -268,7 +273,7 @@ void check_vector_size(const mtv_type& t); }; -}} +}} // namespace mdds::mtv #include "collection_def.inl" diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/custom_func1.hpp mdds-2.0.3/include/mdds/multi_type_vector/custom_func1.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/custom_func1.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/custom_func1.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -46,8 +46,7 @@ { case _Block::block_type: return _Block::create_block(init_size); - default: - ; + default:; } return element_block_func::create_new_block(type, init_size); @@ -59,8 +58,7 @@ { case _Block::block_type: return _Block::clone_block(block); - default: - ; + default:; } return element_block_func::clone_block(block); @@ -75,7 +73,7 @@ { case _Block::block_type: _Block::delete_block(p); - break; + break; default: element_block_func::delete_block(p); } @@ -87,7 +85,7 @@ { case _Block::block_type: _Block::resize_block(block, new_size); - break; + break; default: element_block_func::resize_block(block, new_size); } @@ -99,7 +97,7 @@ { case _Block::block_type: _Block::print_block(block); - break; + break; default: element_block_func::print_block(block); } @@ -111,7 +109,7 @@ { case _Block::block_type: _Block::erase_block(block, pos); - break; + break; default: element_block_func::erase(block, pos); } @@ -123,7 +121,7 @@ { case _Block::block_type: _Block::erase_block(block, pos, size); - break; + break; default: element_block_func_base::erase(block, pos, size); } @@ -135,7 +133,7 @@ { case _Block::block_type: _Block::append_values_from_block(dest, src); - break; + break; default: element_block_func_base::append_values_from_block(dest, src); } @@ -148,7 +146,7 @@ { case _Block::block_type: _Block::append_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::append_values_from_block(dest, src, begin_pos, len); } @@ -161,7 +159,7 @@ { case _Block::block_type: _Block::assign_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::assign_values_from_block(dest, src, begin_pos, len); } @@ -174,27 +172,25 @@ { case _Block::block_type: _Block::prepend_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::prepend_values_from_block(dest, src, begin_pos, len); } } - static void swap_values( - base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) + static void swap_values(base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) { switch (get_block_type(blk1)) { case _Block::block_type: _Block::swap_values(blk1, blk2, pos1, pos2, len); - break; + break; default: element_block_func_base::swap_values(blk1, blk2, pos1, pos2, len); } } - static bool equal_block( - const base_element_block& left, const base_element_block& right) + static bool equal_block(const base_element_block& left, const base_element_block& right) { if (get_block_type(left) == _Block::block_type) { @@ -215,7 +211,7 @@ { case _Block::block_type: _Block::overwrite_values(block, pos, len); - break; + break; default: element_block_func::overwrite_values(block, pos, len); } @@ -227,7 +223,7 @@ { case _Block::block_type: _Block::shrink_to_fit(block); - break; + break; default: element_block_func::shrink_to_fit(block); } @@ -245,9 +241,8 @@ } }; -}} +}} // namespace mdds::mtv #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/custom_func2.hpp mdds-2.0.3/include/mdds/multi_type_vector/custom_func2.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/custom_func2.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/custom_func2.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -48,8 +48,7 @@ return _Block1::create_block(init_size); case _Block2::block_type: return _Block2::create_block(init_size); - default: - ; + default:; } return element_block_func::create_new_block(type, init_size); @@ -63,8 +62,7 @@ return _Block1::clone_block(block); case _Block2::block_type: return _Block2::clone_block(block); - default: - ; + default:; } return element_block_func::clone_block(block); @@ -79,10 +77,10 @@ { case _Block1::block_type: _Block1::delete_block(p); - break; + break; case _Block2::block_type: _Block2::delete_block(p); - break; + break; default: element_block_func::delete_block(p); } @@ -94,10 +92,10 @@ { case _Block1::block_type: _Block1::resize_block(block, new_size); - break; + break; case _Block2::block_type: _Block2::resize_block(block, new_size); - break; + break; default: element_block_func::resize_block(block, new_size); } @@ -109,10 +107,10 @@ { case _Block1::block_type: _Block1::print_block(block); - break; + break; case _Block2::block_type: _Block2::print_block(block); - break; + break; default: element_block_func::print_block(block); } @@ -124,10 +122,10 @@ { case _Block1::block_type: _Block1::erase_block(block, pos); - break; + break; case _Block2::block_type: _Block2::erase_block(block, pos); - break; + break; default: element_block_func::erase(block, pos); } @@ -139,10 +137,10 @@ { case _Block1::block_type: _Block1::erase_block(block, pos, size); - break; + break; case _Block2::block_type: _Block2::erase_block(block, pos, size); - break; + break; default: element_block_func_base::erase(block, pos, size); } @@ -154,10 +152,10 @@ { case _Block1::block_type: _Block1::append_values_from_block(dest, src); - break; + break; case _Block2::block_type: _Block2::append_values_from_block(dest, src); - break; + break; default: element_block_func_base::append_values_from_block(dest, src); } @@ -170,10 +168,10 @@ { case _Block1::block_type: _Block1::append_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block2::block_type: _Block2::append_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::append_values_from_block(dest, src, begin_pos, len); } @@ -186,10 +184,10 @@ { case _Block1::block_type: _Block1::assign_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block2::block_type: _Block2::assign_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::assign_values_from_block(dest, src, begin_pos, len); } @@ -202,33 +200,31 @@ { case _Block1::block_type: _Block1::prepend_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block2::block_type: _Block2::prepend_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::prepend_values_from_block(dest, src, begin_pos, len); } } - static void swap_values( - base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) + static void swap_values(base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) { switch (get_block_type(blk1)) { case _Block1::block_type: _Block1::swap_values(blk1, blk2, pos1, pos2, len); - break; + break; case _Block2::block_type: _Block2::swap_values(blk1, blk2, pos1, pos2, len); - break; + break; default: element_block_func_base::swap_values(blk1, blk2, pos1, pos2, len); } } - static bool equal_block( - const base_element_block& left, const base_element_block& right) + static bool equal_block(const base_element_block& left, const base_element_block& right) { if (get_block_type(left) == _Block1::block_type) { @@ -259,10 +255,10 @@ { case _Block1::block_type: _Block1::overwrite_values(block, pos, len); - break; + break; case _Block2::block_type: _Block2::overwrite_values(block, pos, len); - break; + break; default: element_block_func::overwrite_values(block, pos, len); } @@ -274,10 +270,10 @@ { case _Block1::block_type: _Block1::shrink_to_fit(block); - break; + break; case _Block2::block_type: _Block2::shrink_to_fit(block); - break; + break; default: element_block_func::shrink_to_fit(block); } @@ -297,7 +293,7 @@ } }; -}} +}} // namespace mdds::mtv /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/custom_func3.hpp mdds-2.0.3/include/mdds/multi_type_vector/custom_func3.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/custom_func3.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/custom_func3.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -47,8 +47,7 @@ return _Block2::create_block(init_size); case _Block3::block_type: return _Block3::create_block(init_size); - default: - ; + default:; } return element_block_func::create_new_block(type, init_size); @@ -64,8 +63,7 @@ return _Block2::clone_block(block); case _Block3::block_type: return _Block3::clone_block(block); - default: - ; + default:; } return element_block_func::clone_block(block); @@ -80,13 +78,13 @@ { case _Block1::block_type: _Block1::delete_block(p); - break; + break; case _Block2::block_type: _Block2::delete_block(p); - break; + break; case _Block3::block_type: _Block3::delete_block(p); - break; + break; default: element_block_func::delete_block(p); } @@ -98,13 +96,13 @@ { case _Block1::block_type: _Block1::resize_block(block, new_size); - break; + break; case _Block2::block_type: _Block2::resize_block(block, new_size); - break; + break; case _Block3::block_type: _Block3::resize_block(block, new_size); - break; + break; default: element_block_func::resize_block(block, new_size); } @@ -116,13 +114,13 @@ { case _Block1::block_type: _Block1::print_block(block); - break; + break; case _Block2::block_type: _Block2::print_block(block); - break; + break; case _Block3::block_type: _Block3::print_block(block); - break; + break; default: element_block_func::print_block(block); } @@ -134,13 +132,13 @@ { case _Block1::block_type: _Block1::erase_block(block, pos); - break; + break; case _Block2::block_type: _Block2::erase_block(block, pos); - break; + break; case _Block3::block_type: _Block3::erase_block(block, pos); - break; + break; default: element_block_func::erase(block, pos); } @@ -152,13 +150,13 @@ { case _Block1::block_type: _Block1::erase_block(block, pos, size); - break; + break; case _Block2::block_type: _Block2::erase_block(block, pos, size); - break; + break; case _Block3::block_type: _Block3::erase_block(block, pos, size); - break; + break; default: element_block_func_base::erase(block, pos, size); } @@ -170,13 +168,13 @@ { case _Block1::block_type: _Block1::append_values_from_block(dest, src); - break; + break; case _Block2::block_type: _Block2::append_values_from_block(dest, src); - break; + break; case _Block3::block_type: _Block3::append_values_from_block(dest, src); - break; + break; default: element_block_func_base::append_values_from_block(dest, src); } @@ -189,13 +187,13 @@ { case _Block1::block_type: _Block1::append_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block2::block_type: _Block2::append_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block3::block_type: _Block3::append_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::append_values_from_block(dest, src, begin_pos, len); } @@ -208,13 +206,13 @@ { case _Block1::block_type: _Block1::assign_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block2::block_type: _Block2::assign_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block3::block_type: _Block3::assign_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::assign_values_from_block(dest, src, begin_pos, len); } @@ -227,39 +225,37 @@ { case _Block1::block_type: _Block1::prepend_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block2::block_type: _Block2::prepend_values_from_block(dest, src, begin_pos, len); - break; + break; case _Block3::block_type: _Block3::prepend_values_from_block(dest, src, begin_pos, len); - break; + break; default: element_block_func_base::prepend_values_from_block(dest, src, begin_pos, len); } } - static void swap_values( - base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) + static void swap_values(base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) { switch (get_block_type(blk1)) { case _Block1::block_type: _Block1::swap_values(blk1, blk2, pos1, pos2, len); - break; + break; case _Block2::block_type: _Block2::swap_values(blk1, blk2, pos1, pos2, len); - break; + break; case _Block3::block_type: _Block3::swap_values(blk1, blk2, pos1, pos2, len); - break; + break; default: element_block_func_base::swap_values(blk1, blk2, pos1, pos2, len); } } - static bool equal_block( - const base_element_block& left, const base_element_block& right) + static bool equal_block(const base_element_block& left, const base_element_block& right) { if (get_block_type(left) == _Block1::block_type) { @@ -300,13 +296,13 @@ { case _Block1::block_type: _Block1::overwrite_values(block, pos, len); - break; + break; case _Block2::block_type: _Block2::overwrite_values(block, pos, len); - break; + break; case _Block3::block_type: _Block3::overwrite_values(block, pos, len); - break; + break; default: element_block_func::overwrite_values(block, pos, len); } @@ -318,13 +314,13 @@ { case _Block1::block_type: _Block1::shrink_to_fit(block); - break; + break; case _Block2::block_type: _Block2::shrink_to_fit(block); - break; + break; case _Block3::block_type: _Block3::shrink_to_fit(block); - break; + break; default: element_block_func::shrink_to_fit(block); } @@ -346,8 +342,7 @@ } }; -}} +}} // namespace mdds::mtv #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/iterator_node.hpp mdds-2.0.3/include/mdds/multi_type_vector/iterator_node.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/iterator_node.hpp 2021-07-26 22:05:24.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/iterator_node.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -37,18 +37,20 @@ * What the end position stores in its private data is totally & * intentionally undefined. */ -template +template struct iterator_value_node { - using size_type = _SizeT; + using parent_type = ParentT; + using size_type = SizeT; mdds::mtv::element_t type; size_type position; size_type size; mdds::mtv::base_element_block* data; - iterator_value_node(size_type block_index) : - type(mdds::mtv::element_type_empty), position(0), size(0), data(nullptr), __private_data(block_index) {} + iterator_value_node(const parent_type* parent, size_type block_index) + : type(mdds::mtv::element_type_empty), position(0), size(0), data(nullptr), __private_data(parent, block_index) + {} void swap(iterator_value_node& other) { @@ -62,44 +64,50 @@ struct private_data { + const parent_type* parent; size_type block_index; - private_data() : block_index(0) {} - private_data(size_type _block_index) : - block_index(_block_index) {} + private_data() : parent(nullptr), block_index(0) + {} + private_data(const parent_type* _parent, size_type _block_index) : parent(_parent), block_index(_block_index) + {} void swap(private_data& other) { + std::swap(parent, other.parent); std::swap(block_index, other.block_index); } }; private_data __private_data; - bool operator== (const iterator_value_node& other) const + bool operator==(const iterator_value_node& other) const { return type == other.type && position == other.position && size == other.size && data == other.data && - __private_data.block_index == other.__private_data.block_index; + __private_data.parent == other.__private_data.parent && + __private_data.block_index == other.__private_data.block_index; } - bool operator!= (const iterator_value_node& other) const + bool operator!=(const iterator_value_node& other) const { - return !operator== (other); + return !operator==(other); } }; -template +template struct private_data_no_update { - using node_type = iterator_value_node<_SizeT>; + using node_type = iterator_value_node; - static void inc(node_type&) {} - static void dec(node_type&) {} + static void inc(node_type&) + {} + static void dec(node_type&) + {} }; -template +template struct private_data_forward_update { - using node_type = iterator_value_node<_SizeT>; + using node_type = iterator_value_node; static void inc(node_type& nd) { @@ -112,9 +120,8 @@ } }; -}}} +}}} // namespace mdds::detail::mtv #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/macro.hpp mdds-2.0.3/include/mdds/multi_type_vector/macro.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/macro.hpp 2021-07-26 22:05:24.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/macro.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -28,154 +28,162 @@ #ifndef INCLUDED_MDDS_MULTI_TYPE_VECTOR_DIR_MACRO_HPP #define INCLUDED_MDDS_MULTI_TYPE_VECTOR_DIR_MACRO_HPP -#define MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(_type_,_type_id_,_empty_val_,_block_) \ - \ -inline mdds::mtv::element_t mdds_mtv_get_element_type(const _type_&) \ -{ \ - return _type_id_; \ -} \ - \ -inline void mdds_mtv_get_empty_value(_type_& val) \ -{ \ - val = _empty_val_; \ -} \ - \ -inline void mdds_mtv_set_value(mdds::mtv::base_element_block& block, size_t pos, const _type_& val) \ -{ \ - _block_::set_value(block, pos, val); \ -} \ - \ -inline void mdds_mtv_get_value(const mdds::mtv::base_element_block& block, size_t pos, _type_& val) \ -{ \ - _block_::get_value(block, pos, val); \ -} \ - \ -template \ -void mdds_mtv_set_values( \ - mdds::mtv::base_element_block& block, size_t pos, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::set_values(block, pos, it_begin, it_end); \ -} \ - \ -inline void mdds_mtv_append_value(mdds::mtv::base_element_block& block, const _type_& val) \ -{ \ - _block_::append_value(block, val); \ -} \ - \ -inline void mdds_mtv_prepend_value(mdds::mtv::base_element_block& block, const _type_& val) \ -{ \ - _block_::prepend_value(block, val); \ -} \ - \ -template \ -void mdds_mtv_prepend_values(mdds::mtv::base_element_block& block, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::prepend_values(block, it_begin, it_end); \ -} \ - \ -template \ -void mdds_mtv_append_values(mdds::mtv::base_element_block& block, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::append_values(block, it_begin, it_end); \ -} \ - \ -template \ -void mdds_mtv_assign_values(mdds::mtv::base_element_block& dest, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::assign_values(dest, it_begin, it_end); \ -} \ - \ -template \ -void mdds_mtv_insert_values( \ - mdds::mtv::base_element_block& block, size_t pos, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::insert_values(block, pos, it_begin, it_end); \ -} \ - \ -inline mdds::mtv::base_element_block* mdds_mtv_create_new_block(size_t init_size, const _type_& val) \ -{ \ - return _block_::create_block_with_value(init_size, val); \ -} \ - \ -template \ -mdds::mtv::base_element_block* mdds_mtv_create_new_block(const _type_&, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - return _block_::create_block_with_values(it_begin, it_end); \ -} +#define MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(_type_, _type_id_, _empty_val_, _block_) \ +\ + inline mdds::mtv::element_t mdds_mtv_get_element_type(const _type_&) \ + { \ + return _type_id_; \ + } \ +\ + inline void mdds_mtv_get_empty_value(_type_& val) \ + { \ + val = _empty_val_; \ + } \ +\ + inline void mdds_mtv_set_value(mdds::mtv::base_element_block& block, size_t pos, const _type_& val) \ + { \ + _block_::set_value(block, pos, val); \ + } \ +\ + inline void mdds_mtv_get_value(const mdds::mtv::base_element_block& block, size_t pos, _type_& val) \ + { \ + _block_::get_value(block, pos, val); \ + } \ +\ + template \ + void mdds_mtv_set_values( \ + mdds::mtv::base_element_block& block, size_t pos, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::set_values(block, pos, it_begin, it_end); \ + } \ +\ + inline void mdds_mtv_append_value(mdds::mtv::base_element_block& block, const _type_& val) \ + { \ + _block_::append_value(block, val); \ + } \ +\ + inline void mdds_mtv_prepend_value(mdds::mtv::base_element_block& block, const _type_& val) \ + { \ + _block_::prepend_value(block, val); \ + } \ +\ + template \ + void mdds_mtv_prepend_values( \ + mdds::mtv::base_element_block& block, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::prepend_values(block, it_begin, it_end); \ + } \ +\ + template \ + void mdds_mtv_append_values( \ + mdds::mtv::base_element_block& block, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::append_values(block, it_begin, it_end); \ + } \ +\ + template \ + void mdds_mtv_assign_values( \ + mdds::mtv::base_element_block& dest, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::assign_values(dest, it_begin, it_end); \ + } \ +\ + template \ + void mdds_mtv_insert_values( \ + mdds::mtv::base_element_block& block, size_t pos, const _type_&, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::insert_values(block, pos, it_begin, it_end); \ + } \ +\ + inline mdds::mtv::base_element_block* mdds_mtv_create_new_block(size_t init_size, const _type_& val) \ + { \ + return _block_::create_block_with_value(init_size, val); \ + } \ +\ + template \ + mdds::mtv::base_element_block* mdds_mtv_create_new_block( \ + const _type_&, const _Iter& it_begin, const _Iter& it_end) \ + { \ + return _block_::create_block_with_values(it_begin, it_end); \ + } -#define MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(_type_,_type_id_,_empty_val_,_block_) \ - \ -inline mdds::mtv::element_t mdds_mtv_get_element_type(const _type_*) \ -{ \ - return _type_id_; \ -} \ - \ -inline void mdds_mtv_get_empty_value(_type_*& val) \ -{ \ - val = _empty_val_; \ -} \ - \ -inline void mdds_mtv_set_value(mdds::mtv::base_element_block& block, size_t pos, _type_* val) \ -{ \ - _block_::set_value(block, pos, val); \ -} \ - \ -inline void mdds_mtv_get_value(const mdds::mtv::base_element_block& block, size_t pos, _type_*& val) \ -{ \ - _block_::get_value(block, pos, val); \ -} \ - \ -template \ -void mdds_mtv_set_values( \ - mdds::mtv::base_element_block& block, size_t pos, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::set_values(block, pos, it_begin, it_end); \ -} \ - \ -inline void mdds_mtv_append_value(mdds::mtv::base_element_block& block, _type_* val) \ -{ \ - _block_::append_value(block, val); \ -} \ - \ -inline void mdds_mtv_prepend_value(mdds::mtv::base_element_block& block, _type_* val) \ -{ \ - _block_::prepend_value(block, val); \ -} \ - \ -template \ -void mdds_mtv_prepend_values(mdds::mtv::base_element_block& block, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::prepend_values(block, it_begin, it_end); \ -} \ - \ -template \ -void mdds_mtv_append_values(mdds::mtv::base_element_block& block, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::append_values(block, it_begin, it_end); \ -} \ - \ -template \ -void mdds_mtv_assign_values(mdds::mtv::base_element_block& dest, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::assign_values(dest, it_begin, it_end); \ -} \ - \ -template \ -void mdds_mtv_insert_values( \ - mdds::mtv::base_element_block& block, size_t pos, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - _block_::insert_values(block, pos, it_begin, it_end); \ -} \ - \ -inline mdds::mtv::base_element_block* mdds_mtv_create_new_block(size_t init_size, _type_* val) \ -{ \ - return _block_::create_block_with_value(init_size, val); \ -} \ - \ -template \ -mdds::mtv::base_element_block* mdds_mtv_create_new_block(const _type_*, const _Iter& it_begin, const _Iter& it_end) \ -{ \ - return _block_::create_block_with_values(it_begin, it_end); \ -} +#define MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(_type_, _type_id_, _empty_val_, _block_) \ +\ + inline mdds::mtv::element_t mdds_mtv_get_element_type(const _type_*) \ + { \ + return _type_id_; \ + } \ +\ + inline void mdds_mtv_get_empty_value(_type_*& val) \ + { \ + val = _empty_val_; \ + } \ +\ + inline void mdds_mtv_set_value(mdds::mtv::base_element_block& block, size_t pos, _type_* val) \ + { \ + _block_::set_value(block, pos, val); \ + } \ +\ + inline void mdds_mtv_get_value(const mdds::mtv::base_element_block& block, size_t pos, _type_*& val) \ + { \ + _block_::get_value(block, pos, val); \ + } \ +\ + template \ + void mdds_mtv_set_values( \ + mdds::mtv::base_element_block& block, size_t pos, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::set_values(block, pos, it_begin, it_end); \ + } \ +\ + inline void mdds_mtv_append_value(mdds::mtv::base_element_block& block, _type_* val) \ + { \ + _block_::append_value(block, val); \ + } \ +\ + inline void mdds_mtv_prepend_value(mdds::mtv::base_element_block& block, _type_* val) \ + { \ + _block_::prepend_value(block, val); \ + } \ +\ + template \ + void mdds_mtv_prepend_values( \ + mdds::mtv::base_element_block& block, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::prepend_values(block, it_begin, it_end); \ + } \ +\ + template \ + void mdds_mtv_append_values( \ + mdds::mtv::base_element_block& block, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::append_values(block, it_begin, it_end); \ + } \ +\ + template \ + void mdds_mtv_assign_values( \ + mdds::mtv::base_element_block& dest, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::assign_values(dest, it_begin, it_end); \ + } \ +\ + template \ + void mdds_mtv_insert_values( \ + mdds::mtv::base_element_block& block, size_t pos, const _type_*, const _Iter& it_begin, const _Iter& it_end) \ + { \ + _block_::insert_values(block, pos, it_begin, it_end); \ + } \ +\ + inline mdds::mtv::base_element_block* mdds_mtv_create_new_block(size_t init_size, _type_* val) \ + { \ + return _block_::create_block_with_value(init_size, val); \ + } \ +\ + template \ + mdds::mtv::base_element_block* mdds_mtv_create_new_block( \ + const _type_*, const _Iter& it_begin, const _Iter& it_end) \ + { \ + return _block_::create_block_with_values(it_begin, it_end); \ + } #endif diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/Makefile.in mdds-2.0.3/include/mdds/multi_type_vector/Makefile.in --- mdds-2.0.2/include/mdds/multi_type_vector/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -179,8 +179,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -220,9 +218,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -234,11 +233,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -482,7 +480,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/soa/block_util.hpp mdds-2.0.3/include/mdds/multi_type_vector/soa/block_util.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/soa/block_util.hpp 2021-11-02 22:21:11.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/soa/block_util.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -39,9 +39,7 @@ #include #endif -namespace mdds { namespace mtv { namespace soa { - -namespace detail { +namespace mdds { namespace mtv { namespace soa { namespace detail { template struct adjust_block_positions @@ -63,7 +61,7 @@ return; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < n; ++i) block_store.positions[i] += delta; @@ -86,14 +84,14 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 4) { - block_store.positions[i+0] += delta; - block_store.positions[i+1] += delta; - block_store.positions[i+2] += delta; - block_store.positions[i+3] += delta; + block_store.positions[i + 0] += delta; + block_store.positions[i + 1] += delta; + block_store.positions[i + 2] += delta; + block_store.positions[i + 3] += delta; } rem += len; @@ -118,18 +116,18 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 8) { - block_store.positions[i+0] += delta; - block_store.positions[i+1] += delta; - block_store.positions[i+2] += delta; - block_store.positions[i+3] += delta; - block_store.positions[i+4] += delta; - block_store.positions[i+5] += delta; - block_store.positions[i+6] += delta; - block_store.positions[i+7] += delta; + block_store.positions[i + 0] += delta; + block_store.positions[i + 1] += delta; + block_store.positions[i + 2] += delta; + block_store.positions[i + 3] += delta; + block_store.positions[i + 4] += delta; + block_store.positions[i + 5] += delta; + block_store.positions[i + 6] += delta; + block_store.positions[i + 7] += delta; } rem += len; @@ -154,26 +152,26 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 16) { - block_store.positions[i+0] += delta; - block_store.positions[i+1] += delta; - block_store.positions[i+2] += delta; - block_store.positions[i+3] += delta; - block_store.positions[i+4] += delta; - block_store.positions[i+5] += delta; - block_store.positions[i+6] += delta; - block_store.positions[i+7] += delta; - block_store.positions[i+8] += delta; - block_store.positions[i+9] += delta; - block_store.positions[i+10] += delta; - block_store.positions[i+11] += delta; - block_store.positions[i+12] += delta; - block_store.positions[i+13] += delta; - block_store.positions[i+14] += delta; - block_store.positions[i+15] += delta; + block_store.positions[i + 0] += delta; + block_store.positions[i + 1] += delta; + block_store.positions[i + 2] += delta; + block_store.positions[i + 3] += delta; + block_store.positions[i + 4] += delta; + block_store.positions[i + 5] += delta; + block_store.positions[i + 6] += delta; + block_store.positions[i + 7] += delta; + block_store.positions[i + 8] += delta; + block_store.positions[i + 9] += delta; + block_store.positions[i + 10] += delta; + block_store.positions[i + 11] += delta; + block_store.positions[i + 12] += delta; + block_store.positions[i + 13] += delta; + block_store.positions[i + 14] += delta; + block_store.positions[i + 15] += delta; } rem += len; @@ -198,42 +196,42 @@ len -= rem; len += start_block_index; #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 32) { - block_store.positions[i+0] += delta; - block_store.positions[i+1] += delta; - block_store.positions[i+2] += delta; - block_store.positions[i+3] += delta; - block_store.positions[i+4] += delta; - block_store.positions[i+5] += delta; - block_store.positions[i+6] += delta; - block_store.positions[i+7] += delta; - block_store.positions[i+8] += delta; - block_store.positions[i+9] += delta; - block_store.positions[i+10] += delta; - block_store.positions[i+11] += delta; - block_store.positions[i+12] += delta; - block_store.positions[i+13] += delta; - block_store.positions[i+14] += delta; - block_store.positions[i+15] += delta; - block_store.positions[i+16] += delta; - block_store.positions[i+17] += delta; - block_store.positions[i+18] += delta; - block_store.positions[i+19] += delta; - block_store.positions[i+20] += delta; - block_store.positions[i+21] += delta; - block_store.positions[i+22] += delta; - block_store.positions[i+23] += delta; - block_store.positions[i+24] += delta; - block_store.positions[i+25] += delta; - block_store.positions[i+26] += delta; - block_store.positions[i+27] += delta; - block_store.positions[i+28] += delta; - block_store.positions[i+29] += delta; - block_store.positions[i+30] += delta; - block_store.positions[i+31] += delta; + block_store.positions[i + 0] += delta; + block_store.positions[i + 1] += delta; + block_store.positions[i + 2] += delta; + block_store.positions[i + 3] += delta; + block_store.positions[i + 4] += delta; + block_store.positions[i + 5] += delta; + block_store.positions[i + 6] += delta; + block_store.positions[i + 7] += delta; + block_store.positions[i + 8] += delta; + block_store.positions[i + 9] += delta; + block_store.positions[i + 10] += delta; + block_store.positions[i + 11] += delta; + block_store.positions[i + 12] += delta; + block_store.positions[i + 13] += delta; + block_store.positions[i + 14] += delta; + block_store.positions[i + 15] += delta; + block_store.positions[i + 16] += delta; + block_store.positions[i + 17] += delta; + block_store.positions[i + 18] += delta; + block_store.positions[i + 19] += delta; + block_store.positions[i + 20] += delta; + block_store.positions[i + 21] += delta; + block_store.positions[i + 22] += delta; + block_store.positions[i + 23] += delta; + block_store.positions[i + 24] += delta; + block_store.positions[i + 25] += delta; + block_store.positions[i + 26] += delta; + block_store.positions[i + 27] += delta; + block_store.positions[i + 28] += delta; + block_store.positions[i + 29] += delta; + block_store.positions[i + 30] += delta; + block_store.positions[i + 31] += delta; } rem += len; @@ -269,7 +267,7 @@ __m128i right = _mm_set_epi64x(delta, delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 2) { @@ -305,20 +303,20 @@ __m128i right = _mm_set_epi64x(delta, delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 8) { __m128i* dst0 = (__m128i*)&block_store.positions[i]; _mm_storeu_si128(dst0, _mm_add_epi64(_mm_loadu_si128(dst0), right)); - __m128i* dst2 = (__m128i*)&block_store.positions[i+2]; + __m128i* dst2 = (__m128i*)&block_store.positions[i + 2]; _mm_storeu_si128(dst2, _mm_add_epi64(_mm_loadu_si128(dst2), right)); - __m128i* dst4 = (__m128i*)&block_store.positions[i+4]; + __m128i* dst4 = (__m128i*)&block_store.positions[i + 4]; _mm_storeu_si128(dst4, _mm_add_epi64(_mm_loadu_si128(dst4), right)); - __m128i* dst6 = (__m128i*)&block_store.positions[i+6]; + __m128i* dst6 = (__m128i*)&block_store.positions[i + 6]; _mm_storeu_si128(dst6, _mm_add_epi64(_mm_loadu_si128(dst6), right)); } @@ -351,32 +349,32 @@ __m128i right = _mm_set_epi64x(delta, delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 16) { __m128i* dst0 = (__m128i*)&block_store.positions[i]; _mm_storeu_si128(dst0, _mm_add_epi64(_mm_loadu_si128(dst0), right)); - __m128i* dst2 = (__m128i*)&block_store.positions[i+2]; + __m128i* dst2 = (__m128i*)&block_store.positions[i + 2]; _mm_storeu_si128(dst2, _mm_add_epi64(_mm_loadu_si128(dst2), right)); - __m128i* dst4 = (__m128i*)&block_store.positions[i+4]; + __m128i* dst4 = (__m128i*)&block_store.positions[i + 4]; _mm_storeu_si128(dst4, _mm_add_epi64(_mm_loadu_si128(dst4), right)); - __m128i* dst6 = (__m128i*)&block_store.positions[i+6]; + __m128i* dst6 = (__m128i*)&block_store.positions[i + 6]; _mm_storeu_si128(dst6, _mm_add_epi64(_mm_loadu_si128(dst6), right)); - __m128i* dst8 = (__m128i*)&block_store.positions[i+8]; + __m128i* dst8 = (__m128i*)&block_store.positions[i + 8]; _mm_storeu_si128(dst8, _mm_add_epi64(_mm_loadu_si128(dst8), right)); - __m128i* dst10 = (__m128i*)&block_store.positions[i+10]; + __m128i* dst10 = (__m128i*)&block_store.positions[i + 10]; _mm_storeu_si128(dst10, _mm_add_epi64(_mm_loadu_si128(dst10), right)); - __m128i* dst12 = (__m128i*)&block_store.positions[i+12]; + __m128i* dst12 = (__m128i*)&block_store.positions[i + 12]; _mm_storeu_si128(dst12, _mm_add_epi64(_mm_loadu_si128(dst12), right)); - __m128i* dst14 = (__m128i*)&block_store.positions[i+14]; + __m128i* dst14 = (__m128i*)&block_store.positions[i + 14]; _mm_storeu_si128(dst14, _mm_add_epi64(_mm_loadu_si128(dst14), right)); } @@ -409,56 +407,56 @@ __m128i right = _mm_set_epi64x(delta, delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 32) { __m128i* dst0 = (__m128i*)&block_store.positions[i]; _mm_storeu_si128(dst0, _mm_add_epi64(_mm_loadu_si128(dst0), right)); - __m128i* dst2 = (__m128i*)&block_store.positions[i+2]; + __m128i* dst2 = (__m128i*)&block_store.positions[i + 2]; _mm_storeu_si128(dst2, _mm_add_epi64(_mm_loadu_si128(dst2), right)); - __m128i* dst4 = (__m128i*)&block_store.positions[i+4]; + __m128i* dst4 = (__m128i*)&block_store.positions[i + 4]; _mm_storeu_si128(dst4, _mm_add_epi64(_mm_loadu_si128(dst4), right)); - __m128i* dst6 = (__m128i*)&block_store.positions[i+6]; + __m128i* dst6 = (__m128i*)&block_store.positions[i + 6]; _mm_storeu_si128(dst6, _mm_add_epi64(_mm_loadu_si128(dst6), right)); - __m128i* dst8 = (__m128i*)&block_store.positions[i+8]; + __m128i* dst8 = (__m128i*)&block_store.positions[i + 8]; _mm_storeu_si128(dst8, _mm_add_epi64(_mm_loadu_si128(dst8), right)); - __m128i* dst10 = (__m128i*)&block_store.positions[i+10]; + __m128i* dst10 = (__m128i*)&block_store.positions[i + 10]; _mm_storeu_si128(dst10, _mm_add_epi64(_mm_loadu_si128(dst10), right)); - __m128i* dst12 = (__m128i*)&block_store.positions[i+12]; + __m128i* dst12 = (__m128i*)&block_store.positions[i + 12]; _mm_storeu_si128(dst12, _mm_add_epi64(_mm_loadu_si128(dst12), right)); - __m128i* dst14 = (__m128i*)&block_store.positions[i+14]; + __m128i* dst14 = (__m128i*)&block_store.positions[i + 14]; _mm_storeu_si128(dst14, _mm_add_epi64(_mm_loadu_si128(dst14), right)); - __m128i* dst16 = (__m128i*)&block_store.positions[i+16]; + __m128i* dst16 = (__m128i*)&block_store.positions[i + 16]; _mm_storeu_si128(dst16, _mm_add_epi64(_mm_loadu_si128(dst16), right)); - __m128i* dst18 = (__m128i*)&block_store.positions[i+18]; + __m128i* dst18 = (__m128i*)&block_store.positions[i + 18]; _mm_storeu_si128(dst18, _mm_add_epi64(_mm_loadu_si128(dst18), right)); - __m128i* dst20 = (__m128i*)&block_store.positions[i+20]; + __m128i* dst20 = (__m128i*)&block_store.positions[i + 20]; _mm_storeu_si128(dst20, _mm_add_epi64(_mm_loadu_si128(dst20), right)); - __m128i* dst22 = (__m128i*)&block_store.positions[i+22]; + __m128i* dst22 = (__m128i*)&block_store.positions[i + 22]; _mm_storeu_si128(dst22, _mm_add_epi64(_mm_loadu_si128(dst22), right)); - __m128i* dst24 = (__m128i*)&block_store.positions[i+24]; + __m128i* dst24 = (__m128i*)&block_store.positions[i + 24]; _mm_storeu_si128(dst24, _mm_add_epi64(_mm_loadu_si128(dst24), right)); - __m128i* dst26 = (__m128i*)&block_store.positions[i+26]; + __m128i* dst26 = (__m128i*)&block_store.positions[i + 26]; _mm_storeu_si128(dst26, _mm_add_epi64(_mm_loadu_si128(dst26), right)); - __m128i* dst28 = (__m128i*)&block_store.positions[i+28]; + __m128i* dst28 = (__m128i*)&block_store.positions[i + 28]; _mm_storeu_si128(dst28, _mm_add_epi64(_mm_loadu_si128(dst28), right)); - __m128i* dst30 = (__m128i*)&block_store.positions[i+30]; + __m128i* dst30 = (__m128i*)&block_store.positions[i + 30]; _mm_storeu_si128(dst30, _mm_add_epi64(_mm_loadu_si128(dst30), right)); } @@ -495,7 +493,7 @@ __m256i right = _mm256_set1_epi64x(delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 4) { @@ -532,20 +530,20 @@ __m256i right = _mm256_set1_epi64x(delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 16) { __m256i* dst = (__m256i*)&block_store.positions[i]; _mm256_storeu_si256(dst, _mm256_add_epi64(_mm256_loadu_si256(dst), right)); - __m256i* dst4 = (__m256i*)&block_store.positions[i+4]; + __m256i* dst4 = (__m256i*)&block_store.positions[i + 4]; _mm256_storeu_si256(dst4, _mm256_add_epi64(_mm256_loadu_si256(dst4), right)); - __m256i* dst8 = (__m256i*)&block_store.positions[i+8]; + __m256i* dst8 = (__m256i*)&block_store.positions[i + 8]; _mm256_storeu_si256(dst8, _mm256_add_epi64(_mm256_loadu_si256(dst8), right)); - __m256i* dst12 = (__m256i*)&block_store.positions[i+12]; + __m256i* dst12 = (__m256i*)&block_store.positions[i + 12]; _mm256_storeu_si256(dst12, _mm256_add_epi64(_mm256_loadu_si256(dst12), right)); } @@ -578,32 +576,32 @@ __m256i right = _mm256_set1_epi64x(delta); #if MDDS_USE_OPENMP - #pragma omp parallel for +#pragma omp parallel for #endif for (int64_t i = start_block_index; i < len; i += 32) { __m256i* dst = (__m256i*)&block_store.positions[i]; _mm256_storeu_si256(dst, _mm256_add_epi64(_mm256_loadu_si256(dst), right)); - __m256i* dst4 = (__m256i*)&block_store.positions[i+4]; + __m256i* dst4 = (__m256i*)&block_store.positions[i + 4]; _mm256_storeu_si256(dst4, _mm256_add_epi64(_mm256_loadu_si256(dst4), right)); - __m256i* dst8 = (__m256i*)&block_store.positions[i+8]; + __m256i* dst8 = (__m256i*)&block_store.positions[i + 8]; _mm256_storeu_si256(dst8, _mm256_add_epi64(_mm256_loadu_si256(dst8), right)); - __m256i* dst12 = (__m256i*)&block_store.positions[i+12]; + __m256i* dst12 = (__m256i*)&block_store.positions[i + 12]; _mm256_storeu_si256(dst12, _mm256_add_epi64(_mm256_loadu_si256(dst12), right)); - __m256i* dst16 = (__m256i*)&block_store.positions[i+16]; + __m256i* dst16 = (__m256i*)&block_store.positions[i + 16]; _mm256_storeu_si256(dst16, _mm256_add_epi64(_mm256_loadu_si256(dst16), right)); - __m256i* dst20 = (__m256i*)&block_store.positions[i+20]; + __m256i* dst20 = (__m256i*)&block_store.positions[i + 20]; _mm256_storeu_si256(dst20, _mm256_add_epi64(_mm256_loadu_si256(dst20), right)); - __m256i* dst24 = (__m256i*)&block_store.positions[i+24]; + __m256i* dst24 = (__m256i*)&block_store.positions[i + 24]; _mm256_storeu_si256(dst24, _mm256_add_epi64(_mm256_loadu_si256(dst24), right)); - __m256i* dst28 = (__m256i*)&block_store.positions[i+28]; + __m256i* dst28 = (__m256i*)&block_store.positions[i + 28]; _mm256_storeu_si256(dst28, _mm256_add_epi64(_mm256_loadu_si256(dst28), right)); } @@ -615,11 +613,8 @@ #endif // __AVX2__ -} // namespace detail - -}}} +}}}} // namespace mdds::mtv::soa::detail #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/soa/iterator.hpp mdds-2.0.3/include/mdds/multi_type_vector/soa/iterator.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/soa/iterator.hpp 2022-02-11 14:50:43.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/soa/iterator.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -51,21 +51,21 @@ *
  • element_blocks_type
  • * */ -template +template class iterator_updater { protected: - using parent_type = typename _Trait::parent; - using positions_type = typename _Trait::positions_type; - using sizes_type = typename _Trait::sizes_type; - using element_blocks_type = typename _Trait::element_blocks_type; - using size_type = typename _Trait::parent::size_type; - - using node = mdds::detail::mtv::iterator_value_node; - - using positions_iterator_type = typename _Trait::positions_iterator_type; - using sizes_iterator_type = typename _Trait::sizes_iterator_type; - using element_blocks_iterator_type = typename _Trait::element_blocks_iterator_type; + using parent_type = typename Trait::parent; + using positions_type = typename Trait::positions_type; + using sizes_type = typename Trait::sizes_type; + using element_blocks_type = typename Trait::element_blocks_type; + using size_type = typename Trait::parent::size_type; + + using node = mdds::detail::mtv::iterator_value_node; + + using positions_iterator_type = typename Trait::positions_iterator_type; + using sizes_iterator_type = typename Trait::sizes_iterator_type; + using element_blocks_iterator_type = typename Trait::element_blocks_iterator_type; /** * This struct groups together the iterators for the three array types for @@ -93,9 +93,8 @@ bool operator==(const grouped_iterator_type& other) const { - return position_iterator == other.position_iterator && - size_iterator == other.size_iterator && - element_block_iterator == other.element_block_iterator; + return position_iterator == other.position_iterator && size_iterator == other.size_iterator && + element_block_iterator == other.element_block_iterator; } bool operator!=(const grouped_iterator_type& other) const @@ -106,54 +105,39 @@ grouped_iterator_type() = default; grouped_iterator_type( - const positions_iterator_type& itr_pos, - const sizes_iterator_type& itr_size, - const element_blocks_iterator_type& itr_elem_blocks) : - position_iterator(itr_pos), - size_iterator(itr_size), - element_block_iterator(itr_elem_blocks) - { - } + const positions_iterator_type& itr_pos, const sizes_iterator_type& itr_size, + const element_blocks_iterator_type& itr_elem_blocks) + : position_iterator(itr_pos), size_iterator(itr_size), element_block_iterator(itr_elem_blocks) + {} }; node m_cur_node; grouped_iterator_type m_pos; grouped_iterator_type m_end; - iterator_updater() : m_cur_node(0) {} + iterator_updater() : m_cur_node(nullptr, 0) + {} iterator_updater( - const grouped_iterator_type& pos, const grouped_iterator_type& end, size_type block_index) : - m_cur_node(block_index), - m_pos(pos), - m_end(end) + const grouped_iterator_type& pos, const grouped_iterator_type& end, const parent_type* parent, + size_type block_index) + : m_cur_node(parent, block_index), m_pos(pos), m_end(end) { if (m_pos != m_end) update_node(); } iterator_updater( - const positions_iterator_type& positions_pos, - const sizes_iterator_type& sizes_pos, - const element_blocks_iterator_type& eb_pos, - const positions_iterator_type& positions_end, - const sizes_iterator_type& sizes_end, - const element_blocks_iterator_type& eb_end, - size_type block_index) : - iterator_updater( - { positions_pos, sizes_pos, eb_pos }, - { positions_end, sizes_end, eb_end }, - block_index - ) - { - } - - iterator_updater(const iterator_updater& other) : - m_cur_node(other.m_cur_node), - m_pos(other.m_pos), - m_end(other.m_end) - { - } + const positions_iterator_type& positions_pos, const sizes_iterator_type& sizes_pos, + const element_blocks_iterator_type& eb_pos, const positions_iterator_type& positions_end, + const sizes_iterator_type& sizes_end, const element_blocks_iterator_type& eb_end, const parent_type* parent, + size_type block_index) + : iterator_updater({positions_pos, sizes_pos, eb_pos}, {positions_end, sizes_end, eb_end}, parent, block_index) + {} + + iterator_updater(const iterator_updater& other) + : m_cur_node(other.m_cur_node), m_pos(other.m_pos), m_end(other.m_end) + {} void update_node() { @@ -191,15 +175,15 @@ void _print_state(std::ostream& os) const { - os << "block-index=" << m_cur_node.__private_data.block_index - << "; position=" << m_cur_node.position - << "; size=" << m_cur_node.size - << "; type=" << m_cur_node.type - << "; data=" << m_cur_node.data; + auto prev_flags = os.flags(); + os << "parent=" << std::hex << m_cur_node.__private_data.parent + << "; block-index=" << m_cur_node.__private_data.block_index << "; position=" << m_cur_node.position + << "; size=" << m_cur_node.size << "; type=" << m_cur_node.type << "; data=" << m_cur_node.data; + os.flags(prev_flags); } public: - bool operator== (const iterator_updater& other) const + bool operator==(const iterator_updater& other) const { if (m_pos != m_end && other.m_pos != other.m_end) { @@ -211,12 +195,12 @@ return m_pos == other.m_pos && m_end == other.m_end; } - bool operator!= (const iterator_updater& other) const + bool operator!=(const iterator_updater& other) const { return !operator==(other); } - iterator_updater& operator= (const iterator_updater& other) + iterator_updater& operator=(const iterator_updater& other) { m_cur_node = other.m_cur_node; m_pos = other.m_pos; @@ -231,28 +215,37 @@ std::swap(m_end, other.m_end); } - const node& get_node() const { return m_cur_node; } - const grouped_iterator_type& get_pos() const { return m_pos; } - const grouped_iterator_type& get_end() const { return m_end; } + const node& get_node() const + { + return m_cur_node; + } + const grouped_iterator_type& get_pos() const + { + return m_pos; + } + const grouped_iterator_type& get_end() const + { + return m_end; + } }; -template -class iterator_base : public iterator_updater<_Trait> +template +class iterator_base : public iterator_updater { - using node_update_func = typename _Trait::private_data_update; - using updater = iterator_updater<_Trait>; + using parent_type = typename Trait::parent; + using node_update_func = typename Trait::private_data_update; + using updater = iterator_updater; using grouped_iterator_type = typename updater::grouped_iterator_type; using size_type = typename updater::size_type; - using updater::inc; using updater::dec; + using updater::inc; using updater::m_cur_node; public: - - using updater::get_pos; using updater::get_end; + using updater::get_pos; // iterator traits using value_type = typename updater::node; @@ -262,10 +255,13 @@ using iterator_category = std::bidirectional_iterator_tag; public: - iterator_base() {} + iterator_base() + {} iterator_base( - const grouped_iterator_type& pos, const grouped_iterator_type& end, size_type block_index) : - updater(pos, end, block_index) {} + const grouped_iterator_type& pos, const grouped_iterator_type& end, const parent_type* parent, + size_type block_index) + : updater(pos, end, parent, block_index) + {} value_type& operator*() { @@ -309,25 +305,25 @@ } }; -template -class const_iterator_base : public iterator_updater<_Trait> +template +class const_iterator_base : public iterator_updater { - using node_update_func = typename _Trait::private_data_update; - using updater = iterator_updater<_Trait>; + using parent_type = typename Trait::parent; + using node_update_func = typename Trait::private_data_update; + using updater = iterator_updater; using grouped_iterator_type = typename updater::grouped_iterator_type; using size_type = typename updater::size_type; - using updater::inc; using updater::dec; + using updater::inc; using updater::m_cur_node; public: - - using updater::get_pos; using updater::get_end; + using updater::get_pos; - using iterator_base = _NonConstItrBase; + using iterator_base = NonConstItrBase; // iterator traits using value_type = typename updater::node; @@ -337,23 +333,23 @@ using iterator_category = std::bidirectional_iterator_tag; public: - const_iterator_base() : updater() {} + const_iterator_base() : updater() + {} const_iterator_base( - const grouped_iterator_type& pos, const grouped_iterator_type& end, size_type block_index) : - updater(pos, end, block_index) {} + const grouped_iterator_type& pos, const grouped_iterator_type& end, const parent_type* parent, + size_type block_index) + : updater(pos, end, parent, block_index) + {} /** * Take the non-const iterator counterpart to create a const iterator. */ - const_iterator_base(const iterator_base& other) : - updater( - other.get_pos().position_iterator, - other.get_pos().size_iterator, - other.get_pos().element_block_iterator, - other.get_end().position_iterator, - other.get_end().size_iterator, - other.get_end().element_block_iterator, - other.get_node().__private_data.block_index) {} + const_iterator_base(const iterator_base& other) + : updater( + other.get_pos().position_iterator, other.get_pos().size_iterator, other.get_pos().element_block_iterator, + other.get_end().position_iterator, other.get_end().size_iterator, other.get_end().element_block_iterator, + other.get_node().__private_data.parent, other.get_node().__private_data.block_index) + {} const value_type& operator*() const { @@ -379,12 +375,12 @@ return *this; } - bool operator== (const const_iterator_base& other) const + bool operator==(const const_iterator_base& other) const { return updater::operator==(other); } - bool operator!= (const const_iterator_base& other) const + bool operator!=(const const_iterator_base& other) const { return updater::operator!=(other); } @@ -397,24 +393,22 @@ } }; -template -std::ostream& operator<< (std::ostream& os, const iterator_base<_Trait>& it) +template +std::ostream& operator<<(std::ostream& os, const iterator_base& it) { it._print_state(os); return os; } -template -std::ostream& operator<< (std::ostream& os, const const_iterator_base<_Trait, _NonConstItrBase>& it) +template +std::ostream& operator<<(std::ostream& os, const const_iterator_base& it) { it._print_state(os); return os; } -}}}} - +}}}} // namespace mdds::mtv::soa::detail #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/soa/main_def.inl mdds-2.0.3/include/mdds/multi_type_vector/soa/main_def.inl --- mdds-2.0.2/include/mdds/multi_type_vector/soa/main_def.inl 2022-02-11 14:50:43.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/soa/main_def.inl 2022-05-11 00:33:24.000000000 +0000 @@ -42,7 +42,8 @@ MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(uint64_t, mdds::mtv::element_type_uint64, 0, mdds::mtv::uint64_element_block) MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(float, mdds::mtv::element_type_float, 0.0, mdds::mtv::float_element_block) MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(double, mdds::mtv::element_type_double, 0.0, mdds::mtv::double_element_block) -MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(std::string, mdds::mtv::element_type_string, std::string(), mdds::mtv::string_element_block) +MDDS_MTV_DEFINE_ELEMENT_CALLBACKS( + std::string, mdds::mtv::element_type_string, std::string(), mdds::mtv::string_element_block) namespace detail { @@ -57,14 +58,11 @@ template multi_type_vector::blocks_type::blocks_type() -{ -} +{} template -multi_type_vector::blocks_type::blocks_type(const blocks_type& other) : - positions(other.positions), - sizes(other.sizes), - element_blocks(other.element_blocks) +multi_type_vector::blocks_type::blocks_type(const blocks_type& other) + : positions(other.positions), sizes(other.sizes), element_blocks(other.element_blocks) { for (element_block_type*& data : element_blocks) { @@ -74,12 +72,10 @@ } template -multi_type_vector::blocks_type::blocks_type(blocks_type&& other) : - positions(std::move(other.positions)), - sizes(std::move(other.sizes)), - element_blocks(std::move(other.element_blocks)) -{ -} +multi_type_vector::blocks_type::blocks_type(blocks_type&& other) + : positions(std::move(other.positions)), sizes(std::move(other.sizes)), + element_blocks(std::move(other.element_blocks)) +{} template void multi_type_vector::blocks_type::erase(size_type index) @@ -90,8 +86,7 @@ } template -void multi_type_vector::blocks_type::erase( - size_type index, size_type size) +void multi_type_vector::blocks_type::erase(size_type index, size_type size) { detail::erase(positions, index, size); detail::erase(sizes, index, size); @@ -99,8 +94,7 @@ } template -void multi_type_vector::blocks_type::insert( - size_type index, size_type size) +void multi_type_vector::blocks_type::insert(size_type index, size_type size) { positions.insert(positions.begin() + index, size, 0); sizes.insert(sizes.begin() + index, size, 0); @@ -117,12 +111,12 @@ } template -void multi_type_vector::blocks_type::insert( - size_type index, const blocks_type& new_blocks) +void multi_type_vector::blocks_type::insert(size_type index, const blocks_type& new_blocks) { - positions.insert(positions.begin()+index, new_blocks.positions.begin(), new_blocks.positions.end()); - sizes.insert(sizes.begin()+index, new_blocks.sizes.begin(), new_blocks.sizes.end()); - element_blocks.insert(element_blocks.begin()+index, new_blocks.element_blocks.begin(), new_blocks.element_blocks.end()); + positions.insert(positions.begin() + index, new_blocks.positions.begin(), new_blocks.positions.end()); + sizes.insert(sizes.begin() + index, new_blocks.sizes.begin(), new_blocks.sizes.end()); + element_blocks.insert( + element_blocks.begin() + index, new_blocks.element_blocks.begin(), new_blocks.element_blocks.end()); } template @@ -135,12 +129,12 @@ } assert(index < positions.size()); - positions[index] = positions[index-1] + sizes[index-1]; + positions[index] = positions[index - 1] + sizes[index - 1]; } template -typename multi_type_vector::size_type -multi_type_vector::blocks_type::calc_next_block_position(size_type index) +typename multi_type_vector::size_type multi_type_vector< + ElemBlockFunc, Trait>::blocks_type::calc_next_block_position(size_type index) { return positions[index] + sizes[index]; } @@ -234,8 +228,8 @@ } template -typename multi_type_vector::position_type -multi_type_vector::next_position(const position_type& pos) +typename multi_type_vector::position_type multi_type_vector::next_position( + const position_type& pos) { position_type ret = pos; if (pos.second + 1 < pos.first->size) @@ -253,15 +247,15 @@ } template -typename multi_type_vector::position_type -multi_type_vector::advance_position(const position_type& pos, int steps) +typename multi_type_vector::position_type multi_type_vector< + ElemBlockFunc, Trait>::advance_position(const position_type& pos, int steps) { return mdds::detail::mtv::advance_position(pos, steps); } template -typename multi_type_vector::const_position_type -multi_type_vector::next_position(const const_position_type& pos) +typename multi_type_vector::const_position_type multi_type_vector< + ElemBlockFunc, Trait>::next_position(const const_position_type& pos) { const_position_type ret = pos; if (pos.second + 1 < pos.first->size) @@ -279,30 +273,28 @@ } template -typename multi_type_vector::const_position_type -multi_type_vector::advance_position(const const_position_type& pos, int steps) +typename multi_type_vector::const_position_type multi_type_vector< + ElemBlockFunc, Trait>::advance_position(const const_position_type& pos, int steps) { return mdds::detail::mtv::advance_position(pos, steps); } template -typename multi_type_vector::size_type -multi_type_vector::logical_position(const const_position_type& pos) +typename multi_type_vector::size_type multi_type_vector::logical_position( + const const_position_type& pos) { return pos.first->position + pos.second; } template template -typename _Blk::value_type -multi_type_vector::get(const const_position_type& pos) +typename _Blk::value_type multi_type_vector::get(const const_position_type& pos) { return mdds::detail::mtv::get_block_element_at<_Blk>(*pos.first->data, pos.second); } template -typename multi_type_vector::event_func& -multi_type_vector::event_handler() +typename multi_type_vector::event_func& multi_type_vector::event_handler() { MDDS_MTV_TRACE(accessor); @@ -310,8 +302,8 @@ } template -const typename multi_type_vector::event_func& -multi_type_vector::event_handler() const +const typename multi_type_vector::event_func& multi_type_vector< + ElemBlockFunc, Trait>::event_handler() const { MDDS_MTV_TRACE(accessor); @@ -325,22 +317,20 @@ } template -multi_type_vector::multi_type_vector(const event_func& hdl) : - m_hdl_event(hdl), m_cur_size(0) +multi_type_vector::multi_type_vector(const event_func& hdl) : m_hdl_event(hdl), m_cur_size(0) { MDDS_MTV_TRACE_ARGS(constructor, "event_func=?"); } template -multi_type_vector::multi_type_vector(event_func&& hdl) : - m_hdl_event(std::move(hdl)), m_cur_size(0) +multi_type_vector::multi_type_vector(event_func&& hdl) + : m_hdl_event(std::move(hdl)), m_cur_size(0) { MDDS_MTV_TRACE_ARGS(constructor, "event_func=? (move)"); } template -multi_type_vector::multi_type_vector(size_type init_size) : - m_cur_size(init_size) +multi_type_vector::multi_type_vector(size_type init_size) : m_cur_size(init_size) { MDDS_MTV_TRACE_ARGS(constructor, "init_size=" << init_size); @@ -355,10 +345,10 @@ template template -multi_type_vector::multi_type_vector(size_type init_size, const T& value) : - m_cur_size(init_size) +multi_type_vector::multi_type_vector(size_type init_size, const T& value) : m_cur_size(init_size) { - MDDS_MTV_TRACE_ARGS(constructor, "init_size=" << init_size << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); + MDDS_MTV_TRACE_ARGS( + constructor, "init_size=" << init_size << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); if (!init_size) return; @@ -372,10 +362,12 @@ template template -multi_type_vector::multi_type_vector(size_type init_size, const T& it_begin, const T& it_end) : - m_cur_size(init_size) +multi_type_vector::multi_type_vector(size_type init_size, const T& it_begin, const T& it_end) + : m_cur_size(init_size) { - MDDS_MTV_TRACE_ARGS(constructor, "init_size=" << init_size << "; it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); + MDDS_MTV_TRACE_ARGS( + constructor, + "init_size=" << init_size << "; it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); if (!m_cur_size) return; @@ -392,10 +384,8 @@ } template -multi_type_vector::multi_type_vector(const multi_type_vector& other) : - m_hdl_event(other.m_hdl_event), - m_block_store(other.m_block_store), - m_cur_size(other.m_cur_size) +multi_type_vector::multi_type_vector(const multi_type_vector& other) + : m_hdl_event(other.m_hdl_event), m_block_store(other.m_block_store), m_cur_size(other.m_cur_size) { MDDS_MTV_TRACE_ARGS(constructor, "other=? (copy)"); @@ -422,10 +412,9 @@ } template -multi_type_vector::multi_type_vector(multi_type_vector&& other) : - m_hdl_event(std::move(other.m_hdl_event)), - m_block_store(std::move(other.m_block_store)), - m_cur_size(other.m_cur_size) +multi_type_vector::multi_type_vector(multi_type_vector&& other) + : m_hdl_event(std::move(other.m_hdl_event)), m_block_store(std::move(other.m_block_store)), + m_cur_size(other.m_cur_size) { MDDS_MTV_TRACE_ARGS(constructor, "other=? (move)"); @@ -498,8 +487,8 @@ } template -typename multi_type_vector::position_type -multi_type_vector::position(size_type pos) +typename multi_type_vector::position_type multi_type_vector::position( + size_type pos) { MDDS_MTV_TRACE_ARGS(accessor, "pos=" << pos); @@ -522,8 +511,8 @@ } template -typename multi_type_vector::position_type -multi_type_vector::position(const iterator& pos_hint, size_type pos) +typename multi_type_vector::position_type multi_type_vector::position( + const iterator& pos_hint, size_type pos) { MDDS_MTV_TRACE_ARGS(accessor_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos); @@ -534,7 +523,7 @@ return position_type(end(), 0); } - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::position", __LINE__, pos, block_size(), size()); @@ -545,8 +534,8 @@ } template -typename multi_type_vector::const_position_type -multi_type_vector::position(size_type pos) const +typename multi_type_vector::const_position_type multi_type_vector::position( + size_type pos) const { MDDS_MTV_TRACE_ARGS(accessor, "pos=" << pos); @@ -569,8 +558,8 @@ } template -typename multi_type_vector::const_position_type -multi_type_vector::position(const const_iterator& pos_hint, size_type pos) const +typename multi_type_vector::const_position_type multi_type_vector::position( + const const_iterator& pos_hint, size_type pos) const { MDDS_MTV_TRACE_ARGS(accessor_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos); @@ -581,7 +570,7 @@ return const_position_type(cend(), 0); } - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::position", __LINE__, pos, block_size(), size()); @@ -592,11 +581,11 @@ } template -typename multi_type_vector::iterator -multi_type_vector::transfer( +typename multi_type_vector::iterator multi_type_vector::transfer( size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos) { - MDDS_MTV_TRACE_ARGS(mutator, "start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest=?; dest_pos=" << dest_pos); + MDDS_MTV_TRACE_ARGS( + mutator, "start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest=?; dest_pos=" << dest_pos); if (&dest == this) throw invalid_arg_error("You cannot transfer between the same container."); @@ -628,7 +617,9 @@ { std::ostringstream os; os << e.what() << std::endl; - os << std::endl << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest_pos=" << dest_pos << ")" << std::endl; + os << std::endl + << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos + << "; dest_pos=" << dest_pos << ")" << std::endl; os << std::endl << "previous block state (source):" << std::endl; os << os_prev_block.str(); os << std::endl << "previous block state (destination):" << std::endl; @@ -646,17 +637,17 @@ } template -typename multi_type_vector::iterator -multi_type_vector::transfer( - const iterator& pos_hint, size_type start_pos, size_type end_pos, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector::transfer( + const iterator& pos_hint, size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest=?; dest_pos=" << dest_pos); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, "pos_hint=" << pos_hint << "; start_pos=" << start_pos << "; end_pos=" << end_pos + << "; dest=?; dest_pos=" << dest_pos); if (&dest == this) throw invalid_arg_error("You cannot transfer between the same container."); - size_type block_index1 = get_block_position(pos_hint, start_pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, start_pos); if (block_index1 == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::transfer", __LINE__, start_pos, block_size(), size()); @@ -683,7 +674,9 @@ { std::ostringstream os; os << e.what() << std::endl; - os << std::endl << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos << "; dest_pos=" << dest_pos << ")" << std::endl; + os << std::endl + << "block integrity check failed in transfer (start_pos=" << start_pos << "; end_pos=" << end_pos + << "; dest_pos=" << dest_pos << ")" << std::endl; os << std::endl << "previous block state (source):" << std::endl; os << os_prev_block.str(); os << std::endl << "previous block state (destination):" << std::endl; @@ -702,8 +695,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(size_type pos, const T& value) +typename multi_type_vector::iterator multi_type_vector::set( + size_type pos, const T& value) { MDDS_MTV_TRACE_ARGS(mutator, "pos=" << pos << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); @@ -741,12 +734,14 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(const iterator& pos_hint, size_type pos, const T& value) +typename multi_type_vector::iterator multi_type_vector::set( + const iterator& pos_hint, size_type pos, const T& value) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, + "pos_hint=" << pos_hint << "; pos=" << pos << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::set", __LINE__, pos, block_size(), size()); @@ -780,10 +775,11 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::set( + size_type pos, const T& it_begin, const T& it_end) { - MDDS_MTV_TRACE_ARGS(mutator, "pos=" << pos << "; it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); + MDDS_MTV_TRACE_ARGS( + mutator, "pos=" << pos << "; it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); auto res = mdds::detail::mtv::calc_input_end_position(it_begin, it_end, pos, m_cur_size); @@ -826,17 +822,19 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set(const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::set( + const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; it_begin=?; it_end=? (length=" + << std::distance(it_begin, it_end) << ")"); auto res = mdds::detail::mtv::calc_input_end_position(it_begin, it_end, pos, m_cur_size); if (!res.second) return end(); size_type end_pos = res.first; - size_type block_index1 = get_block_position(pos_hint, pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, pos); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_prev_block; @@ -867,8 +865,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::push_back(const T& value) +typename multi_type_vector::iterator multi_type_vector::push_back( + const T& value) { MDDS_MTV_TRACE_ARGS(mutator, "value=? (type=" << mdds_mtv_get_element_type(value) << ")"); @@ -900,8 +898,7 @@ } template -typename multi_type_vector::iterator -multi_type_vector::push_back_empty() +typename multi_type_vector::iterator multi_type_vector::push_back_empty() { MDDS_MTV_TRACE(mutator); @@ -919,10 +916,11 @@ template template -typename multi_type_vector::iterator -multi_type_vector::insert(size_type pos, const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector::insert( + size_type pos, const T& it_begin, const T& it_end) { - MDDS_MTV_TRACE_ARGS(mutator, "pos=" << pos << "it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); + MDDS_MTV_TRACE_ARGS( + mutator, "pos=" << pos << "it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); size_type block_index = get_block_position(pos); if (block_index == m_block_store.positions.size()) @@ -946,7 +944,8 @@ std::ostringstream os; os << e.what() << std::endl; element_category_type cat = mdds_mtv_get_element_type(*it_begin); - os << "block integrity check failed in insert (pos=" << pos << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; + os << "block integrity check failed in insert (pos=" << pos + << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; os << "previous block state:" << std::endl; os << os_prev_block.str(); std::cerr << os.str() << std::endl; @@ -959,13 +958,14 @@ template template -typename multi_type_vector::iterator -multi_type_vector::insert( +typename multi_type_vector::iterator multi_type_vector::insert( const iterator& pos_hint, size_type pos, const T& it_begin, const T& it_end) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; it_begin=?; it_end=? (length=" << std::distance(it_begin, it_end) << ")"); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; it_begin=?; it_end=? (length=" + << std::distance(it_begin, it_end) << ")"); - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::insert", __LINE__, pos, block_size(), size()); @@ -987,7 +987,8 @@ std::ostringstream os; os << e.what() << std::endl; element_category_type cat = mdds_mtv_get_element_type(*it_begin); - os << "block integrity check failed in insert (pos=" << pos << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; + os << "block integrity check failed in insert (pos=" << pos + << "; value-size=" << std::distance(it_begin, it_end) << "; value-type=" << cat << ")" << std::endl; os << "previous block state:" << std::endl; os << os_prev_block.str(); std::cerr << os.str() << std::endl; @@ -1000,11 +1001,12 @@ template template -typename multi_type_vector::iterator -multi_type_vector::push_back_impl(const T& value) +typename multi_type_vector::iterator multi_type_vector::push_back_impl( + const T& value) { element_category_type cat = mdds_mtv_get_element_type(value); - element_block_type* last_data = m_block_store.element_blocks.empty() ? nullptr : m_block_store.element_blocks.back(); + element_block_type* last_data = + m_block_store.element_blocks.empty() ? nullptr : m_block_store.element_blocks.back(); if (!last_data || cat != get_block_type(*last_data)) { @@ -1064,8 +1066,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::set_empty(size_type start_pos, size_type end_pos) +typename multi_type_vector::iterator multi_type_vector::set_empty( + size_type start_pos, size_type end_pos) { MDDS_MTV_TRACE_ARGS(mutator, "start_pos=" << start_pos << "; end_pos=" << end_pos); @@ -1078,12 +1080,13 @@ } template -typename multi_type_vector::iterator -multi_type_vector::set_empty(const iterator& pos_hint, size_type start_pos, size_type end_pos) +typename multi_type_vector::iterator multi_type_vector::set_empty( + const iterator& pos_hint, size_type start_pos, size_type end_pos) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; start_pos=" << start_pos << "; end_pos=" << end_pos); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, "pos_hint=" << pos_hint << "; start_pos=" << start_pos << "; end_pos=" << end_pos); - size_type block_index1 = get_block_position(pos_hint, start_pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, start_pos); if (block_index1 == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::set_empty", __LINE__, start_pos, block_size(), size()); @@ -1126,8 +1129,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::insert_empty(size_type pos, size_type length) +typename multi_type_vector::iterator multi_type_vector::insert_empty( + size_type pos, size_type length) { MDDS_MTV_TRACE_ARGS(mutator, "pos=" << pos << "; length=" << length); @@ -1168,8 +1171,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::insert_empty(const iterator& pos_hint, size_type pos, size_type length) +typename multi_type_vector::iterator multi_type_vector::insert_empty( + const iterator& pos_hint, size_type pos, size_type length) { MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; length=" << length); @@ -1177,7 +1180,7 @@ // Nothing to insert. return end(); - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::insert_empty", __LINE__, pos, block_size(), size()); @@ -1238,8 +1241,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_impl(size_type pos, size_type block_index, const T& value) +typename multi_type_vector::iterator multi_type_vector::set_impl( + size_type pos, size_type block_index, const T& value) { size_type start_row = m_block_store.positions[block_index]; @@ -1291,9 +1294,9 @@ m_block_store.positions[block_index] += 1; element_block_func::overwrite_values(*m_block_store.element_blocks[block_index], 0, 1); element_block_func::erase(*m_block_store.element_blocks[block_index], 0); - m_block_store.sizes[block_index-1] += 1; - mdds_mtv_append_value(*m_block_store.element_blocks[block_index-1], value); - return get_iterator(block_index-1); + m_block_store.sizes[block_index - 1] += 1; + mdds_mtv_append_value(*m_block_store.element_blocks[block_index - 1], value); + return get_iterator(block_index - 1); } // t|---|x--|???|b @@ -1333,14 +1336,14 @@ // t|--x|xxx|b - Next block is of the same type as the new value. - element_block_func::overwrite_values(*blk_data, blk_size-1, 1); - element_block_func::erase(*blk_data, blk_size-1); + element_block_func::overwrite_values(*blk_data, blk_size - 1, 1); + element_block_func::erase(*blk_data, blk_size - 1); m_block_store.sizes[block_index] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], value); - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], value); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } assert(block_index > 0); @@ -1359,24 +1362,24 @@ // t|???|--x|---|b - Next block is of different type than the new // value's. set_cell_to_bottom_of_data_block(block_index, value); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // t|???|--x|xxx|b - The next block is of the same type as the new value. - element_block_func::overwrite_values(*blk_data, blk_size-1, 1); - element_block_func::erase(*blk_data, blk_size-1); + element_block_func::overwrite_values(*blk_data, blk_size - 1, 1); + element_block_func::erase(*blk_data, blk_size - 1); m_block_store.sizes[block_index] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], value); - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], value); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template template -typename multi_type_vector::iterator -multi_type_vector::release_impl(size_type pos, size_type block_index, T& value) +typename multi_type_vector::iterator multi_type_vector::release_impl( + size_type pos, size_type block_index, T& value) { const element_block_type* blk_data = m_block_store.element_blocks[block_index]; size_type start_pos = m_block_store.positions[block_index]; @@ -1399,8 +1402,8 @@ template void multi_type_vector::swap_impl( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2) { if (block_index1 == block_index2) { @@ -1408,15 +1411,13 @@ if (dblock_index1 == dblock_index2) { // Destination range is also in a single block. - swap_single_block( - other, start_pos, end_pos, other_pos, block_index1, dblock_index1); + swap_single_block(other, start_pos, end_pos, other_pos, block_index1, dblock_index1); } else { // Source is single-, and destination is multi-blocks. swap_single_to_multi_blocks( - other, start_pos, end_pos, other_pos, block_index1, - dblock_index1, dblock_index2); + other, start_pos, end_pos, other_pos, block_index1, dblock_index1, dblock_index2); } } else if (dblock_index1 == dblock_index2) @@ -1424,22 +1425,20 @@ // Destination range is over a single block. Switch source and destination. size_type len = end_pos - start_pos + 1; other.swap_single_to_multi_blocks( - *this, other_pos, other_pos+len-1, start_pos, dblock_index1, - block_index1, block_index2); + *this, other_pos, other_pos + len - 1, start_pos, dblock_index1, block_index1, block_index2); } else { // Both source and destinations are multi-block. swap_multi_to_multi_blocks( - other, start_pos, end_pos, other_pos, - block_index1, block_index2, dblock_index1, dblock_index2); + other, start_pos, end_pos, other_pos, block_index1, block_index2, dblock_index1, dblock_index2); } } template void multi_type_vector::swap_single_block( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type other_block_index) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type other_block_index) { element_block_type* src_data = m_block_store.element_blocks[block_index]; element_block_type* dst_data = other.m_block_store.element_blocks[other_block_index]; @@ -1499,8 +1498,8 @@ // the entire source block needs to be replaced. std::unique_ptr src_data_original(src_data); m_hdl_event.element_block_released(src_data); - m_block_store.element_blocks[block_index] = other.exchange_elements( - *src_data_original, src_offset, other_block_index, dst_offset, len); + m_block_store.element_blocks[block_index] = + other.exchange_elements(*src_data_original, src_offset, other_block_index, dst_offset, len); src_data = m_block_store.element_blocks[block_index]; m_hdl_event.element_block_acquired(src_data); @@ -1523,10 +1522,10 @@ if (blk_prev) { // Append the new elements to the previous block. - element_block_type* prev_data = m_block_store.element_blocks[block_index-1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; element_block_func::append_values_from_block(*prev_data, *new_dst_data); element_block_func::resize_block(*new_dst_data, 0); // prevent double-delete. - m_block_store.sizes[block_index-1] += len; + m_block_store.sizes[block_index - 1] += len; } else { @@ -1554,18 +1553,18 @@ if (is_next_block_of_type(block_index, cat_dst)) { // Merge with the next block. - element_block_type* next_data = m_block_store.element_blocks[block_index+1]; + element_block_type* next_data = m_block_store.element_blocks[block_index + 1]; element_block_func::prepend_values_from_block(*next_data, *data_from_dst, 0, len); element_block_func::resize_block(*data_from_dst, 0); // prevent double-delete. - m_block_store.sizes[block_index+1] += len; - m_block_store.positions[block_index+1] -= len; + m_block_store.sizes[block_index + 1] += len; + m_block_store.positions[block_index + 1] -= len; } else { - m_block_store.insert(block_index+1, 0, len, nullptr); - m_block_store.calc_block_position(block_index+1); - m_block_store.element_blocks[block_index+1] = data_from_dst.release(); - m_hdl_event.element_block_acquired(m_block_store.element_blocks[block_index+1]); + m_block_store.insert(block_index + 1, 0, len, nullptr); + m_block_store.calc_block_position(block_index + 1); + m_block_store.element_blocks[block_index + 1] = data_from_dst.release(); + m_hdl_event.element_block_acquired(m_block_store.element_blocks[block_index + 1]); } return; } @@ -1579,8 +1578,8 @@ template void multi_type_vector::swap_single_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type dst_block_index1, size_type dst_block_index2) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type dst_block_index1, size_type dst_block_index2) { element_block_type* src_data = m_block_store.element_blocks[block_index]; size_type start_pos_in_block = m_block_store.positions[block_index]; @@ -1595,7 +1594,7 @@ { // The source block is empty. Use transfer. other.transfer_multi_blocks( - other_pos, other_pos+len-1, dst_block_index1, dst_block_index2, *this, start_pos); + other_pos, other_pos + len - 1, dst_block_index1, dst_block_index2, *this, start_pos); return; } @@ -1640,9 +1639,9 @@ } insert_blocks_at(src_position, block_index, new_blocks); - merge_with_next_block(block_index+new_blocks.positions.size()-1); // last block inserted. + merge_with_next_block(block_index + new_blocks.positions.size() - 1); // last block inserted. if (block_index > 0) - merge_with_next_block(block_index-1); // block before the first block inserted. + merge_with_next_block(block_index - 1); // block before the first block inserted. return; } @@ -1667,20 +1666,20 @@ // we will immediately remove. The new blocks from the other // container will be inserted at the removed slot. set_new_block_to_middle(block_index, src_offset, len, false); - delete_element_block(block_index+1); - m_block_store.erase(block_index+1); + delete_element_block(block_index + 1); + m_block_store.erase(block_index + 1); position = m_block_store.positions[block_index] + m_block_store.sizes[block_index]; } - insert_blocks_at(position, block_index+1, new_blocks); - merge_with_next_block(block_index+new_blocks.positions.size()); // last block inserted. + insert_blocks_at(position, block_index + 1, new_blocks); + merge_with_next_block(block_index + new_blocks.positions.size()); // last block inserted. merge_with_next_block(block_index); // block before the first block inserted. } template void multi_type_vector::swap_multi_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2) + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2) { assert(block_index1 < block_index2); assert(dblock_index1 < dblock_index2); @@ -1709,7 +1708,7 @@ insert_blocks_at(position, src_bucket.insert_index, dst_bucket.blocks); // Merge the boundary blocks in the source. - merge_with_next_block(src_bucket.insert_index + dst_bucket.blocks.positions.size()-1); + merge_with_next_block(src_bucket.insert_index + dst_bucket.blocks.positions.size() - 1); if (src_bucket.insert_index > 0) merge_with_next_block(src_bucket.insert_index - 1); @@ -1722,15 +1721,14 @@ other.insert_blocks_at(position, dst_bucket.insert_index, src_bucket.blocks); // Merge the boundary blocks in the destination. - other.merge_with_next_block(dst_bucket.insert_index + src_bucket.blocks.positions.size()-1); + other.merge_with_next_block(dst_bucket.insert_index + src_bucket.blocks.positions.size() - 1); if (dst_bucket.insert_index > 0) - other.merge_with_next_block(dst_bucket.insert_index-1); + other.merge_with_next_block(dst_bucket.insert_index - 1); } template template -typename multi_type_vector::iterator -multi_type_vector::insert_cells_impl( +typename multi_type_vector::iterator multi_type_vector::insert_cells_impl( size_type row, size_type block_index, const T& it_begin, const T& it_end) { size_type start_row = m_block_store.positions[block_index]; @@ -1753,13 +1751,13 @@ if (blk0) { // Append to the previous block. - element_block_type* blk0_data = m_block_store.element_blocks[block_index-1]; + element_block_type* blk0_data = m_block_store.element_blocks[block_index - 1]; mdds_mtv_append_values(*blk0_data, *it_begin, it_begin, it_end); - m_block_store.sizes[block_index-1] += length; + m_block_store.sizes[block_index - 1] += length; m_cur_size += length; adjust_block_positions_func{}(m_block_store, block_index, length); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Just insert a new block before the current block. @@ -1770,7 +1768,7 @@ m_hdl_event.element_block_acquired(blk_data); mdds_mtv_assign_values(*blk_data, *it_begin, it_begin, it_end); m_cur_size += length; - adjust_block_positions_func{}(m_block_store, block_index+1, length); + adjust_block_positions_func{}(m_block_store, block_index + 1, length); return get_iterator(block_index); } @@ -1778,7 +1776,7 @@ insert_cells_to_middle(row, block_index, it_begin, it_end); m_cur_size += length; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } assert(blk_data); @@ -1787,10 +1785,10 @@ { // Simply insert the new data series into existing block. assert(it_begin != it_end); - mdds_mtv_insert_values(*blk_data, row-start_row, *it_begin, it_begin, it_end); + mdds_mtv_insert_values(*blk_data, row - start_row, *it_begin, it_begin, it_end); m_block_store.sizes[block_index] += length; m_cur_size += length; - adjust_block_positions_func{}(m_block_store, block_index+1, length); + adjust_block_positions_func{}(m_block_store, block_index + 1, length); return get_iterator(block_index); } @@ -1803,25 +1801,24 @@ if (blk0) { // Append to the previous block. - element_block_type* blk0_data = m_block_store.element_blocks[block_index-1]; + element_block_type* blk0_data = m_block_store.element_blocks[block_index - 1]; mdds_mtv_append_values(*blk0_data, *it_begin, it_begin, it_end); - m_block_store.sizes[block_index-1] += length; + m_block_store.sizes[block_index - 1] += length; m_cur_size += length; adjust_block_positions_func{}(m_block_store, block_index, length); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Just insert a new block before the current block. - m_block_store.insert( - block_index, m_block_store.positions[block_index], length, nullptr); + m_block_store.insert(block_index, m_block_store.positions[block_index], length, nullptr); m_block_store.element_blocks[block_index] = element_block_func::create_new_block(cat, 0); m_hdl_event.element_block_acquired(blk_data); blk_data = m_block_store.element_blocks[block_index]; mdds_mtv_assign_values(*blk_data, *it_begin, it_begin, it_end); m_block_store.sizes[block_index] = length; m_cur_size += length; - adjust_block_positions_func{}(m_block_store, block_index+1, length); + adjust_block_positions_func{}(m_block_store, block_index + 1, length); return get_iterator(block_index); } @@ -1829,12 +1826,11 @@ insert_cells_to_middle(row, block_index, it_begin, it_end); m_cur_size += length; - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template -typename multi_type_vector::iterator -multi_type_vector::set_empty_impl( +typename multi_type_vector::iterator multi_type_vector::set_empty_impl( size_type start_pos, size_type end_pos, size_type block_index1, bool overwrite) { if (start_pos > end_pos) @@ -1854,8 +1850,7 @@ if (block_index1 == block_index2) ret_it = set_empty_in_single_block(start_pos, end_pos, block_index1, overwrite); else - ret_it = set_empty_in_multi_blocks( - start_pos, end_pos, block_index1, block_index2, overwrite); + ret_it = set_empty_in_multi_blocks(start_pos, end_pos, block_index1, block_index2, overwrite); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG try @@ -1866,7 +1861,8 @@ { std::ostringstream os; os << e.what() << std::endl; - os << "block integrity check failed in set_empty(start_pos=" << start_pos << "; end_pos=" << end_pos << ")" << std::endl; + os << "block integrity check failed in set_empty(start_pos=" << start_pos << "; end_pos=" << end_pos << ")" + << std::endl; os << "previous block state:" << std::endl; os << os_prev_block.str(); std::cerr << os.str() << std::endl; @@ -1877,9 +1873,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::set_empty_in_single_block( - size_type start_row, size_type end_row, size_type block_index, bool overwrite) +typename multi_type_vector::iterator multi_type_vector:: + set_empty_in_single_block(size_type start_row, size_type end_row, size_type block_index, bool overwrite) { // Range is within a single block. element_block_type* blk_data = m_block_store.element_blocks[block_index]; @@ -1911,9 +1906,9 @@ if (blk_prev) { // Extend the previous empty block. - m_block_store.sizes[block_index-1] += empty_block_size; + m_block_store.sizes[block_index - 1] += empty_block_size; m_block_store.positions[block_index] += empty_block_size; - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Insert a new empty block before the current one. @@ -1941,30 +1936,29 @@ if (blk_next) { // Extend the next empty block to cover the new empty segment. - m_block_store.sizes[block_index+1] += empty_block_size; - m_block_store.positions[block_index+1] = start_row; + m_block_store.sizes[block_index + 1] += empty_block_size; + m_block_store.positions[block_index + 1] = start_row; } else { // Insert a new empty block after the current one. - m_block_store.insert(block_index+1, start_row, empty_block_size, nullptr); + m_block_store.insert(block_index + 1, start_row, empty_block_size, nullptr); } - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Empty the middle part of a block. assert(end_row_in_block - end_row > 0); - set_new_block_to_middle(block_index, start_row-start_row_in_block, empty_block_size, overwrite); + set_new_block_to_middle(block_index, start_row - start_row_in_block, empty_block_size, overwrite); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template -typename multi_type_vector::iterator -multi_type_vector::set_empty_in_multi_blocks( - size_type start_row, size_type end_row, - size_type block_index1, size_type block_index2, bool overwrite) +typename multi_type_vector::iterator multi_type_vector:: + set_empty_in_multi_blocks( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, bool overwrite) { assert(block_index1 < block_index2); size_type start_row_in_block1 = m_block_store.positions[block_index1]; @@ -1985,7 +1979,7 @@ // Previous block is empty. Move the start row to the // first row of the previous block, and make the previous // block 'block 1'. - start_row -= m_block_store.sizes[block_index1-1]; + start_row -= m_block_store.sizes[block_index1 - 1]; --block_index1; } else @@ -2003,7 +1997,7 @@ size_type new_size = start_row - start_row_in_block1; if (overwrite) element_block_func::overwrite_values( - *blk_data, new_size, m_block_store.sizes[block_index1]-new_size); + *blk_data, new_size, m_block_store.sizes[block_index1] - new_size); element_block_func::resize_block(*blk_data, new_size); m_block_store.sizes[block_index1] = new_size; @@ -2036,7 +2030,7 @@ if (next_empty) { // The following block is also empty. - end_row += m_block_store.sizes[block_index2+1]; + end_row += m_block_store.sizes[block_index2 + 1]; ++end_block_to_erase; } } @@ -2067,7 +2061,7 @@ for (size_type i = block_index1 + 1; i < end_block_to_erase; ++i) { - element_block_type *data = m_block_store.element_blocks[i]; + element_block_type* data = m_block_store.element_blocks[i]; if (!overwrite && data) element_block_func::resize_block(*data, 0); @@ -2075,7 +2069,7 @@ } size_type n_erase_blocks = end_block_to_erase - block_index1 - 1; - m_block_store.erase(block_index1+1, n_erase_blocks); + m_block_store.erase(block_index1 + 1, n_erase_blocks); } element_block_type* blk_data = m_block_store.element_blocks[block_index1]; @@ -2083,8 +2077,8 @@ if (blk_data) { // Insert a new empty block after the first block. - m_block_store.insert(block_index1+1, start_row, empty_block_size, nullptr); - return get_iterator(block_index1+1); + m_block_store.insert(block_index1 + 1, start_row, empty_block_size, nullptr); + return get_iterator(block_index1 + 1); } // Current block is already empty. Just extend its size. @@ -2139,7 +2133,7 @@ if (blk_data) { // Shrink the element block. - element_block_func::overwrite_values(*blk_data, new_size, m_block_store.sizes[block_pos1]-new_size); + element_block_func::overwrite_values(*blk_data, new_size, m_block_store.sizes[block_pos1] - new_size); element_block_func::resize_block(*blk_data, new_size); } m_block_store.sizes[block_pos1] = new_size; @@ -2177,7 +2171,7 @@ // Now, erase all blocks in between. delete_element_blocks(index_erase_begin, index_erase_end); - m_block_store.erase(index_erase_begin, index_erase_end-index_erase_begin); + m_block_store.erase(index_erase_begin, index_erase_end - index_erase_begin); int64_t delta = end_row - start_row + 1; m_cur_size -= delta; @@ -2213,7 +2207,7 @@ if (m_block_store.sizes[block_index]) { // Block still contains data. Bail out. - adjust_block_positions_func{}(m_block_store, block_index+1, -size_to_erase); + adjust_block_positions_func{}(m_block_store, block_index + 1, -size_to_erase); return; } @@ -2233,7 +2227,7 @@ return; // Check the previous and next blocks to see if they should be merged. - element_block_type* prev_data = m_block_store.element_blocks[block_index-1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; element_block_type* next_data = m_block_store.element_blocks[block_index]; if (prev_data) @@ -2253,7 +2247,7 @@ { // Merge the two blocks. element_block_func::append_values_from_block(*prev_data, *next_data); - m_block_store.sizes[block_index-1] += m_block_store.sizes[block_index]; + m_block_store.sizes[block_index - 1] += m_block_store.sizes[block_index]; // Resize to 0 to prevent deletion of cells in case of managed cells. element_block_func::resize_block(*next_data, 0); delete_element_block(block_index); @@ -2274,7 +2268,7 @@ // Both blocks are empty. Simply increase the size of the previous // block. - m_block_store.sizes[block_index-1] += m_block_store.sizes[block_index]; + m_block_store.sizes[block_index - 1] += m_block_store.sizes[block_index]; delete_element_block(block_index); m_block_store.erase(block_index); adjust_block_positions_func{}(m_block_store, block_index, -size_to_erase); @@ -2282,8 +2276,7 @@ } template -typename multi_type_vector::iterator -multi_type_vector::insert_empty_impl( +typename multi_type_vector::iterator multi_type_vector::insert_empty_impl( size_type pos, size_type block_index, size_type length) { assert(pos < m_cur_size); @@ -2296,7 +2289,7 @@ // with it. m_block_store.sizes[block_index] += length; m_cur_size += length; - adjust_block_positions_func{}(m_block_store, block_index+1, length); + adjust_block_positions_func{}(m_block_store, block_index + 1, length); return get_iterator(block_index); } @@ -2309,17 +2302,17 @@ if (blk_prev) { // Previous block is empty. Expand the size of the previous block. - assert(!m_block_store.element_blocks[block_index-1]); - m_block_store.sizes[block_index-1] += length; + assert(!m_block_store.element_blocks[block_index - 1]); + m_block_store.sizes[block_index - 1] += length; m_cur_size += length; adjust_block_positions_func{}(m_block_store, block_index, length); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Insert a new empty block. m_block_store.insert(block_index, start_pos, length, nullptr); m_cur_size += length; - adjust_block_positions_func{}(m_block_store, block_index+1, length); + adjust_block_positions_func{}(m_block_store, block_index + 1, length); return get_iterator(block_index); } @@ -2332,14 +2325,14 @@ // Insert two new blocks below the current; one for the empty block being // inserted, and the other for the lower part of the current non-empty // block. - m_block_store.insert(block_index+1, 2u); + m_block_store.insert(block_index + 1, 2u); - m_block_store.sizes[block_index+1] = length; - m_block_store.sizes[block_index+2] = size_blk_next; + m_block_store.sizes[block_index + 1] = length; + m_block_store.sizes[block_index + 2] = size_blk_next; - m_block_store.element_blocks[block_index+2] = + m_block_store.element_blocks[block_index + 2] = element_block_func::create_new_block(mdds::mtv::get_block_type(*blk_data), 0); - element_block_type* next_data = m_block_store.element_blocks[block_index+2]; + element_block_type* next_data = m_block_store.element_blocks[block_index + 2]; m_hdl_event.element_block_acquired(next_data); // Check if the previous block is the bigger one @@ -2347,8 +2340,7 @@ { // Upper (previous) block is larger than the lower (next) block. Copy // the lower values to the next block. - element_block_func::assign_values_from_block( - *next_data, *blk_data, size_blk_prev, size_blk_next); + element_block_func::assign_values_from_block(*next_data, *blk_data, size_blk_prev, size_blk_next); element_block_func::resize_block(*blk_data, size_blk_prev); m_block_store.sizes[block_index] = size_blk_prev; } @@ -2357,7 +2349,7 @@ // Lower (next) block is larger than the upper (previous) block. Copy // the upper values to the "next" block. element_block_func::assign_values_from_block(*next_data, *blk_data, 0, size_blk_prev); - m_block_store.sizes[block_index+2] = size_blk_prev; + m_block_store.sizes[block_index + 2] = size_blk_prev; // Remove the copied values and push the rest to the top. element_block_func::erase(*blk_data, 0, size_blk_prev); @@ -2367,16 +2359,16 @@ // And now let's swap the blocks, but save the block position. size_type position = m_block_store.positions[block_index]; - m_block_store.swap(block_index, block_index+2); + m_block_store.swap(block_index, block_index + 2); m_block_store.positions[block_index] = position; } m_cur_size += length; - m_block_store.calc_block_position(block_index+1); - m_block_store.calc_block_position(block_index+2); - adjust_block_positions_func{}(m_block_store, block_index+3, length); + m_block_store.calc_block_position(block_index + 1); + m_block_store.calc_block_position(block_index + 2); + adjust_block_positions_func{}(m_block_store, block_index + 3, length); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } template @@ -2437,7 +2429,7 @@ m_block_store.sizes[block_index1] = offset1; } - if (offset2 == m_block_store.sizes[block_index2]-1) + if (offset2 == m_block_store.sizes[block_index2] - 1) { // The entire last block needs to be swapped. ++index_end; @@ -2472,20 +2464,19 @@ if (data) m_hdl_event.element_block_released(data); - bucket.blocks.push_back( - m_block_store.positions[i], m_block_store.sizes[i], m_block_store.element_blocks[i]); + bucket.blocks.push_back(m_block_store.positions[i], m_block_store.sizes[i], m_block_store.element_blocks[i]); } if (block_last.size) bucket.blocks.push_back(block_last); // Remove the slots for these blocks (but don't delete the blocks). - m_block_store.erase(index_begin, index_end-index_begin); + m_block_store.erase(index_begin, index_end - index_begin); } template -typename multi_type_vector::iterator -multi_type_vector::set_whole_block_empty(size_type block_index, bool overwrite) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_whole_block_empty(size_type block_index, bool overwrite) { element_block_type* blk_data = m_block_store.element_blocks[block_index]; if (!overwrite) @@ -2500,35 +2491,35 @@ // Merge with adjacent block(s) if necessary. if (blk_prev) { - assert(!m_block_store.element_blocks[block_index-1]); + assert(!m_block_store.element_blocks[block_index - 1]); if (blk_next) { // Both preceding and next blocks are empty. - assert(!m_block_store.element_blocks[block_index+1]); + assert(!m_block_store.element_blocks[block_index + 1]); - m_block_store.sizes[block_index-1] += - m_block_store.sizes[block_index] + m_block_store.sizes[block_index+1]; + m_block_store.sizes[block_index - 1] += + m_block_store.sizes[block_index] + m_block_store.sizes[block_index + 1]; // No need delete the current and next element blocks since they are both empty. m_block_store.erase(block_index, 2); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Only the preceding block is empty. Merge the current block with the previous. - m_block_store.sizes[block_index-1] += m_block_store.sizes[block_index]; + m_block_store.sizes[block_index - 1] += m_block_store.sizes[block_index]; m_block_store.erase(block_index); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } else if (blk_next) { - assert(!m_block_store.element_blocks[block_index+1]); + assert(!m_block_store.element_blocks[block_index + 1]); // Only the next block is empty. Merge the next block with the current. - m_block_store.sizes[block_index] += m_block_store.sizes[block_index+1]; - m_block_store.erase(block_index+1); + m_block_store.sizes[block_index] += m_block_store.sizes[block_index + 1]; + m_block_store.erase(block_index + 1); return get_iterator(block_index); } @@ -2538,8 +2529,7 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_impl( +typename multi_type_vector::iterator multi_type_vector::set_cells_impl( size_type row, size_type end_row, size_type block_index1, const T& it_begin, const T& it_end) { size_type block_index2 = get_block_position(end_row, block_index1); @@ -2553,16 +2543,14 @@ return set_cells_to_single_block(row, end_row, block_index1, it_begin, it_end); } - return set_cells_to_multi_blocks( - row, end_row, block_index1, block_index2, it_begin, it_end); + return set_cells_to_multi_blocks(row, end_row, block_index1, block_index2, it_begin, it_end); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_single_block( - size_type start_row, size_type end_row, size_type block_index, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_single_block( + size_type start_row, size_type end_row, size_type block_index, const T& it_begin, const T& it_end) { assert(it_begin != it_end); assert(!m_block_store.positions.empty()); @@ -2593,7 +2581,7 @@ { // t|???|xxx|???|b - Replace the entire current block, but first try // to see if the values can be appended to the previous block. - if (append_to_prev_block(block_index, cat, end_row-start_row+1, it_begin, it_end)) + if (append_to_prev_block(block_index, cat, end_row - start_row + 1, it_begin, it_end)) { delete_element_block(block_index); m_block_store.erase(block_index); @@ -2650,7 +2638,7 @@ { // The new values have been successfully appended to the previous block. m_block_store.positions[block_index] += length; - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Insert a new block before the current block, and populate it with @@ -2691,43 +2679,40 @@ if (blk_next) { // t|???|--xxx|xxx|b - Prepend it to the next block. - mdds_mtv_prepend_values( - *m_block_store.element_blocks[block_index+1], *it_begin, it_begin, it_end); - m_block_store.sizes[block_index+1] += new_size; - m_block_store.positions[block_index+1] -= new_size; - return get_iterator(block_index+1); + mdds_mtv_prepend_values(*m_block_store.element_blocks[block_index + 1], *it_begin, it_begin, it_end); + m_block_store.sizes[block_index + 1] += new_size; + m_block_store.positions[block_index + 1] -= new_size; + return get_iterator(block_index + 1); } // t|???|--xxx|---|b - Next block has a different data type. Do the // normal insertion. - m_block_store.insert(block_index+1, 0, new_size, nullptr); - m_block_store.calc_block_position(block_index+1); - m_block_store.element_blocks[block_index+1] = - element_block_func::create_new_block(cat, 0); - blk_data = m_block_store.element_blocks[block_index+1]; + m_block_store.insert(block_index + 1, 0, new_size, nullptr); + m_block_store.calc_block_position(block_index + 1); + m_block_store.element_blocks[block_index + 1] = element_block_func::create_new_block(cat, 0); + blk_data = m_block_store.element_blocks[block_index + 1]; m_hdl_event.element_block_acquired(blk_data); mdds_mtv_assign_values(*blk_data, *it_begin, it_begin, it_end); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // t|???|--xxx|b - Last block. assert(block_index == m_block_store.positions.size() - 1); - m_block_store.push_back(m_cur_size-new_size, new_size, nullptr); + m_block_store.push_back(m_cur_size - new_size, new_size, nullptr); m_block_store.element_blocks.back() = element_block_func::create_new_block(cat, 0); blk_data = m_block_store.element_blocks.back(); m_hdl_event.element_block_acquired(blk_data); mdds_mtv_assign_values(*blk_data, *it_begin, it_begin, it_end); - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // t|???|-xx-|???|b - New values will be in the middle of the current block. assert(start_row_in_block < start_row && end_row < end_row_in_block); - block_index = set_new_block_to_middle( - block_index, start_row-start_row_in_block, end_row-start_row+1, true); + block_index = set_new_block_to_middle(block_index, start_row - start_row_in_block, end_row - start_row + 1, true); m_block_store.element_blocks[block_index] = element_block_func::create_new_block(cat, 0); blk_data = m_block_store.element_blocks[block_index]; @@ -2739,10 +2724,10 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_multi_blocks( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_multi_blocks( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end) { assert(block_index1 < block_index2); assert(it_begin != it_end); @@ -2758,16 +2743,15 @@ // Block 1 is empty. assert(!blk1_data); - return set_cells_to_multi_blocks_block1_non_equal( - start_row, end_row, block_index1, block_index2, it_begin, it_end); + return set_cells_to_multi_blocks_block1_non_equal(start_row, end_row, block_index1, block_index2, it_begin, it_end); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_multi_blocks_block1_non_equal( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_multi_blocks_block1_non_equal( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end) { element_category_type cat = mdds_mtv_get_element_type(*it_begin); element_block_type* blk1_data = m_block_store.element_blocks[block_index1]; @@ -2795,15 +2779,15 @@ // Check the type of the previous block (block 0) if exists. if (block_index1 > 0) { - element_block_type* blk0_data = m_block_store.element_blocks[block_index1-1]; + element_block_type* blk0_data = m_block_store.element_blocks[block_index1 - 1]; if (blk0_data && cat == mdds::mtv::get_block_type(*blk0_data)) { // Transfer the whole data from block 0 to data block. data_blk.element_block = blk0_data; - m_block_store.element_blocks[block_index1-1] = nullptr; + m_block_store.element_blocks[block_index1 - 1] = nullptr; - data_blk.size += m_block_store.sizes[block_index1-1]; - data_blk.position = m_block_store.positions[block_index1-1]; + data_blk.size += m_block_store.sizes[block_index1 - 1]; + data_blk.position = m_block_store.positions[block_index1 - 1]; --index_erase_begin; blk0_copied = true; @@ -2838,17 +2822,17 @@ // Remove block 2. ++index_erase_end; - if (block_index2+1 < m_block_store.positions.size()) + if (block_index2 + 1 < m_block_store.positions.size()) { // There is at least one block after block 2. - element_block_type* blk3_data = m_block_store.element_blocks[block_index2+1]; + element_block_type* blk3_data = m_block_store.element_blocks[block_index2 + 1]; if (blk3_data && mdds::mtv::get_block_type(*blk3_data) == cat) { // Merge the whole block 3 with the new data. Remove block 3 // afterward. Resize block 3 to zero to prevent invalid free. element_block_func::append_values_from_block(*data_blk.element_block, *blk3_data); element_block_func::resize_block(*blk3_data, 0); - data_blk.size += m_block_store.sizes[block_index2+1]; + data_blk.size += m_block_store.sizes[block_index2 + 1]; ++index_erase_end; } } @@ -2897,7 +2881,7 @@ // Remove the in-between blocks first. delete_element_blocks(index_erase_begin, index_erase_end); - m_block_store.erase(index_erase_begin, index_erase_end-index_erase_begin); + m_block_store.erase(index_erase_begin, index_erase_end - index_erase_begin); // Insert the new data block. @@ -2907,10 +2891,10 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cells_to_multi_blocks_block1_non_empty( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end) +typename multi_type_vector::iterator multi_type_vector:: + set_cells_to_multi_blocks_block1_non_empty( + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end) { size_type start_row_in_block1 = m_block_store.positions[block_index1]; size_type start_row_in_block2 = m_block_store.positions[block_index2]; @@ -2933,8 +2917,7 @@ // Extend the first block to store the new data set. // Shrink it first to remove the old values, then append new values. - element_block_func::overwrite_values( - *blk1_data, offset, m_block_store.sizes[block_index1]-offset); + element_block_func::overwrite_values(*blk1_data, offset, m_block_store.sizes[block_index1] - offset); element_block_func::resize_block(*blk1_data, offset); mdds_mtv_append_values(*blk1_data, *it_begin, it_begin, it_end); m_block_store.sizes[block_index1] = offset + length; @@ -2958,8 +2941,7 @@ // deleted on block deletion. size_type data_length = end_row_in_block2 - end_row; size_type begin_pos = end_row - start_row_in_block2 + 1; - element_block_func::append_values_from_block( - *blk1_data, *blk2_data, begin_pos, data_length); + element_block_func::append_values_from_block(*blk1_data, *blk2_data, begin_pos, data_length); element_block_func::overwrite_values(*blk2_data, 0, begin_pos); element_block_func::resize_block(*blk2_data, 0); m_block_store.sizes[block_index1] += data_length; @@ -2983,7 +2965,7 @@ } delete_element_blocks(index_erase_begin, index_erase_end); - m_block_store.erase(index_erase_begin, index_erase_end-index_erase_begin); + m_block_store.erase(index_erase_begin, index_erase_end - index_erase_begin); return get_iterator(block_index1); } @@ -2991,15 +2973,13 @@ // The first block type is different. assert(blk_cat1 != cat); - return set_cells_to_multi_blocks_block1_non_equal( - start_row, end_row, block_index1, block_index2, it_begin, it_end); + return set_cells_to_multi_blocks_block1_non_equal(start_row, end_row, block_index1, block_index2, it_begin, it_end); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cell_to_empty_block( - size_type block_index, size_type pos_in_block, const T& cell) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_cell_to_empty_block(size_type block_index, size_type pos_in_block, const T& cell) { assert(!m_block_store.element_blocks[block_index]); // In this call, the current block is an empty block. @@ -3045,7 +3025,7 @@ m_block_store.sizes.push_back(1); m_block_store.element_blocks.push_back(nullptr); - create_new_block_with_new_cell(block_index+1, cell); + create_new_block_with_new_cell(block_index + 1, cell); iterator ret = end(); return --ret; } @@ -3111,22 +3091,22 @@ // Shrink this empty block by one, and prepend the cell to the next block. m_block_store.sizes[block_index] -= 1; - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], cell); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], cell); } else { // Shrink the current empty block by one, and create a new block of size 1 to store the new value. m_block_store.sizes[block_index] -= 1; - m_block_store.insert(block_index+1, 1); - m_block_store.calc_block_position(block_index+1); - m_block_store.sizes[block_index+1] = 1; + m_block_store.insert(block_index + 1, 1); + m_block_store.calc_block_position(block_index + 1); + m_block_store.sizes[block_index + 1] = 1; - create_new_block_with_new_cell(block_index+1, cell); + create_new_block_with_new_cell(block_index + 1, cell); } - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } // Inserting into the middle of an empty block. @@ -3134,13 +3114,12 @@ } // This empty block is right below a non-empty block. - assert(block_index > 0 && m_block_store.element_blocks[block_index-1] != nullptr); + assert(block_index > 0 && m_block_store.element_blocks[block_index - 1] != nullptr); if (pos_in_block == 0) { // Set the value to the top of the block, right below a non-empty block. - element_category_type blk_cat_prev = - mdds::mtv::get_block_type(*m_block_store.element_blocks[block_index-1]); + element_category_type blk_cat_prev = mdds::mtv::get_block_type(*m_block_store.element_blocks[block_index - 1]); element_category_type cat = mdds_mtv_get_element_type(cell); if (blk_cat_prev == cat) @@ -3155,7 +3134,7 @@ // block by one. delete_element_block(block_index); m_block_store.pop_back(); - append_cell_to_block(block_index-1, cell); + append_cell_to_block(block_index - 1, cell); } else { @@ -3164,35 +3143,35 @@ if (blk_next) { // Empty block must not be followed by another empty block. - assert(m_block_store.element_blocks[block_index+1]); + assert(m_block_store.element_blocks[block_index + 1]); - // We need to merge the previous and next blocks, then - // delete the current and next blocks. Be sure to - // resize the next block to zero to prevent the - // transferred cells to be deleted. + // We need to merge the previous and next blocks, then + // delete the current and next blocks. Be sure to + // resize the next block to zero to prevent the + // transferred cells to be deleted. // Check if the next block is bigger. - if (m_block_store.sizes[block_index-1] < m_block_store.sizes[block_index+1]) + if (m_block_store.sizes[block_index - 1] < m_block_store.sizes[block_index + 1]) { // Prepend the new item to the next block, then // prepend the content of the previous block and // release both previous and current blocks. - size_type position = m_block_store.positions[block_index-1]; + size_type position = m_block_store.positions[block_index - 1]; element_block_type* data = m_block_store.element_blocks[block_index]; - element_block_type* prev_data = m_block_store.element_blocks[block_index-1]; - element_block_type* next_data = m_block_store.element_blocks[block_index+1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; + element_block_type* next_data = m_block_store.element_blocks[block_index + 1]; // Increase the size of block and prepend the new cell - m_block_store.sizes[block_index+1] += 1; + m_block_store.sizes[block_index + 1] += 1; mdds_mtv_prepend_value(*next_data, cell); // Preprend the content of previous block to the next block. - size_type prev_size = m_block_store.sizes[block_index-1]; + size_type prev_size = m_block_store.sizes[block_index - 1]; element_block_func::prepend_values_from_block(*next_data, *prev_data, 0, prev_size); - m_block_store.sizes[block_index+1] += prev_size; - m_block_store.positions[block_index+1] = position; + m_block_store.sizes[block_index + 1] += prev_size; + m_block_store.positions[block_index + 1] = position; // Resize the previous block to zero element_block_func::resize_block(*prev_data, 0); @@ -3203,16 +3182,16 @@ element_block_func::delete_block(prev_data); // Remove the previous and current blocks. - m_block_store.erase(block_index-1, 2); + m_block_store.erase(block_index - 1, 2); } else { // Be sure to resize the next block to zero to prevent the // transferred cells to be deleted. - m_block_store.sizes[block_index-1] += 1 + m_block_store.sizes[block_index+1]; + m_block_store.sizes[block_index - 1] += 1 + m_block_store.sizes[block_index + 1]; element_block_type* data = m_block_store.element_blocks[block_index]; - element_block_type* data_prev = m_block_store.element_blocks[block_index-1]; - element_block_type* data_next = m_block_store.element_blocks[block_index+1]; + element_block_type* data_prev = m_block_store.element_blocks[block_index - 1]; + element_block_type* data_next = m_block_store.element_blocks[block_index + 1]; mdds_mtv_append_value(*data_prev, cell); element_block_func::append_values_from_block(*data_prev, *data_next); element_block_func::resize_block(*data_next, 0); @@ -3227,7 +3206,7 @@ // Ignore the next block. Just extend the previous block. delete_element_block(block_index); m_block_store.erase(block_index); - append_cell_to_block(block_index-1, cell); + append_cell_to_block(block_index - 1, cell); } } } @@ -3237,10 +3216,10 @@ assert(m_block_store.sizes[block_index] > 1); m_block_store.sizes[block_index] -= 1; m_block_store.positions[block_index] += 1; - append_cell_to_block(block_index-1, cell); + append_cell_to_block(block_index - 1, cell); } - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } else { @@ -3261,9 +3240,9 @@ if (blk_next) { // t|---|x|xxx|b - Remove this empty block, and prepend the cell to the next block. - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], cell); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], cell); delete_element_block(block_index); m_block_store.erase(block_index); } @@ -3283,7 +3262,7 @@ size_type new_block_position = m_block_store.positions[block_index] + 1; m_block_store.sizes[block_index] = 1; create_new_block_with_new_cell(block_index, cell); - m_block_store.insert(block_index+1, new_block_position, new_block_size, nullptr); + m_block_store.insert(block_index + 1, new_block_position, new_block_size, nullptr); } return get_iterator(block_index); @@ -3298,8 +3277,8 @@ // t|???| x|b - The current block is the last block. m_block_store.sizes[block_index] -= 1; m_block_store.push_back(0, 1, nullptr); - m_block_store.calc_block_position(block_index+1); - create_new_block_with_new_cell(block_index+1, cell); + m_block_store.calc_block_position(block_index + 1); + create_new_block_with_new_cell(block_index + 1, cell); iterator it = end(); return --it; @@ -3313,20 +3292,20 @@ { // t|???| x|xxx|b - Shrink this empty block and extend the next block. m_block_store.sizes[block_index] -= 1; - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], cell); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], cell); } else { // t|???| x|---|b - Shrink this block by one and insert a new block for the new cell. m_block_store.sizes[block_index] -= 1; - m_block_store.insert(block_index+1, 0, 1, nullptr); - m_block_store.calc_block_position(block_index+1); - create_new_block_with_new_cell(block_index+1, cell); + m_block_store.insert(block_index + 1, 0, 1, nullptr); + m_block_store.calc_block_position(block_index + 1); + create_new_block_with_new_cell(block_index + 1, cell); } - return get_iterator(block_index+1); + return get_iterator(block_index + 1); } } @@ -3336,8 +3315,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::set_cell_to_non_empty_block_of_size_one(size_type block_index, const T& cell) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_cell_to_non_empty_block_of_size_one(size_type block_index, const T& cell) { assert(m_block_store.sizes[block_index] == 1); assert(m_block_store.element_blocks[block_index]); @@ -3364,9 +3343,9 @@ } // t|x|xxx|b - Delete this block and prepend the cell to the next block. - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], cell); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], cell); delete_element_block(block_index); m_block_store.erase(block_index); @@ -3378,7 +3357,7 @@ if (block_index == m_block_store.positions.size() - 1) { // t|???|x|b - This is the last block and another block exists above. - element_block_type* prev_data = m_block_store.element_blocks[block_index-1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; if (!prev_data || mdds::mtv::get_block_type(*prev_data) != cat) { // t|---|x|b - The previous block is of different type. @@ -3387,8 +3366,8 @@ else { // t|xxx|x|b - Append the cell to the previous block and remove the current one. - mdds_mtv_append_value(*m_block_store.element_blocks[block_index-1], cell); - m_block_store.sizes[block_index-1] += 1; + mdds_mtv_append_value(*m_block_store.element_blocks[block_index - 1], cell); + m_block_store.sizes[block_index - 1] += 1; delete_element_block(block_index); m_block_store.erase(block_index); } @@ -3401,10 +3380,10 @@ // previous block, or prepended to the following block. Also check if the // blocks above and below need to be combined. - if (!m_block_store.element_blocks[block_index-1]) + if (!m_block_store.element_blocks[block_index - 1]) { // t| |x|???|b - Previous block is empty. - if (!m_block_store.element_blocks[block_index+1]) + if (!m_block_store.element_blocks[block_index + 1]) { // t| |x| |b - Next block is empty too. create_new_block_with_new_cell(block_index, cell); @@ -3412,8 +3391,7 @@ } // Previous block is empty, but the next block is not. - element_category_type blk_cat_next = mdds::mtv::get_block_type( - *m_block_store.element_blocks[block_index+1]); + element_category_type blk_cat_next = mdds::mtv::get_block_type(*m_block_store.element_blocks[block_index + 1]); if (blk_cat_next == cat) { @@ -3432,21 +3410,21 @@ return get_iterator(block_index); } - if (!m_block_store.element_blocks[block_index+1]) + if (!m_block_store.element_blocks[block_index + 1]) { // t|---|x| |b - Next block is empty and the previous block is not. - element_block_type *prev_data = m_block_store.element_blocks[block_index - 1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; assert(prev_data); element_category_type prev_cat = mdds::mtv::get_block_type(*prev_data); if (prev_cat == cat) { // t|xxx|x| |b - Append to the previous block. - m_block_store.sizes[block_index-1] += 1; + m_block_store.sizes[block_index - 1] += 1; mdds_mtv_append_value(*prev_data, cell); delete_element_block(block_index); m_block_store.erase(block_index); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // Just overwrite the current block. @@ -3455,8 +3433,8 @@ } // t|???|x|???|b - Neither previous nor next blocks are empty. - element_block_type* prev_data = m_block_store.element_blocks[block_index-1]; - element_block_type* next_data = m_block_store.element_blocks[block_index+1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; + element_block_type* next_data = m_block_store.element_blocks[block_index + 1]; assert(prev_data); assert(next_data); element_category_type prev_cat = mdds::mtv::get_block_type(*prev_data); @@ -3468,17 +3446,17 @@ { // t|xxx|x|xxx|b - All three blocks are of the same type. Merge all // three blocks. - m_block_store.sizes[block_index-1] += 1 + m_block_store.sizes[block_index+1]; + m_block_store.sizes[block_index - 1] += 1 + m_block_store.sizes[block_index + 1]; mdds_mtv_append_value(*prev_data, cell); element_block_func::append_values_from_block(*prev_data, *next_data); element_block_func::resize_block(*next_data, 0); // to prevent deletion of managed cells on block deletion // Delete the current and next blocks. delete_element_block(block_index); - delete_element_block(block_index+1); + delete_element_block(block_index + 1); m_block_store.erase(block_index, 2); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } // t|---|x|---|b - Just overwrite the current block. @@ -3491,19 +3469,19 @@ if (prev_cat == cat) { // t|xxx|x|---|b - Append to the previous block. - m_block_store.sizes[block_index-1] += 1; - mdds_mtv_append_value(*m_block_store.element_blocks[block_index-1], cell); + m_block_store.sizes[block_index - 1] += 1; + mdds_mtv_append_value(*m_block_store.element_blocks[block_index - 1], cell); delete_element_block(block_index); m_block_store.erase(block_index); - return get_iterator(block_index-1); + return get_iterator(block_index - 1); } if (next_cat == cat) { // t|---|x|xxx|b - Prepend to the next block. - m_block_store.sizes[block_index+1] += 1; - m_block_store.positions[block_index+1] -= 1; - mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index+1], cell); + m_block_store.sizes[block_index + 1] += 1; + m_block_store.positions[block_index + 1] -= 1; + mdds_mtv_prepend_value(*m_block_store.element_blocks[block_index + 1], cell); delete_element_block(block_index); m_block_store.erase(block_index); return get_iterator(block_index); @@ -3515,8 +3493,7 @@ } template -typename multi_type_vector::size_type -multi_type_vector::size() const +typename multi_type_vector::size_type multi_type_vector::size() const { MDDS_MTV_TRACE(accessor); @@ -3524,8 +3501,7 @@ } template -typename multi_type_vector::size_type -multi_type_vector::block_size() const +typename multi_type_vector::size_type multi_type_vector::block_size() const { MDDS_MTV_TRACE(accessor); @@ -3600,8 +3576,8 @@ template template -typename multi_type_vector::iterator -multi_type_vector::release(size_type pos, T& value) +typename multi_type_vector::iterator multi_type_vector::release( + size_type pos, T& value) { MDDS_MTV_TRACE_ARGS(mutator, "pos=" << pos << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); @@ -3639,12 +3615,14 @@ template template -typename multi_type_vector::iterator -multi_type_vector::release(const iterator& pos_hint, size_type pos, T& value) +typename multi_type_vector::iterator multi_type_vector::release( + const iterator& pos_hint, size_type pos, T& value) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; pos=" << pos << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, + "pos_hint=" << pos_hint << "; pos=" << pos << "; value=? (type=" << mdds_mtv_get_element_type(value) << ")"); - size_type block_index = get_block_position(pos_hint, pos); + size_type block_index = get_block_position(pos_hint->__private_data, pos); if (block_index == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::release", __LINE__, pos, block_size(), size()); @@ -3718,8 +3696,8 @@ } template -typename multi_type_vector::iterator -multi_type_vector::release_range(size_type start_pos, size_type end_pos) +typename multi_type_vector::iterator multi_type_vector::release_range( + size_type start_pos, size_type end_pos) { MDDS_MTV_TRACE_ARGS(mutator, "start_pos=" << start_pos << "; end_pos=" << end_pos); @@ -3732,13 +3710,13 @@ } template -typename multi_type_vector::iterator -multi_type_vector::release_range( +typename multi_type_vector::iterator multi_type_vector::release_range( const iterator& pos_hint, size_type start_pos, size_type end_pos) { - MDDS_MTV_TRACE_ARGS(mutator_with_pos_hint, "pos_hint=" << pos_hint << "; start_pos=" << start_pos << "; end_pos=" << end_pos); + MDDS_MTV_TRACE_ARGS( + mutator_with_pos_hint, "pos_hint=" << pos_hint << "; start_pos=" << start_pos << "; end_pos=" << end_pos); - size_type block_index1 = get_block_position(pos_hint, start_pos); + size_type block_index1 = get_block_position(pos_hint->__private_data, start_pos); if (block_index1 == m_block_store.positions.size()) mdds::detail::mtv::throw_block_position_not_found( "multi_type_vector::release_range", __LINE__, start_pos, block_size(), size()); @@ -3747,34 +3725,28 @@ } template -typename multi_type_vector::iterator -multi_type_vector::begin() +typename multi_type_vector::iterator multi_type_vector::begin() { MDDS_MTV_TRACE(accessor); return iterator( - { m_block_store.positions.begin(), m_block_store.sizes.begin(), m_block_store.element_blocks.begin() }, - { m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end() }, - 0 - ); + {m_block_store.positions.begin(), m_block_store.sizes.begin(), m_block_store.element_blocks.begin()}, + {m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end()}, this, 0); } template -typename multi_type_vector::iterator -multi_type_vector::end() +typename multi_type_vector::iterator multi_type_vector::end() { MDDS_MTV_TRACE(accessor); return iterator( - { m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end() }, - { m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end() }, - m_block_store.positions.size() - ); + {m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end()}, + {m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end()}, this, + m_block_store.positions.size()); } template -typename multi_type_vector::const_iterator -multi_type_vector::begin() const +typename multi_type_vector::const_iterator multi_type_vector::begin() const { MDDS_MTV_TRACE(accessor); @@ -3782,8 +3754,7 @@ } template -typename multi_type_vector::const_iterator -multi_type_vector::end() const +typename multi_type_vector::const_iterator multi_type_vector::end() const { MDDS_MTV_TRACE(accessor); @@ -3791,60 +3762,49 @@ } template -typename multi_type_vector::const_iterator -multi_type_vector::cbegin() const +typename multi_type_vector::const_iterator multi_type_vector::cbegin() const { MDDS_MTV_TRACE(accessor); return const_iterator( - { m_block_store.positions.cbegin(), m_block_store.sizes.cbegin(), m_block_store.element_blocks.cbegin() }, - { m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend() }, - 0 - ); + {m_block_store.positions.cbegin(), m_block_store.sizes.cbegin(), m_block_store.element_blocks.cbegin()}, + {m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend()}, this, 0); } template -typename multi_type_vector::const_iterator -multi_type_vector::cend() const +typename multi_type_vector::const_iterator multi_type_vector::cend() const { MDDS_MTV_TRACE(accessor); return const_iterator( - { m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend() }, - { m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend() }, - m_block_store.positions.size() - ); + {m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend()}, + {m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend()}, this, + m_block_store.positions.size()); } template -typename multi_type_vector::reverse_iterator -multi_type_vector::rbegin() +typename multi_type_vector::reverse_iterator multi_type_vector::rbegin() { MDDS_MTV_TRACE(accessor); return reverse_iterator( - { m_block_store.positions.rbegin(), m_block_store.sizes.rbegin(), m_block_store.element_blocks.rbegin() }, - { m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend() }, - 0 - ); + {m_block_store.positions.rbegin(), m_block_store.sizes.rbegin(), m_block_store.element_blocks.rbegin()}, + {m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend()}, this, 0); } template -typename multi_type_vector::reverse_iterator -multi_type_vector::rend() +typename multi_type_vector::reverse_iterator multi_type_vector::rend() { MDDS_MTV_TRACE(accessor); return reverse_iterator( - { m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend() }, - { m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend() }, - 0 - ); + {m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend()}, + {m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend()}, this, 0); } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::rbegin() const +typename multi_type_vector::const_reverse_iterator multi_type_vector< + ElemBlockFunc, Trait>::rbegin() const { MDDS_MTV_TRACE(accessor); @@ -3852,8 +3812,8 @@ } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::rend() const +typename multi_type_vector::const_reverse_iterator multi_type_vector::rend() + const { MDDS_MTV_TRACE(accessor); @@ -3861,34 +3821,30 @@ } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::crbegin() const +typename multi_type_vector::const_reverse_iterator multi_type_vector< + ElemBlockFunc, Trait>::crbegin() const { MDDS_MTV_TRACE(accessor); return const_reverse_iterator( - { m_block_store.positions.rbegin(), m_block_store.sizes.rbegin(), m_block_store.element_blocks.rbegin() }, - { m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend() }, - 0 - ); + {m_block_store.positions.rbegin(), m_block_store.sizes.rbegin(), m_block_store.element_blocks.rbegin()}, + {m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend()}, this, 0); } template -typename multi_type_vector::const_reverse_iterator -multi_type_vector::crend() const +typename multi_type_vector::const_reverse_iterator multi_type_vector< + ElemBlockFunc, Trait>::crend() const { MDDS_MTV_TRACE(accessor); return const_reverse_iterator( - { m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend() }, - { m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend() }, - 0 - ); + {m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend()}, + {m_block_store.positions.rend(), m_block_store.sizes.rend(), m_block_store.element_blocks.rend()}, this, 0); } template -typename multi_type_vector::size_type -multi_type_vector::get_block_position(size_type row, size_type start_block_index) const +typename multi_type_vector::size_type multi_type_vector::get_block_position( + size_type row, size_type start_block_index) const { if (row >= m_cur_size || start_block_index >= m_block_store.positions.size()) return m_block_store.positions.size(); @@ -3912,20 +3868,12 @@ } template -typename multi_type_vector::size_type -multi_type_vector::get_block_position(const const_iterator& pos_hint, size_type row) const +typename multi_type_vector::size_type multi_type_vector::get_block_position( + const typename value_type::private_data& pos_data, size_type row) const { size_type block_index = 0; - - if (pos_hint.get_end().position_iterator == m_block_store.positions.end() && - pos_hint.get_end().size_iterator == m_block_store.sizes.end() && - pos_hint.get_end().element_block_iterator == m_block_store.element_blocks.end()) - { - // Iterator is valid. Get the block position from it unless it's the - // end position. - if (pos_hint.get_pos() != pos_hint.get_end()) - block_index = pos_hint->__private_data.block_index; - } + if (pos_data.parent == this && pos_data.block_index < m_block_store.positions.size()) + block_index = pos_data.block_index; size_type start_row = m_block_store.positions[block_index]; @@ -3956,8 +3904,7 @@ template template -void multi_type_vector::create_new_block_with_new_cell( - size_type block_index, const T& cell) +void multi_type_vector::create_new_block_with_new_cell(size_type block_index, const T& cell) { element_block_type* data = m_block_store.element_blocks[block_index]; if (data) @@ -3987,17 +3934,15 @@ template template bool multi_type_vector::append_to_prev_block( - size_type block_index, element_category_type cat, size_type length, - const T& it_begin, const T& it_end) + size_type block_index, element_category_type cat, size_type length, const T& it_begin, const T& it_end) { bool blk_prev = is_previous_block_of_type(block_index, cat); if (!blk_prev) return false; // Append to the previous block. - mdds_mtv_append_values( - *m_block_store.element_blocks[block_index-1], *it_begin, it_begin, it_end); - m_block_store.sizes[block_index-1] += length; + mdds_mtv_append_values(*m_block_store.element_blocks[block_index - 1], *it_begin, it_begin, it_end); + m_block_store.sizes[block_index - 1] += length; return true; } @@ -4014,17 +3959,17 @@ // Insert two new blocks after the specified block position. size_type n1 = row - start_row; size_type n2 = m_block_store.sizes[block_index] - n1; - m_block_store.insert(block_index+1, 2u); + m_block_store.insert(block_index + 1, 2u); m_block_store.sizes[block_index] = n1; - m_block_store.sizes[block_index+1] = length; - m_block_store.sizes[block_index+2] = n2; - m_block_store.calc_block_position(block_index+1); - m_block_store.calc_block_position(block_index+2); + m_block_store.sizes[block_index + 1] = length; + m_block_store.sizes[block_index + 2] = n2; + m_block_store.calc_block_position(block_index + 1); + m_block_store.calc_block_position(block_index + 2); // block for data series. - m_block_store.element_blocks[block_index+1] = element_block_func::create_new_block(cat, 0); - element_block_type* blk2_data = m_block_store.element_blocks[block_index+1]; + m_block_store.element_blocks[block_index + 1] = element_block_func::create_new_block(cat, 0); + element_block_type* blk2_data = m_block_store.element_blocks[block_index + 1]; m_hdl_event.element_block_acquired(blk2_data); mdds_mtv_assign_values(*blk2_data, *it_begin, it_begin, it_end); @@ -4033,8 +3978,8 @@ element_category_type blk_cat = mdds::mtv::get_block_type(*blk_data); // block to hold data from the lower part of the existing block. - m_block_store.element_blocks[block_index+2] = element_block_func::create_new_block(blk_cat, 0); - element_block_type* blk3_data = m_block_store.element_blocks[block_index+2]; + m_block_store.element_blocks[block_index + 2] = element_block_func::create_new_block(blk_cat, 0); + element_block_type* blk3_data = m_block_store.element_blocks[block_index + 2]; m_hdl_event.element_block_acquired(blk3_data); // Transfer the lower part of the current block to the new block. @@ -4043,14 +3988,13 @@ element_block_func::resize_block(*blk_data, m_block_store.sizes[block_index]); } - adjust_block_positions_func{}(m_block_store, block_index+3, length); + adjust_block_positions_func{}(m_block_store, block_index + 3, length); } template template -typename multi_type_vector::iterator -multi_type_vector::set_cell_to_middle_of_block( - size_type block_index, size_type pos_in_block, const T& cell) +typename multi_type_vector::iterator multi_type_vector< + ElemBlockFunc, Trait>::set_cell_to_middle_of_block(size_type block_index, size_type pos_in_block, const T& cell) { block_index = set_new_block_to_middle(block_index, pos_in_block, 1, true); create_new_block_with_new_cell(block_index, cell); @@ -4090,22 +4034,20 @@ size_type& blk_size = m_block_store.sizes[block_index]; if (blk_data) { - element_block_func::overwrite_values(*blk_data, blk_size-1, 1); - element_block_func::erase(*blk_data, blk_size-1); + element_block_func::overwrite_values(*blk_data, blk_size - 1, 1); + element_block_func::erase(*blk_data, blk_size - 1); } blk_size -= 1; // Insert a new block of size one with the new value. - m_block_store.insert(block_index+1, 0, 1, nullptr); - m_block_store.calc_block_position(block_index+1); - create_new_block_with_new_cell(block_index+1, cell); + m_block_store.insert(block_index + 1, 0, 1, nullptr); + m_block_store.calc_block_position(block_index + 1); + create_new_block_with_new_cell(block_index + 1, cell); } template -typename multi_type_vector::iterator -multi_type_vector::transfer_impl( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector::transfer_impl( + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos) { if (start_pos > end_pos) { @@ -4133,15 +4075,13 @@ return transfer_single_block(start_pos, end_pos, block_index1, dest, dest_pos); } - return transfer_multi_blocks( - start_pos, end_pos, block_index1, block_index2, dest, dest_pos); + return transfer_multi_blocks(start_pos, end_pos, block_index1, block_index2, dest, dest_pos); } template -typename multi_type_vector::iterator -multi_type_vector::transfer_single_block( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector:: + transfer_single_block( + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos) { size_type len = end_pos - start_pos + 1; size_type last_dest_pos = dest_pos + len - 1; @@ -4185,8 +4125,8 @@ // Insert a new block below current, and shrink the current block. dest.m_block_store.sizes[dest_block_index] -= len; - dest.m_block_store.insert(dest_block_index+1, 0, len, nullptr); - dest.m_block_store.calc_block_position(dest_block_index+1); + dest.m_block_store.insert(dest_block_index + 1, 0, len, nullptr); + dest.m_block_store.calc_block_position(dest_block_index + 1); ++dest_block_index; // Must point to the new copied block. } else @@ -4195,13 +4135,13 @@ // Insert two new blocks below current. size_type blk2_size = dest.m_block_store.sizes[dest_block_index] - dest_pos_in_block - len; - dest.m_block_store.insert(dest_block_index+1, 2); + dest.m_block_store.insert(dest_block_index + 1, 2); dest.m_block_store.sizes[dest_block_index] = dest_pos_in_block; - dest.m_block_store.sizes[dest_block_index+1] = len; - dest.m_block_store.sizes[dest_block_index+2] = blk2_size; + dest.m_block_store.sizes[dest_block_index + 1] = len; + dest.m_block_store.sizes[dest_block_index + 2] = blk2_size; - dest.m_block_store.calc_block_position(dest_block_index+1); - dest.m_block_store.calc_block_position(dest_block_index+2); + dest.m_block_store.calc_block_position(dest_block_index + 1); + dest.m_block_store.calc_block_position(dest_block_index + 2); ++dest_block_index; // Must point to the new copied block. } @@ -4243,8 +4183,8 @@ } template -typename multi_type_vector::size_type -multi_type_vector::merge_with_adjacent_blocks(size_type block_index) +typename multi_type_vector::size_type multi_type_vector< + ElemBlockFunc, Trait>::merge_with_adjacent_blocks(size_type block_index) { assert(!m_block_store.positions.empty()); assert(block_index < m_block_store.positions.size()); @@ -4256,11 +4196,11 @@ return 0; } - size_type size_prev = m_block_store.sizes[block_index-1]; - element_block_type* prev_data = m_block_store.element_blocks[block_index-1]; + size_type size_prev = m_block_store.sizes[block_index - 1]; + element_block_type* prev_data = m_block_store.element_blocks[block_index - 1]; element_block_type* blk_data = m_block_store.element_blocks[block_index]; - bool has_next = block_index < (m_block_store.element_blocks.size()-1); - element_block_type* next_data = has_next ? m_block_store.element_blocks[block_index+1] : nullptr; + bool has_next = block_index < (m_block_store.element_blocks.size() - 1); + element_block_type* next_data = has_next ? m_block_store.element_blocks[block_index + 1] : nullptr; // Check the previous block. if (prev_data) @@ -4278,8 +4218,8 @@ if (next_data && cat_prev == get_block_type(*next_data)) { // Merge all three blocks. - m_block_store.sizes[block_index-1] += - m_block_store.sizes[block_index] + m_block_store.sizes[block_index+1]; + m_block_store.sizes[block_index - 1] += + m_block_store.sizes[block_index] + m_block_store.sizes[block_index + 1]; element_block_func::append_values_from_block(*prev_data, *blk_data); element_block_func::append_values_from_block(*prev_data, *next_data); @@ -4288,14 +4228,14 @@ element_block_func::resize_block(*next_data, 0); delete_element_block(block_index); - delete_element_block(block_index+1); + delete_element_block(block_index + 1); m_block_store.erase(block_index, 2); return size_prev; } // Merge only the previous and current blocks. - bool merged = merge_with_next_block(block_index-1); + bool merged = merge_with_next_block(block_index - 1); if (!merged) assert(!"Blocks were not merged!"); @@ -4317,8 +4257,7 @@ if (has_next && !next_data) { // Next block is empty too. Merge all three. - m_block_store.sizes[block_index-1] += - m_block_store.sizes[block_index] + m_block_store.sizes[block_index+1]; + m_block_store.sizes[block_index - 1] += m_block_store.sizes[block_index] + m_block_store.sizes[block_index + 1]; m_block_store.erase(block_index, 2); @@ -4326,7 +4265,7 @@ } // Next block is not empty, or does not exist. Merge the current block with the previous one. - bool merged = merge_with_next_block(block_index-1); + bool merged = merge_with_next_block(block_index - 1); if (!merged) assert(!"Blocks were not merged!"); @@ -4339,13 +4278,13 @@ assert(!m_block_store.positions.empty()); assert(block_index < m_block_store.positions.size()); - if (block_index >= m_block_store.positions.size()-1) + if (block_index >= m_block_store.positions.size() - 1) // No more block below this one. return false; // Block exists below. element_block_type* blk_data = m_block_store.element_blocks[block_index]; - element_block_type* next_data = m_block_store.element_blocks[block_index+1]; + element_block_type* next_data = m_block_store.element_blocks[block_index + 1]; if (!blk_data) { @@ -4355,8 +4294,8 @@ return false; // Merge the two blocks. - m_block_store.sizes[block_index] += m_block_store.sizes[block_index+1]; - m_block_store.erase(block_index+1); + m_block_store.sizes[block_index] += m_block_store.sizes[block_index + 1]; + m_block_store.erase(block_index + 1); return true; } @@ -4370,33 +4309,32 @@ // Merge it with the next block. element_block_func::append_values_from_block(*blk_data, *next_data); element_block_func::resize_block(*next_data, 0); - m_block_store.sizes[block_index] += m_block_store.sizes[block_index+1]; - delete_element_block(block_index+1); - m_block_store.erase(block_index+1); + m_block_store.sizes[block_index] += m_block_store.sizes[block_index + 1]; + delete_element_block(block_index + 1); + m_block_store.erase(block_index + 1); return true; } template -typename multi_type_vector::size_type -multi_type_vector::set_new_block_to_middle( - size_type block_index, size_type offset, size_type new_block_size, bool overwrite) +typename multi_type_vector::size_type multi_type_vector:: + set_new_block_to_middle(size_type block_index, size_type offset, size_type new_block_size, bool overwrite) { assert(block_index < m_block_store.positions.size()); // First, insert two new blocks after the current block. size_type lower_block_size = m_block_store.sizes[block_index] - offset - new_block_size; - m_block_store.insert(block_index+1, 2); - m_block_store.sizes[block_index+1] = new_block_size; // empty block. - m_block_store.sizes[block_index+2] = lower_block_size; + m_block_store.insert(block_index + 1, 2); + m_block_store.sizes[block_index + 1] = new_block_size; // empty block. + m_block_store.sizes[block_index + 2] = lower_block_size; element_block_type* blk_data = m_block_store.element_blocks[block_index]; if (blk_data) { size_type lower_data_start = offset + new_block_size; - assert(m_block_store.sizes[block_index+2] == lower_block_size); + assert(m_block_store.sizes[block_index + 2] == lower_block_size); element_category_type cat = mtv::get_block_type(*blk_data); - m_block_store.element_blocks[block_index+2] = element_block_func::create_new_block(cat, 0); - m_hdl_event.element_block_acquired(m_block_store.element_blocks[block_index+2]); + m_block_store.element_blocks[block_index + 2] = element_block_func::create_new_block(cat, 0); + m_hdl_event.element_block_acquired(m_block_store.element_blocks[block_index + 2]); // Try to copy the fewer amount of data to the new non-empty block. if (offset > lower_block_size) @@ -4404,8 +4342,7 @@ // Keep the upper values in the current block and copy the lower // values to the new non-empty block. element_block_func::assign_values_from_block( - *m_block_store.element_blocks[block_index+2], - *blk_data, lower_data_start, lower_block_size); + *m_block_store.element_blocks[block_index + 2], *blk_data, lower_data_start, lower_block_size); if (overwrite) { @@ -4416,16 +4353,16 @@ // Shrink the current data block. element_block_func::resize_block(*blk_data, offset); m_block_store.sizes[block_index] = offset; - m_block_store.sizes[block_index+2] = lower_block_size; + m_block_store.sizes[block_index + 2] = lower_block_size; } else { // Keep the lower values in the current block and copy the upper // values to the new non-empty block (blk_lower), and swap the two // later. - element_block_type* blk_lower_data = m_block_store.element_blocks[block_index+2]; + element_block_type* blk_lower_data = m_block_store.element_blocks[block_index + 2]; element_block_func::assign_values_from_block(*blk_lower_data, *blk_data, 0, offset); - m_block_store.sizes[block_index+2] = offset; + m_block_store.sizes[block_index + 2] = offset; if (overwrite) { @@ -4438,11 +4375,11 @@ // Set the size of the current block to its new size ( what is after the new block ) m_block_store.sizes[block_index] = lower_block_size; - m_block_store.sizes[block_index+2] = offset; + m_block_store.sizes[block_index + 2] = offset; // And now let's swap the blocks, while preserving the position of the original block. size_type position = m_block_store.positions[block_index]; - m_block_store.swap(block_index, block_index+2); + m_block_store.swap(block_index, block_index + 2); m_block_store.positions[block_index] = position; } } @@ -4453,10 +4390,10 @@ } // Re-calculate the block positions. - m_block_store.calc_block_position(block_index+1); - m_block_store.calc_block_position(block_index+2); + m_block_store.calc_block_position(block_index + 1); + m_block_store.calc_block_position(block_index + 2); - return block_index+1; + return block_index + 1; } template @@ -4467,7 +4404,7 @@ // No previous block. return false; - const element_block_type* data = m_block_store.element_blocks[block_index-1]; + const element_block_type* data = m_block_store.element_blocks[block_index - 1]; if (data) return cat == mdds::mtv::get_block_type(*data); @@ -4482,7 +4419,7 @@ // No next block. return false; - const element_block_type* data = m_block_store.element_blocks[block_index+1]; + const element_block_type* data = m_block_store.element_blocks[block_index + 1]; if (data) return cat == mdds::mtv::get_block_type(*data); @@ -4490,10 +4427,10 @@ } template -typename multi_type_vector::element_block_type* -multi_type_vector::exchange_elements( - const element_block_type& src_data, size_type src_offset, size_type dst_index, - size_type dst_offset, size_type len) +typename multi_type_vector::element_block_type* multi_type_vector:: + exchange_elements( + const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset, + size_type len) { assert(dst_index < m_block_store.positions.size()); element_block_type* dst_blk_data = m_block_store.element_blocks[dst_index]; @@ -4512,15 +4449,16 @@ // The whole block will get replaced. std::unique_ptr data(dst_blk_data); m_hdl_event.element_block_released(dst_blk_data); - m_block_store.element_blocks[dst_index] = nullptr; // Prevent its deletion when the parent block gets deleted. + m_block_store.element_blocks[dst_index] = + nullptr; // Prevent its deletion when the parent block gets deleted. dst_blk_data = nullptr; if (blk_prev) { // Append to the previous block. Remove the current block. - element_block_type* dst_prev_data = m_block_store.element_blocks[dst_index-1]; + element_block_type* dst_prev_data = m_block_store.element_blocks[dst_index - 1]; element_block_func::append_values_from_block(*dst_prev_data, src_data, src_offset, len); - m_block_store.sizes[dst_index-1] += len; + m_block_store.sizes[dst_index - 1] += len; size_type dst_erase_size = 1; @@ -4529,11 +4467,11 @@ if (blk_next) { // Apend elements from the next block too. - element_block_type* dst_next_data = m_block_store.element_blocks[dst_index+1]; + element_block_type* dst_next_data = m_block_store.element_blocks[dst_index + 1]; element_block_func::append_values_from_block(*dst_prev_data, *dst_next_data); - m_block_store.sizes[dst_index-1] += m_block_store.sizes[dst_index+1]; + m_block_store.sizes[dst_index - 1] += m_block_store.sizes[dst_index + 1]; ++dst_erase_size; - delete_element_block(dst_index+1); + delete_element_block(dst_index + 1); } m_block_store.erase(dst_index, dst_erase_size); @@ -4546,10 +4484,10 @@ // We need to merge with the next block. Remove the current // block and use the next block to store the new elements as // well as the existing ones. - element_block_type* dst_next_data = m_block_store.element_blocks[dst_index+1]; + element_block_type* dst_next_data = m_block_store.element_blocks[dst_index + 1]; element_block_func::prepend_values_from_block(*dst_next_data, src_data, src_offset, len); - m_block_store.positions[dst_index+1] -= len; - m_block_store.sizes[dst_index+1] += len; + m_block_store.positions[dst_index + 1] -= len; + m_block_store.sizes[dst_index + 1] += len; m_block_store.erase(dst_index); } else @@ -4585,9 +4523,9 @@ if (blk_prev) { // Append the new elements to the previous block. - element_block_type* dst_prev_data = m_block_store.element_blocks[dst_index-1]; + element_block_type* dst_prev_data = m_block_store.element_blocks[dst_index - 1]; element_block_func::append_values_from_block(*dst_prev_data, src_data, src_offset, len); - m_block_store.sizes[dst_index-1] += len; + m_block_store.sizes[dst_index - 1] += len; } else { @@ -4626,18 +4564,18 @@ if (blk_next) { // Merge with the next block. - element_block_type* dst_next_data = m_block_store.element_blocks[dst_index+1]; + element_block_type* dst_next_data = m_block_store.element_blocks[dst_index + 1]; element_block_func::prepend_values_from_block(*dst_next_data, src_data, src_offset, len); - m_block_store.positions[dst_index+1] -= len; - m_block_store.sizes[dst_index+1] += len; + m_block_store.positions[dst_index + 1] -= len; + m_block_store.sizes[dst_index + 1] += len; } else { // Insert a new block to store the new elements. size_type position = m_block_store.positions[dst_index] + dst_offset; - m_block_store.insert(dst_index+1, position, len, nullptr); - m_block_store.element_blocks[dst_index+1] = element_block_func::create_new_block(cat_src, 0); - dst_blk_data = m_block_store.element_blocks[dst_index+1]; + m_block_store.insert(dst_index + 1, position, len, nullptr); + m_block_store.element_blocks[dst_index + 1] = element_block_func::create_new_block(cat_src, 0); + dst_blk_data = m_block_store.element_blocks[dst_index + 1]; assert(dst_blk_data); m_hdl_event.element_block_acquired(dst_blk_data); element_block_func::assign_values_from_block(*dst_blk_data, src_data, src_offset, len); @@ -4661,9 +4599,8 @@ template void multi_type_vector::exchange_elements( - const element_block_type& src_blk, size_type src_offset, - size_type dst_index1, size_type dst_offset1, size_type dst_index2, size_type dst_offset2, - size_type len, blocks_type& new_blocks) + const element_block_type& src_blk, size_type src_offset, size_type dst_index1, size_type dst_offset1, + size_type dst_index2, size_type dst_offset2, size_type len, blocks_type& new_blocks) { assert(dst_index1 < dst_index2); assert(dst_offset1 < m_block_store.sizes[dst_index1]); @@ -4790,24 +4727,24 @@ size_type new_block_size = new_end_row - start_row_in_block + 1; if (data) { - element_block_func::overwrite_values(*data, new_end_row+1, end_row_in_block-new_end_row); + element_block_func::overwrite_values(*data, new_end_row + 1, end_row_in_block - new_end_row); element_block_func::resize_block(*data, new_block_size); } m_block_store.sizes[block_index] = new_block_size; } // Remove all blocks below the current one. - delete_element_blocks(block_index+1, m_block_store.element_blocks.size()); + delete_element_blocks(block_index + 1, m_block_store.element_blocks.size()); size_type len = m_block_store.element_blocks.size() - block_index - 1; - m_block_store.erase(block_index+1, len); + m_block_store.erase(block_index + 1, len); m_cur_size = new_size; } template -typename multi_type_vector::iterator -multi_type_vector::transfer_multi_blocks( - size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, - multi_type_vector& dest, size_type dest_pos) +typename multi_type_vector::iterator multi_type_vector:: + transfer_multi_blocks( + size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, multi_type_vector& dest, + size_type dest_pos) { assert(block_index1 < block_index2); size_type start_pos_in_block1 = m_block_store.positions[block_index1]; @@ -4847,14 +4784,14 @@ dest.delete_element_block(dest_block_index); dest.m_block_store.sizes[dest_block_index] = 0; if (block_len > 1) - dest.m_block_store.insert(dest_block_index, block_len-1); + dest.m_block_store.insert(dest_block_index, block_len - 1); } } else if (dest_pos_in_block + len - 1 == it_dest_blk->size - 1) { // Copy to the bottom part of destination block. Insert slots for new // blocks below current, and shrink the current block. - dest.m_block_store.insert(dest_block_index+1, block_len); + dest.m_block_store.insert(dest_block_index + 1, block_len); dest.m_block_store.sizes[dest_block_index] -= len; ++dest_block_index1; @@ -4865,14 +4802,14 @@ // new blocks (plus one extra for the bottom empty block) below the // current block. size_type blk2_size = dest.m_block_store.sizes[dest_block_index] - dest_pos_in_block - len; - dest.m_block_store.insert(dest_block_index+1, block_len+1); - assert(dest.m_block_store.positions.size() > dest_block_index+block_len+1); + dest.m_block_store.insert(dest_block_index + 1, block_len + 1); + assert(dest.m_block_store.positions.size() > dest_block_index + block_len + 1); dest.m_block_store.sizes[dest_block_index] = dest_pos_in_block; // Re-calculate the size and position of the lower part of the destination block. - dest.m_block_store.positions[dest_block_index+block_len+1] = + dest.m_block_store.positions[dest_block_index + block_len + 1] = dest.m_block_store.calc_next_block_position(dest_block_index) + len; - dest.m_block_store.sizes[dest_block_index+block_len+1] = blk2_size; + dest.m_block_store.sizes[dest_block_index + block_len + 1] = blk2_size; ++dest_block_index1; } @@ -4904,7 +4841,7 @@ // Shallow-copy the elements to the destination block, and shrink // the source block to remove the transferred elements. element_block_func::assign_values_from_block( - *dst_data1, *blk_data1, offset, m_block_store.sizes[block_index1]-offset); + *dst_data1, *blk_data1, offset, m_block_store.sizes[block_index1] - offset); element_block_func::resize_block(*blk_data1, offset); } @@ -4974,10 +4911,8 @@ if (blk_data2) { element_category_type cat = mtv::get_block_type(*blk_data2); - dest.m_block_store.element_blocks[dest_block_pos] = - element_block_func::create_new_block(cat, 0); - element_block_type* blk_dst_data = - dest.m_block_store.element_blocks[dest_block_pos]; + dest.m_block_store.element_blocks[dest_block_pos] = element_block_func::create_new_block(cat, 0); + element_block_type* blk_dst_data = dest.m_block_store.element_blocks[dest_block_pos]; dest.m_hdl_event.element_block_acquired(blk_dst_data); element_block_func::assign_values_from_block(*blk_dst_data, *blk_data2, 0, size_to_trans); @@ -5009,7 +4944,7 @@ // Now that all the elements have been transferred, check the bordering // blocks in the destination and merge them as needed. if (block_len > 1) - dest.merge_with_adjacent_blocks(dest_block_index1+block_len-1); + dest.merge_with_adjacent_blocks(dest_block_index1 + block_len - 1); dest.merge_with_adjacent_blocks(dest_block_index1); // Delete all transferred blocks, and replace it with one empty block. @@ -5050,11 +4985,11 @@ return get_iterator(block_index2); } - if (del_index1 > 0 && !m_block_store.element_blocks[del_index1-1]) + if (del_index1 > 0 && !m_block_store.element_blocks[del_index1 - 1]) { // The block before the first block to be deleted is empty. Simply // extend that block to cover the deleted block segment. - m_block_store.sizes[del_index1-1] += len; + m_block_store.sizes[del_index1 - 1] += len; } else { @@ -5104,9 +5039,11 @@ } template -void multi_type_vector::swap(size_type start_pos, size_type end_pos, multi_type_vector& other, size_type other_pos) +void multi_type_vector::swap( + size_type start_pos, size_type end_pos, multi_type_vector& other, size_type other_pos) { - MDDS_MTV_TRACE_ARGS(mutator, "start_pos=" << start_pos << "; end_pos=" << end_pos << "; other=?; other_pos=" << other_pos); + MDDS_MTV_TRACE_ARGS( + mutator, "start_pos=" << start_pos << "; end_pos=" << end_pos << "; other=?; other_pos=" << other_pos); if (start_pos > end_pos) throw std::out_of_range("multi_type_vector::swap: start position is larger than the end position!"); @@ -5138,8 +5075,7 @@ other.dump_blocks(os_prev_block_other); #endif - swap_impl( - other, start_pos, end_pos, other_pos, block_index1, block_index2, dest_block_index1, dest_block_index2); + swap_impl(other, start_pos, end_pos, other_pos, block_index1, block_index2, dest_block_index1, dest_block_index2); #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG std::ostringstream os_block, os_block_other; @@ -5155,7 +5091,9 @@ { std::ostringstream os; os << e.what() << std::endl; - os << std::endl << "block integrity check failed in swap (start_pos=" << start_pos << "; end_pos=" << end_pos << "; other_pos=" << other_pos << ")" << std::endl; + os << std::endl + << "block integrity check failed in swap (start_pos=" << start_pos << "; end_pos=" << end_pos + << "; other_pos=" << other_pos << ")" << std::endl; os << std::endl << "previous block state (source):" << std::endl; os << os_prev_block.str(); os << std::endl << "previous block state (destination):" << std::endl; @@ -5183,7 +5121,7 @@ } template -bool multi_type_vector::operator== (const multi_type_vector& other) const +bool multi_type_vector::operator==(const multi_type_vector& other) const { MDDS_MTV_TRACE_ARGS(accessor, "other=?"); @@ -5199,15 +5137,16 @@ } template -bool multi_type_vector::operator!= (const multi_type_vector& other) const +bool multi_type_vector::operator!=(const multi_type_vector& other) const { MDDS_MTV_TRACE_ARGS(accessor, "other=?"); - return !operator== (other); + return !operator==(other); } template -multi_type_vector& multi_type_vector::operator= (const multi_type_vector& other) +multi_type_vector& multi_type_vector::operator=( + const multi_type_vector& other) { MDDS_MTV_TRACE_ARGS(mutator, "other=? (copy)"); @@ -5217,7 +5156,7 @@ } template -multi_type_vector& multi_type_vector::operator= (multi_type_vector&& other) +multi_type_vector& multi_type_vector::operator=(multi_type_vector&& other) { MDDS_MTV_TRACE_ARGS(mutator, "other=? (move)"); @@ -5248,7 +5187,8 @@ element_category_type cat = mtv::element_type_empty; if (data) cat = mtv::get_block_type(*data); - os << " block " << i << ": position=" << pos << " size=" << size << " type=" << std::dec << cat << " data=" << std::hex << data << std::endl; + os << " block " << i << ": position=" << pos << " size=" << size << " type=" << std::dec << cat + << " data=" << std::hex << data << std::endl; } os.setf(origflags); } @@ -5275,8 +5215,7 @@ } const element_block_type* data_prev = m_block_store.element_blocks[0]; - element_category_type cat_prev = - data_prev ? mtv::get_block_type(*data_prev) : mtv::element_type_empty; + element_category_type cat_prev = data_prev ? mtv::get_block_type(*data_prev) : mtv::element_type_empty; size_type cur_position = m_block_store.sizes[0]; size_type total_size = m_block_store.sizes[0]; @@ -5290,9 +5229,8 @@ if (m_block_store.positions[i] != cur_position) { std::ostringstream os; - os << "position of the current block is wrong! (expected=" - << cur_position << "; actual=" << m_block_store.positions[i] << ")" - << std::endl; + os << "position of the current block is wrong! (expected=" << cur_position + << "; actual=" << m_block_store.positions[i] << ")" << std::endl; dump_blocks(os); throw mdds::integrity_error(os.str()); @@ -5307,8 +5245,7 @@ cat = mtv::get_block_type(*data); if (element_block_func::size(*data) != this_size) - throw mdds::integrity_error( - "block size cache and the actual element block size differ!"); + throw mdds::integrity_error("block size cache and the actual element block size differ!"); } if (cat_prev == cat) @@ -5338,7 +5275,6 @@ #endif -}}} +}}} // namespace mdds::mtv::soa /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/soa/main.hpp mdds-2.0.3/include/mdds/multi_type_vector/soa/main.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/soa/main.hpp 2022-02-16 00:39:59.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/soa/main.hpp 2022-05-11 00:33:24.000000000 +0000 @@ -104,9 +104,10 @@ size_type size = 0; element_block_type* element_block = nullptr; - block_slot_type() {} - block_slot_type(size_type _position, size_type _size) : - position(_position), size(_size) {} + block_slot_type() + {} + block_slot_type(size_type _position, size_type _size) : position(_position), size(_size) + {} }; struct blocks_type @@ -186,7 +187,7 @@ using sizes_iterator_type = typename sizes_type::iterator; using element_blocks_iterator_type = typename element_blocks_type::iterator; - using private_data_update = mdds::detail::mtv::private_data_forward_update; + using private_data_update = mdds::detail::mtv::private_data_forward_update; }; struct const_iterator_trait @@ -200,7 +201,7 @@ using sizes_iterator_type = typename sizes_type::const_iterator; using element_blocks_iterator_type = typename element_blocks_type::const_iterator; - using private_data_update = mdds::detail::mtv::private_data_forward_update; + using private_data_update = mdds::detail::mtv::private_data_forward_update; }; struct reverse_iterator_trait @@ -214,7 +215,7 @@ using sizes_iterator_type = typename sizes_type::reverse_iterator; using element_blocks_iterator_type = typename element_blocks_type::reverse_iterator; - using private_data_update = mdds::detail::mtv::private_data_no_update; + using private_data_update = mdds::detail::mtv::private_data_no_update; }; struct const_reverse_iterator_trait @@ -228,19 +229,18 @@ using sizes_iterator_type = typename sizes_type::const_reverse_iterator; using element_blocks_iterator_type = typename element_blocks_type::const_reverse_iterator; - using private_data_update = mdds::detail::mtv::private_data_no_update; + using private_data_update = mdds::detail::mtv::private_data_no_update; }; struct element_block_deleter { - void operator() (const element_block_type* p) + void operator()(const element_block_type* p) { element_block_func::delete_block(p); } }; public: - using iterator = detail::iterator_base; using const_iterator = detail::const_iterator_base; @@ -265,7 +265,7 @@ * nullptr in case the block represents an empty segment. * */ - using value_type = mdds::detail::mtv::iterator_value_node; + using value_type = mdds::detail::mtv::iterator_value_node; /** * Move the position object to the next logical position. Caller must @@ -338,7 +338,6 @@ */ multi_type_vector(); - /** * Constructor that takes an lvalue reference to an event handler object. * The event handler instance will be copy-constructed. @@ -388,7 +387,7 @@ * @param it_end iterator that points to the end position of the values * the container is being initialized to. The end position * is not inclusive. - */ + */ template multi_type_vector(size_type init_size, const T& it_begin, const T& it_end); @@ -536,7 +535,8 @@ * @return iterator referencing the block where the moved elements were * prior to the transfer. */ - iterator transfer(const iterator& pos_hint, size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos); + iterator transfer( + const iterator& pos_hint, size_type start_pos, size_type end_pos, multi_type_vector& dest, size_type dest_pos); /** * Set a value of an arbitrary type to a specified position. The type of @@ -1108,11 +1108,11 @@ */ void shrink_to_fit(); - bool operator== (const multi_type_vector& other) const; - bool operator!= (const multi_type_vector& other) const; + bool operator==(const multi_type_vector& other) const; + bool operator!=(const multi_type_vector& other) const; - multi_type_vector& operator= (const multi_type_vector& other); - multi_type_vector& operator= (multi_type_vector&& other); + multi_type_vector& operator=(const multi_type_vector& other); + multi_type_vector& operator=(multi_type_vector&& other); /** * Return the numerical identifier that represents passed element. @@ -1139,8 +1139,7 @@ void get_impl(size_type pos, T& value) const; template - bool set_cells_precheck( - size_type row, const T& it_begin, const T& it_end, size_type& end_pos); + bool set_cells_precheck(size_type row, const T& it_begin, const T& it_end, size_type& end_pos); template iterator set_impl(size_type pos, size_type block_index, const T& value); @@ -1149,20 +1148,20 @@ iterator release_impl(size_type pos, size_type block_index, T& value); void swap_impl( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2); void swap_single_block( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type other_block_index); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type other_block_index); void swap_single_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index, size_type dst_block_index1, size_type dst_block_index2); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index, + size_type dst_block_index1, size_type dst_block_index2); void swap_multi_to_multi_blocks( - multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, - size_type block_index1, size_type block_index2, size_type dblock_index1, size_type dblock_index2); + multi_type_vector& other, size_type start_pos, size_type end_pos, size_type other_pos, size_type block_index1, + size_type block_index2, size_type dblock_index1, size_type dblock_index2); template iterator insert_cells_impl(size_type row, size_type block_index, const T& it_begin, const T& it_end); @@ -1174,8 +1173,8 @@ * blocks. */ iterator transfer_multi_blocks( - size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, - multi_type_vector& dest, size_type dest_pos); + size_type start_pos, size_type end_pos, size_type block_index1, size_type block_index2, multi_type_vector& dest, + size_type dest_pos); /** * @param start_pos logical start position. @@ -1185,11 +1184,9 @@ * heap objects, objects pointed to by the overwritten * pointers should be freed from memory. */ - iterator set_empty_impl( - size_type start_pos, size_type end_pos, size_type block_index1, bool overwrite); + iterator set_empty_impl(size_type start_pos, size_type end_pos, size_type block_index1, bool overwrite); - iterator set_empty_in_single_block( - size_type start_row, size_type end_row, size_type block_index, bool overwrite); + iterator set_empty_in_single_block(size_type start_row, size_type end_row, size_type block_index, bool overwrite); /** * @param start_row logical start position. @@ -1201,8 +1198,7 @@ * pointers should be freed from memory. */ iterator set_empty_in_multi_blocks( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - bool overwrite); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, bool overwrite); void erase_impl(size_type start_pos, size_type end_pos); void erase_in_single_block(size_type start_pos, size_type end_pos, size_type block_index); @@ -1217,7 +1213,8 @@ void insert_blocks_at(size_type position, size_type insert_pos, blocks_type& new_blocks); void prepare_blocks_to_transfer( - blocks_to_transfer& bucket, size_type block_index1, size_type offset1, size_type block_index2, size_type offset2); + blocks_to_transfer& bucket, size_type block_index1, size_type offset1, size_type block_index2, + size_type offset2); iterator set_whole_block_empty(size_type block_index, bool overwrite); @@ -1230,23 +1227,22 @@ template iterator set_cells_to_single_block( - size_type start_row, size_type end_row, size_type block_index, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index, const T& it_begin, const T& it_end); template iterator set_cells_to_multi_blocks( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end); template iterator set_cells_to_multi_blocks_block1_non_equal( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end); template iterator set_cells_to_multi_blocks_block1_non_empty( - size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, - const T& it_begin, const T& it_end); + size_type start_row, size_type end_row, size_type block_index1, size_type block_index2, const T& it_begin, + const T& it_end); template iterator set_cell_to_empty_block(size_type block_index, size_type pos_in_block, const T& cell); @@ -1263,13 +1259,13 @@ * * @return index of the block that contains the specified logical row ID. */ - size_type get_block_position(size_type row, size_type start_block_index=0) const; + size_type get_block_position(size_type row, size_type start_block_index = 0) const; /** - * Same as above, but try to infer block position from the iterator first - * before trying full search. + * Same as above, but try to infer block position from the private position + * data stored in the iterator first before trying full search. */ - size_type get_block_position(const const_iterator& pos_hint, size_type row) const; + size_type get_block_position(const typename value_type::private_data& pos_data, size_type row) const; template void create_new_block_with_new_cell(size_type block_index, const T& cell); @@ -1286,16 +1282,13 @@ */ template bool append_to_prev_block( - size_type block_index, element_category_type cat, size_type length, - const T& it_begin, const T& it_end); + size_type block_index, element_category_type cat, size_type length, const T& it_begin, const T& it_end); template - void insert_cells_to_middle( - size_type row, size_type block_index, const T& it_begin, const T& it_end); + void insert_cells_to_middle(size_type row, size_type block_index, const T& it_begin, const T& it_end); template - iterator set_cell_to_middle_of_block( - size_type block_index, size_type pos_in_block, const T& cell); + iterator set_cell_to_middle_of_block(size_type block_index, size_type pos_in_block, const T& cell); /** * Set a new value to the top of specified non-empty block. The block is @@ -1309,15 +1302,13 @@ void set_cell_to_bottom_of_data_block(size_type block_index, const T& cell); iterator transfer_impl( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos); + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos); /** * All elements to transfer to the other instance is in the same block. */ iterator transfer_single_block( - size_type start_pos, size_type end_pos, size_type block_index1, - multi_type_vector& dest, size_type dest_pos); + size_type start_pos, size_type end_pos, size_type block_index1, multi_type_vector& dest, size_type dest_pos); /** * Merge with previous or next block as needed. @@ -1398,12 +1389,12 @@ * its life cycle. */ element_block_type* exchange_elements( - const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset, size_type len); + const element_block_type& src_data, size_type src_offset, size_type dst_index, size_type dst_offset, + size_type len); void exchange_elements( - const element_block_type& src_blk, size_type src_offset, - size_type dst_index1, size_type dst_offset1, size_type dst_index2, size_type dst_offset2, - size_type len, blocks_type& new_blocks); + const element_block_type& src_blk, size_type src_offset, size_type dst_index1, size_type dst_offset1, + size_type dst_index2, size_type dst_offset2, size_type len, blocks_type& new_blocks); bool append_empty(size_type len); @@ -1417,10 +1408,9 @@ std::advance(iter_elem, block_index); return iterator( - { iter_pos, iter_size, iter_elem }, - { m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end() }, - block_index - ); + {iter_pos, iter_size, iter_elem}, + {m_block_store.positions.end(), m_block_store.sizes.end(), m_block_store.element_blocks.end()}, this, + block_index); } inline const_iterator get_const_iterator(size_type block_index) const @@ -1433,15 +1423,13 @@ std::advance(iter_elem, block_index); return const_iterator( - { iter_pos, iter_size, iter_elem }, - { m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend() }, - block_index - ); + {iter_pos, iter_size, iter_elem}, + {m_block_store.positions.cend(), m_block_store.sizes.cend(), m_block_store.element_blocks.cend()}, this, + block_index); } private: - using adjust_block_positions_func = - detail::adjust_block_positions; + using adjust_block_positions_func = detail::adjust_block_positions; event_func m_hdl_event; blocks_type m_block_store; @@ -1452,11 +1440,10 @@ #endif }; -}}} +}}} // namespace mdds::mtv::soa #include "main_def.inl" #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/soa/Makefile.in mdds-2.0.3/include/mdds/multi_type_vector/soa/Makefile.in --- mdds-2.0.2/include/mdds/multi_type_vector/soa/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/soa/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -163,8 +163,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -178,9 +176,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -192,11 +191,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -386,7 +384,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/trait.hpp mdds-2.0.3/include/mdds/multi_type_vector/trait.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/trait.hpp 2021-07-26 22:05:24.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/trait.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -197,8 +197,7 @@ // destructor and destructors should not throw exceptions. std::ostringstream os; os << __FILE__ << "#" << __LINE__ << " (element_block_func_base:delete_block): " - << "failed to delete a block of unknown type (" << get_block_type(*p) << ")" - << std::endl; + << "failed to delete a block of unknown type (" << get_block_type(*p) << ")" << std::endl; throw general_error(os.str()); #else throw general_error("delete_block: failed to delete a block of unknown type."); @@ -651,8 +650,7 @@ return int8_element_block::get(left) == int8_element_block::get(right); case element_type_uint8: return uint8_element_block::get(left) == uint8_element_block::get(right); - default: - ; + default:; } return false; } @@ -744,11 +742,12 @@ * Default cell block function definitions. Implementation can use this if * it only uses the default block types implemented by the library. */ -struct element_block_func : public element_block_func_base {}; +struct element_block_func : public element_block_func_base +{ +}; -}} +}} // namespace mdds::mtv #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/types.hpp mdds-2.0.3/include/mdds/multi_type_vector/types.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/types.hpp 2022-02-11 14:50:43.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/types.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -42,11 +42,11 @@ #include #endif -#if defined(MDDS_UNIT_TEST) || defined (MDDS_MULTI_TYPE_VECTOR_DEBUG) +#if defined(MDDS_UNIT_TEST) || defined(MDDS_MULTI_TYPE_VECTOR_DEBUG) #include #include -using std::cout; using std::cerr; +using std::cout; using std::endl; #endif @@ -57,17 +57,17 @@ constexpr element_t element_type_empty = -1; constexpr element_t element_type_boolean = 0; -constexpr element_t element_type_int8 = 1; -constexpr element_t element_type_uint8 = 2; -constexpr element_t element_type_int16 = 3; -constexpr element_t element_type_uint16 = 4; -constexpr element_t element_type_int32 = 5; -constexpr element_t element_type_uint32 = 6; -constexpr element_t element_type_int64 = 7; -constexpr element_t element_type_uint64 = 8; -constexpr element_t element_type_float = 9; -constexpr element_t element_type_double = 10; -constexpr element_t element_type_string = 11; +constexpr element_t element_type_int8 = 1; +constexpr element_t element_type_uint8 = 2; +constexpr element_t element_type_int16 = 3; +constexpr element_t element_type_uint16 = 4; +constexpr element_t element_type_int32 = 5; +constexpr element_t element_type_uint32 = 6; +constexpr element_t element_type_int64 = 7; +constexpr element_t element_type_uint64 = 8; +constexpr element_t element_type_float = 9; +constexpr element_t element_type_double = 10; +constexpr element_t element_type_string = 11; constexpr element_t element_type_user_start = 50; @@ -159,7 +159,8 @@ class element_block_error : public mdds::general_error { public: - element_block_error(const std::string& msg) : mdds::general_error(msg) {} + element_block_error(const std::string& msg) : mdds::general_error(msg) + {} }; class base_element_block; @@ -172,9 +173,11 @@ class base_element_block { friend element_t get_block_type(const base_element_block&); + protected: element_t type; - base_element_block(element_t _t) : type(_t) {} + base_element_block(element_t _t) : type(_t) + {} }; template @@ -183,7 +186,7 @@ #ifdef MDDS_UNIT_TEST struct print_block_array { - void operator() (const _Data& val) const + void operator()(const _Data& val) const { std::cout << val << " "; } @@ -198,12 +201,16 @@ #endif store_type m_array; - element_block() : base_element_block(_TypeId) {} - element_block(size_t n) : base_element_block(_TypeId), m_array(n) {} - element_block(size_t n, const _Data& val) : base_element_block(_TypeId), m_array(n, val) {} + element_block() : base_element_block(_TypeId) + {} + element_block(size_t n) : base_element_block(_TypeId), m_array(n) + {} + element_block(size_t n, const _Data& val) : base_element_block(_TypeId), m_array(n, val) + {} template - element_block(const _Iter& it_begin, const _Iter& it_end) : base_element_block(_TypeId), m_array(it_begin, it_end) {} + element_block(const _Iter& it_begin, const _Iter& it_end) : base_element_block(_TypeId), m_array(it_begin, it_end) + {} public: static const element_t block_type = _TypeId; @@ -214,12 +221,12 @@ typedef typename store_type::const_reverse_iterator const_reverse_iterator; typedef _Data value_type; - bool operator== (const _Self& r) const + bool operator==(const _Self& r) const { return m_array == r.m_array; } - bool operator!= (const _Self& r) const + bool operator!=(const _Self& r) const { return !operator==(r); } @@ -310,7 +317,8 @@ if (get_block_type(block) != _TypeId) { std::ostringstream os; - os << "incorrect block type: expected block type=" << _TypeId << ", passed block type=" << get_block_type(block); + os << "incorrect block type: expected block type=" << _TypeId + << ", passed block type=" << get_block_type(block); throw general_error(os.str()); } #endif @@ -323,7 +331,8 @@ if (get_block_type(block) != _TypeId) { std::ostringstream os; - os << "incorrect block type: expected block type=" << _TypeId << ", passed block type=" << get_block_type(block); + os << "incorrect block type: expected block type=" << _TypeId + << ", passed block type=" << get_block_type(block); throw general_error(os.str()); } #endif @@ -385,19 +394,20 @@ std::cout << std::endl; } #else - static void print_block(const base_element_block&) {} + static void print_block(const base_element_block&) + {} #endif static void erase_block(base_element_block& blk, size_t pos) { store_type& blk2 = get(blk).m_array; - blk2.erase(blk2.begin()+pos); + blk2.erase(blk2.begin() + pos); } static void erase_block(base_element_block& blk, size_t pos, size_t size) { store_type& blk2 = get(blk).m_array; - blk2.erase(blk2.begin()+pos, blk2.begin()+pos+size); + blk2.erase(blk2.begin() + pos, blk2.begin() + pos + size); } static void append_values_from_block(base_element_block& dest, const base_element_block& src) @@ -412,7 +422,7 @@ { store_type& d = get(dest).m_array; const store_type& s = get(src).m_array; - std::pair its = get_iterator_pair(s, begin_pos, len); + std::pair its = get_iterator_pair(s, begin_pos, len); #ifndef MDDS_MULTI_TYPE_VECTOR_USE_DEQUE d.reserve(d.size() + len); #endif @@ -424,7 +434,7 @@ { store_type& d = get(dest).m_array; const store_type& s = get(src).m_array; - std::pair its = get_iterator_pair(s, begin_pos, len); + std::pair its = get_iterator_pair(s, begin_pos, len); d.assign(its.first, its.second); } @@ -433,15 +443,14 @@ { store_type& d = get(dest).m_array; const store_type& s = get(src).m_array; - std::pair its = get_iterator_pair(s, begin_pos, len); + std::pair its = get_iterator_pair(s, begin_pos, len); #ifndef MDDS_MULTI_TYPE_VECTOR_USE_DEQUE d.reserve(d.size() + len); #endif d.insert(d.begin(), its.first, its.second); } - static void swap_values( - base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) + static void swap_values(base_element_block& blk1, base_element_block& blk2, size_t pos1, size_t pos2, size_t len) { store_type& st1 = get(blk1).m_array; store_type& st2 = get(blk2).m_array; @@ -464,8 +473,7 @@ } template - static void set_values( - base_element_block& block, size_t pos, const _Iter& it_begin, const _Iter& it_end) + static void set_values(base_element_block& block, size_t pos, const _Iter& it_begin, const _Iter& it_end) { store_type& d = get(block).m_array; typename store_type::iterator it_dest = d.begin(); @@ -497,11 +505,10 @@ } template - static void insert_values( - base_element_block& block, size_t pos, const _Iter& it_begin, const _Iter& it_end) + static void insert_values(base_element_block& block, size_t pos, const _Iter& it_begin, const _Iter& it_end) { store_type& blk = get(block).m_array; - blk.insert(blk.begin()+pos, it_begin, it_end); + blk.insert(blk.begin() + pos, it_begin, it_end); } static size_t capacity(const base_element_block& block) @@ -522,29 +529,34 @@ } private: - static std::pair - get_iterator_pair(const store_type& array, size_t begin_pos, size_t len) + static std::pair get_iterator_pair( + const store_type& array, size_t begin_pos, size_t len) { assert(begin_pos + len <= array.size()); const_iterator it = array.begin(); std::advance(it, begin_pos); const_iterator it_end = it; std::advance(it_end, len); - return std::pair(it, it_end); + return std::pair(it, it_end); } }; template class copyable_element_block : public element_block<_Self, _TypeId, _Data> { - typedef element_block<_Self,_TypeId,_Data> base_type; + typedef element_block<_Self, _TypeId, _Data> base_type; + protected: - copyable_element_block() : base_type() {} - copyable_element_block(size_t n) : base_type(n) {} - copyable_element_block(size_t n, const _Data& val) : base_type(n, val) {} + copyable_element_block() : base_type() + {} + copyable_element_block(size_t n) : base_type(n) + {} + copyable_element_block(size_t n, const _Data& val) : base_type(n, val) + {} template - copyable_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) {} + copyable_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) + {} public: using base_type::get; @@ -559,14 +571,19 @@ template class noncopyable_element_block : public element_block<_Self, _TypeId, _Data> { - typedef element_block<_Self,_TypeId,_Data> base_type; + typedef element_block<_Self, _TypeId, _Data> base_type; + protected: - noncopyable_element_block() : base_type() {} - noncopyable_element_block(size_t n) : base_type(n) {} - noncopyable_element_block(size_t n, const _Data& val) : base_type(n, val) {} + noncopyable_element_block() : base_type() + {} + noncopyable_element_block(size_t n) : base_type(n) + {} + noncopyable_element_block(size_t n, const _Data& val) : base_type(n, val) + {} template - noncopyable_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) {} + noncopyable_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) + {} public: noncopyable_element_block(const noncopyable_element_block&) = delete; @@ -595,17 +612,21 @@ * multi_type_vector. */ template -struct default_element_block : public copyable_element_block, _TypeId, _Data> +struct default_element_block : public copyable_element_block, _TypeId, _Data> { typedef copyable_element_block base_type; - typedef default_element_block<_TypeId,_Data> self_type; + typedef default_element_block<_TypeId, _Data> self_type; - default_element_block() : base_type() {} - default_element_block(size_t n) : base_type(n) {} - default_element_block(size_t n, const _Data& val) : base_type(n, val) {} + default_element_block() : base_type() + {} + default_element_block(size_t n) : base_type(n) + {} + default_element_block(size_t n, const _Data& val) : base_type(n, val) + {} template - default_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) {} + default_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) + {} static self_type* create_block_with_value(size_t init_size, const _Data& val) { @@ -629,17 +650,19 @@ * cycles are managed by the block. */ template -struct managed_element_block : public copyable_element_block, _TypeId, _Data*> +struct managed_element_block : public copyable_element_block, _TypeId, _Data*> { - typedef copyable_element_block, _TypeId, _Data*> base_type; - typedef managed_element_block<_TypeId,_Data> self_type; + typedef copyable_element_block, _TypeId, _Data*> base_type; + typedef managed_element_block<_TypeId, _Data> self_type; using base_type::get; - using base_type::set_value; using base_type::m_array; + using base_type::set_value; - managed_element_block() : base_type() {} - managed_element_block(size_t n) : base_type(n) {} + managed_element_block() : base_type() + {} + managed_element_block(size_t n) : base_type(n) + {} managed_element_block(const managed_element_block& r) { #ifndef MDDS_MULTI_TYPE_VECTOR_USE_DEQUE @@ -651,7 +674,8 @@ } template - managed_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) {} + managed_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) + {} ~managed_element_block() { @@ -687,20 +711,24 @@ }; template -struct noncopyable_managed_element_block : public noncopyable_element_block, _TypeId, _Data*> +struct noncopyable_managed_element_block + : public noncopyable_element_block, _TypeId, _Data*> { - typedef noncopyable_element_block, _TypeId, _Data*> base_type; - typedef managed_element_block<_TypeId,_Data> self_type; + typedef noncopyable_element_block, _TypeId, _Data*> base_type; + typedef managed_element_block<_TypeId, _Data> self_type; using base_type::get; using base_type::m_array; using base_type::set_value; - noncopyable_managed_element_block() : base_type() {} - noncopyable_managed_element_block(size_t n) : base_type(n) {} + noncopyable_managed_element_block() : base_type() + {} + noncopyable_managed_element_block(size_t n) : base_type(n) + {} template - noncopyable_managed_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) {} + noncopyable_managed_element_block(const _Iter& it_begin, const _Iter& it_end) : base_type(it_begin, it_end) + {} ~noncopyable_managed_element_block() { @@ -736,21 +764,20 @@ }; using boolean_element_block = default_element_block; -using int8_element_block = default_element_block; -using uint8_element_block = default_element_block; -using int16_element_block = default_element_block; -using uint16_element_block = default_element_block; -using int32_element_block = default_element_block; -using uint32_element_block = default_element_block; -using int64_element_block = default_element_block; -using uint64_element_block = default_element_block; -using float_element_block = default_element_block; -using double_element_block = default_element_block; -using string_element_block = default_element_block; +using int8_element_block = default_element_block; +using uint8_element_block = default_element_block; +using int16_element_block = default_element_block; +using uint16_element_block = default_element_block; +using int32_element_block = default_element_block; +using uint32_element_block = default_element_block; +using int64_element_block = default_element_block; +using uint64_element_block = default_element_block; +using float_element_block = default_element_block; +using double_element_block = default_element_block; +using string_element_block = default_element_block; -}} +}} // namespace mdds::mtv #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector/util.hpp mdds-2.0.3/include/mdds/multi_type_vector/util.hpp --- mdds-2.0.2/include/mdds/multi_type_vector/util.hpp 2022-02-11 14:50:57.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector/util.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -95,18 +95,28 @@ #ifdef MDDS_MULTI_TYPE_VECTOR_DEBUG template -struct has_trace : std::false_type {}; +struct has_trace : std::false_type +{ +}; template -struct has_trace : std::true_type {}; +struct has_trace : std::true_type +{ +}; template struct call_trace { int& call_depth; - call_trace(int& _call_depth) : call_depth(_call_depth) { ++call_depth; } - ~call_trace() noexcept { --call_depth; } + call_trace(int& _call_depth) : call_depth(_call_depth) + { + ++call_depth; + } + ~call_trace() noexcept + { + --call_depth; + } void call(std::false_type, const ::mdds::mtv::trace_method_properties_t&) const { @@ -132,8 +142,8 @@ const char* method_sig, int line, size_t pos, size_t block_size, size_t container_size) { std::ostringstream os; - os << method_sig << "#" << line << ": block position not found! (logical pos=" - << pos << ", block size=" << block_size << ", logical size=" << container_size << ")"; + os << method_sig << "#" << line << ": block position not found! (logical pos=" << pos + << ", block size=" << block_size << ", logical size=" << container_size << ")"; throw std::out_of_range(os.str()); } @@ -156,8 +166,7 @@ * not the input value sequence is empty (second). */ template -std::pair<_SizeT, bool> calc_input_end_position( - const _T& it_begin, const _T& it_end, _SizeT pos, _SizeT total_size) +std::pair<_SizeT, bool> calc_input_end_position(const _T& it_begin, const _T& it_end, _SizeT pos, _SizeT total_size) { using ret_type = std::pair<_SizeT, bool>; @@ -226,7 +235,8 @@ #ifndef MDDS_MULTI_TYPE_VECTOR_USE_DEQUE template<> -inline bool get_block_element_at(const mdds::mtv::base_element_block& data, size_t offset) +inline bool get_block_element_at( + const mdds::mtv::base_element_block& data, size_t offset) { auto it = mdds::mtv::boolean_element_block::cbegin(data); std::advance(it, offset); @@ -243,9 +253,7 @@ #define MDDS_MTV_TRACE(method_type) \ ::mdds::detail::mtv::call_trace mdds_mtv_ct(m_trace_call_depth); \ - mdds_mtv_ct( \ - { trace_method_t::method_type, this, __func__, "", __FILE__, __LINE__ } \ - ) + mdds_mtv_ct({trace_method_t::method_type, this, __func__, "", __FILE__, __LINE__}) #define MDDS_MTV_TRACE_ARGS(method_type, stream) \ ::mdds::detail::mtv::call_trace mdds_mtv_ct(m_trace_call_depth); \ @@ -253,9 +261,7 @@ { \ std::ostringstream _os_; \ _os_ << stream; \ - mdds_mtv_ct( \ - { trace_method_t::method_type, this, __func__, _os_.str(), __FILE__, __LINE__ } \ - ); \ + mdds_mtv_ct({trace_method_t::method_type, this, __func__, _os_.str(), __FILE__, __LINE__}); \ } while (false) #else @@ -269,4 +275,3 @@ #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/multi_type_vector.hpp mdds-2.0.3/include/mdds/multi_type_vector.hpp --- mdds-2.0.2/include/mdds/multi_type_vector.hpp 2021-09-09 12:46:01.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -39,6 +39,6 @@ template using multi_type_vector = mtv::soa::multi_type_vector; -} +} // namespace mdds #endif diff -Nru mdds-2.0.2/include/mdds/multi_type_vector_itr.hpp mdds-2.0.3/include/mdds/multi_type_vector_itr.hpp --- mdds-2.0.2/include/mdds/multi_type_vector_itr.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/multi_type_vector_itr.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -34,4 +34,3 @@ #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/node.hpp mdds-2.0.3/include/mdds/node.hpp --- mdds-2.0.2/include/mdds/node.hpp 2018-05-05 15:58:40.000000000 +0000 +++ mdds-2.0.3/include/mdds/node.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -45,8 +45,10 @@ node_base* parent; /// parent nonleaf_node bool is_leaf; - node_base(bool _is_leaf) : parent(nullptr), is_leaf(_is_leaf) {} - node_base(const node_base& r) : parent(nullptr), is_leaf(r.is_leaf) {} + node_base(bool _is_leaf) : parent(nullptr), is_leaf(_is_leaf) + {} + node_base(const node_base& r) : parent(nullptr), is_leaf(r.is_leaf) + {} }; template @@ -61,22 +63,19 @@ #endif nonleaf_value_type value_nonleaf; - node_base* left; /// left child nonleaf_node - node_base* right; /// right child nonleaf_node + node_base* left; /// left child nonleaf_node + node_base* right; /// right child nonleaf_node private: - fill_nonleaf_value_handler _hdl_fill_nonleaf; - init_handler _hdl_init; - dispose_handler _hdl_dispose; + fill_nonleaf_value_handler _hdl_fill_nonleaf; + init_handler _hdl_init; + dispose_handler _hdl_dispose; #ifdef MDDS_UNIT_TEST - to_string_handler _hdl_to_string; + to_string_handler _hdl_to_string; #endif public: - nonleaf_node() : - node_base(false), - left(nullptr), - right(nullptr) + nonleaf_node() : node_base(false), left(nullptr), right(nullptr) { _hdl_init(*this); } @@ -85,10 +84,7 @@ * When copying nonleaf_node, only the stored values should be copied. * Connections to the parent, left and right nodes must not be copied. */ - nonleaf_node(const nonleaf_node& r) : - node_base(r), - left(nullptr), - right(nullptr) + nonleaf_node(const nonleaf_node& r) : node_base(r), left(nullptr), right(nullptr) { value_nonleaf = r.value_nonleaf; } @@ -142,7 +138,7 @@ template struct node : public node_base { - typedef ::boost::intrusive_ptr node_ptr; + typedef ::boost::intrusive_ptr node_ptr; typedef typename T::leaf_value_type leaf_value_type; typedef typename T::init_handler init_handler; @@ -160,17 +156,18 @@ #endif } - leaf_value_type value_leaf; + leaf_value_type value_leaf; - node_ptr prev; /// previous sibling leaf node. - node_ptr next; /// next sibling leaf node. + node_ptr prev; /// previous sibling leaf node. + node_ptr next; /// next sibling leaf node. + + size_t refcount; - size_t refcount; private: - init_handler _hdl_init; - dispose_handler _hdl_dispose; + init_handler _hdl_init; + dispose_handler _hdl_dispose; #ifdef MDDS_UNIT_TEST - to_string_handler _hdl_to_string; + to_string_handler _hdl_to_string; #endif public: @@ -268,8 +265,8 @@ typedef mdds::__st::nonleaf_node nonleaf_node; typedef std::vector nonleaf_node_pool_type; - tree_builder(nonleaf_node_pool_type& pool) : - m_pool(pool), m_pool_pos(pool.begin()), m_pool_pos_end(pool.end()) {} + tree_builder(nonleaf_node_pool_type& pool) : m_pool(pool), m_pool_pos(pool.begin()), m_pool_pos_end(pool.end()) + {} nonleaf_node* build(const leaf_node_ptr& left_leaf_node) { @@ -297,7 +294,6 @@ } private: - nonleaf_node* make_parent_node(node_base* node1, node_base* node2) { assert(m_pool_pos != m_pool_pos_end); @@ -360,7 +356,6 @@ typename nonleaf_node_pool_type::iterator m_pool_pos_end; }; - template void disconnect_all_nodes(node* p) { @@ -385,8 +380,7 @@ node* next_node = cur_node->next.get(); disconnect_all_nodes(cur_node); cur_node = next_node; - } - while (cur_node != right_node); + } while (cur_node != right_node); disconnect_all_nodes(right_node); } @@ -452,7 +446,7 @@ size_t node_count = node_list.size(); bool is_leaf = node_list.front()->is_leaf; - cout << "level " << level << " (" << (is_leaf?"leaf":"non-leaf") << ")" << endl; + cout << "level " << level << " (" << (is_leaf ? "leaf" : "non-leaf") << ")" << endl; node_list_type new_list; typename node_list_type::const_iterator it = node_list.begin(), it_end = node_list.end(); @@ -483,7 +477,7 @@ cout << endl; if (!new_list.empty()) - node_count += dump_layer(new_list, level+1); + node_count += dump_layer(new_list, level + 1); return node_count; } @@ -491,6 +485,6 @@ #endif -}} +}} // namespace mdds::__st #endif diff -Nru mdds-2.0.2/include/mdds/point_quad_tree.hpp mdds-2.0.3/include/mdds/point_quad_tree.hpp --- mdds-2.0.2/include/mdds/point_quad_tree.hpp 2021-11-23 00:24:18.000000000 +0000 +++ mdds-2.0.3/include/mdds/point_quad_tree.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * Copyright (c) 2010-2015 Kohei Yoshida - * + * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without @@ -10,10 +10,10 @@ * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -50,8 +50,7 @@ } template -void search_region_node( - const _NodeType* p, _Key x1, _Key y1, _Key x2, _Key y2, _Inserter& result) +void search_region_node(const _NodeType* p, _Key x1, _Key y1, _Key x2, _Key y2, _Inserter& result) { using namespace std; @@ -59,7 +58,7 @@ return; search_region_space_t region = ::mdds::get_search_region_space(p, x1, y1, x2, y2); - + switch (region) { case region_center: @@ -102,7 +101,6 @@ } } - template class point_quad_tree { @@ -110,12 +108,14 @@ class search_result_inserter; public: - typedef _Key key_type; - typedef _Value value_type; - typedef size_t size_type; + typedef _Key key_type; + typedef _Value value_type; + typedef size_t size_type; typedef ::std::vector data_array_type; - class data_not_found : public ::std::exception {}; + class data_not_found : public ::std::exception + { + }; private: struct node; @@ -124,22 +124,21 @@ struct node : quad_node_base { value_type data; - node(key_type _x, key_type _y, value_type _data) : - quad_node_base(_x, _y), - data(_data) {} + node(key_type _x, key_type _y, value_type _data) : quad_node_base(_x, _y), data(_data) + {} - node(const node& r) : - quad_node_base(r), - data(r.data) {} + node(const node& r) : quad_node_base(r), data(r.data) + {} - void dispose() {} + void dispose() + {} - bool operator== (const node& r) const + bool operator==(const node& r) const { - return quad_node_base::operator ==(r) && data == r.data; + return quad_node_base::operator==(r) && data == r.data; } - node& operator= (const node& r) + node& operator=(const node& r) { quad_node_base::operator=(r); data = r.data; @@ -151,32 +150,62 @@ typedef ::std::pair key_range_type; public: - /** * Node wrapper to allow read-only access to the internal quad node * structure. */ class node_access { - friend class point_quad_tree<_Key,_Value>; + friend class point_quad_tree<_Key, _Value>; + public: - node_access northeast() const { return node_access(mp->northeast.get()); } - node_access northwest() const { return node_access(mp->northwest.get()); } - node_access southeast() const { return node_access(mp->southeast.get()); } - node_access southwest() const { return node_access(mp->southwest.get()); } - - value_type data() const { return mp->data; } - key_type x() const { return mp->x; } - key_type y() const { return mp->y; } + node_access northeast() const + { + return node_access(mp->northeast.get()); + } + node_access northwest() const + { + return node_access(mp->northwest.get()); + } + node_access southeast() const + { + return node_access(mp->southeast.get()); + } + node_access southwest() const + { + return node_access(mp->southwest.get()); + } - operator bool() const { return mp != nullptr; } - bool operator== (const node_access& r) const { return mp == r.mp; } + value_type data() const + { + return mp->data; + } + key_type x() const + { + return mp->x; + } + key_type y() const + { + return mp->y; + } + + operator bool() const + { + return mp != nullptr; + } + bool operator==(const node_access& r) const + { + return mp == r.mp; + } - node_access() : mp(nullptr) {} - ~node_access() {} + node_access() : mp(nullptr) + {} + ~node_access() + {} private: - node_access(const node* p) : mp(p) {} + node_access(const node* p) : mp(p) + {} private: const node* mp; @@ -186,41 +215,43 @@ { key_type x; key_type y; - point(key_type _x, key_type _y) : x(_x), y(_y) {} - point() : x(0), y(0) {} + point(key_type _x, key_type _y) : x(_x), y(_y) + {} + point() : x(0), y(0) + {} }; class search_results { friend class search_result_inserter; - typedef std::vector res_nodes_type; + typedef std::vector res_nodes_type; typedef std::shared_ptr res_nodes_ptr; - public: + public: class const_iterator { - friend class point_quad_tree<_Key,_Value>::search_results; - typedef typename point_quad_tree<_Key,_Value>::point point; - typedef typename point_quad_tree<_Key,_Value>::value_type parent_value_type; + friend class point_quad_tree<_Key, _Value>::search_results; + typedef typename point_quad_tree<_Key, _Value>::point point; + typedef typename point_quad_tree<_Key, _Value>::value_type parent_value_type; public: // Iterator traits typedef std::pair value_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef ptrdiff_t difference_type; typedef ::std::bidirectional_iterator_tag iterator_category; - const_iterator(res_nodes_ptr& ptr) : mp_res_nodes(ptr), m_end_pos(false) {} + const_iterator(res_nodes_ptr& ptr) : mp_res_nodes(ptr), m_end_pos(false) + {} - const_iterator(const const_iterator& r) : - mp_res_nodes(r.mp_res_nodes), - m_cur_pos(r.m_cur_pos), - m_cur_value(r.m_cur_value), - m_end_pos(r.m_end_pos) {} + const_iterator(const const_iterator& r) + : mp_res_nodes(r.mp_res_nodes), m_cur_pos(r.m_cur_pos), m_cur_value(r.m_cur_value), + m_end_pos(r.m_end_pos) + {} - const_iterator& operator= (const const_iterator& r) + const_iterator& operator=(const const_iterator& r) { mp_res_nodes = r.mp_res_nodes; m_cur_pos = r.m_cur_pos; @@ -229,13 +260,13 @@ return *this; } - bool operator== (const const_iterator& r) const + bool operator==(const const_iterator& r) const { if (mp_res_nodes) { // Non-empty result set. - return mp_res_nodes.get() == r.mp_res_nodes.get() && - m_cur_pos == r.m_cur_pos && m_end_pos == r.m_end_pos; + return mp_res_nodes.get() == r.mp_res_nodes.get() && m_cur_pos == r.m_cur_pos && + m_end_pos == r.m_end_pos; } // Empty result set. @@ -245,7 +276,7 @@ return m_end_pos == r.m_end_pos; } - bool operator!= (const const_iterator& r) const + bool operator!=(const const_iterator& r) const { return !operator==(r); } @@ -262,7 +293,7 @@ const value_type* operator++() { - // The only difference between the last data position and the + // The only difference between the last data position and the // end iterator position must be the value of m_end_pos; // m_cur_pos needs to point to the last data position even // when the iterator is at the end-of-iterator position. @@ -332,11 +363,13 @@ res_nodes_ptr mp_res_nodes; typename res_nodes_type::const_iterator m_cur_pos; value_type m_cur_value; - bool m_end_pos:1; + bool m_end_pos : 1; }; - search_results() : mp_res_nodes(static_cast(nullptr)) {} - search_results(const search_results& r) : mp_res_nodes(r.mp_res_nodes) {} + search_results() : mp_res_nodes(static_cast(nullptr)) + {} + search_results(const search_results& r) : mp_res_nodes(r.mp_res_nodes) + {} typename search_results::const_iterator begin() { @@ -344,7 +377,7 @@ itr.move_to_front(); return itr; } - + typename search_results::const_iterator end() { typename search_results::const_iterator itr(mp_res_nodes); @@ -371,7 +404,7 @@ /** * Insert a new data at specified coordinates. It overwrites existing * data in case one exists at the specified coordinates. - * + * * @param x x coordinate of new data position * @param y y coordinate of new data position * @param data data being inserted at the specified coordinates. @@ -379,50 +412,50 @@ void insert(key_type x, key_type y, value_type data); /** - * Perform region search (aka window search), that is, find all points - * that fall within specified rectangular region. The boundaries are + * Perform region search (aka window search), that is, find all points + * that fall within specified rectangular region. The boundaries are * inclusive. - * - * @param x1 left coordinate of the search region - * @param y1 top coordinate of the search region - * @param x2 right coordinate of the search region - * @param y2 bottom coordinate of the search region - * @param result this array will contain all data found without specified + * + * @param x1 left coordinate of the search region + * @param y1 top coordinate of the search region + * @param x2 right coordinate of the search region + * @param y2 bottom coordinate of the search region + * @param result this array will contain all data found without specified * region. */ void search_region(key_type x1, key_type y1, key_type x2, key_type y2, data_array_type& result) const; /** - * Perform region search (aka window search), that is, find all points - * that fall within specified rectangular region. The boundaries are + * Perform region search (aka window search), that is, find all points + * that fall within specified rectangular region. The boundaries are * inclusive. - * - * @param x1 left coordinate of the search region - * @param y1 top coordinate of the search region - * @param x2 right coordinate of the search region - * @param y2 bottom coordinate of the search region - * - * @return search result object containing all data found within the + * + * @param x1 left coordinate of the search region + * @param y1 top coordinate of the search region + * @param x2 right coordinate of the search region + * @param y2 bottom coordinate of the search region + * + * @return search result object containing all data found within the * specified region. */ search_results search_region(key_type x1, key_type y1, key_type x2, key_type y2) const; /** - * Find data at specified coordinates. If no data exists at the specified - * coordinates, this method throws a + * Find data at specified coordinates. If no data exists at the specified + * coordinates, this method throws a * point_quad_tree::data_not_found exception. - * - * @param x x coordinate - * @param y y coordinate - * + * + * @param x x coordinate + * @param y y coordinate + * * @return data found at the specified coordinates. */ value_type find(key_type x, key_type y) const; /** - * Remove data from specified coordinates. This method does nothing if no - * data exists at the specified coordinates. - * + * Remove data from specified coordinates. This method does nothing if no + * data exists at the specified coordinates. + * * @param x x coordinate * @param y y coordinate */ @@ -430,7 +463,7 @@ /** * Swap the internal state with another instance. - * + * * @param r another instance to swap internals with. */ void swap(point_quad_tree& r); @@ -441,31 +474,34 @@ void clear(); /** - * Check whether or not the container is empty. - * + * Check whether or not the container is empty. + * * @return bool true if empty, false otherwise. */ bool empty() const; /** - * Get the number of stored data. - * + * Get the number of stored data. + * * @return the number of data currently stored in the container. */ size_t size() const; /** - * Get read-only access to the internal quad node tree. - * + * Get read-only access to the internal quad node tree. + * * @return root node */ node_access get_node_access() const; - point_quad_tree& operator= (const point_quad_tree& r); + point_quad_tree& operator=(const point_quad_tree& r); - bool operator== (const point_quad_tree& r) const; + bool operator==(const point_quad_tree& r) const; - bool operator!= (const point_quad_tree& r) const { return !operator== (r); } + bool operator!=(const point_quad_tree& r) const + { + return !operator==(r); + } #ifdef MDDS_UNIT_TEST public: @@ -473,32 +509,32 @@ private: #endif /** - * Data stored in each node. Used for verification of data stored in tree - * during unit testing. + * Data stored in each node. Used for verification of data stored in tree + * during unit testing. */ struct node_data { - key_type x; - key_type y; - value_type data; - node_data(key_type _x, key_type _y, value_type _data) : - x(_x), y(_y), data(_data) {} - node_data(const node_data& r) : - x(r.x), y(r.y), data(r.data) {} + key_type x; + key_type y; + value_type data; + node_data(key_type _x, key_type _y, value_type _data) : x(_x), y(_y), data(_data) + {} + node_data(const node_data& r) : x(r.x), y(r.y), data(r.data) + {} - bool operator== (const node_data& r) const + bool operator==(const node_data& r) const { return (x == r.x) && (y == r.y) && (data == r.data); } - bool operator!= (const node_data& r) const + bool operator!=(const node_data& r) const { return !operator==(r); } struct sorter { - bool operator() (const node_data& left, const node_data& right) const + bool operator()(const node_data& left, const node_data& right) const { if (left.x != right.x) return left.x < right.x; @@ -524,12 +560,14 @@ class array_inserter { public: - array_inserter(data_array_type& result) : m_result(result) {} + array_inserter(data_array_type& result) : m_result(result) + {} - void operator() (const node* p) + void operator()(const node* p) { m_result.push_back(p->data); } + private: data_array_type& m_result; }; @@ -537,12 +575,14 @@ class search_result_inserter { public: - search_result_inserter(search_results& result) : m_result(result) {} + search_result_inserter(search_results& result) : m_result(result) + {} - void operator() (const node* p) + void operator()(const node* p) { m_result.push_back(p); } + private: search_results& m_result; }; @@ -550,12 +590,14 @@ class data_inserter { public: - data_inserter(point_quad_tree& db) : m_db(db) {} + data_inserter(point_quad_tree& db) : m_db(db) + {} - void operator() (const node_data& v) + void operator()(const node_data& v) { m_db.insert(v.x, v.y, v.data); } + private: point_quad_tree& m_db; }; @@ -563,27 +605,31 @@ struct node_distance { node_quadrant_t quad; - key_type dist; - node_ptr node; + key_type dist; + node_ptr node; - node_distance() : quad(quad_unspecified), dist(0), node(nullptr) {} - node_distance(node_quadrant_t _quad, key_type _dist, const node_ptr& _node) : - quad(_quad), dist(_dist), node(_node) {} + node_distance() : quad(quad_unspecified), dist(0), node(nullptr) + {} + node_distance(node_quadrant_t _quad, key_type _dist, const node_ptr& _node) + : quad(_quad), dist(_dist), node(_node) + {} }; node_ptr find_node(key_type x, key_type y) const; const node* find_node_ptr(key_type x, key_type y) const; node_ptr find_replacement_node(key_type x, key_type y, const node_ptr& delete_node) const; - void find_candidate_in_quad(key_type x, key_type y, - node_distance& dx_node, node_distance& dy_node, node_distance& min_city_block_node, - const node_ptr& delete_node, node_quadrant_t quad) const; - - void adjust_quad(const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, - node_ptr quad_root, direction_t dir, reinsert_tree_array_type& insert_list); - - void set_new_root(const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, - node_ptr& quad_root, node_quadrant_t dir, reinsert_tree_array_type& insert_list); + void find_candidate_in_quad( + key_type x, key_type y, node_distance& dx_node, node_distance& dy_node, node_distance& min_city_block_node, + const node_ptr& delete_node, node_quadrant_t quad) const; + + void adjust_quad( + const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, node_ptr quad_root, direction_t dir, + reinsert_tree_array_type& insert_list); + + void set_new_root( + const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, node_ptr& quad_root, + node_quadrant_t dir, reinsert_tree_array_type& insert_list); void insert_node(node_ptr& dest, node_ptr& node); void reinsert_tree(node_ptr& dest, node_ptr& root); @@ -595,41 +641,35 @@ void get_all_stored_data(const node* p, ::std::vector& stored_data) const; private: - node_ptr m_root; + node_ptr m_root; key_range_type m_xrange; key_range_type m_yrange; }; template -point_quad_tree<_Key,_Value>::point_quad_tree() : - m_root(nullptr), - m_xrange(0,0), - m_yrange(0,0) -{ -} +point_quad_tree<_Key, _Value>::point_quad_tree() : m_root(nullptr), m_xrange(0, 0), m_yrange(0, 0) +{} template -point_quad_tree<_Key,_Value>::point_quad_tree(const point_quad_tree& r) : - m_root(nullptr), - m_xrange(0,0), - m_yrange(0,0) +point_quad_tree<_Key, _Value>::point_quad_tree(const point_quad_tree& r) + : m_root(nullptr), m_xrange(0, 0), m_yrange(0, 0) { insert_data_from(r); } template -point_quad_tree<_Key,_Value>::~point_quad_tree() +point_quad_tree<_Key, _Value>::~point_quad_tree() { clear_all_nodes(); } template -void point_quad_tree<_Key,_Value>::insert(key_type x, key_type y, value_type data) +void point_quad_tree<_Key, _Value>::insert(key_type x, key_type y, value_type data) { - m_xrange.first = ::std::min(m_xrange.first, x); + m_xrange.first = ::std::min(m_xrange.first, x); m_xrange.second = ::std::max(m_xrange.second, x); - m_yrange.first = ::std::min(m_yrange.first, y); + m_yrange.first = ::std::min(m_yrange.first, y); m_yrange.second = ::std::max(m_yrange.second, y); if (!m_root) @@ -700,7 +740,8 @@ } template -void point_quad_tree<_Key,_Value>::search_region(key_type x1, key_type y1, key_type x2, key_type y2, data_array_type& result) const +void point_quad_tree<_Key, _Value>::search_region( + key_type x1, key_type y1, key_type x2, key_type y2, data_array_type& result) const { using namespace std; const node* p = m_root.get(); @@ -709,8 +750,8 @@ } template -typename point_quad_tree<_Key,_Value>::search_results -point_quad_tree<_Key,_Value>::search_region(key_type x1, key_type y1, key_type x2, key_type y2) const +typename point_quad_tree<_Key, _Value>::search_results point_quad_tree<_Key, _Value>::search_region( + key_type x1, key_type y1, key_type x2, key_type y2) const { using namespace std; search_results result; @@ -721,8 +762,7 @@ } template -typename point_quad_tree<_Key,_Value>::value_type -point_quad_tree<_Key,_Value>::find(key_type x, key_type y) const +typename point_quad_tree<_Key, _Value>::value_type point_quad_tree<_Key, _Value>::find(key_type x, key_type y) const { const node* p = find_node_ptr(x, y); if (!p) @@ -731,7 +771,7 @@ } template -void point_quad_tree<_Key,_Value>::remove(key_type x, key_type y) +void point_quad_tree<_Key, _Value>::remove(key_type x, key_type y) { using namespace std; node_ptr delete_node = find_node(x, y); @@ -740,10 +780,11 @@ return; #if DEBUG_POINT_QUAD_TREE - cout << "found the node to be removed at " << delete_node->x << "," << delete_node->y << " (" << *delete_node->data << ")" << endl; + cout << "found the node to be removed at " << delete_node->x << "," << delete_node->y << " (" << *delete_node->data + << ")" << endl; #endif - // Check if this is a leaf node, in which case we can just delete it + // Check if this is a leaf node, in which case we can just delete it // without further processing. if (delete_node->leaf()) { @@ -764,7 +805,7 @@ throw general_error("failed to find a replacement candidate node."); node_quadrant_t repl_quad = delete_node->get_quadrant(repl_node->x, repl_node->y); - + key_range_type xrange(delete_node->x, repl_node->x); key_range_type yrange(delete_node->y, repl_node->y); ensure_order(xrange); @@ -800,8 +841,8 @@ throw general_error("quadrant for the replacement node is unspecified."); } - // Reinsert all child nodes from the replacement node into the node to be - // "deleted". + // Reinsert all child nodes from the replacement node into the node to be + // "deleted". switch (repl_quad) { case quad_northeast: @@ -810,7 +851,7 @@ node_ptr root = repl_node->northwest; repl_node->northwest.reset(); reinsert_tree(delete_node, quad_northwest, root); - + root = repl_node->southeast; repl_node->southeast.reset(); reinsert_tree(delete_node, quad_southeast, root); @@ -822,7 +863,7 @@ node_ptr root = repl_node->northeast; repl_node->northeast.reset(); reinsert_tree(delete_node, quad_northeast, root); - + root = repl_node->southwest; repl_node->southwest.reset(); reinsert_tree(delete_node, quad_southwest, root); @@ -863,16 +904,15 @@ throw general_error("quadrant for the replacement node is unspecified."); } - // Lastly, re-insert all those trees that have been cut during the quad + // Lastly, re-insert all those trees that have been cut during the quad // adjustment into the new root. - typename reinsert_tree_array_type::iterator - itr = insert_list.begin(), itr_end = insert_list.end(); + typename reinsert_tree_array_type::iterator itr = insert_list.begin(), itr_end = insert_list.end(); for (; itr != itr_end; ++itr) reinsert_tree(delete_node, *itr); } template -void point_quad_tree<_Key,_Value>::swap(point_quad_tree& r) +void point_quad_tree<_Key, _Value>::swap(point_quad_tree& r) { m_root.swap(r.m_root); ::std::swap(m_xrange, r.m_xrange); @@ -880,19 +920,19 @@ } template -void point_quad_tree<_Key,_Value>::clear() +void point_quad_tree<_Key, _Value>::clear() { clear_all_nodes(); } template -bool point_quad_tree<_Key,_Value>::empty() const +bool point_quad_tree<_Key, _Value>::empty() const { return (m_root.get() == nullptr); } template -size_t point_quad_tree<_Key,_Value>::size() const +size_t point_quad_tree<_Key, _Value>::size() const { size_t node_count = 0; count_all_nodes(m_root.get(), node_count); @@ -900,14 +940,13 @@ } template -typename point_quad_tree<_Key,_Value>::node_access -point_quad_tree<_Key,_Value>::get_node_access() const +typename point_quad_tree<_Key, _Value>::node_access point_quad_tree<_Key, _Value>::get_node_access() const { return node_access(m_root.get()); } template -point_quad_tree<_Key,_Value>& point_quad_tree<_Key,_Value>::operator= (const point_quad_tree& r) +point_quad_tree<_Key, _Value>& point_quad_tree<_Key, _Value>::operator=(const point_quad_tree& r) { m_xrange = key_range_type(0, 0); m_yrange = key_range_type(0, 0); @@ -917,7 +956,7 @@ } template -bool point_quad_tree<_Key,_Value>::operator== (const point_quad_tree& r) const +bool point_quad_tree<_Key, _Value>::operator==(const point_quad_tree& r) const { ::std::vector v1, v2; get_all_stored_data(v1); @@ -926,11 +965,13 @@ } template -void point_quad_tree<_Key,_Value>::dump_tree_svg(const ::std::string& fpath) const +void point_quad_tree<_Key, _Value>::dump_tree_svg(const ::std::string& fpath) const { using namespace std; ofstream file(fpath.c_str()); - file << "" << endl; + file << "" + << endl; file << "" << " " << " " << "" << endl; - - file << "" << endl; - file << "" << endl; + + file << "" << endl; + file << "" << endl; dump_node_svg(m_root.get(), file); file << "" << endl; } @@ -952,13 +995,13 @@ { using namespace std; file << "" << endl; - file << "x << "\" y1=\"" << start->y << "\" x2=\"" - << end->x << "\" y2=\"" << end->y << "\" stroke-width=\"0.2\"/>" << endl; + file << "x << "\" y1=\"" << start->y << "\" x2=\"" << end->x << "\" y2=\"" << end->y + << "\" stroke-width=\"0.2\"/>" << endl; file << "" << endl; } template -void point_quad_tree<_Key,_Value>::dump_node_svg(const node* p, ::std::ofstream& file) const +void point_quad_tree<_Key, _Value>::dump_node_svg(const node* p, ::std::ofstream& file) const { using namespace std; @@ -966,9 +1009,9 @@ return; file << "x << "\" cy=\"" << p->y << "\" r=\"0.1\"" - << " fill=\"black\" stroke=\"black\"/>" << endl; - file << "x + 1 << "\" y=\"" << p->y + 2 << "\" font-size=\"1.2\" fill=\"black\">" - << *p->data << " (" << p->x << "," << p->y << ")" << endl; + << " fill=\"black\" stroke=\"black\"/>" << endl; + file << "x + 1 << "\" y=\"" << p->y + 2 << "\" font-size=\"1.2\" fill=\"black\">" << *p->data + << " (" << p->x << "," << p->y << ")" << endl; if (p->northwest) draw_svg_arrow(file, p, p->northwest.get()); @@ -989,7 +1032,7 @@ } template -bool point_quad_tree<_Key,_Value>::equals(::std::vector& v1, ::std::vector& v2) +bool point_quad_tree<_Key, _Value>::equals(::std::vector& v1, ::std::vector& v2) { using namespace std; @@ -998,9 +1041,9 @@ sort(v1.begin(), v1.end(), typename node_data::sorter()); sort(v2.begin(), v2.end(), typename node_data::sorter()); - - typename vector::const_iterator - itr1 = v1.begin(), itr1_end = v1.end(), itr2 = v2.begin(), itr2_end = v2.end(); + + typename vector::const_iterator itr1 = v1.begin(), itr1_end = v1.end(), itr2 = v2.begin(), + itr2_end = v2.end(); for (; itr1 != itr1_end; ++itr1, ++itr2) { @@ -1017,7 +1060,7 @@ } template -void point_quad_tree<_Key,_Value>::get_all_stored_data(::std::vector& stored_data) const +void point_quad_tree<_Key, _Value>::get_all_stored_data(::std::vector& stored_data) const { stored_data.clear(); if (!m_root) @@ -1027,7 +1070,7 @@ } template -void point_quad_tree<_Key,_Value>::count_all_nodes(const node* p, size_t& node_count) const +void point_quad_tree<_Key, _Value>::count_all_nodes(const node* p, size_t& node_count) const { if (!p) return; @@ -1041,7 +1084,7 @@ } template -void point_quad_tree<_Key,_Value>::insert_data_from(const point_quad_tree& r) +void point_quad_tree<_Key, _Value>::insert_data_from(const point_quad_tree& r) { using namespace std; vector all_data; @@ -1050,7 +1093,7 @@ } template -bool point_quad_tree<_Key,_Value>::verify_data(::std::vector& expected) const +bool point_quad_tree<_Key, _Value>::verify_data(::std::vector& expected) const { ::std::vector stored; get_all_stored_data(stored); @@ -1058,13 +1101,13 @@ } template -bool point_quad_tree<_Key,_Value>::verify_node_iterator(const node_access& nac) const +bool point_quad_tree<_Key, _Value>::verify_node_iterator(const node_access& nac) const { return verify_node_iterator(nac, m_root.get()); } template -bool point_quad_tree<_Key,_Value>::verify_node_iterator(const node_access& nac, const node* p) +bool point_quad_tree<_Key, _Value>::verify_node_iterator(const node_access& nac, const node* p) { if (!nac) return (p == nullptr); @@ -1085,7 +1128,7 @@ } template -void point_quad_tree<_Key,_Value>::get_all_stored_data(const node* p, ::std::vector& stored_data) const +void point_quad_tree<_Key, _Value>::get_all_stored_data(const node* p, ::std::vector& stored_data) const { if (!p) return; @@ -1099,8 +1142,7 @@ } template -typename point_quad_tree<_Key,_Value>::node_ptr -point_quad_tree<_Key,_Value>::find_node(key_type x, key_type y) const +typename point_quad_tree<_Key, _Value>::node_ptr point_quad_tree<_Key, _Value>::find_node(key_type x, key_type y) const { node_ptr cur_node = m_root; while (cur_node) @@ -1142,8 +1184,8 @@ } template -const typename point_quad_tree<_Key,_Value>::node* -point_quad_tree<_Key,_Value>::find_node_ptr(key_type x, key_type y) const +const typename point_quad_tree<_Key, _Value>::node* point_quad_tree<_Key, _Value>::find_node_ptr( + key_type x, key_type y) const { const node* cur_node = m_root.get(); while (cur_node) @@ -1185,8 +1227,8 @@ } template -typename point_quad_tree<_Key,_Value>::node_ptr -point_quad_tree<_Key,_Value>::find_replacement_node(key_type x, key_type y, const node_ptr& delete_node) const +typename point_quad_tree<_Key, _Value>::node_ptr point_quad_tree<_Key, _Value>::find_replacement_node( + key_type x, key_type y, const node_ptr& delete_node) const { using namespace std; @@ -1195,27 +1237,23 @@ #if DEBUG_POINT_QUAD_TREE cout << "northeast" << endl; -#endif - find_candidate_in_quad( - x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_northeast); +#endif + find_candidate_in_quad(x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_northeast); #if DEBUG_POINT_QUAD_TREE cout << "northwest" << endl; -#endif - find_candidate_in_quad( - x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_northwest); +#endif + find_candidate_in_quad(x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_northwest); #if DEBUG_POINT_QUAD_TREE cout << "southwest" << endl; -#endif - find_candidate_in_quad( - x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_southwest); +#endif + find_candidate_in_quad(x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_southwest); #if DEBUG_POINT_QUAD_TREE cout << "southeast" << endl; -#endif - find_candidate_in_quad( - x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_southeast); +#endif + find_candidate_in_quad(x, y, dx_node, dy_node, min_city_block_node, delete_node, quad_southeast); // Check Criterion 1. @@ -1225,20 +1263,20 @@ if (dy_node.node) cout << "node closest to y axis: " << *dy_node.node->data << " (dy=" << dy_node.dist << ")" << endl; -#endif +#endif if (dx_node.node == dy_node.node && ((dx_node.quad == quad_northwest) || (dx_node.quad == quad_southeast))) { #if DEBUG_POINT_QUAD_TREE cout << "node that satisfies Criterion 1: " << *dx_node.node->data << endl; -#endif +#endif return dx_node.node; } else { #if DEBUG_POINT_QUAD_TREE cout << "unable to find node that satisfies Criterion 1." << endl; -#endif +#endif } // Move on to Criterion 2. @@ -1246,8 +1284,9 @@ if (min_city_block_node.node) { #if DEBUG_POINT_QUAD_TREE - cout << "node that satisfies Criterion 2: " << *min_city_block_node.node->data << " (dist=" << min_city_block_node.dist << ")" << endl; -#endif + cout << "node that satisfies Criterion 2: " << *min_city_block_node.node->data + << " (dist=" << min_city_block_node.dist << ")" << endl; +#endif return min_city_block_node.node; } @@ -1255,9 +1294,8 @@ } template -void point_quad_tree<_Key,_Value>::find_candidate_in_quad( - key_type x, key_type y, - node_distance& dx_node, node_distance& dy_node, node_distance& min_city_block_node, +void point_quad_tree<_Key, _Value>::find_candidate_in_quad( + key_type x, key_type y, node_distance& dx_node, node_distance& dy_node, node_distance& min_city_block_node, const node_ptr& delete_node, node_quadrant_t quad) const { using namespace std; @@ -1268,7 +1306,7 @@ // No candidate in this quadrant. #if DEBUG_POINT_QUAD_TREE cout << " no candidate in this quadrant" << endl; -#endif +#endif return; } @@ -1278,14 +1316,14 @@ #if DEBUG_POINT_QUAD_TREE cout << " candidate: " << repl_node->x << "," << repl_node->y << " (" << *repl_node->data << ")" << endl; -#endif +#endif // Calculate its distance to each of the borders. key_type dx = repl_node->x > x ? repl_node->x - x : x - repl_node->x; key_type dy = repl_node->y > y ? repl_node->y - y : y - repl_node->y; #if DEBUG_POINT_QUAD_TREE cout << " dx = " << dx << ", dy = " << dy << endl; -#endif +#endif if (!dx_node.node || dx_node.dist > dx) dx_node = node_distance(quad, dx, repl_node); @@ -1293,13 +1331,13 @@ dy_node = node_distance(quad, dy, repl_node); if (!min_city_block_node.node || min_city_block_node.dist > (dx + dy)) - min_city_block_node = node_distance(quad_unspecified, dx+dy, repl_node); + min_city_block_node = node_distance(quad_unspecified, dx + dy, repl_node); } template -void point_quad_tree<_Key,_Value>::adjust_quad( - const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, - node_ptr quad_root, direction_t dir, reinsert_tree_array_type& insert_list) +void point_quad_tree<_Key, _Value>::adjust_quad( + const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, node_ptr quad_root, direction_t dir, + reinsert_tree_array_type& insert_list) { using namespace std; @@ -1308,14 +1346,14 @@ #if DEBUG_POINT_QUAD_TREE cout << "adjust_quad: checking " << *quad_root->data << " (" << quad_root->x << "," << quad_root->y << ")" << endl; -#endif +#endif if ((hatched_xrange.first <= quad_root->x && quad_root->x <= hatched_xrange.second) || (hatched_yrange.first <= quad_root->y && quad_root->y <= hatched_yrange.second)) { #if DEBUG_POINT_QUAD_TREE cout << " " << *quad_root->data << " is in the hatched region" << endl; -#endif +#endif // Insert the whole tree, including the root, into the insert list. disconnect_node_from_parent(quad_root); quad_root->parent.reset(); @@ -1341,15 +1379,14 @@ adjust_quad(hatched_xrange, hatched_yrange, quad_root->northwest, dir_west, insert_list); adjust_quad(hatched_xrange, hatched_yrange, quad_root->southwest, dir_west, insert_list); break; - default: - ; + default:; } } template -void point_quad_tree<_Key,_Value>::set_new_root( - const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, - node_ptr& quad_root, node_quadrant_t dir, reinsert_tree_array_type& insert_list) +void point_quad_tree<_Key, _Value>::set_new_root( + const key_range_type& hatched_xrange, const key_range_type& hatched_yrange, node_ptr& quad_root, + node_quadrant_t dir, reinsert_tree_array_type& insert_list) { node_ptr cur_node = quad_root; while (cur_node) @@ -1380,7 +1417,7 @@ } template -void point_quad_tree<_Key,_Value>::insert_node(node_ptr& dest, node_ptr& this_node) +void point_quad_tree<_Key, _Value>::insert_node(node_ptr& dest, node_ptr& this_node) { node_ptr cur_node = dest; while (true) @@ -1444,7 +1481,7 @@ } template -void point_quad_tree<_Key,_Value>::reinsert_tree(node_ptr& dest, node_ptr& root) +void point_quad_tree<_Key, _Value>::reinsert_tree(node_ptr& dest, node_ptr& root) { assert(dest); // Destination node should not be null. @@ -1478,12 +1515,12 @@ } template -void point_quad_tree<_Key,_Value>::reinsert_tree(node_ptr& dest, node_quadrant_t quad, node_ptr& root) +void point_quad_tree<_Key, _Value>::reinsert_tree(node_ptr& dest, node_quadrant_t quad, node_ptr& root) { if (!root) // Nothing to re-insert. Bail out. return; - + switch (quad) { case quad_northeast: @@ -1528,12 +1565,12 @@ } template -void point_quad_tree<_Key,_Value>::clear_all_nodes() +void point_quad_tree<_Key, _Value>::clear_all_nodes() { ::mdds::disconnect_all_nodes(m_root); m_root.reset(); } -} +} // namespace mdds #endif diff -Nru mdds-2.0.2/include/mdds/quad_node.hpp mdds-2.0.3/include/mdds/quad_node.hpp --- mdds-2.0.2/include/mdds/quad_node.hpp 2018-05-05 15:58:40.000000000 +0000 +++ mdds-2.0.3/include/mdds/quad_node.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -1,7 +1,7 @@ /************************************************************************* * * Copyright (c) 2010 Kohei Yoshida - * + * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without @@ -10,10 +10,10 @@ * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: - * + * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -58,11 +58,11 @@ quad_unspecified }; -/** +/** * NW | N | NE - * -----|-----|----- + * -----|-----|----- * W | C | E - * -----|-----|----- + * -----|-----|----- * SW | S | SE */ enum search_region_space_t @@ -78,15 +78,15 @@ region_center }; -/** - * N +/** + * N * | * | * W -----+----- E * | * | * S - */ + */ enum direction_t { dir_north, @@ -108,58 +108,45 @@ case quad_southwest: return quad_northeast; case quad_unspecified: - default: - ; + default:; } return quad_unspecified; } template struct quad_node_base -{ - typedef _Key key_type; - typedef _NodePtr node_ptr; - typedef _NodeType node_type; - - size_t refcount; - - node_ptr parent; - node_ptr northeast; - node_ptr northwest; - node_ptr southeast; - node_ptr southwest; - - key_type x; - key_type y; - - quad_node_base(key_type _x, key_type _y) : - refcount(0), - parent(nullptr), - northeast(nullptr), - northwest(nullptr), - southeast(nullptr), - southwest(nullptr), - x(_x), - y(_y) +{ + typedef _Key key_type; + typedef _NodePtr node_ptr; + typedef _NodeType node_type; + + size_t refcount; + + node_ptr parent; + node_ptr northeast; + node_ptr northwest; + node_ptr southeast; + node_ptr southwest; + + key_type x; + key_type y; + + quad_node_base(key_type _x, key_type _y) + : refcount(0), parent(nullptr), northeast(nullptr), northwest(nullptr), southeast(nullptr), southwest(nullptr), + x(_x), y(_y) { #ifdef MDDS_DEBUG_NODE_BASE ++node_instance_count; #endif } - /** - * When copying node, only the stored values should be copied. + /** + * When copying node, only the stored values should be copied. * Connections to the parent and the neighboring nodes must not be copied. */ - quad_node_base(const quad_node_base& r) : - refcount(0), - parent(nullptr), - northeast(nullptr), - northwest(nullptr), - southeast(nullptr), - southwest(nullptr), - x(r.x), - y(r.y) + quad_node_base(const quad_node_base& r) + : refcount(0), parent(nullptr), northeast(nullptr), northwest(nullptr), southeast(nullptr), southwest(nullptr), + x(r.x), y(r.y) { #ifdef MDDS_DEBUG_NODE_BASE ++node_instance_count; @@ -176,8 +163,8 @@ return x == r.x && y == r.y; } - /** - * Like the copy constructor, only the stored values should be copied. + /** + * Like the copy constructor, only the stored values should be copied. */ quad_node_base& operator=(const quad_node_base& r) { @@ -200,8 +187,8 @@ /** * Return the quadrant of specified point in reference to this node. - * - * @return quadrant where the other node is located in reference to this + * + * @return quadrant where the other node is located in reference to this * node. */ node_quadrant_t get_quadrant(key_type other_x, key_type other_y) const @@ -257,13 +244,13 @@ }; template -inline void intrusive_ptr_add_ref(::mdds::quad_node_base<_NodePtr,_NodeType,_Key>* p) +inline void intrusive_ptr_add_ref(::mdds::quad_node_base<_NodePtr, _NodeType, _Key>* p) { ++p->refcount; } template -inline void intrusive_ptr_release(::mdds::quad_node_base<_NodePtr,_NodeType,_Key>* p) +inline void intrusive_ptr_release(::mdds::quad_node_base<_NodePtr, _NodeType, _Key>* p) { --p->refcount; if (!p->refcount) @@ -332,8 +319,7 @@ } template -search_region_space_t get_search_region_space( - _NodeType* p, _Key x1, _Key y1, _Key x2, _Key y2) +search_region_space_t get_search_region_space(_NodeType* p, _Key x1, _Key y1, _Key x2, _Key y2) { typedef _Key key_type; @@ -368,7 +354,7 @@ assert(y2 < y); return region_south; } - + // eastern region assert(x2 < x); if (y < y1) @@ -379,11 +365,11 @@ { return region_east; } - + assert(y2 < y); return region_southeast; } -} +} // namespace mdds #endif diff -Nru mdds-2.0.2/include/mdds/ref_pair.hpp mdds-2.0.3/include/mdds/ref_pair.hpp --- mdds-2.0.2/include/mdds/ref_pair.hpp 2020-07-18 14:54:46.000000000 +0000 +++ mdds-2.0.3/include/mdds/ref_pair.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -42,27 +42,27 @@ first_type first; second_type second; - ref_pair(first_type _first, second_type _second) : - first(_first), second(_second) {} + ref_pair(first_type _first, second_type _second) : first(_first), second(_second) + {} ref_pair(const ref_pair& other) = default; - bool operator== (const std::pair::type, typename std::decay::type>& other) const + bool operator==(const std::pair::type, typename std::decay::type>& other) const { return first == other.first && second == other.second; } - bool operator!= (const std::pair::type, typename std::decay::type>& other) const + bool operator!=(const std::pair::type, typename std::decay::type>& other) const { return !operator==(other); } - bool operator== (const ref_pair& other) const + bool operator==(const ref_pair& other) const { return first == other.first && second == other.second; } - bool operator!= (const ref_pair& other) const + bool operator!=(const ref_pair& other) const { return !operator==(other); } @@ -73,8 +73,7 @@ } }; -}} - +}} // namespace mdds::detail #endif diff -Nru mdds-2.0.2/include/mdds/rtree_def.inl mdds-2.0.3/include/mdds/rtree_def.inl --- mdds-2.0.2/include/mdds/rtree_def.inl 2021-08-13 19:46:30.000000000 +0000 +++ mdds-2.0.3/include/mdds/rtree_def.inl 2022-04-22 00:12:40.000000000 +0000 @@ -85,7 +85,8 @@ } template -auto calc_linear_intersection(size_t dim, const _Extent& bb1, const _Extent& bb2) -> remove_cvref_t +auto calc_linear_intersection(size_t dim, const _Extent& bb1, const _Extent& bb2) + -> remove_cvref_t { using key_type = remove_cvref_t; @@ -274,7 +275,8 @@ * @return quantity of the area enlargement. */ template -auto calc_area_enlargement(const _Extent& bb_host, const _Extent& bb_guest) -> remove_cvref_t +auto calc_area_enlargement(const _Extent& bb_host, const _Extent& bb_guest) + -> remove_cvref_t { constexpr size_t dim_size = sizeof(bb_host.start.d) / sizeof(bb_host.start.d[0]); static_assert(dim_size > 0, "Dimension cannot be zero."); @@ -370,7 +372,7 @@ node_ptr_map_type node_ptr_map; - std::string operator() (node_ptr_type np) const + std::string operator()(node_ptr_type np) const { auto it = node_ptr_map.find(np); return (it == node_ptr_map.end()) ? "(*, *)" : it->second; @@ -382,13 +384,14 @@ } ptr_to_string(const ptr_to_string&) = delete; - ptr_to_string(ptr_to_string&& other) : node_ptr_map(std::move(other.node_ptr_map)) {} + ptr_to_string(ptr_to_string&& other) : node_ptr_map(std::move(other.node_ptr_map)) + {} }; -}} +}} // namespace detail::rtree template -rtree<_Key,_Value,_Trait>::point_type::point_type() +rtree<_Key, _Value, _Trait>::point_type::point_type() { // Initialize the point values with the key type's default value. key_type* p = d; @@ -399,7 +402,7 @@ } template -rtree<_Key,_Value,_Trait>::point_type::point_type(std::initializer_list vs) +rtree<_Key, _Value, _Trait>::point_type::point_type(std::initializer_list vs) { // Initialize the point values with the key type's default value. key_type* dst = d; @@ -416,8 +419,7 @@ } template -std::string -rtree<_Key,_Value,_Trait>::point_type::to_string() const +std::string rtree<_Key, _Value, _Trait>::point_type::to_string() const { std::ostringstream os; @@ -434,7 +436,7 @@ } template -bool rtree<_Key,_Value,_Trait>::point_type::operator== (const point_type& other) const +bool rtree<_Key, _Value, _Trait>::point_type::operator==(const point_type& other) const { const key_type* left = d; const key_type* right = other.d; @@ -450,21 +452,22 @@ } template -bool rtree<_Key,_Value,_Trait>::point_type::operator!= (const point_type& other) const +bool rtree<_Key, _Value, _Trait>::point_type::operator!=(const point_type& other) const { - return !operator== (other); + return !operator==(other); } template -rtree<_Key,_Value,_Trait>::extent_type::extent_type() {} +rtree<_Key, _Value, _Trait>::extent_type::extent_type() +{} template -rtree<_Key,_Value,_Trait>::extent_type::extent_type(const point_type& _start, const point_type& _end) : - start(_start), end(_end) {} +rtree<_Key, _Value, _Trait>::extent_type::extent_type(const point_type& _start, const point_type& _end) + : start(_start), end(_end) +{} template -std::string -rtree<_Key,_Value,_Trait>::extent_type::to_string() const +std::string rtree<_Key, _Value, _Trait>::extent_type::to_string() const { std::ostringstream os; os << start.to_string(); @@ -476,25 +479,25 @@ } template -bool rtree<_Key,_Value,_Trait>::extent_type::is_point() const +bool rtree<_Key, _Value, _Trait>::extent_type::is_point() const { return start == end; } template -bool rtree<_Key,_Value,_Trait>::extent_type::operator== (const extent_type& other) const +bool rtree<_Key, _Value, _Trait>::extent_type::operator==(const extent_type& other) const { return start == other.start && end == other.end; } template -bool rtree<_Key,_Value,_Trait>::extent_type::operator!= (const extent_type& other) const +bool rtree<_Key, _Value, _Trait>::extent_type::operator!=(const extent_type& other) const { - return !operator== (other); + return !operator==(other); } template -bool rtree<_Key,_Value,_Trait>::extent_type::contains(const point_type& pt) const +bool rtree<_Key, _Value, _Trait>::extent_type::contains(const point_type& pt) const { for (size_t dim = 0; dim < trait_type::dimensions; ++dim) { @@ -506,7 +509,7 @@ } template -bool rtree<_Key,_Value,_Trait>::extent_type::contains(const extent_type& bb) const +bool rtree<_Key, _Value, _Trait>::extent_type::contains(const extent_type& bb) const { for (size_t dim = 0; dim < trait_type::dimensions; ++dim) { @@ -518,13 +521,13 @@ } template -bool rtree<_Key,_Value,_Trait>::extent_type::intersects(const extent_type& bb) const +bool rtree<_Key, _Value, _Trait>::extent_type::intersects(const extent_type& bb) const { return detail::rtree::intersects(bb, *this); } template -bool rtree<_Key,_Value,_Trait>::extent_type::contains_at_boundary(const extent_type& bb) const +bool rtree<_Key, _Value, _Trait>::extent_type::contains_at_boundary(const extent_type& bb) const { for (size_t dim = 0; dim < trait_type::dimensions; ++dim) { @@ -536,18 +539,14 @@ } template -rtree<_Key,_Value,_Trait>::node_store::node_store() : - type(node_type::unspecified), parent(nullptr), node_ptr(nullptr), count(0), - valid_pointer(true) {} +rtree<_Key, _Value, _Trait>::node_store::node_store() + : type(node_type::unspecified), parent(nullptr), node_ptr(nullptr), count(0), valid_pointer(true) +{} template -rtree<_Key,_Value,_Trait>::node_store::node_store(node_store&& r) : - type(r.type), - extent(r.extent), - parent(r.parent), - node_ptr(r.node_ptr), - count(r.count), - valid_pointer(r.valid_pointer) +rtree<_Key, _Value, _Trait>::node_store::node_store(node_store&& r) + : type(r.type), extent(r.extent), parent(r.parent), node_ptr(r.node_ptr), count(r.count), + valid_pointer(r.valid_pointer) { r.type = node_type::unspecified; r.extent = extent_type(); @@ -558,11 +557,12 @@ } template -rtree<_Key,_Value,_Trait>::node_store::node_store(node_type _type, const extent_type& _extent, node* _node_ptr) : - type(_type), extent(_extent), parent(nullptr), node_ptr(_node_ptr), count(0), valid_pointer(true) {} +rtree<_Key, _Value, _Trait>::node_store::node_store(node_type _type, const extent_type& _extent, node* _node_ptr) + : type(_type), extent(_extent), parent(nullptr), node_ptr(_node_ptr), count(0), valid_pointer(true) +{} template -rtree<_Key,_Value,_Trait>::node_store::~node_store() +rtree<_Key, _Value, _Trait>::node_store::~node_store() { if (node_ptr) { @@ -583,11 +583,9 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store -rtree<_Key,_Value,_Trait>::node_store::clone() const +typename rtree<_Key, _Value, _Trait>::node_store rtree<_Key, _Value, _Trait>::node_store::clone() const { - auto func_copy_dir = [this](node_store& cloned, const directory_node* src) - { + auto func_copy_dir = [this](node_store& cloned, const directory_node* src) { directory_node* dir = cloned.get_directory_node(); assert(dir); for (const node_store& ns : src->children) @@ -625,8 +623,7 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store -rtree<_Key,_Value,_Trait>::node_store::create_leaf_directory_node() +typename rtree<_Key, _Value, _Trait>::node_store rtree<_Key, _Value, _Trait>::node_store::create_leaf_directory_node() { node_store ret(node_type::directory_leaf, extent_type(), new directory_node); ret.valid_pointer = false; @@ -634,8 +631,8 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store -rtree<_Key,_Value,_Trait>::node_store::create_nonleaf_directory_node() +typename rtree<_Key, _Value, _Trait>::node_store rtree< + _Key, _Value, _Trait>::node_store::create_nonleaf_directory_node() { node_store ret(node_type::directory_nonleaf, extent_type(), new directory_node); ret.valid_pointer = false; @@ -643,24 +640,23 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store -rtree<_Key,_Value,_Trait>::node_store::create_value_node(const extent_type& extent, value_type&& v) +typename rtree<_Key, _Value, _Trait>::node_store rtree<_Key, _Value, _Trait>::node_store::create_value_node( + const extent_type& extent, value_type&& v) { node_store ret(node_type::value, extent, new value_node(std::move(v))); return ret; } template -typename rtree<_Key,_Value,_Trait>::node_store -rtree<_Key,_Value,_Trait>::node_store::create_value_node(const extent_type& extent, const value_type& v) +typename rtree<_Key, _Value, _Trait>::node_store rtree<_Key, _Value, _Trait>::node_store::create_value_node( + const extent_type& extent, const value_type& v) { node_store ret(node_type::value, extent, new value_node(v)); return ret; } template -typename rtree<_Key,_Value,_Trait>::node_store& -rtree<_Key,_Value,_Trait>::node_store::operator= (node_store&& other) +typename rtree<_Key, _Value, _Trait>::node_store& rtree<_Key, _Value, _Trait>::node_store::operator=(node_store&& other) { node_store tmp(std::move(other)); swap(tmp); @@ -668,7 +664,7 @@ } template -bool rtree<_Key,_Value,_Trait>::node_store::pack() +bool rtree<_Key, _Value, _Trait>::node_store::pack() { const directory_node* dir = get_directory_node(); if (!dir) @@ -691,7 +687,7 @@ } template -void rtree<_Key,_Value,_Trait>::node_store::pack_upward() +void rtree<_Key, _Value, _Trait>::node_store::pack_upward() { bool propagate = true; for (node_store* p = parent; propagate && p; p = p->parent) @@ -699,28 +695,27 @@ } template -bool rtree<_Key,_Value,_Trait>::node_store::is_directory() const +bool rtree<_Key, _Value, _Trait>::node_store::is_directory() const { switch (type) { case node_type::directory_leaf: case node_type::directory_nonleaf: return true; - default: - ; + default:; } return false; } template -bool rtree<_Key,_Value,_Trait>::node_store::is_root() const +bool rtree<_Key, _Value, _Trait>::node_store::is_root() const { return parent == nullptr; } template -bool rtree<_Key,_Value,_Trait>::node_store::exceeds_capacity() const +bool rtree<_Key, _Value, _Trait>::node_store::exceeds_capacity() const { if (type != node_type::directory_leaf) return false; @@ -729,7 +724,7 @@ } template -void rtree<_Key,_Value,_Trait>::node_store::swap(node_store& other) +void rtree<_Key, _Value, _Trait>::node_store::swap(node_store& other) { std::swap(type, other.type); std::swap(extent, other.extent); @@ -740,7 +735,7 @@ } template -void rtree<_Key,_Value,_Trait>::node_store::reset_parent_pointers_of_children() +void rtree<_Key, _Value, _Trait>::node_store::reset_parent_pointers_of_children() { if (valid_pointer) return; @@ -759,15 +754,14 @@ } template -void rtree<_Key,_Value,_Trait>::node_store::reset_parent_pointers() +void rtree<_Key, _Value, _Trait>::node_store::reset_parent_pointers() { valid_pointer = false; reset_parent_pointers_of_children(); } template -typename rtree<_Key,_Value,_Trait>::directory_node* -rtree<_Key,_Value,_Trait>::node_store::get_directory_node() +typename rtree<_Key, _Value, _Trait>::directory_node* rtree<_Key, _Value, _Trait>::node_store::get_directory_node() { if (!is_directory()) return nullptr; @@ -776,8 +770,8 @@ } template -const typename rtree<_Key,_Value,_Trait>::directory_node* -rtree<_Key,_Value,_Trait>::node_store::get_directory_node() const +const typename rtree<_Key, _Value, _Trait>::directory_node* rtree< + _Key, _Value, _Trait>::node_store::get_directory_node() const { if (!is_directory()) return nullptr; @@ -786,7 +780,7 @@ } template -bool rtree<_Key,_Value,_Trait>::node_store::erase_child(const node_store* p) +bool rtree<_Key, _Value, _Trait>::node_store::erase_child(const node_store* p) { if (!is_directory()) return false; @@ -801,37 +795,38 @@ } template -rtree<_Key,_Value,_Trait>::node::node() {} +rtree<_Key, _Value, _Trait>::node::node() +{} template -rtree<_Key,_Value,_Trait>::node::~node() {} +rtree<_Key, _Value, _Trait>::node::~node() +{} template -rtree<_Key,_Value,_Trait>::value_node::value_node(value_type&& _value) : - value(std::move(_value)) {} +rtree<_Key, _Value, _Trait>::value_node::value_node(value_type&& _value) : value(std::move(_value)) +{} template -rtree<_Key,_Value,_Trait>::value_node::value_node(const value_type& _value) : - value(_value) {} +rtree<_Key, _Value, _Trait>::value_node::value_node(const value_type& _value) : value(_value) +{} template -rtree<_Key,_Value,_Trait>::value_node::~value_node() {} +rtree<_Key, _Value, _Trait>::value_node::~value_node() +{} template -rtree<_Key,_Value,_Trait>::directory_node::directory_node() {} +rtree<_Key, _Value, _Trait>::directory_node::directory_node() +{} template -rtree<_Key,_Value,_Trait>::directory_node::~directory_node() {} +rtree<_Key, _Value, _Trait>::directory_node::~directory_node() +{} template -bool rtree<_Key,_Value,_Trait>::directory_node::erase(const node_store* ns) +bool rtree<_Key, _Value, _Trait>::directory_node::erase(const node_store* ns) { - auto it = std::find_if(children.begin(), children.end(), - [ns](const node_store& this_ns) -> bool - { - return &this_ns == ns; - } - ); + auto it = std::find_if( + children.begin(), children.end(), [ns](const node_store& this_ns) -> bool { return &this_ns == ns; }); if (it == children.end()) return false; @@ -855,8 +850,8 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store* -rtree<_Key,_Value,_Trait>::directory_node::get_child_with_minimal_overlap(const extent_type& bb) +typename rtree<_Key, _Value, _Trait>::node_store* rtree< + _Key, _Value, _Trait>::directory_node::get_child_with_minimal_overlap(const extent_type& bb) { key_type min_overlap = key_type(); key_type min_area_enlargement = key_type(); @@ -899,8 +894,8 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store* -rtree<_Key,_Value,_Trait>::directory_node::get_child_with_minimal_area_enlargement(const extent_type& bb) +typename rtree<_Key, _Value, _Trait>::node_store* rtree< + _Key, _Value, _Trait>::directory_node::get_child_with_minimal_area_enlargement(const extent_type& bb) { // Compare the costs of area enlargements. key_type min_cost = key_type(); @@ -937,8 +932,7 @@ } template -typename rtree<_Key,_Value,_Trait>::extent_type -rtree<_Key,_Value,_Trait>::directory_node::calc_extent() const +typename rtree<_Key, _Value, _Trait>::extent_type rtree<_Key, _Value, _Trait>::directory_node::calc_extent() const { auto it = children.cbegin(), ite = children.cend(); @@ -950,8 +944,8 @@ } template -typename rtree<_Key,_Value,_Trait>::key_type -rtree<_Key,_Value,_Trait>::directory_node::calc_overlap_cost(const extent_type& bb) const +typename rtree<_Key, _Value, _Trait>::key_type rtree<_Key, _Value, _Trait>::directory_node::calc_overlap_cost( + const extent_type& bb) const { key_type overlap_cost = key_type(); @@ -962,7 +956,7 @@ } template -bool rtree<_Key,_Value,_Trait>::directory_node::has_leaf_directory() const +bool rtree<_Key, _Value, _Trait>::directory_node::has_leaf_directory() const { for (const auto& ns : children) { @@ -975,40 +969,43 @@ template template -void rtree<_Key,_Value,_Trait>::search_results_base<_NS>::add_node_store( - node_store_type* ns, size_t depth) +void rtree<_Key, _Value, _Trait>::search_results_base<_NS>::add_node_store(node_store_type* ns, size_t depth) { m_store.emplace_back(ns, depth); } template template -rtree<_Key,_Value,_Trait>::search_results_base<_NS>::entry::entry(node_store_type* _ns, size_t _depth) : - ns(_ns), depth(_depth) {} +rtree<_Key, _Value, _Trait>::search_results_base<_NS>::entry::entry(node_store_type* _ns, size_t _depth) + : ns(_ns), depth(_depth) +{} template template -rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::iterator_base(store_iterator_type pos) : - m_pos(std::move(pos)) {} +rtree<_Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::iterator_base(store_iterator_type pos) + : m_pos(std::move(pos)) +{} template template -bool rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::operator== (const self_iterator_type& other) const +bool rtree<_Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::operator==( + const self_iterator_type& other) const { return m_pos == other.m_pos; } template template -bool rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::operator!= (const self_iterator_type& other) const +bool rtree<_Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::operator!=( + const self_iterator_type& other) const { return !operator==(other); } template template -typename rtree<_Key,_Value,_Trait>::template iterator_base<_SelfIter,_StoreIter,_ValueT>::self_iterator_type& -rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::operator++() +typename rtree<_Key, _Value, _Trait>::template iterator_base<_SelfIter, _StoreIter, _ValueT>::self_iterator_type& rtree< + _Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::operator++() { ++m_pos; return static_cast(*this); @@ -1016,8 +1013,8 @@ template template -typename rtree<_Key,_Value,_Trait>::template iterator_base<_SelfIter,_StoreIter,_ValueT>::self_iterator_type -rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::operator++(int) +typename rtree<_Key, _Value, _Trait>::template iterator_base<_SelfIter, _StoreIter, _ValueT>::self_iterator_type rtree< + _Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::operator++(int) { self_iterator_type ret(m_pos); ++m_pos; @@ -1026,8 +1023,8 @@ template template -typename rtree<_Key,_Value,_Trait>::template iterator_base<_SelfIter,_StoreIter,_ValueT>::self_iterator_type& -rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::operator--() +typename rtree<_Key, _Value, _Trait>::template iterator_base<_SelfIter, _StoreIter, _ValueT>::self_iterator_type& rtree< + _Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::operator--() { --m_pos; return static_cast(*this); @@ -1035,8 +1032,8 @@ template template -typename rtree<_Key,_Value,_Trait>::template iterator_base<_SelfIter,_StoreIter,_ValueT>::self_iterator_type -rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::operator--(int) +typename rtree<_Key, _Value, _Trait>::template iterator_base<_SelfIter, _StoreIter, _ValueT>::self_iterator_type rtree< + _Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::operator--(int) { self_iterator_type ret(m_pos); --m_pos; @@ -1045,114 +1042,107 @@ template template -const typename rtree<_Key,_Value,_Trait>::extent_type& -rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::extent() const +const typename rtree<_Key, _Value, _Trait>::extent_type& rtree<_Key, _Value, _Trait>::iterator_base< + _SelfIter, _StoreIter, _ValueT>::extent() const { return m_pos->ns->extent; } template template -size_t rtree<_Key,_Value,_Trait>::iterator_base<_SelfIter,_StoreIter,_ValueT>::depth() const +size_t rtree<_Key, _Value, _Trait>::iterator_base<_SelfIter, _StoreIter, _ValueT>::depth() const { return m_pos->depth; } template -typename rtree<_Key,_Value,_Trait>::const_iterator -rtree<_Key,_Value,_Trait>::const_search_results::cbegin() const +typename rtree<_Key, _Value, _Trait>::const_iterator rtree<_Key, _Value, _Trait>::const_search_results::cbegin() const { return const_iterator(m_store.cbegin()); } template -typename rtree<_Key,_Value,_Trait>::const_iterator -rtree<_Key,_Value,_Trait>::const_search_results::cend() const +typename rtree<_Key, _Value, _Trait>::const_iterator rtree<_Key, _Value, _Trait>::const_search_results::cend() const { return const_iterator(m_store.cend()); } template -typename rtree<_Key,_Value,_Trait>::const_iterator -rtree<_Key,_Value,_Trait>::const_search_results::begin() const +typename rtree<_Key, _Value, _Trait>::const_iterator rtree<_Key, _Value, _Trait>::const_search_results::begin() const { return const_iterator(m_store.cbegin()); } template -typename rtree<_Key,_Value,_Trait>::const_iterator -rtree<_Key,_Value,_Trait>::const_search_results::end() const +typename rtree<_Key, _Value, _Trait>::const_iterator rtree<_Key, _Value, _Trait>::const_search_results::end() const { return const_iterator(m_store.cend()); } template -typename rtree<_Key,_Value,_Trait>::iterator -rtree<_Key,_Value,_Trait>::search_results::begin() +typename rtree<_Key, _Value, _Trait>::iterator rtree<_Key, _Value, _Trait>::search_results::begin() { return iterator(m_store.begin()); } template -typename rtree<_Key,_Value,_Trait>::iterator -rtree<_Key,_Value,_Trait>::search_results::end() +typename rtree<_Key, _Value, _Trait>::iterator rtree<_Key, _Value, _Trait>::search_results::end() { return iterator(m_store.end()); } template -rtree<_Key,_Value,_Trait>::const_iterator::const_iterator(store_iterator_type pos) : - base_type(std::move(pos)) {} +rtree<_Key, _Value, _Trait>::const_iterator::const_iterator(store_iterator_type pos) : base_type(std::move(pos)) +{} template -rtree<_Key,_Value,_Trait>::iterator::iterator(store_iterator_type pos) : - base_type(std::move(pos)) {} +rtree<_Key, _Value, _Trait>::iterator::iterator(store_iterator_type pos) : base_type(std::move(pos)) +{} template -rtree<_Key,_Value,_Trait>::bulk_loader::bulk_loader() -{ -} +rtree<_Key, _Value, _Trait>::bulk_loader::bulk_loader() +{} template -void rtree<_Key,_Value,_Trait>::bulk_loader::insert(const extent_type& extent, value_type&& value) +void rtree<_Key, _Value, _Trait>::bulk_loader::insert(const extent_type& extent, value_type&& value) { insert_impl(extent, std::move(value)); } template -void rtree<_Key,_Value,_Trait>::bulk_loader::insert(const extent_type& extent, const value_type& value) +void rtree<_Key, _Value, _Trait>::bulk_loader::insert(const extent_type& extent, const value_type& value) { insert_impl(extent, value); } template -void rtree<_Key,_Value,_Trait>::bulk_loader::insert(const point_type& position, value_type&& value) +void rtree<_Key, _Value, _Trait>::bulk_loader::insert(const point_type& position, value_type&& value) { insert_impl(extent_type({position, position}), std::move(value)); } template -void rtree<_Key,_Value,_Trait>::bulk_loader::insert(const point_type& position, const value_type& value) +void rtree<_Key, _Value, _Trait>::bulk_loader::insert(const point_type& position, const value_type& value) { insert_impl(extent_type({position, position}), value); } template -void rtree<_Key,_Value,_Trait>::bulk_loader::insert_impl(const extent_type& extent, value_type&& value) +void rtree<_Key, _Value, _Trait>::bulk_loader::insert_impl(const extent_type& extent, value_type&& value) { node_store ns_value = node_store::create_value_node(extent, std::move(value)); m_store.emplace_back(std::move(ns_value)); } template -void rtree<_Key,_Value,_Trait>::bulk_loader::insert_impl(const extent_type& extent, const value_type& value) +void rtree<_Key, _Value, _Trait>::bulk_loader::insert_impl(const extent_type& extent, const value_type& value) { node_store ns_value = node_store::create_value_node(extent, value); m_store.emplace_back(std::move(ns_value)); } template -rtree<_Key,_Value,_Trait> rtree<_Key,_Value,_Trait>::bulk_loader::pack() +rtree<_Key, _Value, _Trait> rtree<_Key, _Value, _Trait>::bulk_loader::pack() { size_t depth = 0; for (; m_store.size() > trait_type::max_node_size; ++depth) @@ -1179,13 +1169,12 @@ } template -void rtree<_Key,_Value,_Trait>::bulk_loader::pack_level(dir_store_type& store, size_t depth) +void rtree<_Key, _Value, _Trait>::bulk_loader::pack_level(dir_store_type& store, size_t depth) { assert(!store.empty()); float n_total_node = std::ceil(store.size() / float(trait_type::max_node_size)); - float n_splits_per_dim = std::ceil( - std::pow(n_total_node, 1.0f / float(trait_type::dimensions))); + float n_splits_per_dim = std::ceil(std::pow(n_total_node, 1.0f / float(trait_type::dimensions))); // The first dimension will start with one segment. std::vector segments; @@ -1209,21 +1198,17 @@ } // Sort by the current dimension key. - std::sort(seg.begin, seg.end, - [dim](const node_store& left, const node_store& right) -> bool - { - // Compare the middle points. - float left_key = (left.extent.end.d[dim] + left.extent.start.d[dim]) / 2.0f; - float right_key = (right.extent.end.d[dim] + right.extent.start.d[dim]) / 2.0f; + std::sort(seg.begin, seg.end, [dim](const node_store& left, const node_store& right) -> bool { + // Compare the middle points. + float left_key = (left.extent.end.d[dim] + left.extent.start.d[dim]) / 2.0f; + float right_key = (right.extent.end.d[dim] + right.extent.start.d[dim]) / 2.0f; - return left_key < right_key; - } - ); + return left_key < right_key; + }); // Size of each segment in this dimension splits. size_t segment_size = detail::rtree::calc_optimal_segment_size_for_pack( - std::ceil(seg.size / n_splits_per_dim), - trait_type::min_node_size, trait_type::max_node_size, seg.size); + std::ceil(seg.size / n_splits_per_dim), trait_type::min_node_size, trait_type::max_node_size, seg.size); size_t n_cur_segment = 0; auto begin = seg.begin; @@ -1251,8 +1236,7 @@ test_total += seg.size; if (test_total != store.size()) - throw std::logic_error( - "The total combined segment sizes must equal the size of the inserted values!"); + throw std::logic_error("The total combined segment sizes must equal the size of the inserted values!"); #endif segments.swap(next_segments); } @@ -1264,8 +1248,7 @@ test_total += seg.size; if (test_total != store.size()) - throw std::logic_error( - "The total combined segment sizes must equal the size of the inserted values!"); + throw std::logic_error("The total combined segment sizes must equal the size of the inserted values!"); #endif assert(!segments.empty()); @@ -1293,17 +1276,19 @@ } template -rtree<_Key,_Value,_Trait>::rtree() : m_root(node_store::create_leaf_directory_node()) +rtree<_Key, _Value, _Trait>::rtree() : m_root(node_store::create_leaf_directory_node()) { - static_assert(trait_type::min_node_size <= trait_type::max_node_size / 2, + static_assert( + trait_type::min_node_size <= trait_type::max_node_size / 2, "Minimum node size must be less than half of the maximum node size."); - static_assert(trait_type::reinsertion_size <= (trait_type::max_node_size - trait_type::min_node_size + 1), + static_assert( + trait_type::reinsertion_size <= (trait_type::max_node_size - trait_type::min_node_size + 1), "Reinsertion size is too large."); } template -rtree<_Key,_Value,_Trait>::rtree(rtree&& other) : m_root(std::move(other.m_root)) +rtree<_Key, _Value, _Trait>::rtree(rtree&& other) : m_root(std::move(other.m_root)) { // The root node must be a valid directory at all times. other.m_root = node_store::create_leaf_directory_node(); @@ -1314,24 +1299,23 @@ } template -rtree<_Key,_Value,_Trait>::rtree(const rtree& other) : m_root(other.m_root.clone()) +rtree<_Key, _Value, _Trait>::rtree(const rtree& other) : m_root(other.m_root.clone()) { m_root.reset_parent_pointers(); } template -rtree<_Key,_Value,_Trait>::rtree(node_store&& root) : m_root(std::move(root)) +rtree<_Key, _Value, _Trait>::rtree(node_store&& root) : m_root(std::move(root)) { m_root.reset_parent_pointers(); } template -rtree<_Key,_Value,_Trait>::~rtree() -{ -} +rtree<_Key, _Value, _Trait>::~rtree() +{} template -rtree<_Key,_Value,_Trait>& rtree<_Key,_Value,_Trait>::operator= (const rtree& other) +rtree<_Key, _Value, _Trait>& rtree<_Key, _Value, _Trait>::operator=(const rtree& other) { rtree tmp(other); tmp.swap(*this); @@ -1339,7 +1323,7 @@ } template -rtree<_Key,_Value,_Trait>& rtree<_Key,_Value,_Trait>::operator= (rtree&& other) +rtree<_Key, _Value, _Trait>& rtree<_Key, _Value, _Trait>::operator=(rtree&& other) { rtree tmp(std::move(other)); tmp.swap(*this); @@ -1347,31 +1331,31 @@ } template -void rtree<_Key,_Value,_Trait>::insert(const extent_type& extent, value_type&& value) +void rtree<_Key, _Value, _Trait>::insert(const extent_type& extent, value_type&& value) { insert_impl(extent.start, extent.end, std::move(value)); } template -void rtree<_Key,_Value,_Trait>::insert(const extent_type& extent, const value_type& value) +void rtree<_Key, _Value, _Trait>::insert(const extent_type& extent, const value_type& value) { insert_impl(extent.start, extent.end, value); } template -void rtree<_Key,_Value,_Trait>::insert(const point_type& position, value_type&& value) +void rtree<_Key, _Value, _Trait>::insert(const point_type& position, value_type&& value) { insert_impl(position, position, std::move(value)); } template -void rtree<_Key,_Value,_Trait>::insert(const point_type& position, const value_type& value) +void rtree<_Key, _Value, _Trait>::insert(const point_type& position, const value_type& value) { insert_impl(position, position, value); } template -void rtree<_Key,_Value,_Trait>::insert_impl(const point_type& start, const point_type& end, value_type&& value) +void rtree<_Key, _Value, _Trait>::insert_impl(const point_type& start, const point_type& end, value_type&& value) { extent_type bb(start, end); node_store new_ns = node_store::create_value_node(bb, std::move(value)); @@ -1381,7 +1365,7 @@ } template -void rtree<_Key,_Value,_Trait>::insert_impl(const point_type& start, const point_type& end, const value_type& value) +void rtree<_Key, _Value, _Trait>::insert_impl(const point_type& start, const point_type& end, const value_type& value) { extent_type bb(start, end); node_store new_ns = node_store::create_value_node(bb, value); @@ -1391,7 +1375,7 @@ } template -void rtree<_Key,_Value,_Trait>::insert(node_store&& ns, std::unordered_set* reinserted_depths) +void rtree<_Key, _Value, _Trait>::insert(node_store&& ns, std::unordered_set* reinserted_depths) { extent_type ns_box = ns.extent; @@ -1443,7 +1427,7 @@ } template -void rtree<_Key,_Value,_Trait>::insert_dir(node_store&& ns, size_t max_depth) +void rtree<_Key, _Value, _Trait>::insert_dir(node_store&& ns, size_t max_depth) { assert(ns.is_directory()); extent_type ns_box = ns.extent; @@ -1481,8 +1465,8 @@ } template -typename rtree<_Key,_Value,_Trait>::const_search_results -rtree<_Key,_Value,_Trait>::search(const point_type& pt, search_type st) const +typename rtree<_Key, _Value, _Trait>::const_search_results rtree<_Key, _Value, _Trait>::search( + const point_type& pt, search_type st) const { search_condition_type dir_cond, value_cond; @@ -1490,25 +1474,16 @@ { case search_type::overlap: { - dir_cond = [&pt](const node_store& ns) -> bool - { - return ns.extent.contains(pt); - }; + dir_cond = [&pt](const node_store& ns) -> bool { return ns.extent.contains(pt); }; value_cond = dir_cond; break; } case search_type::match: { - dir_cond = [&pt](const node_store& ns) -> bool - { - return ns.extent.contains(pt); - }; + dir_cond = [&pt](const node_store& ns) -> bool { return ns.extent.contains(pt); }; - value_cond = [&pt](const node_store& ns) -> bool - { - return ns.extent.start == pt && ns.extent.end == pt; - }; + value_cond = [&pt](const node_store& ns) -> bool { return ns.extent.start == pt && ns.extent.end == pt; }; break; } @@ -1522,8 +1497,8 @@ } template -typename rtree<_Key,_Value,_Trait>::search_results -rtree<_Key,_Value,_Trait>::search(const point_type& pt, search_type st) +typename rtree<_Key, _Value, _Trait>::search_results rtree<_Key, _Value, _Trait>::search( + const point_type& pt, search_type st) { search_condition_type dir_cond, value_cond; @@ -1531,25 +1506,16 @@ { case search_type::overlap: { - dir_cond = [&pt](const node_store& ns) -> bool - { - return ns.extent.contains(pt); - }; + dir_cond = [&pt](const node_store& ns) -> bool { return ns.extent.contains(pt); }; value_cond = dir_cond; break; } case search_type::match: { - dir_cond = [&pt](const node_store& ns) -> bool - { - return ns.extent.contains(pt); - }; + dir_cond = [&pt](const node_store& ns) -> bool { return ns.extent.contains(pt); }; - value_cond = [&pt](const node_store& ns) -> bool - { - return ns.extent.start == pt && ns.extent.end == pt; - }; + value_cond = [&pt](const node_store& ns) -> bool { return ns.extent.start == pt && ns.extent.end == pt; }; break; } @@ -1563,8 +1529,8 @@ } template -typename rtree<_Key,_Value,_Trait>::const_search_results -rtree<_Key,_Value,_Trait>::search(const extent_type& extent, search_type st) const +typename rtree<_Key, _Value, _Trait>::const_search_results rtree<_Key, _Value, _Trait>::search( + const extent_type& extent, search_type st) const { search_condition_type dir_cond, value_cond; @@ -1572,25 +1538,16 @@ { case search_type::overlap: { - dir_cond = [&extent](const node_store& ns) -> bool - { - return ns.extent.intersects(extent); - }; + dir_cond = [&extent](const node_store& ns) -> bool { return ns.extent.intersects(extent); }; value_cond = dir_cond; break; } case search_type::match: { - dir_cond = [&extent](const node_store& ns) -> bool - { - return ns.extent.contains(extent); - }; + dir_cond = [&extent](const node_store& ns) -> bool { return ns.extent.contains(extent); }; - value_cond = [&extent](const node_store& ns) -> bool - { - return ns.extent == extent; - }; + value_cond = [&extent](const node_store& ns) -> bool { return ns.extent == extent; }; break; } @@ -1604,8 +1561,8 @@ } template -typename rtree<_Key,_Value,_Trait>::search_results -rtree<_Key,_Value,_Trait>::search(const extent_type& extent, search_type st) +typename rtree<_Key, _Value, _Trait>::search_results rtree<_Key, _Value, _Trait>::search( + const extent_type& extent, search_type st) { search_condition_type dir_cond, value_cond; @@ -1613,25 +1570,16 @@ { case search_type::overlap: { - dir_cond = [&extent](const node_store& ns) -> bool - { - return ns.extent.intersects(extent); - }; + dir_cond = [&extent](const node_store& ns) -> bool { return ns.extent.intersects(extent); }; value_cond = dir_cond; break; } case search_type::match: { - dir_cond = [&extent](const node_store& ns) -> bool - { - return ns.extent.contains(extent); - }; + dir_cond = [&extent](const node_store& ns) -> bool { return ns.extent.contains(extent); }; - value_cond = [&extent](const node_store& ns) -> bool - { - return ns.extent == extent; - }; + value_cond = [&extent](const node_store& ns) -> bool { return ns.extent == extent; }; break; } @@ -1645,7 +1593,7 @@ } template -void rtree<_Key,_Value,_Trait>::erase(const const_iterator& pos) +void rtree<_Key, _Value, _Trait>::erase(const const_iterator& pos) { const node_store* ns = pos.m_pos->ns; size_t depth = pos.m_pos->depth; @@ -1653,7 +1601,7 @@ } template -void rtree<_Key,_Value,_Trait>::erase(const iterator& pos) +void rtree<_Key, _Value, _Trait>::erase(const iterator& pos) { const node_store* ns = pos.m_pos->ns; size_t depth = pos.m_pos->depth; @@ -1661,7 +1609,7 @@ } template -void rtree<_Key,_Value,_Trait>::erase_impl(const node_store* ns, size_t depth) +void rtree<_Key, _Value, _Trait>::erase_impl(const node_store* ns, size_t depth) { assert(ns->type == node_type::value); assert(ns->parent); @@ -1765,35 +1713,31 @@ } template -const typename rtree<_Key,_Value,_Trait>::extent_type& -rtree<_Key,_Value,_Trait>::extent() const +const typename rtree<_Key, _Value, _Trait>::extent_type& rtree<_Key, _Value, _Trait>::extent() const { return m_root.extent; } template -bool rtree<_Key,_Value,_Trait>::empty() const +bool rtree<_Key, _Value, _Trait>::empty() const { return !m_root.count; } template -size_t rtree<_Key,_Value,_Trait>::size() const +size_t rtree<_Key, _Value, _Trait>::size() const { size_t n = 0; - descend_with_func( - [&n](const node_properties& np) - { - if (np.type == node_type::value) - ++n; - } - ); + descend_with_func([&n](const node_properties& np) { + if (np.type == node_type::value) + ++n; + }); return n; } template -void rtree<_Key,_Value,_Trait>::swap(rtree& other) +void rtree<_Key, _Value, _Trait>::swap(rtree& other) { m_root.swap(other.m_root); m_root.reset_parent_pointers(); @@ -1801,7 +1745,7 @@ } template -void rtree<_Key,_Value,_Trait>::clear() +void rtree<_Key, _Value, _Trait>::clear() { node_store new_root = node_store::create_leaf_directory_node(); m_root.swap(new_root); @@ -1809,13 +1753,13 @@ template template -void rtree<_Key,_Value,_Trait>::walk(_Func func) const +void rtree<_Key, _Value, _Trait>::walk(_Func func) const { descend_with_func(std::move(func)); } template -void rtree<_Key,_Value,_Trait>::check_integrity(const integrity_check_properties& props) const +void rtree<_Key, _Value, _Trait>::check_integrity(const integrity_check_properties& props) const { auto func_ptr_to_string = build_ptr_to_string_map(); @@ -1834,8 +1778,8 @@ std::vector ns_stack; - std::function func_descend = [&ns_stack,&func_descend,&func_ptr_to_string,&props](const node_store* ns, int level) -> bool - { + std::function func_descend = [&ns_stack, &func_descend, &func_ptr_to_string, + &props](const node_store* ns, int level) -> bool { bool valid = true; std::string indent; @@ -1852,10 +1796,8 @@ if (!props.throw_on_first_error) { - std::cout << indent << "node: " << func_ptr_to_string(ns) - << "; parent: " << func_ptr_to_string(ns->parent) - << "; type: " << to_string(ns->type) - << "; extent: " << ns->extent.to_string() << std::endl; + std::cout << indent << "node: " << func_ptr_to_string(ns) << "; parent: " << func_ptr_to_string(ns->parent) + << "; type: " << to_string(ns->type) << "; extent: " << ns->extent.to_string() << std::endl; } if (parent) @@ -1863,7 +1805,8 @@ if (ns->parent != parent) { std::ostringstream os; - os << "The parent node pointer does not point to the real parent. (expected: " << parent << "; stored in node: " << ns->parent << ")"; + os << "The parent node pointer does not point to the real parent. (expected: " << parent + << "; stored in node: " << ns->parent << ")"; if (props.throw_on_first_error) throw integrity_error(os.str()); std::cout << indent << "* " << os.str() << std::endl; @@ -1873,7 +1816,8 @@ if (!parent_bb.contains(ns->extent)) { std::ostringstream os; - os << "The extent of the child " << ns->extent.to_string() << " is not within the extent of the parent " << parent_bb.to_string() << "."; + os << "The extent of the child " << ns->extent.to_string() << " is not within the extent of the parent " + << parent_bb.to_string() << "."; if (props.throw_on_first_error) throw integrity_error(os.str()); std::cout << indent << "* " << os.str() << std::endl; @@ -1933,13 +1877,13 @@ case node_type::directory_leaf: case node_type::directory_nonleaf: { - const directory_node* dir = - static_cast(ns->node_ptr); + const directory_node* dir = static_cast(ns->node_ptr); if (ns->count != dir->children.size()) { std::ostringstream os; - os << "Incorrect count of child nodes detected. (expected: " << dir->children.size() << "; actual: " << ns->count << ")"; + os << "Incorrect count of child nodes detected. (expected: " << dir->children.size() + << "; actual: " << ns->count << ")"; if (props.throw_on_first_error) throw integrity_error(os.str()); @@ -1988,7 +1932,8 @@ if (bb_expected != ns->extent) { std::ostringstream os; - os << "The extent of the node " << ns->extent.to_string() << " does not equal truly tight extent " << bb_expected.to_string(); + os << "The extent of the node " << ns->extent.to_string() << " does not equal truly tight extent " + << bb_expected.to_string(); if (props.throw_on_first_error) throw integrity_error(os.str()); @@ -1999,7 +1944,7 @@ for (const node_store& ns_child : dir->children) { - bool valid_subtree = func_descend(&ns_child, level+1); + bool valid_subtree = func_descend(&ns_child, level + 1); if (!valid_subtree) valid = false; } @@ -2025,7 +1970,7 @@ } template -std::string rtree<_Key,_Value,_Trait>::export_tree(export_tree_type mode) const +std::string rtree<_Key, _Value, _Trait>::export_tree(export_tree_type mode) const { switch (mode) { @@ -2041,38 +1986,37 @@ } template -detail::rtree::ptr_to_string::node_store*> -rtree<_Key,_Value,_Trait>::build_ptr_to_string_map() const +detail::rtree::ptr_to_string::node_store*> rtree< + _Key, _Value, _Trait>::build_ptr_to_string_map() const { detail::rtree::ptr_to_string func; - std::function func_build_node_ptr = [&func_build_node_ptr,&func](const node_store* ns, int level, int pos) - { - std::ostringstream os; - os << "(" << level << ", " << pos << ")"; - func.node_ptr_map.insert(std::make_pair(ns, os.str())); + std::function func_build_node_ptr = + [&func_build_node_ptr, &func](const node_store* ns, int level, int pos) { + std::ostringstream os; + os << "(" << level << ", " << pos << ")"; + func.node_ptr_map.insert(std::make_pair(ns, os.str())); - switch (ns->type) - { - case node_type::directory_leaf: - case node_type::directory_nonleaf: + switch (ns->type) { - const directory_node* dir = - static_cast(ns->node_ptr); + case node_type::directory_leaf: + case node_type::directory_nonleaf: + { + const directory_node* dir = static_cast(ns->node_ptr); - int child_pos = 0; - for (const node_store& ns_child : dir->children) - func_build_node_ptr(&ns_child, level+1, child_pos++); + int child_pos = 0; + for (const node_store& ns_child : dir->children) + func_build_node_ptr(&ns_child, level + 1, child_pos++); - break; + break; + } + case node_type::value: + // Do nothing. + break; + default: + throw integrity_error("Unexpected node type!"); } - case node_type::value: - // Do nothing. - break; - default: - throw integrity_error("Unexpected node type!"); - } - }; + }; func_build_node_ptr(&m_root, 0, 0); @@ -2080,31 +2024,30 @@ } template -std::string rtree<_Key,_Value,_Trait>::export_tree_formatted() const +std::string rtree<_Key, _Value, _Trait>::export_tree_formatted() const { auto func_ptr_to_string = build_ptr_to_string_map(); std::ostringstream os; - std::function func_descend = [&func_descend,&os,&func_ptr_to_string](const node_store* ns, int level) - { + std::function func_descend = [&func_descend, &os, + &func_ptr_to_string](const node_store* ns, int level) { std::string indent; for (int i = 0; i < level; ++i) indent += " "; os << indent << "node: " << func_ptr_to_string(ns) << "; parent: " << func_ptr_to_string(ns->parent) - << "; type: " << to_string(ns->type) << "; extent: " << ns->extent.to_string() << std::endl; + << "; type: " << to_string(ns->type) << "; extent: " << ns->extent.to_string() << std::endl; switch (ns->type) { case node_type::directory_leaf: case node_type::directory_nonleaf: { - const directory_node* dir = - static_cast(ns->node_ptr); + const directory_node* dir = static_cast(ns->node_ptr); for (const node_store& ns_child : dir->children) - func_descend(&ns_child, level+1); + func_descend(&ns_child, level + 1); break; } @@ -2122,27 +2065,25 @@ } template -std::string rtree<_Key,_Value,_Trait>::export_tree_extent_as_obj() const +std::string rtree<_Key, _Value, _Trait>::export_tree_extent_as_obj() const { if (trait_type::dimensions != 2u) throw size_error("Only 2-dimensional trees are supported."); float unit_height = - ((m_root.extent.end.d[0] - m_root.extent.start.d[0]) + - (m_root.extent.end.d[1] - m_root.extent.start.d[1])) / 5.0f; + ((m_root.extent.end.d[0] - m_root.extent.start.d[0]) + (m_root.extent.end.d[1] - m_root.extent.start.d[1])) / + 5.0f; // Calculate the width to use for point data. float pt_width = std::min( - m_root.extent.end.d[0] - m_root.extent.start.d[0], - m_root.extent.end.d[1] - m_root.extent.start.d[1]); + m_root.extent.end.d[0] - m_root.extent.start.d[0], m_root.extent.end.d[1] - m_root.extent.start.d[1]); pt_width /= 400.0f; pt_width = std::min(pt_width, 1.0f); std::ostringstream os; size_t counter = 0; - std::function func_descend = [&](const node_store* ns, int level) - { + std::function func_descend = [&](const node_store* ns, int level) { size_t offset = counter * 4; point_type s = ns->extent.start; point_type e = ns->extent.end; @@ -2154,12 +2095,13 @@ e.d[1] += pt_width; } - os << "o extent " << counter << " (level " << level << ") " << s.to_string() << " - " << e.to_string() << std::endl; - os << "v " << s.d[0] << ' ' << (level*unit_height) << ' ' << s.d[1] << std::endl; - os << "v " << s.d[0] << ' ' << (level*unit_height) << ' ' << e.d[1] << std::endl; - os << "v " << e.d[0] << ' ' << (level*unit_height) << ' ' << e.d[1] << std::endl; - os << "v " << e.d[0] << ' ' << (level*unit_height) << ' ' << s.d[1] << std::endl; - os << "f " << (offset+1) << ' ' << (offset+2) << ' ' << (offset+3) << ' ' << (offset+4) << std::endl; + os << "o extent " << counter << " (level " << level << ") " << s.to_string() << " - " << e.to_string() + << std::endl; + os << "v " << s.d[0] << ' ' << (level * unit_height) << ' ' << s.d[1] << std::endl; + os << "v " << s.d[0] << ' ' << (level * unit_height) << ' ' << e.d[1] << std::endl; + os << "v " << e.d[0] << ' ' << (level * unit_height) << ' ' << e.d[1] << std::endl; + os << "v " << e.d[0] << ' ' << (level * unit_height) << ' ' << s.d[1] << std::endl; + os << "f " << (offset + 1) << ' ' << (offset + 2) << ' ' << (offset + 3) << ' ' << (offset + 4) << std::endl; ++counter; @@ -2168,11 +2110,10 @@ case node_type::directory_leaf: case node_type::directory_nonleaf: { - const directory_node* dir = - static_cast(ns->node_ptr); + const directory_node* dir = static_cast(ns->node_ptr); for (const node_store& ns_child : dir->children) - func_descend(&ns_child, level+1); + func_descend(&ns_child, level + 1); break; } @@ -2190,7 +2131,7 @@ } template -std::string rtree<_Key,_Value,_Trait>::export_tree_extent_as_svg() const +std::string rtree<_Key, _Value, _Trait>::export_tree_extent_as_svg() const { if (trait_type::dimensions != 2u) throw size_error("Only 2-dimensional trees are supported."); @@ -2238,8 +2179,7 @@ os << "\n"; os << "\n"; - std::function func_descend = [&](const node_store* ns, int level) - { + std::function func_descend = [&](const node_store* ns, int level) { const extent_type& ext = ns->extent; float w = ext.end.d[0] - ext.start.d[0]; @@ -2273,11 +2213,10 @@ case node_type::directory_leaf: case node_type::directory_nonleaf: { - const directory_node* dir = - static_cast(ns->node_ptr); + const directory_node* dir = static_cast(ns->node_ptr); for (const node_store& ns_child : dir->children) - func_descend(&ns_child, level+1); + func_descend(&ns_child, level + 1); break; } @@ -2297,12 +2236,12 @@ } template -void rtree<_Key,_Value,_Trait>::split_node(node_store* ns) +void rtree<_Key, _Value, _Trait>::split_node(node_store* ns) { directory_node* dir = ns->get_directory_node(); assert(dir); - assert(ns->count == trait_type::max_node_size+1); + assert(ns->count == trait_type::max_node_size + 1); dir_store_type& children = dir->children; @@ -2377,10 +2316,10 @@ } template -void rtree<_Key,_Value,_Trait>::perform_forced_reinsertion( +void rtree<_Key, _Value, _Trait>::perform_forced_reinsertion( node_store* ns, std::unordered_set& reinserted_depth) { - assert(ns->count == trait_type::max_node_size+1); + assert(ns->count == trait_type::max_node_size + 1); // Compute the distance between the centers of the value extents and the // center of the extent of the parent directory. @@ -2406,12 +2345,11 @@ // Sort the value entries in decreasing order of their distances. - std::sort(buckets.begin(), buckets.end(), - [](const typename buckets_type::value_type& left, const typename buckets_type::value_type& right) -> bool - { + std::sort( + buckets.begin(), buckets.end(), + [](const typename buckets_type::value_type& left, const typename buckets_type::value_type& right) -> bool { return left.distance < right.distance; - } - ); + }); assert(trait_type::reinsertion_size < buckets.size()); @@ -2425,12 +2363,9 @@ } // Erase the swapped out nodes from the directory. - auto it = std::remove_if(dir->children.begin(), dir->children.end(), - [](const node_store& this_ns) -> bool - { - return this_ns.type == node_type::unspecified; - } - ); + auto it = std::remove_if(dir->children.begin(), dir->children.end(), [](const node_store& this_ns) -> bool { + return this_ns.type == node_type::unspecified; + }); dir->children.erase(it, dir->children.end()); ns->count -= nodes_to_reinsert.size(); @@ -2453,7 +2388,7 @@ } template -void rtree<_Key,_Value,_Trait>::sort_dir_store_by_split_dimension(dir_store_type& children) +void rtree<_Key, _Value, _Trait>::sort_dir_store_by_split_dimension(dir_store_type& children) { // Store the sum of margins for each dimension axis. detail::rtree::min_value_pos min_margin_dim; @@ -2499,24 +2434,21 @@ } template -void rtree<_Key,_Value,_Trait>::sort_dir_store_by_dimension(size_t dim, dir_store_type& children) +void rtree<_Key, _Value, _Trait>::sort_dir_store_by_dimension(size_t dim, dir_store_type& children) { - std::sort(children.begin(), children.end(), - [dim](const node_store& a, const node_store& b) -> bool - { - if (a.extent.start.d[dim] != b.extent.start.d[dim]) - return a.extent.start.d[dim] < b.extent.start.d[dim]; + std::sort(children.begin(), children.end(), [dim](const node_store& a, const node_store& b) -> bool { + if (a.extent.start.d[dim] != b.extent.start.d[dim]) + return a.extent.start.d[dim] < b.extent.start.d[dim]; - return a.extent.end.d[dim] < b.extent.end.d[dim]; - } - ); + return a.extent.end.d[dim] < b.extent.end.d[dim]; + }); for (node_store& ns : children) ns.valid_pointer = false; } template -size_t rtree<_Key,_Value,_Trait>::pick_optimal_distribution(dir_store_type& children) const +size_t rtree<_Key, _Value, _Trait>::pick_optimal_distribution(dir_store_type& children) const { // Along the chosen dimension axis, pick the distribution with the minimum // overlap value. @@ -2538,8 +2470,8 @@ } template -typename rtree<_Key,_Value,_Trait>::insertion_point -rtree<_Key,_Value,_Trait>::find_leaf_directory_node_for_insertion(const extent_type& bb) +typename rtree<_Key, _Value, _Trait>::insertion_point rtree< + _Key, _Value, _Trait>::find_leaf_directory_node_for_insertion(const extent_type& bb) { insertion_point ret; ret.ns = &m_root; @@ -2571,9 +2503,8 @@ } template -typename rtree<_Key,_Value,_Trait>::node_store* -rtree<_Key,_Value,_Trait>::find_nonleaf_directory_node_for_insertion( - const extent_type& bb, size_t max_depth) +typename rtree<_Key, _Value, _Trait>::node_store* rtree< + _Key, _Value, _Trait>::find_nonleaf_directory_node_for_insertion(const extent_type& bb, size_t max_depth) { node_store* dst = &m_root; @@ -2605,10 +2536,9 @@ template template -void rtree<_Key,_Value,_Trait>::descend_with_func(_Func func) const +void rtree<_Key, _Value, _Trait>::descend_with_func(_Func func) const { - std::function func_descend = [&](const node_store* ns) - { + std::function func_descend = [&](const node_store* ns) { node_properties np; np.type = ns->type; np.extent = ns->extent; @@ -2619,8 +2549,7 @@ case node_type::directory_leaf: case node_type::directory_nonleaf: { - const directory_node* dir = - static_cast(ns->node_ptr); + const directory_node* dir = static_cast(ns->node_ptr); for (const node_store& ns_child : dir->children) func_descend(&ns_child); @@ -2640,7 +2569,7 @@ template template -void rtree<_Key,_Value,_Trait>::search_descend( +void rtree<_Key, _Value, _Trait>::search_descend( size_t depth, const search_condition_type& dir_cond, const search_condition_type& value_cond, typename _ResT::node_store_type& ns, _ResT& results) const { @@ -2654,7 +2583,7 @@ auto* dir_node = ns.get_directory_node(); for (auto& child : dir_node->children) - search_descend(depth+1, dir_cond, value_cond, child, results); + search_descend(depth + 1, dir_cond, value_cond, child, results); break; } case node_type::value: @@ -2671,7 +2600,7 @@ } template -void rtree<_Key,_Value,_Trait>::shrink_tree_upward(node_store* ns, const extent_type& bb_affected) +void rtree<_Key, _Value, _Trait>::shrink_tree_upward(node_store* ns, const extent_type& bb_affected) { if (!ns) return; @@ -2693,4 +2622,3 @@ } // namespace mdds /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/include/mdds/rtree.hpp mdds-2.0.3/include/mdds/rtree.hpp --- mdds-2.0.2/include/mdds/rtree.hpp 2021-09-09 12:46:01.000000000 +0000 +++ mdds-2.0.3/include/mdds/rtree.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -97,7 +97,13 @@ bool error_on_min_node_size = true; }; -enum class node_type { unspecified, directory_leaf, directory_nonleaf, value }; +enum class node_type +{ + unspecified, + directory_leaf, + directory_nonleaf, + value +}; enum class export_tree_type { @@ -143,7 +149,7 @@ template struct ptr_to_string; -}} +}} // namespace detail::rtree template class rtree @@ -165,8 +171,8 @@ std::string to_string() const; - bool operator== (const point_type& other) const; - bool operator!= (const point_type& other) const; + bool operator==(const point_type& other) const; + bool operator!=(const point_type& other) const; }; struct extent_type @@ -181,8 +187,8 @@ bool is_point() const; - bool operator== (const extent_type& other) const; - bool operator!= (const extent_type& other) const; + bool operator==(const extent_type& other) const; + bool operator!=(const extent_type& other) const; /** * Determine whether or not the specified point lies within this @@ -236,7 +242,6 @@ }; private: - struct node; struct directory_node; @@ -256,7 +261,7 @@ bool valid_pointer; node_store(const node_store&) = delete; - node_store& operator= (const node_store&) = delete; + node_store& operator=(const node_store&) = delete; node_store(); node_store(node_store&& r); @@ -270,7 +275,7 @@ static node_store create_value_node(const extent_type& extent, value_type&& v); static node_store create_value_node(const extent_type& extent, const value_type& v); - node_store& operator= (node_store&& other); + node_store& operator=(node_store&& other); /** * Re-calculate the extent based on its current children. @@ -319,15 +324,13 @@ typename dir_store_type::iterator end; size_t size; - dir_store_segment() : size(0) {} + dir_store_segment() : size(0) + {} dir_store_segment( - typename dir_store_type::iterator _begin, - typename dir_store_type::iterator _end, - size_t _size) : - begin(std::move(_begin)), - end(std::move(_end)), - size(_size) {} + typename dir_store_type::iterator _begin, typename dir_store_type::iterator _end, size_t _size) + : begin(std::move(_begin)), end(std::move(_end)), size(_size) + {} }; struct distribution @@ -404,11 +407,11 @@ }; public: - template class search_results_base { friend class rtree; + protected: using node_store_type = _NS; @@ -434,6 +437,7 @@ { using base_type = search_results_base; using base_type::m_store; + public: const_iterator cbegin() const; const_iterator cend() const; @@ -445,6 +449,7 @@ { using base_type = search_results_base; using base_type::m_store; + public: iterator begin(); iterator end(); @@ -470,8 +475,8 @@ using difference_type = std::ptrdiff_t; using iterator_category = std::bidirectional_iterator_tag; - bool operator== (const self_iterator_type& other) const; - bool operator!= (const self_iterator_type& other) const; + bool operator==(const self_iterator_type& other) const; + bool operator!=(const self_iterator_type& other) const; self_iterator_type& operator++(); self_iterator_type operator++(int); @@ -483,23 +488,21 @@ size_t depth() const; }; - class const_iterator : public iterator_base< - const_iterator, - typename const_search_results::store_type::const_iterator, - const rtree::value_type> + class const_iterator + : public iterator_base< + const_iterator, typename const_search_results::store_type::const_iterator, const rtree::value_type> { using base_type = iterator_base< - const_iterator, - typename const_search_results::store_type::const_iterator, - const rtree::value_type>; + const_iterator, typename const_search_results::store_type::const_iterator, const rtree::value_type>; using store_type = typename const_search_results::store_type; - using typename base_type::store_iterator_type; using base_type::m_pos; + using typename base_type::store_iterator_type; friend class rtree; const_iterator(store_iterator_type pos); + public: using typename base_type::value_type; @@ -514,23 +517,18 @@ } }; - class iterator : public iterator_base< - iterator, - typename search_results::store_type::iterator, - rtree::value_type> + class iterator : public iterator_base { - using base_type = iterator_base< - iterator, - typename search_results::store_type::iterator, - rtree::value_type>; + using base_type = iterator_base; using store_type = typename const_search_results::store_type; - using typename base_type::store_iterator_type; using base_type::m_pos; + using typename base_type::store_iterator_type; friend class rtree; iterator(store_iterator_type pos); + public: using typename base_type::value_type; @@ -582,9 +580,9 @@ public: ~rtree(); - rtree& operator= (const rtree& other); + rtree& operator=(const rtree& other); - rtree& operator= (rtree&& other); + rtree& operator=(rtree&& other); /** * Insert a new value associated with a bounding box. The new value @@ -762,7 +760,6 @@ std::string export_tree(export_tree_type mode) const; private: - void insert_impl(const point_type& start, const point_type& end, value_type&& value); void insert_impl(const point_type& start, const point_type& end, const value_type& value); diff -Nru mdds-2.0.2/include/mdds/segment_tree_def.inl mdds-2.0.3/include/mdds/segment_tree_def.inl --- mdds-2.0.2/include/mdds/segment_tree_def.inl 2021-09-09 12:46:01.000000000 +0000 +++ mdds-2.0.3/include/mdds/segment_tree_def.inl 2022-04-22 00:12:40.000000000 +0000 @@ -1,29 +1,29 @@ /************************************************************************* -* -* Copyright (c) 2015 Kohei Yoshida -* -* Permission is hereby granted, free of charge, to any person -* obtaining a copy of this software and associated documentation -* files (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, -* copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following -* conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -************************************************************************/ + * + * Copyright (c) 2015 Kohei Yoshida + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + ************************************************************************/ #include @@ -32,8 +32,7 @@ namespace __st { template -void descend_tree_for_search( - typename T::key_type point, const __st::node_base* pnode, _Inserter& result) +void descend_tree_for_search(typename T::key_type point, const __st::node_base* pnode, _Inserter& result) { typedef typename T::node leaf_node; typedef typename T::nonleaf_node nonleaf_node; @@ -89,8 +88,7 @@ { // This child nodes are non-leaf nodes. - const nonleaf_value_type& vleft = - static_cast(pchild)->value_nonleaf; + const nonleaf_value_type& vleft = static_cast(pchild)->value_nonleaf; if (point < vleft.low) { @@ -101,27 +99,23 @@ // Follow the right child. pchild = pnonleaf->right; - assert(static_cast(pchild)->value_nonleaf.low <= point && - point < static_cast(pchild)->value_nonleaf.high); + assert( + static_cast(pchild)->value_nonleaf.low <= point && + point < static_cast(pchild)->value_nonleaf.high); } - descend_tree_for_search(point, pchild, result); + descend_tree_for_search(point, pchild, result); } } // namespace __st template -segment_tree<_Key, _Value>::segment_tree() - : m_root_node(nullptr) - , m_valid_tree(false) -{ -} +segment_tree<_Key, _Value>::segment_tree() : m_root_node(nullptr), m_valid_tree(false) +{} template segment_tree<_Key, _Value>::segment_tree(const segment_tree& r) - : m_segment_data(r.m_segment_data) - , m_root_node(nullptr) - , m_valid_tree(r.m_valid_tree) + : m_segment_data(r.m_segment_data), m_root_node(nullptr), m_valid_tree(r.m_valid_tree) { if (m_valid_tree) build_tree(); @@ -177,16 +171,14 @@ m_root_node = builder.build(m_left_leaf); // Start "inserting" all segments from the root. - typename segment_map_type::const_iterator itr, - itr_beg = m_segment_data.begin(), itr_end = m_segment_data.end(); + typename segment_map_type::const_iterator itr, itr_beg = m_segment_data.begin(), itr_end = m_segment_data.end(); data_node_map_type tagged_node_map; for (itr = itr_beg; itr != itr_end; ++itr) { value_type pdata = itr->first; - auto r = tagged_node_map.insert( - typename data_node_map_type::value_type( - pdata, std::make_unique())); + auto r = + tagged_node_map.insert(typename data_node_map_type::value_type(pdata, std::make_unique())); node_list_type* plist = r.first->second.get(); plist->reserve(10); @@ -248,7 +240,7 @@ // In 1st pass, collect unique end-point values and sort them. vector keys_uniq; - keys_uniq.reserve(m_segment_data.size()*2); + keys_uniq.reserve(m_segment_data.size() * 2); typename segment_map_type::const_iterator itr, itr_beg = m_segment_data.begin(), itr_end = m_segment_data.end(); for (itr = itr_beg; itr != itr_end; ++itr) { @@ -264,7 +256,8 @@ } template -void segment_tree<_Key, _Value>::create_leaf_node_instances(const ::std::vector& keys, node_ptr& left, node_ptr& right) +void segment_tree<_Key, _Value>::create_leaf_node_instances( + const ::std::vector& keys, node_ptr& left, node_ptr& right) { if (keys.empty() || keys.size() < 2) // We need at least two keys in order to build tree. @@ -330,24 +323,21 @@ return true; search_result_vector_inserter result_inserter(result); - typedef segment_tree<_Key,_Value> tree_type; - __st::descend_tree_for_search< - tree_type, search_result_vector_inserter>(point, m_root_node, result_inserter); + typedef segment_tree<_Key, _Value> tree_type; + __st::descend_tree_for_search(point, m_root_node, result_inserter); return true; } template -typename segment_tree<_Key, _Value>::search_results -segment_tree<_Key, _Value>::search(key_type point) const +typename segment_tree<_Key, _Value>::search_results segment_tree<_Key, _Value>::search(key_type point) const { search_results result; if (!m_valid_tree || !m_root_node) return result; search_result_inserter result_inserter(result); - typedef segment_tree<_Key,_Value> tree_type; - __st::descend_tree_for_search( - point, m_root_node, result_inserter); + typedef segment_tree<_Key, _Value> tree_type; + __st::descend_tree_for_search(point, m_root_node, result_inserter); return result; } @@ -359,7 +349,7 @@ return; search_result_inserter result_inserter(result); - typedef segment_tree<_Key,_Value> tree_type; + typedef segment_tree<_Key, _Value> tree_type; __st::descend_tree_for_search(point, m_root_node, result_inserter); } @@ -503,8 +493,7 @@ { using namespace std; - typename data_node_map_type::const_iterator - itr = m_tagged_node_map.begin(), itr_end = m_tagged_node_map.end(); + typename data_node_map_type::const_iterator itr = m_tagged_node_map.begin(), itr_end = m_tagged_node_map.end(); for (; itr != itr_end; ++itr) { // Print stored nodes. @@ -610,8 +599,7 @@ { using namespace std; - typename node_list_type::const_iterator - itr = node_list.begin(), itr_end = node_list.end(); + typename node_list_type::const_iterator itr = node_list.begin(), itr_end = node_list.end(); for (; itr != itr_end; ++itr) { @@ -653,4 +641,4 @@ } #endif -} +} // namespace mdds diff -Nru mdds-2.0.2/include/mdds/segment_tree.hpp mdds-2.0.3/include/mdds/segment_tree.hpp --- mdds-2.0.2/include/mdds/segment_tree.hpp 2021-09-09 12:46:01.000000000 +0000 +++ mdds-2.0.3/include/mdds/segment_tree.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -47,20 +47,20 @@ class segment_tree { public: - typedef _Key key_type; - typedef _Value value_type; - typedef size_t size_type; + typedef _Key key_type; + typedef _Value value_type; + typedef size_t size_type; typedef std::vector search_results_type; #ifdef MDDS_UNIT_TEST struct segment_data { - key_type begin_key; - key_type end_key; - value_type pdata; + key_type begin_key; + key_type end_key; + value_type pdata; - segment_data(key_type _beg, key_type _end, value_type p) : - begin_key(_beg), end_key(_end), pdata(p) {} + segment_data(key_type _beg, key_type _end, value_type p) : begin_key(_beg), end_key(_end), pdata(p) + {} bool operator==(const segment_data& r) const { @@ -75,7 +75,7 @@ struct segment_map_printer { - void operator() (const ::std::pair >& r) const + void operator()(const ::std::pair>& r) const { using namespace std; cout << r.second.first << "-" << r.second.second << ": " << r.first->name << endl; @@ -85,16 +85,16 @@ public: typedef ::std::vector data_chain_type; - typedef std::unordered_map > segment_map_type; - typedef ::std::map > sorted_segment_map_type; + typedef std::unordered_map> segment_map_type; + typedef ::std::map> sorted_segment_map_type; struct nonleaf_value_type { - key_type low; /// low range value (inclusive) - key_type high; /// high range value (non-inclusive) + key_type low; /// low range value (inclusive) + key_type high; /// high range value (non-inclusive) data_chain_type* data_chain; - bool operator== (const nonleaf_value_type& r) const + bool operator==(const nonleaf_value_type& r) const { return low == r.low && high == r.high && data_chain == r.data_chain; } @@ -105,7 +105,7 @@ key_type key; data_chain_type* data_chain; - bool operator== (const leaf_value_type& r) const + bool operator==(const leaf_value_type& r) const { return key == r.key && data_chain == r.data_chain; } @@ -125,14 +125,16 @@ struct fill_nonleaf_value_handler { - void operator() (__st::nonleaf_node& _self, const __st::node_base* left_node, const __st::node_base* right_node) + void operator()( + __st::nonleaf_node& _self, const __st::node_base* left_node, + const __st::node_base* right_node) { // Parent node should carry the range of all of its child nodes. if (left_node) { - _self.value_nonleaf.low = left_node->is_leaf ? - static_cast(left_node)->value_leaf.key : - static_cast(left_node)->value_nonleaf.low; + _self.value_nonleaf.low = left_node->is_leaf + ? static_cast(left_node)->value_leaf.key + : static_cast(left_node)->value_nonleaf.low; } else { @@ -161,9 +163,9 @@ } else { - _self.value_nonleaf.high = left_node->is_leaf ? - static_cast(left_node)->value_leaf.key : - static_cast(left_node)->value_nonleaf.high; + _self.value_nonleaf.high = left_node->is_leaf + ? static_cast(left_node)->value_leaf.key + : static_cast(left_node)->value_nonleaf.high; } } }; @@ -171,24 +173,22 @@ #ifdef MDDS_UNIT_TEST struct to_string_handler { - std::string operator() (const node& _self) const + std::string operator()(const node& _self) const { std::ostringstream os; os << "[" << _self.value_leaf.key << "] "; return os.str(); } - std::string operator() (const __st::nonleaf_node& _self) const + std::string operator()(const __st::nonleaf_node& _self) const { std::ostringstream os; os << "[" << _self.value_nonleaf.low << "-" << _self.value_nonleaf.high << ")"; if (_self.value_nonleaf.data_chain) { os << " { "; - typename data_chain_type::const_iterator - itr, - itr_beg = _self.value_nonleaf.data_chain->begin(), - itr_end = _self.value_nonleaf.data_chain->end(); + typename data_chain_type::const_iterator itr, itr_beg = _self.value_nonleaf.data_chain->begin(), + itr_end = _self.value_nonleaf.data_chain->end(); for (itr = itr_beg; itr != itr_end; ++itr) { if (itr != itr_beg) @@ -205,12 +205,12 @@ struct init_handler { - void operator() (node& _self) + void operator()(node& _self) { _self.value_leaf.data_chain = nullptr; } - void operator() (__st::nonleaf_node& _self) + void operator()(__st::nonleaf_node& _self) { _self.value_nonleaf.data_chain = nullptr; } @@ -218,12 +218,12 @@ struct dispose_handler { - void operator() (node& _self) + void operator()(node& _self) { delete _self.value_leaf.data_chain; } - void operator() (__st::nonleaf_node& _self) + void operator()(__st::nonleaf_node& _self) { delete _self.value_nonleaf.data_chain; } @@ -232,7 +232,7 @@ #ifdef MDDS_UNIT_TEST struct node_printer { - void operator() (const __st::node_base* p) const + void operator()(const __st::node_base* p) const { if (p->is_leaf) std::cout << static_cast(p)->to_string() << " "; @@ -243,7 +243,6 @@ #endif private: - /** * This base class takes care of collecting data chain pointers during * tree descend for search. @@ -251,15 +250,15 @@ class search_results_base { public: - typedef std::vector res_chains_type; - typedef std::shared_ptr res_chains_ptr; - public: + typedef std::vector res_chains_type; + typedef std::shared_ptr res_chains_ptr; - search_results_base() : - mp_res_chains(static_cast(nullptr)) {} + public: + search_results_base() : mp_res_chains(static_cast(nullptr)) + {} - search_results_base(const search_results_base& r) : - mp_res_chains(r.mp_res_chains) {} + search_results_base(const search_results_base& r) : mp_res_chains(r.mp_res_chains) + {} size_t size() const { @@ -267,8 +266,7 @@ if (!mp_res_chains) return combined; - typename res_chains_type::const_iterator - itr = mp_res_chains->begin(), itr_end = mp_res_chains->end(); + typename res_chains_type::const_iterator itr = mp_res_chains->begin(), itr_end = mp_res_chains->end(); for (; itr != itr_end; ++itr) combined += (*itr)->size(); return combined; @@ -284,10 +282,13 @@ mp_res_chains->push_back(chain); } - res_chains_ptr& get_res_chains() { return mp_res_chains; } + res_chains_ptr& get_res_chains() + { + return mp_res_chains; + } private: - res_chains_ptr mp_res_chains; + res_chains_ptr mp_res_chains; }; class iterator_base @@ -296,26 +297,25 @@ typedef typename search_results_base::res_chains_type res_chains_type; typedef typename search_results_base::res_chains_ptr res_chains_ptr; - iterator_base(const res_chains_ptr& p) : - mp_res_chains(p), m_end_pos(true) {} + iterator_base(const res_chains_ptr& p) : mp_res_chains(p), m_end_pos(true) + {} public: - typedef ::std::bidirectional_iterator_tag iterator_category; - typedef typename data_chain_type::value_type value_type; - typedef typename data_chain_type::pointer pointer; - typedef typename data_chain_type::reference reference; - typedef typename data_chain_type::difference_type difference_type; - - iterator_base() : - mp_res_chains(static_cast(nullptr)), m_end_pos(true) {} - - iterator_base(const iterator_base& r) : - mp_res_chains(r.mp_res_chains), - m_cur_chain(r.m_cur_chain), - m_cur_pos_in_chain(r.m_cur_pos_in_chain), - m_end_pos(r.m_end_pos) {} + typedef ::std::bidirectional_iterator_tag iterator_category; + typedef typename data_chain_type::value_type value_type; + typedef typename data_chain_type::pointer pointer; + typedef typename data_chain_type::reference reference; + typedef typename data_chain_type::difference_type difference_type; + + iterator_base() : mp_res_chains(static_cast(nullptr)), m_end_pos(true) + {} + + iterator_base(const iterator_base& r) + : mp_res_chains(r.mp_res_chains), m_cur_chain(r.m_cur_chain), m_cur_pos_in_chain(r.m_cur_pos_in_chain), + m_end_pos(r.m_end_pos) + {} - iterator_base& operator= (const iterator_base& r) + iterator_base& operator=(const iterator_base& r) { mp_res_chains = r.mp_res_chains; m_cur_chain = r.m_cur_chain; @@ -324,7 +324,7 @@ return *this; } - typename data_chain_type::value_type* operator++ () + typename data_chain_type::value_type* operator++() { // We don't check for end position flag for performance reasons. // The caller is responsible for making sure not to increment past @@ -356,7 +356,7 @@ return operator->(); } - typename data_chain_type::value_type* operator-- () + typename data_chain_type::value_type* operator--() { if (!mp_res_chains) return nullptr; @@ -381,14 +381,13 @@ return operator->(); } - bool operator== (const iterator_base& r) const + bool operator==(const iterator_base& r) const { if (mp_res_chains.get()) { // non-empty result set. - return mp_res_chains.get() == r.mp_res_chains.get() && - m_cur_chain == r.m_cur_chain && m_cur_pos_in_chain == r.m_cur_pos_in_chain && - m_end_pos == r.m_end_pos; + return mp_res_chains.get() == r.mp_res_chains.get() && m_cur_chain == r.m_cur_chain && + m_cur_pos_in_chain == r.m_cur_pos_in_chain && m_end_pos == r.m_end_pos; } // empty result set. @@ -397,7 +396,10 @@ return m_end_pos == r.m_end_pos; } - bool operator!= (const iterator_base& r) const { return !operator==(r); } + bool operator!=(const iterator_base& r) const + { + return !operator==(r); + } typename data_chain_type::value_type& operator*() { @@ -441,26 +443,29 @@ private: res_chains_ptr mp_res_chains; - typename res_chains_type::iterator m_cur_chain; - typename data_chain_type::iterator m_cur_pos_in_chain; - bool m_end_pos:1; + typename res_chains_type::iterator m_cur_chain; + typename data_chain_type::iterator m_cur_pos_in_chain; + bool m_end_pos : 1; }; public: - class search_results : public search_results_base { typedef typename search_results_base::res_chains_type res_chains_type; typedef typename search_results_base::res_chains_ptr res_chains_ptr; - public: + public: class iterator : public iterator_base { - friend class segment_tree<_Key,_Value>::search_results; + friend class segment_tree<_Key, _Value>::search_results; + private: - iterator(const res_chains_ptr& p) : iterator_base(p) {} + iterator(const res_chains_ptr& p) : iterator_base(p) + {} + public: - iterator() : iterator_base() {} + iterator() : iterator_base() + {} }; typename search_results::iterator begin() @@ -481,8 +486,9 @@ class search_result_vector_inserter { public: - search_result_vector_inserter(search_results_type& result) : m_result(result) {} - void operator() (data_chain_type* node_data) + search_result_vector_inserter(search_results_type& result) : m_result(result) + {} + void operator()(data_chain_type* node_data) { if (!node_data) return; @@ -491,6 +497,7 @@ for (; itr != itr_end; ++itr) m_result.push_back(*itr); } + private: search_results_type& m_result; }; @@ -498,14 +505,16 @@ class search_result_inserter { public: - search_result_inserter(search_results_base& result) : m_result(result) {} - void operator() (data_chain_type* node_data) + search_result_inserter(search_results_base& result) : m_result(result) + {} + void operator()(data_chain_type* node_data) { if (!node_data) return; m_result.push_back_chain(node_data); } + private: search_results_base& m_result; }; @@ -520,7 +529,10 @@ */ bool operator==(const segment_tree& r) const; - bool operator!=(const segment_tree& r) const { return !operator==(r); } + bool operator!=(const segment_tree& r) const + { + return !operator==(r); + } /** * Check whether or not the internal tree is in a valid state. The tree @@ -528,7 +540,10 @@ * * @return true if the tree is valid, false otherwise. */ - bool is_tree_valid() const { return m_valid_tree; } + bool is_tree_valid() const + { + return m_valid_tree; + } /** * Build or re-build tree based on the current set of segments. @@ -677,12 +692,12 @@ data_node_map_type m_tagged_node_map; nonleaf_node* m_root_node; - node_ptr m_left_leaf; - node_ptr m_right_leaf; - bool m_valid_tree:1; + node_ptr m_left_leaf; + node_ptr m_right_leaf; + bool m_valid_tree : 1; }; -} +} // namespace mdds #include "segment_tree_def.inl" diff -Nru mdds-2.0.2/include/mdds/sorted_string_map_def.inl mdds-2.0.3/include/mdds/sorted_string_map_def.inl --- mdds-2.0.2/include/mdds/sorted_string_map_def.inl 2019-08-15 21:58:40.000000000 +0000 +++ mdds-2.0.3/include/mdds/sorted_string_map_def.inl 2022-04-22 00:12:40.000000000 +0000 @@ -37,8 +37,8 @@ // don't use it! // Implementation detail! template -bool compare(const typename sorted_string_map<_ValueT>::entry& entry1, - const typename sorted_string_map<_ValueT>::entry& entry2) +bool compare( + const typename sorted_string_map<_ValueT>::entry& entry1, const typename sorted_string_map<_ValueT>::entry& entry2) { if (entry1.keylen != entry2.keylen) { @@ -55,14 +55,11 @@ } } -} +} // namespace detail template -sorted_string_map<_ValueT>::sorted_string_map(const entry* entries, size_type entry_size, value_type null_value) : - m_entries(entries), - m_null_value(null_value), - m_entry_size(entry_size), - m_entry_end(m_entries+m_entry_size) +sorted_string_map<_ValueT>::sorted_string_map(const entry* entries, size_type entry_size, value_type null_value) + : m_entries(entries), m_null_value(null_value), m_entry_size(entry_size), m_entry_end(m_entries + m_entry_size) { #if defined(_GLIBCXX_DEBUG) || defined(MDDS_ASSERT_STRING_MAP) assert(std::is_sorted(m_entries, m_entry_end, detail::compare<_ValueT>)); @@ -70,8 +67,7 @@ } template -typename sorted_string_map<_ValueT>::value_type -sorted_string_map<_ValueT>::find(const char* input, size_type len) const +typename sorted_string_map<_ValueT>::value_type sorted_string_map<_ValueT>::find(const char* input, size_type len) const { if (m_entry_size == 0) return m_null_value; @@ -88,10 +84,9 @@ } template -typename sorted_string_map<_ValueT>::size_type -sorted_string_map<_ValueT>::size() const +typename sorted_string_map<_ValueT>::size_type sorted_string_map<_ValueT>::size() const { return m_entry_size; } -} +} // namespace mdds diff -Nru mdds-2.0.2/include/mdds/sorted_string_map.hpp mdds-2.0.3/include/mdds/sorted_string_map.hpp --- mdds-2.0.2/include/mdds/sorted_string_map.hpp 2019-08-15 21:58:40.000000000 +0000 +++ mdds-2.0.3/include/mdds/sorted_string_map.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -87,14 +87,13 @@ size_type size() const; private: - const entry* m_entries; value_type m_null_value; size_type m_entry_size; const entry* m_entry_end; }; -} +} // namespace mdds #include "sorted_string_map_def.inl" diff -Nru mdds-2.0.2/include/mdds/trie_map_def.inl mdds-2.0.3/include/mdds/trie_map_def.inl --- mdds-2.0.2/include/mdds/trie_map_def.inl 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/trie_map_def.inl 2022-04-22 00:12:40.000000000 +0000 @@ -119,10 +119,7 @@ if (bytes_written != _Func::value_size) { std::ostringstream msg; - msg << "bytes written (" - << bytes_written - << ") does not equal the value size (" - << _Func::value_size + msg << "bytes written (" << bytes_written << ") does not equal the value size (" << _Func::value_size << ")"; throw size_error(msg.str()); } @@ -138,10 +135,14 @@ struct write_values_to_ostream; template -struct write_values_to_ostream<_Func, _V, std::true_type> : write_variable_size_values_to_ostream<_Func, _V> {}; +struct write_values_to_ostream<_Func, _V, std::true_type> : write_variable_size_values_to_ostream<_Func, _V> +{ +}; template -struct write_values_to_ostream<_Func, _V, std::false_type> : write_fixed_size_values_to_ostream<_Func, _V> {}; +struct write_values_to_ostream<_Func, _V, std::false_type> : write_fixed_size_values_to_ostream<_Func, _V> +{ +}; template struct read_fixed_size_values_from_istream @@ -203,12 +204,16 @@ struct read_values_from_istream; template -struct read_values_from_istream<_Func, _V, std::true_type> : read_variable_size_values_from_istream<_Func, _V> {}; +struct read_values_from_istream<_Func, _V, std::true_type> : read_variable_size_values_from_istream<_Func, _V> +{ +}; template -struct read_values_from_istream<_Func, _V, std::false_type> : read_fixed_size_values_from_istream<_Func, _V> {}; +struct read_values_from_istream<_Func, _V, std::false_type> : read_fixed_size_values_from_istream<_Func, _V> +{ +}; -}} +}} // namespace detail::trie namespace trie { @@ -253,7 +258,8 @@ template void numeric_sequence_value_serializer::write(std::ostream& os, const T& v) { - static_assert(std::is_arithmetic::value, "value type of this vector is not a numeric type."); + static_assert( + std::is_arithmetic::value, "value type of this vector is not a numeric type."); for (const auto& elem : v) element_serializer::write(os, elem); @@ -263,7 +269,8 @@ void numeric_sequence_value_serializer::read(std::istream& is, size_t n, T& v) { using elem_type = typename T::value_type; - static_assert(std::is_arithmetic::value, "value type of this vector is not a numeric type."); + static_assert( + std::is_arithmetic::value, "value type of this vector is not a numeric type."); constexpr size_t elem_size = element_serializer::value_size; assert(n % elem_size == 0); @@ -278,14 +285,14 @@ } } -template<> inline -void variable_value_serializer::write(std::ostream& os, const std::string& v) +template<> +inline void variable_value_serializer::write(std::ostream& os, const std::string& v) { os.write(v.data(), v.size()); } -template<> inline -void variable_value_serializer::read(std::istream& is, size_t n, std::string& v) +template<> +inline void variable_value_serializer::read(std::istream& is, size_t n, std::string& v) { v.resize(n); char* p = const_cast(v.data()); @@ -302,23 +309,21 @@ } // namespace trie template -trie_map<_KeyTrait,_ValueT>::trie_map::trie_node::trie_node() : - value(value_type()), has_value(false) {} +trie_map<_KeyTrait, _ValueT>::trie_map::trie_node::trie_node() : value(value_type()), has_value(false) +{} template -trie_map<_KeyTrait,_ValueT>::trie_map::trie_node::trie_node(const trie_node& other) : - children(other.children), - value(other.value), - has_value(other.has_value) {} +trie_map<_KeyTrait, _ValueT>::trie_map::trie_node::trie_node(const trie_node& other) + : children(other.children), value(other.value), has_value(other.has_value) +{} template -trie_map<_KeyTrait,_ValueT>::trie_map::trie_node::trie_node(trie_node&& other) : - children(std::move(other.children)), - value(std::move(other.value)), - has_value(std::move(other.has_value)) {} +trie_map<_KeyTrait, _ValueT>::trie_map::trie_node::trie_node(trie_node&& other) + : children(std::move(other.children)), value(std::move(other.value)), has_value(std::move(other.has_value)) +{} template -void trie_map<_KeyTrait,_ValueT>::trie_map::trie_node::swap(trie_node& other) +void trie_map<_KeyTrait, _ValueT>::trie_map::trie_node::swap(trie_node& other) { children.swap(other.children); std::swap(value, other.value); @@ -326,19 +331,19 @@ } template -trie_map<_KeyTrait,_ValueT>::trie_map() {} +trie_map<_KeyTrait, _ValueT>::trie_map() +{} template -trie_map<_KeyTrait,_ValueT>::trie_map(const trie_map& other) : - m_root(other.m_root) {} +trie_map<_KeyTrait, _ValueT>::trie_map(const trie_map& other) : m_root(other.m_root) +{} template -trie_map<_KeyTrait,_ValueT>::trie_map(trie_map&& other) : - m_root(std::move(other.m_root)) {} +trie_map<_KeyTrait, _ValueT>::trie_map(trie_map&& other) : m_root(std::move(other.m_root)) +{} template -typename trie_map<_KeyTrait,_ValueT>::const_iterator -trie_map<_KeyTrait,_ValueT>::begin() const +typename trie_map<_KeyTrait, _ValueT>::const_iterator trie_map<_KeyTrait, _ValueT>::begin() const { if (m_root.children.empty()) // empty container @@ -362,13 +367,11 @@ const_iterator::push_child_node_to_stack(node_stack, buf, this_it); } - return const_iterator( - std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); + return const_iterator(std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); } template -typename trie_map<_KeyTrait,_ValueT>::iterator -trie_map<_KeyTrait,_ValueT>::begin() +typename trie_map<_KeyTrait, _ValueT>::iterator trie_map<_KeyTrait, _ValueT>::begin() { if (m_root.children.empty()) // empty container @@ -392,32 +395,27 @@ iterator::push_child_node_to_stack(node_stack, buf, this_it); } - return iterator( - std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); + return iterator(std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); } template -typename trie_map<_KeyTrait,_ValueT>::const_iterator -trie_map<_KeyTrait,_ValueT>::end() const +typename trie_map<_KeyTrait, _ValueT>::const_iterator trie_map<_KeyTrait, _ValueT>::end() const { const_node_stack_type node_stack; node_stack.emplace_back(&m_root, m_root.children.end()); - return const_iterator( - std::move(node_stack), key_buffer_type(), trie::detail::iterator_type::end); + return const_iterator(std::move(node_stack), key_buffer_type(), trie::detail::iterator_type::end); } template -typename trie_map<_KeyTrait,_ValueT>::iterator -trie_map<_KeyTrait,_ValueT>::end() +typename trie_map<_KeyTrait, _ValueT>::iterator trie_map<_KeyTrait, _ValueT>::end() { node_stack_type node_stack; node_stack.emplace_back(&m_root, m_root.children.end()); - return iterator( - std::move(node_stack), key_buffer_type(), trie::detail::iterator_type::end); + return iterator(std::move(node_stack), key_buffer_type(), trie::detail::iterator_type::end); } template -trie_map<_KeyTrait,_ValueT>& trie_map<_KeyTrait,_ValueT>::operator= (trie_map other) +trie_map<_KeyTrait, _ValueT>& trie_map<_KeyTrait, _ValueT>::operator=(trie_map other) { trie_map tmp(std::move(other)); tmp.swap(*this); @@ -425,13 +423,13 @@ } template -void trie_map<_KeyTrait,_ValueT>::swap(trie_map& other) +void trie_map<_KeyTrait, _ValueT>::swap(trie_map& other) { m_root.swap(other.m_root); } template -void trie_map<_KeyTrait,_ValueT>::insert(const key_type& key, const value_type& value) +void trie_map<_KeyTrait, _ValueT>::insert(const key_type& key, const value_type& value) { using ktt = key_trait_type; @@ -443,15 +441,14 @@ } template -void trie_map<_KeyTrait,_ValueT>::insert( - const key_unit_type* key, size_type len, const value_type& value) +void trie_map<_KeyTrait, _ValueT>::insert(const key_unit_type* key, size_type len, const value_type& value) { const key_unit_type* key_end = key + len; insert_into_tree(m_root, key, key_end, value); } template -bool trie_map<_KeyTrait,_ValueT>::erase(const key_unit_type* key, size_type len) +bool trie_map<_KeyTrait, _ValueT>::erase(const key_unit_type* key, size_type len) { const key_unit_type* key_end = key + len; @@ -482,9 +479,8 @@ } template -void trie_map<_KeyTrait,_ValueT>::insert_into_tree( - trie_node& node, const key_unit_type* key, const key_unit_type* key_end, - const value_type& value) +void trie_map<_KeyTrait, _ValueT>::insert_into_tree( + trie_node& node, const key_unit_type* key, const key_unit_type* key_end, const value_type& value) { if (key == key_end) { @@ -499,8 +495,7 @@ if (it == node.children.end() || node.children.key_comp()(c, it->first)) { // Insert a new node. - it = node.children.insert( - it, typename trie_node::children_type::value_type(c, trie_node())); + it = node.children.insert(it, typename trie_node::children_type::value_type(c, trie_node())); } ++key; @@ -508,8 +503,7 @@ } template -const typename trie_map<_KeyTrait,_ValueT>::trie_node* -trie_map<_KeyTrait,_ValueT>::find_prefix_node( +const typename trie_map<_KeyTrait, _ValueT>::trie_node* trie_map<_KeyTrait, _ValueT>::find_prefix_node( const trie_node& node, const key_unit_type* prefix, const key_unit_type* prefix_end) const { if (prefix == prefix_end) @@ -526,10 +520,8 @@ template template -void trie_map<_KeyTrait,_ValueT>::find_prefix_node_with_stack( - std::vector>& node_stack, - const_t& node, - const key_unit_type* prefix, +void trie_map<_KeyTrait, _ValueT>::find_prefix_node_with_stack( + std::vector>& node_stack, const_t& node, const key_unit_type* prefix, const key_unit_type* prefix_end) const { if (prefix == prefix_end) @@ -551,42 +543,34 @@ template template -typename trie_map<_KeyTrait,_ValueT>::key_buffer_type -trie_map<_KeyTrait,_ValueT>::build_key_buffer_from_node_stack( +typename trie_map<_KeyTrait, _ValueT>::key_buffer_type trie_map<_KeyTrait, _ValueT>::build_key_buffer_from_node_stack( const std::vector>& node_stack) const { // Build the key value from the stack. key_buffer_type buf; auto end = node_stack.end(); - --end; // Skip the node with value which doesn't store a key element. - std::for_each(node_stack.begin(), end, - [&](const stack_item<_IsConst>& si) - { - using ktt = key_trait_type; - ktt::push_back(buf, si.child_pos->first); - } - ); + --end; // Skip the node with value which doesn't store a key element. + std::for_each(node_stack.begin(), end, [&](const stack_item<_IsConst>& si) { + using ktt = key_trait_type; + ktt::push_back(buf, si.child_pos->first); + }); return buf; } template -void trie_map<_KeyTrait,_ValueT>::count_values(size_type& n, const trie_node& node) const +void trie_map<_KeyTrait, _ValueT>::count_values(size_type& n, const trie_node& node) const { if (node.has_value) ++n; - std::for_each(node.children.begin(), node.children.end(), - [&](const typename trie_node::children_type::value_type& v) - { - count_values(n, v.second); - } - ); + std::for_each( + node.children.begin(), node.children.end(), + [&](const typename trie_node::children_type::value_type& v) { count_values(n, v.second); }); } template -typename trie_map<_KeyTrait,_ValueT>::const_iterator -trie_map<_KeyTrait,_ValueT>::find(const key_type& key) const +typename trie_map<_KeyTrait, _ValueT>::const_iterator trie_map<_KeyTrait, _ValueT>::find(const key_type& key) const { using ktt = key_trait_type; key_buffer_type buf = ktt::to_key_buffer(key); @@ -597,8 +581,8 @@ } template -typename trie_map<_KeyTrait,_ValueT>::const_iterator -trie_map<_KeyTrait,_ValueT>::find(const key_unit_type* input, size_type len) const +typename trie_map<_KeyTrait, _ValueT>::const_iterator trie_map<_KeyTrait, _ValueT>::find( + const key_unit_type* input, size_type len) const { const key_unit_type* input_end = input + len; const_node_stack_type node_stack; @@ -609,13 +593,11 @@ key_buffer_type buf = build_key_buffer_from_node_stack(node_stack); - return const_iterator( - std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); + return const_iterator(std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); } template -typename trie_map<_KeyTrait,_ValueT>::iterator -trie_map<_KeyTrait,_ValueT>::find(const key_type& key) +typename trie_map<_KeyTrait, _ValueT>::iterator trie_map<_KeyTrait, _ValueT>::find(const key_type& key) { using ktt = key_trait_type; key_buffer_type buf = ktt::to_key_buffer(key); @@ -626,8 +608,8 @@ } template -typename trie_map<_KeyTrait,_ValueT>::iterator -trie_map<_KeyTrait,_ValueT>::find(const key_unit_type* input, size_type len) +typename trie_map<_KeyTrait, _ValueT>::iterator trie_map<_KeyTrait, _ValueT>::find( + const key_unit_type* input, size_type len) { const key_unit_type* input_end = input + len; node_stack_type node_stack; @@ -638,13 +620,12 @@ key_buffer_type buf = build_key_buffer_from_node_stack(node_stack); - return iterator( - std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); + return iterator(std::move(node_stack), std::move(buf), trie::detail::iterator_type::normal); } template -typename trie_map<_KeyTrait,_ValueT>::search_results -trie_map<_KeyTrait,_ValueT>::prefix_search(const key_type& key) const +typename trie_map<_KeyTrait, _ValueT>::search_results trie_map<_KeyTrait, _ValueT>::prefix_search( + const key_type& key) const { using ktt = key_trait_type; key_buffer_type buf = ktt::to_key_buffer(key); @@ -655,8 +636,8 @@ } template -typename trie_map<_KeyTrait,_ValueT>::search_results -trie_map<_KeyTrait,_ValueT>::prefix_search(const key_unit_type* prefix, size_type len) const +typename trie_map<_KeyTrait, _ValueT>::search_results trie_map<_KeyTrait, _ValueT>::prefix_search( + const key_unit_type* prefix, size_type len) const { using ktt = key_trait_type; @@ -668,8 +649,7 @@ } template -typename trie_map<_KeyTrait,_ValueT>::size_type -trie_map<_KeyTrait,_ValueT>::size() const +typename trie_map<_KeyTrait, _ValueT>::size_type trie_map<_KeyTrait, _ValueT>::size() const { size_type n = 0; count_values(n, m_root); @@ -677,21 +657,20 @@ } template -bool trie_map<_KeyTrait,_ValueT>::empty() const noexcept +bool trie_map<_KeyTrait, _ValueT>::empty() const noexcept { return m_root.children.empty() && !m_root.has_value; } template -void trie_map<_KeyTrait,_ValueT>::clear() +void trie_map<_KeyTrait, _ValueT>::clear() { m_root.children.clear(); m_root.has_value = false; } template -typename trie_map<_KeyTrait,_ValueT>::packed_type -trie_map<_KeyTrait,_ValueT>::pack() const +typename trie_map<_KeyTrait, _ValueT>::packed_type trie_map<_KeyTrait, _ValueT>::pack() const { return packed_type(*this); } @@ -699,8 +678,7 @@ #ifdef MDDS_TRIE_MAP_DEBUG template -void packed_trie_map<_KeyTrait,_ValueT>::dump_node( - key_buffer_type& buffer, const trie_node& node) const +void packed_trie_map<_KeyTrait, _ValueT>::dump_node(key_buffer_type& buffer, const trie_node& node) const { using namespace std; @@ -712,26 +690,23 @@ cout << buffer << ":" << *static_cast(node.value) << endl; } - std::for_each(node.children.begin(), node.children.end(), - [&](const trie_node* p) - { - const trie_node& this_node = *p; - ktt::push_back(buffer, this_node.key); - dump_node(buffer, this_node); - ktt::pop_back(buffer); - } - ); + std::for_each(node.children.begin(), node.children.end(), [&](const trie_node* p) { + const trie_node& this_node = *p; + ktt::push_back(buffer, this_node.key); + dump_node(buffer, this_node); + ktt::pop_back(buffer); + }); } template -void packed_trie_map<_KeyTrait,_ValueT>::dump_trie(const trie_node& root) const +void packed_trie_map<_KeyTrait, _ValueT>::dump_trie(const trie_node& root) const { key_buffer_type buffer; dump_node(buffer, root); } template -void packed_trie_map<_KeyTrait,_ValueT>::dump_packed_trie() const +void packed_trie_map<_KeyTrait, _ValueT>::dump_packed_trie() const { cout << "packed size: " << m_packed.size() << endl; @@ -773,7 +748,8 @@ void node_child_offset(size_t i, const uintptr_t& v) const { size_t offset = v; - cout << std::setw(4) << i << ": offset: " << offset << " (abs: " << (this_node_offset-offset) << ")" << endl; + cout << std::setw(4) << i << ": offset: " << offset << " (abs: " << (this_node_offset - offset) << ")" + << endl; } } handler; @@ -784,12 +760,9 @@ #endif template -void packed_trie_map<_KeyTrait,_ValueT>::traverse_range( - trie_node& root, - node_pool_type& node_pool, - const typename packed_trie_map<_KeyTrait,_ValueT>::entry* start, - const typename packed_trie_map<_KeyTrait,_ValueT>::entry* end, - size_type pos) +void packed_trie_map<_KeyTrait, _ValueT>::traverse_range( + trie_node& root, node_pool_type& node_pool, const typename packed_trie_map<_KeyTrait, _ValueT>::entry* start, + const typename packed_trie_map<_KeyTrait, _ValueT>::entry* end, size_type pos) { const entry* p = start; const entry* range_start = start; @@ -820,7 +793,7 @@ node_pool.emplace_back(range_char); root.children.push_back(&node_pool.back()); - traverse_range(*root.children.back(), node_pool, range_start, range_end, pos+1); + traverse_range(*root.children.back(), node_pool, range_start, range_end, pos + 1); range_start = range_end; range_char = range_start->key[pos]; range_end = nullptr; @@ -833,32 +806,29 @@ assert(range_char); node_pool.emplace_back(range_char); root.children.push_back(&node_pool.back()); - traverse_range(*root.children.back(), node_pool, range_start, end, pos+1); + traverse_range(*root.children.back(), node_pool, range_start, end, pos + 1); } } template -typename packed_trie_map<_KeyTrait,_ValueT>::size_type -packed_trie_map<_KeyTrait,_ValueT>::compact_node(const trie_node& node) +typename packed_trie_map<_KeyTrait, _ValueT>::size_type packed_trie_map<_KeyTrait, _ValueT>::compact_node( + const trie_node& node) { - std::vector> child_offsets; + std::vector> child_offsets; child_offsets.reserve(node.children.size()); // Process child nodes first. - std::for_each(node.children.begin(), node.children.end(), - [&](const trie_node* p) - { - const trie_node& child_node = *p; - size_type child_offset = compact_node(child_node); - child_offsets.emplace_back(child_offset, child_node.key); - } - ); + std::for_each(node.children.begin(), node.children.end(), [&](const trie_node* p) { + const trie_node& child_node = *p; + size_type child_offset = compact_node(child_node); + child_offsets.emplace_back(child_offset, child_node.key); + }); // Process this node. size_type offset = m_packed.size(); if (node.value) { - m_value_store.push_back(*node.value); // copy the value object. + m_value_store.push_back(*node.value); // copy the value object. m_packed.push_back(uintptr_t(&m_value_store.back())); } else @@ -869,31 +839,28 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::size_type -packed_trie_map<_KeyTrait,_ValueT>::compact_node( +typename packed_trie_map<_KeyTrait, _ValueT>::size_type packed_trie_map<_KeyTrait, _ValueT>::compact_node( const typename trie_map<_KeyTrait, _ValueT>::trie_node& node) { using node_type = typename trie_map<_KeyTrait, _ValueT>::trie_node; - std::vector> child_offsets; + std::vector> child_offsets; child_offsets.reserve(node.children.size()); // Process child nodes first. - std::for_each(node.children.begin(), node.children.end(), - [&](const typename node_type::children_type::value_type& v) - { + std::for_each( + node.children.begin(), node.children.end(), [&](const typename node_type::children_type::value_type& v) { key_unit_type key = v.first; const node_type& child_node = v.second; size_type child_offset = compact_node(child_node); child_offsets.emplace_back(child_offset, key); - } - ); + }); // Process this node. size_type offset = m_packed.size(); if (node.has_value) { - m_value_store.push_back(node.value); // copy the value object. + m_value_store.push_back(node.value); // copy the value object. m_packed.push_back(uintptr_t(&m_value_store.back())); } else @@ -904,24 +871,20 @@ } template -void packed_trie_map<_KeyTrait,_ValueT>::push_child_offsets( - size_type offset, const child_offsets_type& child_offsets) +void packed_trie_map<_KeyTrait, _ValueT>::push_child_offsets(size_type offset, const child_offsets_type& child_offsets) { - m_packed.push_back(uintptr_t(child_offsets.size()*2)); + m_packed.push_back(uintptr_t(child_offsets.size() * 2)); - std::for_each(child_offsets.begin(), child_offsets.end(), - [&](const std::tuple& v) - { - key_unit_type key = std::get<1>(v); - size_t child_offset = std::get<0>(v); - m_packed.push_back(key); - m_packed.push_back(offset-child_offset); - } - ); + std::for_each(child_offsets.begin(), child_offsets.end(), [&](const std::tuple& v) { + key_unit_type key = std::get<1>(v); + size_t child_offset = std::get<0>(v); + m_packed.push_back(key); + m_packed.push_back(offset - child_offset); + }); } template -void packed_trie_map<_KeyTrait,_ValueT>::compact(const trie_node& root) +void packed_trie_map<_KeyTrait, _ValueT>::compact(const trie_node& root) { packed_type init(size_t(1), uintptr_t(0)); m_packed.swap(init); @@ -932,8 +895,7 @@ } template -void packed_trie_map<_KeyTrait,_ValueT>::compact( - const typename trie_map<_KeyTrait, _ValueT>::trie_node& root) +void packed_trie_map<_KeyTrait, _ValueT>::compact(const typename trie_map<_KeyTrait, _ValueT>::trie_node& root) { packed_type init(size_t(1), uintptr_t(0)); m_packed.swap(init); @@ -944,23 +906,21 @@ } template -packed_trie_map<_KeyTrait,_ValueT>::packed_trie_map() : m_packed(3, 0u) +packed_trie_map<_KeyTrait, _ValueT>::packed_trie_map() : m_packed(3, 0u) { // root offset (0), root value (1), and root child count (2). m_packed[0] = 1; } template -packed_trie_map<_KeyTrait,_ValueT>::packed_trie_map( - const entry* entries, size_type entry_size) +packed_trie_map<_KeyTrait, _ValueT>::packed_trie_map(const entry* entries, size_type entry_size) { const entry* p = entries; const entry* p_end = p + entry_size; #if defined(MDDS_TRIE_MAP_DEBUG) // Make sure the entries really are sorted. - auto func_compare = [](const entry& left, const entry& right) -> bool - { + auto func_compare = [](const entry& left, const entry& right) -> bool { size_type n_key = std::min(left.keylen, right.keylen); int ret = std::memcmp(left.key, right.key, n_key); if (ret == 0) @@ -990,15 +950,13 @@ } template -packed_trie_map<_KeyTrait,_ValueT>::packed_trie_map( - const trie_map& other) +packed_trie_map<_KeyTrait, _ValueT>::packed_trie_map(const trie_map& other) { compact(other.m_root); } template -packed_trie_map<_KeyTrait,_ValueT>::packed_trie_map(const packed_trie_map& other) : - m_packed(other.m_packed) +packed_trie_map<_KeyTrait, _ValueT>::packed_trie_map(const packed_trie_map& other) : m_packed(other.m_packed) { struct _handler { @@ -1018,13 +976,17 @@ } } - void move_up(const uintptr_t*, const uintptr_t*, const uintptr_t*) {} + void move_up(const uintptr_t*, const uintptr_t*, const uintptr_t*) + {} - void next_child() {} + void next_child() + {} - void end() {} + void end() + {} - _handler(packed_trie_map& parent) : m_parent(parent) {} + _handler(packed_trie_map& parent) : m_parent(parent) + {} } handler(*this); @@ -1032,8 +994,8 @@ } template -packed_trie_map<_KeyTrait,_ValueT>::packed_trie_map(packed_trie_map&& other) : - m_value_store(std::move(other.m_value_store)), m_packed(std::move(other.m_packed)) +packed_trie_map<_KeyTrait, _ValueT>::packed_trie_map(packed_trie_map&& other) + : m_value_store(std::move(other.m_value_store)), m_packed(std::move(other.m_packed)) { // Even the empty structure needs to have the root offset and the empty root record. other.m_packed.resize(3, 0u); // root offset (0), root value (1), and root child count (2). @@ -1041,8 +1003,7 @@ } template -packed_trie_map<_KeyTrait,_ValueT>& -packed_trie_map<_KeyTrait,_ValueT>::operator= (packed_trie_map other) +packed_trie_map<_KeyTrait, _ValueT>& packed_trie_map<_KeyTrait, _ValueT>::operator=(packed_trie_map other) { packed_trie_map tmp(std::move(other)); tmp.swap(*this); @@ -1050,7 +1011,7 @@ } template -bool packed_trie_map<_KeyTrait,_ValueT>::operator== (const packed_trie_map& other) const +bool packed_trie_map<_KeyTrait, _ValueT>::operator==(const packed_trie_map& other) const { if (m_value_store.size() != other.m_value_store.size()) return false; @@ -1069,28 +1030,25 @@ } template -bool packed_trie_map<_KeyTrait,_ValueT>::operator!= (const packed_trie_map& other) const +bool packed_trie_map<_KeyTrait, _ValueT>::operator!=(const packed_trie_map& other) const { - return !operator== (other); + return !operator==(other); } template -typename packed_trie_map<_KeyTrait,_ValueT>::const_iterator -packed_trie_map<_KeyTrait,_ValueT>::begin() const +typename packed_trie_map<_KeyTrait, _ValueT>::const_iterator packed_trie_map<_KeyTrait, _ValueT>::begin() const { return cbegin(); } template -typename packed_trie_map<_KeyTrait,_ValueT>::const_iterator -packed_trie_map<_KeyTrait,_ValueT>::end() const +typename packed_trie_map<_KeyTrait, _ValueT>::const_iterator packed_trie_map<_KeyTrait, _ValueT>::end() const { return cend(); } template -typename packed_trie_map<_KeyTrait,_ValueT>::const_iterator -packed_trie_map<_KeyTrait,_ValueT>::cbegin() const +typename packed_trie_map<_KeyTrait, _ValueT>::const_iterator packed_trie_map<_KeyTrait, _ValueT>::cbegin() const { using ktt = key_trait_type; @@ -1113,7 +1071,7 @@ ++p; size_t offset = *p; - node_pos -= offset; // jump to the child node. + node_pos -= offset; // jump to the child node. p = node_pos; ++p; size_t index_size = *p; @@ -1136,8 +1094,7 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::const_iterator -packed_trie_map<_KeyTrait,_ValueT>::cend() const +typename packed_trie_map<_KeyTrait, _ValueT>::const_iterator packed_trie_map<_KeyTrait, _ValueT>::cend() const { node_stack_type node_stack = get_root_stack(); node_stack.back().child_pos = node_stack.back().child_end; @@ -1145,8 +1102,8 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::node_stack_type -packed_trie_map<_KeyTrait,_ValueT>::get_root_stack() const +typename packed_trie_map<_KeyTrait, _ValueT>::node_stack_type packed_trie_map<_KeyTrait, _ValueT>::get_root_stack() + const { assert(!m_packed.empty()); size_t root_offset = m_packed[0]; @@ -1166,8 +1123,8 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::const_iterator -packed_trie_map<_KeyTrait,_ValueT>::find(const key_type& key) const +typename packed_trie_map<_KeyTrait, _ValueT>::const_iterator packed_trie_map<_KeyTrait, _ValueT>::find( + const key_type& key) const { using ktt = key_trait_type; key_buffer_type buf = ktt::to_key_buffer(key); @@ -1178,8 +1135,8 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::const_iterator -packed_trie_map<_KeyTrait,_ValueT>::find(const key_unit_type* input, size_type len) const +typename packed_trie_map<_KeyTrait, _ValueT>::const_iterator packed_trie_map<_KeyTrait, _ValueT>::find( + const key_unit_type* input, size_type len) const { if (m_value_store.empty()) return end(); @@ -1202,21 +1159,18 @@ // Build the key value from the stack. key_buffer_type buf; auto end = node_stack.end(); - --end; // Skip the node with value which doesn't store a key element. - std::for_each(node_stack.begin(), end, - [&](const stack_item& this_si) - { - using ktt = key_trait_type; - ktt::push_back(buf, *this_si.child_pos); - } - ); + --end; // Skip the node with value which doesn't store a key element. + std::for_each(node_stack.begin(), end, [&](const stack_item& this_si) { + using ktt = key_trait_type; + ktt::push_back(buf, *this_si.child_pos); + }); return const_iterator(std::move(node_stack), std::move(buf), *pv); } template -typename packed_trie_map<_KeyTrait,_ValueT>::search_results -packed_trie_map<_KeyTrait,_ValueT>::prefix_search(const key_type& key) const +typename packed_trie_map<_KeyTrait, _ValueT>::search_results packed_trie_map<_KeyTrait, _ValueT>::prefix_search( + const key_type& key) const { using ktt = key_trait_type; key_buffer_type buf = ktt::to_key_buffer(key); @@ -1227,8 +1181,8 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::search_results -packed_trie_map<_KeyTrait,_ValueT>::prefix_search(const key_unit_type* prefix, size_type len) const +typename packed_trie_map<_KeyTrait, _ValueT>::search_results packed_trie_map<_KeyTrait, _ValueT>::prefix_search( + const key_unit_type* prefix, size_type len) const { using ktt = key_trait_type; @@ -1247,20 +1201,19 @@ } template -typename packed_trie_map<_KeyTrait,_ValueT>::size_type -packed_trie_map<_KeyTrait,_ValueT>::size() const noexcept +typename packed_trie_map<_KeyTrait, _ValueT>::size_type packed_trie_map<_KeyTrait, _ValueT>::size() const noexcept { return m_value_store.size(); } template -bool packed_trie_map<_KeyTrait,_ValueT>::empty() const noexcept +bool packed_trie_map<_KeyTrait, _ValueT>::empty() const noexcept { return m_value_store.empty(); } template -void packed_trie_map<_KeyTrait,_ValueT>::swap(packed_trie_map& other) +void packed_trie_map<_KeyTrait, _ValueT>::swap(packed_trie_map& other) { m_value_store.swap(other.m_value_store); m_packed.swap(other.m_packed); @@ -1268,7 +1221,7 @@ template template -void packed_trie_map<_KeyTrait,_ValueT>::save_state(std::ostream& os) const +void packed_trie_map<_KeyTrait, _ValueT>::save_state(std::ostream& os) const { detail::trie::bin_value bv; @@ -1365,8 +1318,9 @@ write(v); } - _handler(std::ostream& os, const value_addrs_type& value_addrs, const packed_trie_map& parent) : - m_os(os), m_value_addrs(value_addrs), m_parent(parent) {} + _handler(std::ostream& os, const value_addrs_type& value_addrs, const packed_trie_map& parent) + : m_os(os), m_value_addrs(value_addrs), m_parent(parent) + {} } handler(os, value_addrs, *this); @@ -1379,7 +1333,7 @@ template template -void packed_trie_map<_KeyTrait,_ValueT>::load_state(std::istream& is) +void packed_trie_map<_KeyTrait, _ValueT>::load_state(std::istream& is) { detail::trie::bin_value bv; is.read(bv.buffer, 2); @@ -1390,11 +1344,8 @@ if (variable_size != _Func::variable_size) { std::ostringstream os; - os << "This stream is meant for a value type of " - << detail::trie::value_type_size_name(variable_size) - << ", but the actual value type is of " - << detail::trie::value_type_size_name(_Func::variable_size) - << "."; + os << "This stream is meant for a value type of " << detail::trie::value_type_size_name(variable_size) + << ", but the actual value type is of " << detail::trie::value_type_size_name(_Func::variable_size) << "."; throw std::invalid_argument(os.str()); } @@ -1444,7 +1395,8 @@ uintptr_t m_max_value; packed_trie_map& m_parent; - void root_offset(size_t /*i*/, const uintptr_t& /*v*/) const {} + void root_offset(size_t /*i*/, const uintptr_t& /*v*/) const + {} void node_value(size_t i, const uintptr_t& v) const { @@ -1459,9 +1411,12 @@ } } - void node_index_size(size_t /*i*/, const uintptr_t& /*v*/) const {} - void node_child_key(size_t /*i*/, const uintptr_t& /*v*/) const {} - void node_child_offset(size_t /*i*/, const uintptr_t& /*v*/) const {} + void node_index_size(size_t /*i*/, const uintptr_t& /*v*/) const + {} + void node_child_key(size_t /*i*/, const uintptr_t& /*v*/) const + {} + void node_child_offset(size_t /*i*/, const uintptr_t& /*v*/) const + {} _handler(packed_trie_map& parent) : m_max_value(0), m_parent(parent) { @@ -1474,7 +1429,7 @@ } template -void packed_trie_map<_KeyTrait,_ValueT>::dump_structure() const +void packed_trie_map<_KeyTrait, _ValueT>::dump_structure() const { #ifdef MDDS_TRIE_MAP_DEBUG dump_packed_trie(); @@ -1489,7 +1444,8 @@ { const uintptr_t* m_head; - _handler(const uintptr_t* head) : m_head(head) {} + _handler(const uintptr_t* head) : m_head(head) + {} void node(const uintptr_t* node_pos, key_unit_type c, size_t depth, size_t index_size) { @@ -1525,7 +1481,8 @@ cout << " next child" << endl; } - void end() {} + void end() + {} } handler(head); @@ -1534,7 +1491,7 @@ } template -const uintptr_t* packed_trie_map<_KeyTrait,_ValueT>::find_prefix_node( +const uintptr_t* packed_trie_map<_KeyTrait, _ValueT>::find_prefix_node( const uintptr_t* p, const key_unit_type* prefix, const key_unit_type* prefix_end) const { if (prefix == prefix_end) @@ -1553,13 +1510,13 @@ // This is a leaf node. return nullptr; - for (size_type low = 0, high = n-1; low <= high; ) + for (size_type low = 0, high = n - 1; low <= high;) { size_type i = (low + high) / 2; - const uintptr_t* p_this = p + i*2; + const uintptr_t* p_this = p + i * 2; key_unit_type node_key = *p_this; - size_t offset = *(p_this+1); + size_t offset = *(p_this + 1); if (*prefix == node_key) { @@ -1596,14 +1553,13 @@ } template -void packed_trie_map<_KeyTrait,_ValueT>::find_prefix_node_with_stack( - node_stack_type& node_stack, - const uintptr_t* p, const key_unit_type* prefix, const key_unit_type* prefix_end) const +void packed_trie_map<_KeyTrait, _ValueT>::find_prefix_node_with_stack( + node_stack_type& node_stack, const uintptr_t* p, const key_unit_type* prefix, const key_unit_type* prefix_end) const { if (prefix == prefix_end) { - size_t index_size = *(p+1); - const uintptr_t* child_pos = p+2; + size_t index_size = *(p + 1); + const uintptr_t* child_pos = p + 2; const uintptr_t* child_end = child_pos + index_size; node_stack.emplace_back(p, child_pos, child_end); return; @@ -1627,13 +1583,13 @@ const uintptr_t* child_end = p + index_size; - for (size_type low = 0, high = n-1; low <= high; ) + for (size_type low = 0, high = n - 1; low <= high;) { size_type i = (low + high) / 2; - const uintptr_t* child_pos = p + i*2; + const uintptr_t* child_pos = p + i * 2; key_unit_type node_key = *child_pos; - size_t offset = *(child_pos+1); + size_t offset = *(child_pos + 1); if (*prefix == node_key) { @@ -1673,7 +1629,7 @@ template template -void packed_trie_map<_KeyTrait,_ValueT>::traverse_tree(_Handler hdl) const +void packed_trie_map<_KeyTrait, _ValueT>::traverse_tree(_Handler hdl) const { node_stack_type node_stack = get_root_stack(); stack_item* si = &node_stack.back(); @@ -1686,7 +1642,7 @@ const uintptr_t* child_end = si->child_end; const uintptr_t* p = child_pos; - for (bool in_tree = true; in_tree; ) + for (bool in_tree = true; in_tree;) { // Descend until the leaf node is reached by following the left-most child nodes. while (true) @@ -1748,7 +1704,7 @@ template template -void packed_trie_map<_KeyTrait,_ValueT>::traverse_buffer(_Handler hdl) const +void packed_trie_map<_KeyTrait, _ValueT>::traverse_buffer(_Handler hdl) const { size_t n = m_packed.size(); size_t i = 0; @@ -1775,6 +1731,6 @@ } } -} +} // namespace mdds /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff -Nru mdds-2.0.2/include/mdds/trie_map.hpp mdds-2.0.3/include/mdds/trie_map.hpp --- mdds-2.0.2/include/mdds/trie_map.hpp 2021-08-13 19:21:05.000000000 +0000 +++ mdds-2.0.3/include/mdds/trie_map.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -189,13 +189,20 @@ * numeric types. */ template -struct value_serializer : numeric_value_serializer {}; +struct value_serializer : numeric_value_serializer +{ +}; template -struct value_serializer::value>::type> : numeric_sequence_value_serializer {}; +struct value_serializer::value>::type> + : numeric_sequence_value_serializer +{ +}; template<> -struct value_serializer : variable_value_serializer {}; +struct value_serializer : variable_value_serializer +{ +}; } // namespace trie @@ -225,7 +232,7 @@ typedef _KeyTrait key_trait_type; typedef typename key_trait_type::key_type key_type; typedef typename key_trait_type::key_buffer_type key_buffer_type; - typedef typename key_trait_type::key_unit_type key_unit_type; + typedef typename key_trait_type::key_unit_type key_unit_type; typedef _ValueT value_type; typedef size_t size_type; typedef std::pair key_value_type; @@ -235,7 +242,6 @@ typedef trie::detail::search_results search_results; private: - struct trie_node { typedef std::map children_type; @@ -256,26 +262,24 @@ { using _is_const = bool_constant<_IsConst>; - using child_pos_type = - typename get_iterator_type< - typename trie_node::children_type, _is_const>::type; + using child_pos_type = typename get_iterator_type::type; using trie_node_type = typename const_or_not::type; trie_node_type* node; child_pos_type child_pos; - stack_item(trie_node_type* _node, const child_pos_type& _child_pos) : - node(_node), child_pos(_child_pos) {} + stack_item(trie_node_type* _node, const child_pos_type& _child_pos) : node(_node), child_pos(_child_pos) + {} - bool operator== (const stack_item& r) const + bool operator==(const stack_item& r) const { return node == r.node && child_pos == r.child_pos; } - bool operator!= (const stack_item& r) const + bool operator!=(const stack_item& r) const { - return !operator== (r); + return !operator==(r); } }; @@ -283,7 +287,6 @@ using node_stack_type = std::vector>; public: - /** * Default constructor. */ @@ -301,7 +304,7 @@ iterator end(); - trie_map& operator= (trie_map other); + trie_map& operator=(trie_map other); void swap(trie_map& other); @@ -436,14 +439,11 @@ template void find_prefix_node_with_stack( - std::vector>& node_stack, - const_t& node, - const key_unit_type* prefix, + std::vector>& node_stack, const_t& node, const key_unit_type* prefix, const key_unit_type* prefix_end) const; template - key_buffer_type build_key_buffer_from_node_stack( - const std::vector>& node_stack) const; + key_buffer_type build_key_buffer_from_node_stack(const std::vector>& node_stack) const; void count_values(size_type& n, const trie_node& node) const; @@ -471,7 +471,7 @@ typedef _KeyTrait key_trait_type; typedef typename key_trait_type::key_type key_type; typedef typename key_trait_type::key_buffer_type key_buffer_type; - typedef typename key_trait_type::key_unit_type key_unit_type; + typedef typename key_trait_type::key_unit_type key_unit_type; typedef _ValueT value_type; typedef size_t size_type; typedef std::pair key_value_type; @@ -488,8 +488,9 @@ size_type keylen; value_type value; - entry(const key_unit_type* _key, size_type _keylen, value_type _value) : - key(_key), keylen(_keylen), value(_value) {} + entry(const key_unit_type* _key, size_type _keylen, value_type _value) + : key(_key), keylen(_keylen), value(_value) + {} }; private: @@ -500,7 +501,8 @@ std::deque children; - trie_node(key_unit_type _key) : key(_key), value(nullptr) {} + trie_node(key_unit_type _key) : key(_key), value(nullptr) + {} }; struct stack_item @@ -509,15 +511,16 @@ const uintptr_t* child_pos; const uintptr_t* child_end; - stack_item(const uintptr_t* _node_pos, const uintptr_t* _child_pos, const uintptr_t* _child_end) : - node_pos(_node_pos), child_pos(_child_pos), child_end(_child_end) {} + stack_item(const uintptr_t* _node_pos, const uintptr_t* _child_pos, const uintptr_t* _child_end) + : node_pos(_node_pos), child_pos(_child_pos), child_end(_child_end) + {} - bool operator== (const stack_item& other) const + bool operator==(const stack_item& other) const { return node_pos == other.node_pos && child_pos == other.child_pos; } - bool operator!= (const stack_item& other) const + bool operator!=(const stack_item& other) const { return !operator==(other); } @@ -542,7 +545,6 @@ typedef std::vector> child_offsets_type; public: - packed_trie_map(); /** @@ -567,11 +569,11 @@ packed_trie_map(packed_trie_map&& other); - packed_trie_map& operator= (packed_trie_map other); + packed_trie_map& operator=(packed_trie_map other); - bool operator== (const packed_trie_map& other) const; + bool operator==(const packed_trie_map& other) const; - bool operator!= (const packed_trie_map& other) const; + bool operator!=(const packed_trie_map& other) const; const_iterator begin() const; @@ -667,8 +669,7 @@ node_stack_type get_root_stack() const; void traverse_range( - trie_node& root, node_pool_type& node_pool, const entry* start, const entry* end, - size_type pos); + trie_node& root, node_pool_type& node_pool, const entry* start, const entry* end, size_type pos); size_type compact_node(const trie_node& node); size_type compact_node(const typename trie_map<_KeyTrait, _ValueT>::trie_node& node); @@ -682,8 +683,8 @@ const uintptr_t* p, const key_unit_type* prefix, const key_unit_type* prefix_end) const; void find_prefix_node_with_stack( - node_stack_type& node_stack, - const uintptr_t* p, const key_unit_type* prefix, const key_unit_type* prefix_end) const; + node_stack_type& node_stack, const uintptr_t* p, const key_unit_type* prefix, + const key_unit_type* prefix_end) const; template void traverse_tree(_Handler hdl) const; @@ -702,7 +703,7 @@ packed_type m_packed; }; -} +} // namespace mdds #include "trie_map_def.inl" diff -Nru mdds-2.0.2/include/mdds/trie_map_itr.hpp mdds-2.0.3/include/mdds/trie_map_itr.hpp --- mdds-2.0.2/include/mdds/trie_map_itr.hpp 2021-11-08 22:32:47.000000000 +0000 +++ mdds-2.0.3/include/mdds/trie_map_itr.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -61,7 +61,10 @@ empty }; -enum empty_iterator_type { empty_iterator }; +enum empty_iterator_type +{ + empty_iterator +}; template struct get_node_stack_type; @@ -95,8 +98,7 @@ using node_stack_type = typename get_node_stack_type::type; using trie_node_type = const_t; using trie_node_child_pos_type = - typename get_iterator_type< - typename std::remove_const::type::children_type, _is_const>::type; + typename get_iterator_type::type::children_type, _is_const>::type; using key_trait_type = typename trie_type::key_trait_type; using key_type = typename key_trait_type::key_type; @@ -119,8 +121,7 @@ iterator_type m_type; static trie_node_type* push_child_node_to_stack( - node_stack_type& node_stack, key_buffer_type& buf, - trie_node_child_pos_type& child_pos) + node_stack_type& node_stack, key_buffer_type& buf, trie_node_child_pos_type& child_pos) { using ktt = key_trait_type; @@ -135,8 +136,7 @@ * From the current node, move to its previous child node and descend all * the way to the leaf node. */ - static trie_node_type* descend_to_previus_leaf_node( - node_stack_type& node_stack, key_buffer_type& buf) + static trie_node_type* descend_to_previus_leaf_node(node_stack_type& node_stack, key_buffer_type& buf) { using ktt = key_trait_type; @@ -153,26 +153,25 @@ ktt::push_back(buf, si.child_pos->first); cur_node = &si.child_pos->second; node_stack.emplace_back(cur_node, cur_node->children.end()); - } - while (!cur_node->children.empty()); + } while (!cur_node->children.empty()); return cur_node; } - iterator_base(empty_iterator_type) : m_current_value_ptr(nullptr), m_type(iterator_type::empty) {} -public: + iterator_base(empty_iterator_type) : m_current_value_ptr(nullptr), m_type(iterator_type::empty) + {} - iterator_base() : m_current_value_ptr(nullptr), m_type(iterator_type::normal) {} +public: + iterator_base() : m_current_value_ptr(nullptr), m_type(iterator_type::normal) + {} - iterator_base(node_stack_type&& node_stack, key_buffer_type&& buf, iterator_type type) : - m_node_stack(std::move(node_stack)), - m_buffer(std::move(buf)), - m_current_key(key_trait_type::to_key(m_buffer)), - m_current_value_ptr(&m_node_stack.back().node->value), - m_type(type) + iterator_base(node_stack_type&& node_stack, key_buffer_type&& buf, iterator_type type) + : m_node_stack(std::move(node_stack)), m_buffer(std::move(buf)), + m_current_key(key_trait_type::to_key(m_buffer)), m_current_value_ptr(&m_node_stack.back().node->value), + m_type(type) {} - bool operator== (const iterator_base& other) const + bool operator==(const iterator_base& other) const { if (m_type != other.m_type) return false; @@ -183,7 +182,7 @@ return m_node_stack.back() == other.m_node_stack.back(); } - bool operator!= (const iterator_base& other) const + bool operator!=(const iterator_base& other) const { return !operator==(other); } @@ -219,8 +218,7 @@ if (m_type == iterator_type::end) { std::ostringstream os; - os << "iterator_base::operator++#" << __LINE__ - << ": moving past the end position!"; + os << "iterator_base::operator++#" << __LINE__ << ": moving past the end position!"; throw general_error(os.str()); } #endif @@ -249,8 +247,7 @@ auto child_pos = cur_node->children.begin(); cur_node = push_child_node_to_stack(m_node_stack, m_buffer, child_pos); } - } - while (!cur_node->has_value); + } while (!cur_node->has_value); m_current_key = ktt::to_key(m_buffer); m_current_value_ptr = &cur_node->value; @@ -304,8 +301,7 @@ cur_node = descend_to_previus_leaf_node(m_node_stack, m_buffer); assert(cur_node->has_value); } - } - while (!cur_node->has_value); + } while (!cur_node->has_value); } else { @@ -329,8 +325,7 @@ cur_node = descend_to_previus_leaf_node(m_node_stack, m_buffer); assert(cur_node->has_value); } - } - while (!cur_node->has_value); + } while (!cur_node->has_value); } assert(cur_node->has_value); @@ -363,13 +358,15 @@ using node_stack_type = typename base_type::node_stack_type; using key_buffer_type = typename base_type::key_buffer_type; - iterator(empty_iterator_type t) : base_type(t) {} + iterator(empty_iterator_type t) : base_type(t) + {} public: - iterator() : base_type() {} + iterator() : base_type() + {} - iterator(node_stack_type&& node_stack, key_buffer_type&& buf, iterator_type type) : - base_type(std::move(node_stack), std::move(buf), type) + iterator(node_stack_type&& node_stack, key_buffer_type&& buf, iterator_type type) + : base_type(std::move(node_stack), std::move(buf), type) {} }; @@ -385,19 +382,21 @@ using node_stack_type = typename base_type::node_stack_type; using key_buffer_type = typename base_type::key_buffer_type; - using base_type::m_node_stack; using base_type::m_buffer; using base_type::m_current_key; using base_type::m_current_value_ptr; + using base_type::m_node_stack; using base_type::m_type; - const_iterator(empty_iterator_type t) : base_type(t) {} + const_iterator(empty_iterator_type t) : base_type(t) + {} public: - const_iterator() : base_type() {} + const_iterator() : base_type() + {} - const_iterator(node_stack_type&& node_stack, key_buffer_type&& buf, iterator_type type) : - base_type(std::move(node_stack), std::move(buf), type) + const_iterator(node_stack_type&& node_stack, key_buffer_type&& buf, iterator_type type) + : base_type(std::move(node_stack), std::move(buf), type) {} const_iterator(const iterator<_TrieType>& it) : base_type() @@ -453,8 +452,8 @@ key_buffer_type m_buffer; node_stack_type m_node_stack; - search_results(const trie_node* node, key_buffer_type&& buf) : - m_node(node), m_buffer(buf) {} + search_results(const trie_node* node, key_buffer_type&& buf) : m_node(node), m_buffer(buf) + {} public: using const_iterator = typename trie_type::const_iterator; @@ -479,8 +478,7 @@ const_iterator::push_child_node_to_stack(node_stack, buf, it); } - return const_iterator( - std::move(node_stack), std::move(buf), iterator_type::normal); + return const_iterator(std::move(node_stack), std::move(buf), iterator_type::normal); } const_iterator end() const @@ -491,8 +489,7 @@ node_stack_type node_stack; node_stack.emplace_back(m_node, m_node->children.end()); - return const_iterator( - std::move(node_stack), key_buffer_type(m_buffer), iterator_type::end); + return const_iterator(std::move(node_stack), key_buffer_type(m_buffer), iterator_type::end); } }; @@ -532,8 +529,7 @@ * Given a child offset position (child_pos), jump to the actual child * node position and push that onto the stack as stack_item. */ - static void push_child_node_to_stack( - node_stack_type& node_stack, key_buffer_type& buf, const uintptr_t* child_pos) + static void push_child_node_to_stack(node_stack_type& node_stack, key_buffer_type& buf, const uintptr_t* child_pos) { using ktt = key_trait_type; @@ -555,8 +551,7 @@ node_stack.emplace_back(node_pos, child_pos, child_end); } - static const void descend_to_previus_leaf_node( - node_stack_type& node_stack, key_buffer_type& buf) + static const void descend_to_previus_leaf_node(node_stack_type& node_stack, key_buffer_type& buf) { using ktt = key_trait_type; @@ -584,27 +579,26 @@ const uintptr_t* child_pos = p; const uintptr_t* child_end = child_pos + index_size; node_stack.emplace_back(node_pos, child_end, child_end); - } - while (index_size); + } while (index_size); } - packed_iterator_base(empty_iterator_type) : m_type(iterator_type::empty) {} + packed_iterator_base(empty_iterator_type) : m_type(iterator_type::empty) + {} public: - packed_iterator_base() : m_type(iterator_type::normal) {} + packed_iterator_base() : m_type(iterator_type::normal) + {} + + packed_iterator_base(node_stack_type&& node_stack, key_buffer_type&& buf, const typename trie_type::value_type& v) + : m_node_stack(std::move(node_stack)), m_buffer(std::move(buf)), + m_current_value(key_trait_type::to_key(m_buffer), v), m_type(iterator_type::normal) + {} - packed_iterator_base(node_stack_type&& node_stack, key_buffer_type&& buf, const typename trie_type::value_type& v) : - m_node_stack(std::move(node_stack)), - m_buffer(std::move(buf)), - m_current_value(key_trait_type::to_key(m_buffer), v), - m_type(iterator_type::normal) {} - - packed_iterator_base(node_stack_type&& node_stack, key_buffer_type&& buf) : - m_node_stack(std::move(node_stack)), - m_buffer(std::move(buf)), - m_type(iterator_type::end) {} + packed_iterator_base(node_stack_type&& node_stack, key_buffer_type&& buf) + : m_node_stack(std::move(node_stack)), m_buffer(std::move(buf)), m_type(iterator_type::end) + {} - bool operator== (const packed_iterator_base& other) const + bool operator==(const packed_iterator_base& other) const { if (m_type != other.m_type) return false; @@ -615,7 +609,7 @@ return m_node_stack.back() == other.m_node_stack.back(); } - bool operator!= (const packed_iterator_base& other) const + bool operator!=(const packed_iterator_base& other) const { return !operator==(other); } @@ -636,7 +630,7 @@ stack_item* si = &m_node_stack.back(); const typename trie_type::value_type* pv = nullptr; - size_t index_size = *(si->node_pos+1); + size_t index_size = *(si->node_pos + 1); do { @@ -653,8 +647,7 @@ if (m_type == iterator_type::end) { std::ostringstream os; - os << "packed_iterator_base::operator++#" - << __LINE__ << ": moving past the end position!"; + os << "packed_iterator_base::operator++#" << __LINE__ << ": moving past the end position!"; throw general_error(os.str()); } #endif @@ -685,9 +678,8 @@ si = &m_node_stack.back(); pv = reinterpret_cast(*si->node_pos); - index_size = *(si->node_pos+1); - } - while (!pv); + index_size = *(si->node_pos + 1); + } while (!pv); assert(pv); m_current_value = value_type(ktt::to_key(m_buffer), *pv); @@ -709,7 +701,7 @@ stack_item* si = &m_node_stack.back(); const typename trie_type::value_type* pv = reinterpret_cast(*si->node_pos); - size_t index_size = *(si->node_pos+1); // index size for child nodes. + size_t index_size = *(si->node_pos + 1); // index size for child nodes. if (m_type == iterator_type::end && pv) { @@ -755,8 +747,7 @@ pv = reinterpret_cast(*p); assert(pv); } - } - while (!pv); + } while (!pv); } else { @@ -764,7 +755,7 @@ // node or another node with value is reached. assert(*si->node_pos); // this node should have a value. - assert(si->child_pos == (si->node_pos+2)); + assert(si->child_pos == (si->node_pos + 2)); do { @@ -782,8 +773,7 @@ pv = reinterpret_cast(*si->node_pos); assert(pv); } - } - while (!pv); + } while (!pv); } assert(pv); @@ -815,8 +805,8 @@ const uintptr_t* m_node; key_buffer_type m_buffer; - packed_search_results(const uintptr_t* node, key_buffer_type&& buf) : - m_node(node), m_buffer(std::move(buf)) {} + packed_search_results(const uintptr_t* node, key_buffer_type&& buf) : m_node(node), m_buffer(std::move(buf)) + {} node_stack_type get_root_node() const { @@ -842,18 +832,18 @@ public: using const_iterator = packed_iterator_base; - packed_search_results() : m_node(nullptr) {} + packed_search_results() : m_node(nullptr) + {} - packed_search_results(const packed_search_results& other) : - m_node(other.m_node), m_buffer(other.m_buffer) {} + packed_search_results(const packed_search_results& other) : m_node(other.m_node), m_buffer(other.m_buffer) + {} - packed_search_results(packed_search_results&& other) : - m_node(other.m_node), m_buffer(std::move(other.m_buffer)) + packed_search_results(packed_search_results&& other) : m_node(other.m_node), m_buffer(std::move(other.m_buffer)) { other.m_node = nullptr; } - packed_search_results& operator= (packed_search_results other) + packed_search_results& operator=(packed_search_results other) { packed_search_results tmp(std::move(other)); swap(tmp); @@ -878,8 +868,7 @@ const_iterator::push_child_node_to_stack(node_stack, buf, node_stack.back().child_pos); } - return const_iterator( - std::move(node_stack), std::move(buf), *node_stack.back().get_value()); + return const_iterator(std::move(node_stack), std::move(buf), *node_stack.back().get_value()); } const_iterator end() const @@ -895,6 +884,6 @@ } }; -}}} +}}} // namespace mdds::trie::detail #endif diff -Nru mdds-2.0.2/install-sh mdds-2.0.3/install-sh --- mdds-2.0.2/install-sh 2018-05-05 15:55:17.000000000 +0000 +++ mdds-2.0.3/install-sh 2022-04-22 00:21:22.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-11-20.07; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -41,19 +41,15 @@ # This script is compatible with the BSD install script, but was written # from scratch. +tab=' ' nl=' ' -IFS=" "" $nl" +IFS=" $tab$nl" -# set DOITPROG to echo to test this script +# Set DOITPROG to "echo" to test this script. -# Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi +doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. @@ -68,22 +64,16 @@ rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -97,7 +87,7 @@ dst_arg= copy_on_change=false -no_target_directory= +is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE @@ -114,18 +104,28 @@ --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,46 +137,62 @@ -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift;; + shift;; + + -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; + -S) backupsuffix="$2" + shift;; - -T) no_target_directory=true;; + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; - --) shift - break;; + --) shift + break;; - -*) echo "$0: invalid option: $1" >&2 - exit 1;; + -*) echo "$0: invalid option: $1" >&2 + exit 1;; *) break;; esac shift done +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. @@ -208,6 +224,15 @@ fi if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 @@ -223,16 +248,16 @@ *[0-7]) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw='% 200' + u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw=,u+rw + u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac @@ -250,6 +275,10 @@ dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -266,178 +295,148 @@ fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - + dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else - mkdir_mode= + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; + trap '' 0;; esac if $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; esac - eval "$initialize_posix_glob" - oIFS=$IFS IFS=/ - $posix_glob set -f + set -f set fnord $dstdir shift - $posix_glob set +f + set +f IFS=$oIFS prefixes= for d do - test X"$d" = X && continue + test X"$d" = X && continue - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ done if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi fi fi @@ -450,14 +449,25 @@ else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -472,20 +482,24 @@ # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - + set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -493,24 +507,24 @@ # to itself, or perhaps because mv is so ancient that it does not # support -f. { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 @@ -519,9 +533,9 @@ done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -Nru mdds-2.0.2/ltmain.sh mdds-2.0.3/ltmain.sh --- mdds-2.0.2/ltmain.sh 2022-02-12 00:45:20.000000000 +0000 +++ mdds-2.0.3/ltmain.sh 2022-05-11 01:41:20.000000000 +0000 @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-14" +VERSION="2.4.6 Debian-2.4.6-15build2" package_revision=2.4.6 @@ -2141,7 +2141,7 @@ compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.6-14 + version: $progname $scriptversion Debian-2.4.6-15build2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` diff -Nru mdds-2.0.2/Makefile.am mdds-2.0.3/Makefile.am --- mdds-2.0.2/Makefile.am 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/Makefile.am 2022-04-22 00:12:40.000000000 +0000 @@ -92,8 +92,10 @@ test/multi_type_vector/event/aos/test_main.cpp \ test/multi_type_vector/event/aos/test_block_counter.cpp \ test/multi_type_vector/event/aos/test_block_init.cpp \ + test/multi_type_vector/event/aos/test_swap.cpp \ test/multi_type_vector/event/tc/block_counter.inl \ test/multi_type_vector/event/tc/block_init.inl \ + test/multi_type_vector/event/tc/swap.inl \ test/include/test_global.hpp \ test/test_global.cpp @@ -107,6 +109,7 @@ test/multi_type_vector/event/soa/test_main.cpp \ test/multi_type_vector/event/soa/test_block_counter.cpp \ test/multi_type_vector/event/soa/test_block_init.cpp \ + test/multi_type_vector/event/aos/test_swap.cpp \ test/include/test_global.hpp \ test/test_global.cpp diff -Nru mdds-2.0.2/Makefile.in mdds-2.0.3/Makefile.in --- mdds-2.0.2/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -259,6 +259,7 @@ am_multi_type_vector_test_event_aos_OBJECTS = test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_main.$(OBJEXT) \ test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_block_counter.$(OBJEXT) \ test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_block_init.$(OBJEXT) \ + test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.$(OBJEXT) \ test/multi_type_vector_test_event_aos-test_global.$(OBJEXT) multi_type_vector_test_event_aos_OBJECTS = \ $(am_multi_type_vector_test_event_aos_OBJECTS) @@ -266,6 +267,7 @@ am_multi_type_vector_test_event_soa_OBJECTS = test/multi_type_vector/event/soa/multi_type_vector_test_event_soa-test_main.$(OBJEXT) \ test/multi_type_vector/event/soa/multi_type_vector_test_event_soa-test_block_counter.$(OBJEXT) \ test/multi_type_vector/event/soa/multi_type_vector_test_event_soa-test_block_init.$(OBJEXT) \ + test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.$(OBJEXT) \ test/multi_type_vector_test_event_soa-test_global.$(OBJEXT) multi_type_vector_test_event_soa_OBJECTS = \ $(am_multi_type_vector_test_event_soa_OBJECTS) @@ -405,6 +407,8 @@ test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_counter.Po \ test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_init.Po \ test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_main.Po \ + test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Po \ + test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Po \ test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_counter.Po \ test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_init.Po \ test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_main.Po \ @@ -556,9 +560,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -714,6 +715,7 @@ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver @@ -736,8 +738,8 @@ $(MEM_LOG_FLAGS) DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/misc/mdds.pc.in \ - $(top_srcdir)/test/test.mem.in AUTHORS compile depcomp \ - install-sh ltmain.sh missing test-driver + $(top_srcdir)/test/test.mem.in AUTHORS README.md compile \ + depcomp install-sh ltmain.sh missing test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -776,6 +778,8 @@ DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).tar.xz GZIP_ENV = --best DIST_TARGETS = dist-xz dist-bzip2 dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -791,9 +795,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -805,11 +810,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -955,8 +959,10 @@ test/multi_type_vector/event/aos/test_main.cpp \ test/multi_type_vector/event/aos/test_block_counter.cpp \ test/multi_type_vector/event/aos/test_block_init.cpp \ + test/multi_type_vector/event/aos/test_swap.cpp \ test/multi_type_vector/event/tc/block_counter.inl \ test/multi_type_vector/event/tc/block_init.inl \ + test/multi_type_vector/event/tc/swap.inl \ test/include/test_global.hpp \ test/test_global.cpp @@ -970,6 +976,7 @@ test/multi_type_vector/event/soa/test_main.cpp \ test/multi_type_vector/event/soa/test_block_counter.cpp \ test/multi_type_vector/event/soa/test_block_init.cpp \ + test/multi_type_vector/event/aos/test_swap.cpp \ test/include/test_global.hpp \ test/test_global.cpp @@ -1490,6 +1497,9 @@ test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_block_init.$(OBJEXT): \ test/multi_type_vector/event/aos/$(am__dirstamp) \ test/multi_type_vector/event/aos/$(DEPDIR)/$(am__dirstamp) +test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.$(OBJEXT): \ + test/multi_type_vector/event/aos/$(am__dirstamp) \ + test/multi_type_vector/event/aos/$(DEPDIR)/$(am__dirstamp) test/multi_type_vector_test_event_aos-test_global.$(OBJEXT): \ test/$(am__dirstamp) test/$(DEPDIR)/$(am__dirstamp) @@ -1511,6 +1521,9 @@ test/multi_type_vector/event/soa/multi_type_vector_test_event_soa-test_block_init.$(OBJEXT): \ test/multi_type_vector/event/soa/$(am__dirstamp) \ test/multi_type_vector/event/soa/$(DEPDIR)/$(am__dirstamp) +test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.$(OBJEXT): \ + test/multi_type_vector/event/aos/$(am__dirstamp) \ + test/multi_type_vector/event/aos/$(DEPDIR)/$(am__dirstamp) test/multi_type_vector_test_event_soa-test_global.$(OBJEXT): \ test/$(am__dirstamp) test/$(DEPDIR)/$(am__dirstamp) @@ -1707,6 +1720,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_counter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_init.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_counter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_init.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_main.Po@am__quote@ # am--include-marker @@ -2519,6 +2534,20 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_aos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_block_init.obj `if test -f 'test/multi_type_vector/event/aos/test_block_init.cpp'; then $(CYGPATH_W) 'test/multi_type_vector/event/aos/test_block_init.cpp'; else $(CYGPATH_W) '$(srcdir)/test/multi_type_vector/event/aos/test_block_init.cpp'; fi` +test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.o: test/multi_type_vector/event/aos/test_swap.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_aos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.o -MD -MP -MF test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Tpo -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.o `test -f 'test/multi_type_vector/event/aos/test_swap.cpp' || echo '$(srcdir)/'`test/multi_type_vector/event/aos/test_swap.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Tpo test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/multi_type_vector/event/aos/test_swap.cpp' object='test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_aos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.o `test -f 'test/multi_type_vector/event/aos/test_swap.cpp' || echo '$(srcdir)/'`test/multi_type_vector/event/aos/test_swap.cpp + +test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.obj: test/multi_type_vector/event/aos/test_swap.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_aos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.obj -MD -MP -MF test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Tpo -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.obj `if test -f 'test/multi_type_vector/event/aos/test_swap.cpp'; then $(CYGPATH_W) 'test/multi_type_vector/event/aos/test_swap.cpp'; else $(CYGPATH_W) '$(srcdir)/test/multi_type_vector/event/aos/test_swap.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Tpo test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/multi_type_vector/event/aos/test_swap.cpp' object='test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_aos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_aos-test_swap.obj `if test -f 'test/multi_type_vector/event/aos/test_swap.cpp'; then $(CYGPATH_W) 'test/multi_type_vector/event/aos/test_swap.cpp'; else $(CYGPATH_W) '$(srcdir)/test/multi_type_vector/event/aos/test_swap.cpp'; fi` + test/multi_type_vector_test_event_aos-test_global.o: test/test_global.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_aos_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test/multi_type_vector_test_event_aos-test_global.o -MD -MP -MF test/$(DEPDIR)/multi_type_vector_test_event_aos-test_global.Tpo -c -o test/multi_type_vector_test_event_aos-test_global.o `test -f 'test/test_global.cpp' || echo '$(srcdir)/'`test/test_global.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/multi_type_vector_test_event_aos-test_global.Tpo test/$(DEPDIR)/multi_type_vector_test_event_aos-test_global.Po @@ -2575,6 +2604,20 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_soa_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test/multi_type_vector/event/soa/multi_type_vector_test_event_soa-test_block_init.obj `if test -f 'test/multi_type_vector/event/soa/test_block_init.cpp'; then $(CYGPATH_W) 'test/multi_type_vector/event/soa/test_block_init.cpp'; else $(CYGPATH_W) '$(srcdir)/test/multi_type_vector/event/soa/test_block_init.cpp'; fi` +test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.o: test/multi_type_vector/event/aos/test_swap.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_soa_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.o -MD -MP -MF test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Tpo -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.o `test -f 'test/multi_type_vector/event/aos/test_swap.cpp' || echo '$(srcdir)/'`test/multi_type_vector/event/aos/test_swap.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Tpo test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/multi_type_vector/event/aos/test_swap.cpp' object='test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_soa_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.o `test -f 'test/multi_type_vector/event/aos/test_swap.cpp' || echo '$(srcdir)/'`test/multi_type_vector/event/aos/test_swap.cpp + +test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.obj: test/multi_type_vector/event/aos/test_swap.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_soa_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.obj -MD -MP -MF test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Tpo -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.obj `if test -f 'test/multi_type_vector/event/aos/test_swap.cpp'; then $(CYGPATH_W) 'test/multi_type_vector/event/aos/test_swap.cpp'; else $(CYGPATH_W) '$(srcdir)/test/multi_type_vector/event/aos/test_swap.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Tpo test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test/multi_type_vector/event/aos/test_swap.cpp' object='test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_soa_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o test/multi_type_vector/event/aos/multi_type_vector_test_event_soa-test_swap.obj `if test -f 'test/multi_type_vector/event/aos/test_swap.cpp'; then $(CYGPATH_W) 'test/multi_type_vector/event/aos/test_swap.cpp'; else $(CYGPATH_W) '$(srcdir)/test/multi_type_vector/event/aos/test_swap.cpp'; fi` + test/multi_type_vector_test_event_soa-test_global.o: test/test_global.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(multi_type_vector_test_event_soa_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT test/multi_type_vector_test_event_soa-test_global.o -MD -MP -MF test/$(DEPDIR)/multi_type_vector_test_event_soa-test_global.Tpo -c -o test/multi_type_vector_test_event_soa-test_global.o `test -f 'test/test_global.cpp' || echo '$(srcdir)/'`test/test_global.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) test/$(DEPDIR)/multi_type_vector_test_event_soa-test_global.Tpo test/$(DEPDIR)/multi_type_vector_test_event_soa-test_global.Po @@ -2844,7 +2887,7 @@ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -3018,7 +3061,6 @@ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_MEM_LOG_DRIVER_FLAGS) $(MEM_LOG_DRIVER_FLAGS) -- $(MEM_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -3100,6 +3142,10 @@ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -3142,6 +3188,8 @@ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -3157,7 +3205,7 @@ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -3348,6 +3396,8 @@ -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_counter.Po -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_init.Po -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_main.Po + -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Po + -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Po -rm -f test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_counter.Po -rm -f test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_init.Po -rm -f test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_main.Po @@ -3483,6 +3533,8 @@ -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_counter.Po -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_block_init.Po -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_main.Po + -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_aos-test_swap.Po + -rm -f test/multi_type_vector/event/aos/$(DEPDIR)/multi_type_vector_test_event_soa-test_swap.Po -rm -f test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_counter.Po -rm -f test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_block_init.Po -rm -f test/multi_type_vector/event/soa/$(DEPDIR)/multi_type_vector_test_event_soa-test_main.Po @@ -3527,19 +3579,19 @@ clean-checkPROGRAMS clean-cscope clean-generic cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-compile distclean-generic \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-data-local \ - install-dist_docDATA install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-nodist_pkgconfDATA \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ - ps ps-am recheck tags tags-am uninstall uninstall-am \ - uninstall-dist_docDATA uninstall-local \ + dist-zstd distcheck distclean distclean-compile \ + distclean-generic distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-data-local install-dist_docDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-nodist_pkgconfDATA install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am uninstall-dist_docDATA uninstall-local \ uninstall-nodist_pkgconfDATA .PRECIOUS: Makefile diff -Nru mdds-2.0.2/misc/sorted_string_map_perf.cpp mdds-2.0.3/misc/sorted_string_map_perf.cpp --- mdds-2.0.2/misc/sorted_string_map_perf.cpp 2018-05-05 15:58:40.000000000 +0000 +++ mdds-2.0.3/misc/sorted_string_map_perf.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -173,7 +173,7 @@ { static const size_t repeat_count = 10000000; - map_type sorted_map(entries, MDDS_N_ELEMENTS(entries), -1); + map_type sorted_map(entries, std::size(entries), -1); size_t n = sorted_map.size(); cout << "entry count = " << n << endl; @@ -186,7 +186,7 @@ } } - trie_map_type trie_map(trie_entries, MDDS_N_ELEMENTS(trie_entries), -1); + trie_map_type trie_map(trie_entries, std::size(trie_entries), -1); n = trie_map.size(); cout << "entry count = " << n << endl; diff -Nru mdds-2.0.2/missing mdds-2.0.3/missing --- mdds-2.0.2/missing 2022-02-12 00:45:22.000000000 +0000 +++ mdds-2.0.3/missing 2022-05-11 01:41:21.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff -Nru mdds-2.0.2/test/flat_segment_tree_test.cpp mdds-2.0.3/test/flat_segment_tree_test.cpp --- mdds-2.0.2/test/flat_segment_tree_test.cpp 2021-11-23 01:07:40.000000000 +0000 +++ mdds-2.0.3/test/flat_segment_tree_test.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -36,7 +36,7 @@ #include #include -#define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0]) +#define ARRAY_SIZE(x) sizeof(x) / sizeof(x[0]) using namespace std; using namespace mdds; @@ -55,7 +55,7 @@ flat_segment_tree int_ranges(0, 100, -1); for (int i = 0; i < 20; ++i) { - int start = i*5; + int start = i * 5; int end = start + 5; int_ranges.insert_front(start, end, i); } @@ -86,19 +86,19 @@ merge_test.dump_leaf_nodes(); for (int i = 10; i <= 80; i += 10) - merge_test.insert_front(i, i+10, i); + merge_test.insert_front(i, i + 10, i); merge_test.dump_leaf_nodes(); merge_test.insert_front(10, 90, -1); merge_test.dump_leaf_nodes(); for (int i = 10; i <= 80; i += 10) - merge_test.insert_front(i, i+10, i); + merge_test.insert_front(i, i + 10, i); merge_test.dump_leaf_nodes(); merge_test.insert_front(8, 92, -1); merge_test.dump_leaf_nodes(); for (int i = 10; i <= 80; i += 10) - merge_test.insert_front(i, i+10, i); + merge_test.insert_front(i, i + 10, i); merge_test.dump_leaf_nodes(); merge_test.insert_front(12, 88, 25); merge_test.dump_leaf_nodes(); @@ -109,9 +109,9 @@ flat_segment_tree db(0, 100, -1); for (int i = 0; i < 10; ++i) { - int key = i*10; - int val = i*5; - db.insert_front(key, key+10, val); + int key = i * 10; + int val = i * 5; + db.insert_front(key, key + 10, val); } db.dump_leaf_nodes(); for (int i = 0; i <= 100; ++i) @@ -144,8 +144,8 @@ flat_segment_tree db(lower, upper, 0); { stack_printer __stack_printer2__("::fst_test_tree_build insertion"); - for (int i = lower; i < upper; i+=delta) - db.insert_front(i, i+delta, i*2); + for (int i = lower; i < upper; i += delta) + db.insert_front(i, i + delta, i * 2); } db.dump_leaf_nodes(); @@ -168,8 +168,8 @@ int lower = 0, upper = 50000; flat_segment_tree db(lower, upper, 0); - for (int i = upper-1; i >= lower; --i) - db.insert_front(i, i+1, i); + for (int i = upper - 1; i >= lower; --i) + db.insert_front(i, i + 1, i); int success = 0, failure = 0; int val; @@ -189,8 +189,8 @@ int lower = 0, upper = 5000000; flat_segment_tree db(lower, upper, 0); - for (int i = upper-1; i >= lower; --i) - db.insert_front(i, i+1, i); + for (int i = upper - 1; i >= lower; --i) + db.insert_front(i, i + 1, i); { stack_printer sp2("::fst_perf_test_search_tree (build tree)"); @@ -220,7 +220,7 @@ int lower = 0, upper = 200, delta = 5; fst_type db(lower, upper, 0); for (int i = lower; i < upper; i += delta) - db.insert_front(i, i+delta, i); + db.insert_front(i, i + delta, i); db.build_tree(); db.dump_tree(); @@ -228,7 +228,7 @@ int val, start, end; int success = 0, failure = 0; - for (int i = lower-10; i < upper+10; ++i) + for (int i = lower - 10; i < upper + 10; ++i) { if (db.search_tree(i, val, &start, &end).second) { @@ -250,7 +250,7 @@ db.insert_back(23, 28, 4); db.build_tree(); - typedef pair ret_type; + typedef pair ret_type; ret_type ret = db.search_tree(0, val, &start, &end); assert(ret.second); assert(start == 0 && end == 5 && val == 0); @@ -275,7 +275,7 @@ std::advance(check, 3); assert(ret.first == check); - ret = db.search_tree(upper+10, val, &start, &end); + ret = db.search_tree(upper + 10, val, &start, &end); assert(!ret.second); // This search should fail. assert(ret.first == db.end()); } @@ -290,7 +290,7 @@ } template -void build_and_dump(flat_segment_tree&db) +void build_and_dump(flat_segment_tree& db) { db.build_tree(); db.dump_tree(); @@ -299,8 +299,7 @@ template bool check_leaf_nodes( - const flat_segment_tree& db, - const key_type* keys, const value_type* values, size_t key_size) + const flat_segment_tree& db, const key_type* keys, const value_type* values, size_t key_size) { if (key_size <= 1) return false; @@ -314,8 +313,8 @@ return false; vector value_checks; - value_checks.reserve(key_size-1); - for (size_t i = 0; i < key_size-1; ++i) + value_checks.reserve(key_size - 1); + for (size_t i = 0; i < key_size - 1; ++i) value_checks.push_back(values[i]); if (!db.verify_values(value_checks)) @@ -327,8 +326,8 @@ template bool is_iterator_valid( const typename flat_segment_tree::const_iterator& beg, - const typename flat_segment_tree::const_iterator& end, - const key_type* keys, const value_type* values, size_t key_size) + const typename flat_segment_tree::const_iterator& end, const key_type* keys, + const value_type* values, size_t key_size) { assert(key_size > 1); @@ -374,8 +373,7 @@ if (values[idx] != itr->second) return false; } - } - while (itr != beg); + } while (itr != beg); return true; } @@ -383,8 +381,8 @@ template bool is_iterator_valid( const typename flat_segment_tree::const_reverse_iterator& beg, - const typename flat_segment_tree::const_reverse_iterator& end, - const key_type* keys, const value_type* values, size_t key_size) + const typename flat_segment_tree::const_reverse_iterator& end, const key_type* keys, + const value_type* values, size_t key_size) { assert(key_size > 1); @@ -430,8 +428,7 @@ if (values[idx] != itr->second) return false; } - } - while (itr != beg); + } while (itr != beg); return true; } @@ -586,7 +583,7 @@ build_and_dump(db); { int keys[] = {0, 1, 15, 25, 35, 45, 55, 100}; - int vals[] = {0, 5, 0, 10, 0, 15, 0}; + int vals[] = {0, 5, 0, 10, 0, 15, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -595,8 +592,8 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = {0, 1, 2, 7, 17, 27, 100}; - int vals[] = {0, 5, 10, 0, 15, 0}; + int keys[] = {0, 1, 2, 7, 17, 27, 100}; + int vals[] = {0, 5, 10, 0, 15, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -605,8 +602,8 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = {0, 1, 6, 16, 26, 100}; - int vals[] = {5, 10, 0, 15, 0}; + int keys[] = {0, 1, 6, 16, 26, 100}; + int vals[] = {5, 10, 0, 15, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -617,7 +614,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = {0, 1, 6, 100}; + int keys[] = {0, 1, 6, 100}; int vals[] = {5, 10, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -628,8 +625,8 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = {0, 1, 6, 10, 20, 30, 40, 100}; - int vals[] = {5, 10, 0, 400, 0, 400, 0}; + int keys[] = {0, 1, 6, 10, 20, 30, 40, 100}; + int vals[] = {5, 10, 0, 400, 0, 400, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -639,8 +636,8 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = {0, 1, 6, 10, 30, 100}; - int vals[] = {5, 10, 0, 400, 0}; + int keys[] = {0, 1, 6, 10, 30, 100}; + int vals[] = {5, 10, 0, 400, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -660,7 +657,7 @@ db.shift_left(2, 100); build_and_dump(db); { - int keys[] = {0, 100}; + int keys[] = {0, 100}; bool vals[] = {false}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -668,7 +665,7 @@ db.insert_front(20, 100, true); build_and_dump(db); { - int keys[] = { 0, 20, 100}; + int keys[] = {0, 20, 100}; bool vals[] = {false, true}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -678,7 +675,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 20, 80, 100}; + int keys[] = {0, 20, 80, 100}; bool vals[] = {false, true, false}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -689,7 +686,7 @@ assert(db.is_tree_valid()); // tree must still be valid. build_and_dump(db); { - int keys[] = { 0, 20, 80, 100}; + int keys[] = {0, 20, 80, 100}; bool vals[] = {false, true, false}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -699,7 +696,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 20, 80, 85, 100}; + int keys[] = {0, 20, 80, 85, 100}; bool vals[] = {false, true, false, true}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -708,7 +705,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 20, 80, 85, 95, 100}; + int keys[] = {0, 20, 80, 85, 95, 100}; bool vals[] = {false, true, false, true, false}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -722,7 +719,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 100}; + int keys[] = {0, 100}; bool vals[] = {true}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -731,7 +728,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 90, 100}; + int keys[] = {0, 90, 100}; bool vals[] = {true, false}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -744,7 +741,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 10, 20, 60, 80, 100}; + int keys[] = {0, 10, 20, 60, 80, 100}; bool vals[] = {true, false, true, false, true}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -753,7 +750,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = { 0, 10, 30, 100}; + int keys[] = {0, 10, 30, 100}; bool vals[] = {false, true, false}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -764,15 +761,15 @@ stack_printer __stack_printer__("fst_test_shift_segment_right_init0"); flat_segment_tree db(0, 100, 0); - db.insert_front(0, 10, 15); - db.insert_front(10, 20, 1); - db.insert_front(20, 30, 2); - db.insert_front(30, 40, 3); - db.insert_front(40, 50, 4); - db.insert_front(50, 60, 5); - db.insert_front(60, 70, 6); - db.insert_front(70, 80, 7); - db.insert_front(80, 90, 8); + db.insert_front(0, 10, 15); + db.insert_front(10, 20, 1); + db.insert_front(20, 30, 2); + db.insert_front(30, 40, 3); + db.insert_front(40, 50, 4); + db.insert_front(50, 60, 5); + db.insert_front(60, 70, 6); + db.insert_front(70, 80, 7); + db.insert_front(80, 90, 8); assert(!db.is_tree_valid()); build_and_dump(db); @@ -783,8 +780,8 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - int keys[] = {0, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95,100}; - int vals[] = {0, 15, 1, 2, 3, 4, 5, 6, 7, 8, 0}; + int keys[] = {0, 5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 100}; + int vals[] = {0, 15, 1, 2, 3, 4, 5, 6, 7, 8, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -796,7 +793,7 @@ build_and_dump(db); { int keys[] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; - int vals[] = {0, 15, 1, 2, 3, 4, 5, 6, 7, 8}; + int vals[] = {0, 15, 1, 2, 3, 4, 5, 6, 7, 8}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -806,7 +803,7 @@ build_and_dump(db); { int keys[] = {0, 59, 69, 79, 89, 99, 100}; - int vals[] = {0, 15, 1, 2, 3, 4}; + int vals[] = {0, 15, 1, 2, 3, 4}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -817,7 +814,7 @@ build_and_dump(db); { int keys[] = {0, 70, 80, 90, 100}; - int vals[] = {0, 15, 1, 2}; + int vals[] = {0, 15, 1, 2}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -838,7 +835,7 @@ build_and_dump(db); { int keys[] = {0, 5, 10, 20, 30, 100}; - int vals[] = {0, 5, 0, 5, 0}; + int vals[] = {0, 5, 0, 5, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -849,7 +846,7 @@ build_and_dump(db); { int keys[] = {0, 5, 30, 40, 50, 100}; - int vals[] = {0, 5, 0, 5, 0}; + int vals[] = {0, 5, 0, 5, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -859,7 +856,7 @@ build_and_dump(db); { int keys[] = {0, 25, 50, 60, 70, 100}; - int vals[] = {0, 5, 0, 5, 0}; + int vals[] = {0, 5, 0, 5, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -869,7 +866,7 @@ build_and_dump(db); { int keys[] = {0, 25, 50, 60, 100}; - int vals[] = {0, 5, 0, 5}; + int vals[] = {0, 5, 0, 5}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } @@ -879,7 +876,7 @@ build_and_dump(db); { int keys[] = {0, 25, 90, 100}; - int vals[] = {0, 5, 0}; + int vals[] = {0, 5, 0}; assert(check_leaf_nodes(db, keys, vals, ARRAY_SIZE(keys))); } } @@ -962,7 +959,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - long k[] = {0, 3, 7, 1048576}; + long k[] = {0, 3, 7, 1048576}; short v[] = {0, 5, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -971,7 +968,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - long k[] = {0, 3, 9, 1048576}; + long k[] = {0, 3, 9, 1048576}; short v[] = {0, 5, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -981,7 +978,7 @@ assert(!db.is_tree_valid()); build_and_dump(db); { - long k[] = {0, 4, 9, 1048576}; + long k[] = {0, 4, 9, 1048576}; short v[] = {2, 5, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -989,7 +986,7 @@ db.shift_right(0, 2, true); build_and_dump(db); { - long k[] = {0, 6, 11, 1048576}; + long k[] = {0, 6, 11, 1048576}; short v[] = {2, 5, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -1032,9 +1029,8 @@ template struct leaf_node_functor { - void operator() (const pair&) const - { - } + void operator()(const pair&) const + {} }; void fst_test_const_iterator() @@ -1042,8 +1038,8 @@ stack_printer __stack_printer__("::fst_test_const_iterator"); { - typedef unsigned int key_type; - typedef unsigned short value_type; + typedef unsigned int key_type; + typedef unsigned short value_type; unsigned short max_value = numeric_limits::max(); typedef flat_segment_tree container_type; @@ -1051,7 +1047,7 @@ build_and_dump(db); { - unsigned int k[] = {0, 1000}; + unsigned int k[] = {0, 1000}; unsigned short v[] = {max_value}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -1061,7 +1057,7 @@ db.insert_front(100, 300, 55); build_and_dump(db); { - unsigned int k[] = {0, 10, 20, 50, 100, 300, 1000}; + unsigned int k[] = {0, 10, 20, 50, 100, 300, 1000}; unsigned short v[] = {max_value, 10, 20, max_value, 55, max_value}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); fprintf(stdout, "fst_test_const_iterator: leaf nodes valid\n"); @@ -1135,7 +1131,7 @@ container_type db_front(start_key, end_key, default_value); for (key_type i = start_key; i < end_key - 10; ++i) { - itr_type itr = db_front.insert_front(i, i+1, val).first; + itr_type itr = db_front.insert_front(i, i + 1, val).first; assert(itr->first == i); assert(itr->second == val); if (++val > 10) @@ -1147,7 +1143,7 @@ val = 0; for (key_type i = start_key; i < end_key - 10; ++i) { - itr_type itr = db_back.insert_back(i, i+1, val).first; + itr_type itr = db_back.insert_back(i, i + 1, val).first; assert(itr->first == i); assert(itr->second == val); if (++val > 10) @@ -1160,7 +1156,8 @@ // They are not identical! db_front.dump_leaf_nodes(); db_back.dump_leaf_nodes(); - cout << "start_key = " << start_key << " end_key = " << end_key << " default_value = " << default_value << endl; + cout << "start_key = " << start_key << " end_key = " << end_key << " default_value = " << default_value + << endl; assert(!"Contents of the two containers are not identical!"); } } @@ -1168,7 +1165,7 @@ void fst_perf_test_insert_front_back() { typedef unsigned long key_type; - typedef int value_type; + typedef int value_type; typedef flat_segment_tree container_type; key_type upper_bound = 20000; { @@ -1177,7 +1174,7 @@ value_type val = 0; for (key_type i = 0; i < upper_bound; ++i) { - db.insert_front(i, i+1, val); + db.insert_front(i, i + 1, val); if (++val > 10) val = 0; } @@ -1189,7 +1186,7 @@ value_type val = 0; for (key_type i = 0; i < upper_bound; ++i) { - db.insert_back(i, i+1, val); + db.insert_back(i, i + 1, val); if (++val > 10) val = 0; } @@ -1200,7 +1197,7 @@ { stack_printer __stack_printer__("::fst_test_copy_ctor"); typedef unsigned long key_type; - typedef int value_type; + typedef int value_type; typedef flat_segment_tree fst; // Test copy construction of node first. @@ -1208,7 +1205,7 @@ { // Original node. fst::node_ptr node1(new fst::node); - node1->value_leaf.key = 10; + node1->value_leaf.key = 10; node1->value_leaf.value = 500; assert(node1->is_leaf); assert(!node1->parent); @@ -1225,7 +1222,7 @@ assert(node2->value_leaf.value == 500); // Changing the values of the original should not modify the second node. - node1->value_leaf.key = 35; + node1->value_leaf.key = 35; node1->value_leaf.value = 200; assert(node2->value_leaf.key == 10); assert(node2->value_leaf.value == 500); @@ -1234,7 +1231,7 @@ { // Test non-leaf node objects. fst::nonleaf_node node1; - node1.value_nonleaf.low = 123; + node1.value_nonleaf.low = 123; node1.value_nonleaf.high = 789; // Test the copying of non-leaf values. @@ -1254,7 +1251,7 @@ fst db_copied(db); assert(db == db_copied); { - key_type k[] = {0, 100}; + key_type k[] = {0, 100}; value_type v[] = {5}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -1265,8 +1262,8 @@ db_copied.insert_front(5, 10, 0); assert(db == db_copied); { - key_type k[] = {0, 5, 10, 100}; - value_type v[] = {5, 0, 5}; + key_type k[] = {0, 5, 10, 100}; + value_type v[] = {5, 0, 5}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -1274,8 +1271,8 @@ db_copied.insert_front(15, 20, 35); assert(db != db_copied); { - key_type k[] = {0, 5, 10, 15, 20, 100}; - value_type v[] = {5, 0, 5, 35, 5}; + key_type k[] = {0, 5, 10, 15, 20, 100}; + value_type v[] = {5, 0, 5, 35, 5}; assert(check_leaf_nodes(db_copied, k, v, ARRAY_SIZE(k))); } @@ -1300,7 +1297,7 @@ { stack_printer __stack_printer__("::fst_test_equality"); typedef unsigned long key_type; - typedef int value_type; + typedef int value_type; typedef flat_segment_tree container_type; container_type db1(0, 100, 0); @@ -1338,63 +1335,63 @@ void fst_test_back_insert() { stack_printer __stack_printer__("::fst_test_back_insert"); - typedef unsigned int key_type; + typedef unsigned int key_type; typedef unsigned short value_type; typedef flat_segment_tree container_type; container_type db(0, 100, 0); db.insert_back(1, 2, 1); { - unsigned int k[] = {0, 1, 2, 100}; + unsigned int k[] = {0, 1, 2, 100}; unsigned short v[] = {0, 1, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(3, 4, 2); { - unsigned int k[] = {0, 1, 2, 3, 4, 100}; + unsigned int k[] = {0, 1, 2, 3, 4, 100}; unsigned short v[] = {0, 1, 0, 2, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(4, 5, 2); { - unsigned int k[] = {0, 1, 2, 3, 5, 100}; + unsigned int k[] = {0, 1, 2, 3, 5, 100}; unsigned short v[] = {0, 1, 0, 2, 0}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(90, 120, 10); { - unsigned int k[] = {0, 1, 2, 3, 5, 90, 100}; + unsigned int k[] = {0, 1, 2, 3, 5, 90, 100}; unsigned short v[] = {0, 1, 0, 2, 0, 10}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(0, 10, 20); { - unsigned int k[] = {0, 10, 90, 100}; + unsigned int k[] = {0, 10, 90, 100}; unsigned short v[] = {20, 0, 10}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(5, 20, 20); { - unsigned int k[] = {0, 20, 90, 100}; + unsigned int k[] = {0, 20, 90, 100}; unsigned short v[] = {20, 0, 10}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(15, 30, 5); { - unsigned int k[] = {0, 15, 30, 90, 100}; - unsigned short v[] = {20, 5, 0, 10}; + unsigned int k[] = {0, 15, 30, 90, 100}; + unsigned short v[] = {20, 5, 0, 10}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } db.insert_back(0, 1, 2); { - unsigned int k[] = {0, 1, 15, 30, 90, 100}; - unsigned short v[] = {2, 20, 5, 0, 10}; + unsigned int k[] = {0, 1, 15, 30, 90, 100}; + unsigned short v[] = {2, 20, 5, 0, 10}; assert(check_leaf_nodes(db, k, v, ARRAY_SIZE(k))); } @@ -1402,7 +1399,7 @@ } template -void print_iterator(typename flat_segment_tree::const_iterator& itr) +void print_iterator(typename flat_segment_tree::const_iterator& itr) { cout << "iterator: (key=" << itr->first << ",value=" << itr->second << ")" << endl; } @@ -1578,7 +1575,7 @@ bool val = false; for (long i = 0; i < upper; ++i) { - db.insert_front(i, i+1, val); + db.insert_front(i, i + 1, val); val = !val; } } @@ -1589,7 +1586,7 @@ bool val = false; for (long i = 0; i < upper; ++i) { - db.insert_back(i, i+1, val); + db.insert_back(i, i + 1, val); val = !val; } } @@ -1602,7 +1599,7 @@ bool val = false; for (long i = 0; i < upper; ++i) { - ret_type ret = db.insert(itr, i, i+1, val); + ret_type ret = db.insert(itr, i, i + 1, val); val = !val; itr = ret.first; } @@ -1613,7 +1610,7 @@ bool val = true; for (long i = 0; i < upper; ++i) { - ret_type ret = db.insert(itr, i, i+1, val); + ret_type ret = db.insert(itr, i, i + 1, val); val = !val; itr = ret.first; } @@ -1633,7 +1630,7 @@ bool val = false; for (long i = 0; i < upper; ++i) { - ret_type ret = db.insert(itr, i, i+1, val); + ret_type ret = db.insert(itr, i, i + 1, val); val = !val; itr = ret.first; } @@ -1663,9 +1660,8 @@ template bool check_pos_search_result( - const flat_segment_tree& db, - typename flat_segment_tree::const_iterator& itr, - K key, K start_expected, K end_expected, V value_expected) + const flat_segment_tree& db, typename flat_segment_tree::const_iterator& itr, K key, K start_expected, + K end_expected, V value_expected) { typedef flat_segment_tree db_type; typedef pair ret_type; @@ -1678,9 +1674,8 @@ cout << "expected: start=" << start_expected << " end=" << end_expected << " value=" << value_expected << endl; cout << "observed: start=" << _start << " end=" << _end << " value=" << _val << endl; - bool result = - _start == start_expected && _end == end_expected && _val == value_expected && - r.first->first == start_expected && r.first->second == value_expected; + bool result = _start == start_expected && _end == end_expected && _val == value_expected && + r.first->first == start_expected && r.first->second == value_expected; itr = r.first; return result; } @@ -1697,17 +1692,12 @@ db_type db2(-10, 10, 1); - struct { + struct + { long start_range; long end_range; short value_expected; - } params[] = { - { 0, 10, 0 }, - { 10, 20, 1 }, - { 20, 30, 0 }, - { 30, 50, 5 }, - { 50, 100, 0 } - }; + } params[] = {{0, 10, 0}, {10, 20, 1}, {20, 30, 0}, {30, 50, 5}, {50, 100, 0}}; size_t n = sizeof(params) / sizeof(params[0]); @@ -1786,8 +1776,8 @@ // Check the content of db1. { - db_type::key_type k[] = {0, 20, 30, 40, 50, 200}; - db_type::value_type v[] = {20, 1, 2, 3, 20}; + db_type::key_type k[] = {0, 20, 30, 40, 50, 200}; + db_type::value_type v[] = {20, 1, 2, 3, 20}; assert(check_leaf_nodes(db1, k, v, ARRAY_SIZE(k))); } assert(db1.min_key() == 0); @@ -1799,8 +1789,8 @@ // Now db2 should inherit the content of db1. { - db_type::key_type k[] = {0, 20, 30, 40, 50, 200}; - db_type::value_type v[] = {20, 1, 2, 3, 20}; + db_type::key_type k[] = {0, 20, 30, 40, 50, 200}; + db_type::value_type v[] = {20, 1, 2, 3, 20}; assert(check_leaf_nodes(db2, k, v, ARRAY_SIZE(k))); } assert(db2.min_key() == 0); @@ -2106,7 +2096,7 @@ assert(it_moved->value == false); } -int main (int argc, char **argv) +int main(int argc, char** argv) { try { @@ -2120,21 +2110,21 @@ fst_test_copy_ctor(); fst_test_back_insert(); { - typedef unsigned int key_type; + typedef unsigned int key_type; typedef unsigned short value_type; for (value_type i = 0; i <= 100; ++i) fst_test_insert_front_back(0, 100, i); } { - typedef int key_type; + typedef int key_type; typedef short value_type; for (value_type i = 0; i <= 100; ++i) fst_test_insert_front_back(0, 100, i); } { - typedef long key_type; + typedef long key_type; typedef unsigned int value_type; for (value_type i = 0; i <= 100; ++i) fst_test_insert_front_back(0, 100, i); @@ -2185,4 +2175,3 @@ fprintf(stdout, "Test finished successfully!\n"); return 0; } - diff -Nru mdds-2.0.2/test/gdb/Makefile.in mdds-2.0.3/test/gdb/Makefile.in --- mdds-2.0.2/test/gdb/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/gdb/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -148,8 +148,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir DIST_SUBDIRS = $(SUBDIRS) @@ -191,9 +189,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -205,11 +204,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -441,7 +439,7 @@ @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp @echo 'set srcdir "$(srcdir)"' >>site.tmp - @echo "set objdir `pwd`" >>site.tmp + @echo "set objdir \"`pwd`\"" >>site.tmp @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ echo "## Begin content included from file $$f. Do not modify. ##" \ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ @@ -461,7 +459,6 @@ -l='$(DEJATOOL)'; for tool in $$l; do \ rm -f $$tool.sum $$tool.log; \ done - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/gdb/src/Makefile.in mdds-2.0.3/test/gdb/src/Makefile.in --- mdds-2.0.2/test/gdb/src/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/gdb/src/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -169,8 +169,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ @@ -184,9 +182,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ -O0 -ggdb2 @@ -198,11 +197,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -548,7 +546,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/gdb/src/point_quad_tree.cpp mdds-2.0.3/test/gdb/src/point_quad_tree.cpp --- mdds-2.0.2/test/gdb/src/point_quad_tree.cpp 2019-04-29 22:31:40.000000000 +0000 +++ mdds-2.0.3/test/gdb/src/point_quad_tree.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -33,9 +33,9 @@ point_quad_tree pqt_string; pqt_string.insert(25, 32, "a"); - pqt_string.insert( 5, 45, "b"); + pqt_string.insert(5, 45, "b"); pqt_string.insert(52, 10, "c"); - pqt_string.insert(80, 5, "d"); + pqt_string.insert(80, 5, "d"); pqt_string.insert(40, 50, "e"); pqt_string.insert(10, 10, "f"); diff -Nru mdds-2.0.2/test/gdb/src/sorted_string_map.cpp mdds-2.0.3/test/gdb/src/sorted_string_map.cpp --- mdds-2.0.2/test/gdb/src/sorted_string_map.cpp 2019-04-14 14:20:54.000000000 +0000 +++ mdds-2.0.3/test/gdb/src/sorted_string_map.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -26,12 +26,11 @@ { sorted_string_map empty_ssmap(nullptr, 0, 0); - sorted_string_map::entry entries[] = - { - { MDDS_ASCII("aaaa"), 1 }, - { MDDS_ASCII("bbb"), 2 }, - { MDDS_ASCII("cc"), 3 }, - { MDDS_ASCII("d"), 4 }, + sorted_string_map::entry entries[] = { + {MDDS_ASCII("aaaa"), 1}, + {MDDS_ASCII("bbb"), 2}, + {MDDS_ASCII("cc"), 3}, + {MDDS_ASCII("d"), 4}, }; size_t entry_count = sizeof(entries) / sizeof(entries[0]); sorted_string_map ssmap_int(entries, entry_count, 0); diff -Nru mdds-2.0.2/test/gdb/src/test.cpp mdds-2.0.3/test/gdb/src/test.cpp --- mdds-2.0.2/test/gdb/src/test.cpp 2021-11-23 00:24:18.000000000 +0000 +++ mdds-2.0.3/test/gdb/src/test.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -26,10 +26,10 @@ void test_trie_map(); void stop() -{ -} +{} -int main() try +int main() +try { test_flat_segment_tree(); test_multi_type_matrix(); diff -Nru mdds-2.0.2/test/gdb/src/trie_map.cpp mdds-2.0.3/test/gdb/src/trie_map.cpp --- mdds-2.0.2/test/gdb/src/trie_map.cpp 2019-04-29 22:31:40.000000000 +0000 +++ mdds-2.0.3/test/gdb/src/trie_map.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -51,21 +51,19 @@ auto tm_search_iter_end = tm_search_one.end(); auto tm_search_iter_empty = tm_search_empty.begin(); - packed_trie_map::entry entries_int[] = - { - { MDDS_ASCII("a"), 13 }, - { MDDS_ASCII("aa"), 10 }, - { MDDS_ASCII("ab"), 3 }, - { MDDS_ASCII("b"), 7 }, + packed_trie_map::entry entries_int[] = { + {MDDS_ASCII("a"), 13}, + {MDDS_ASCII("aa"), 10}, + {MDDS_ASCII("ab"), 3}, + {MDDS_ASCII("b"), 7}, }; packed_trie_map empty_ptm(entries_int, 0); packed_trie_map ptm_int(entries_int, MDDS_N_ELEMENTS(entries_int)); - packed_trie_map::entry entries_str[] = - { - { MDDS_ASCII("a"), "13" }, - { MDDS_ASCII("aa"), "10" }, - { MDDS_ASCII("ab"), "3" }, - { MDDS_ASCII("b"), "7" }, + packed_trie_map::entry entries_str[] = { + {MDDS_ASCII("a"), "13"}, + {MDDS_ASCII("aa"), "10"}, + {MDDS_ASCII("ab"), "3"}, + {MDDS_ASCII("b"), "7"}, }; packed_trie_map ptm_str(entries_str, MDDS_N_ELEMENTS(entries_str)); diff -Nru mdds-2.0.2/test/include/test_global.hpp mdds-2.0.3/test/include/test_global.hpp --- mdds-2.0.2/test/include/test_global.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/include/test_global.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -87,8 +87,8 @@ double m_start_time; }; -using std::cout; using std::cerr; +using std::cout; using std::endl; #endif diff -Nru mdds-2.0.2/test/Makefile.in mdds-2.0.3/test/Makefile.in --- mdds-2.0.2/test/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -148,8 +148,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -189,9 +187,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -203,11 +202,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -417,7 +415,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_matrix_test.cpp mdds-2.0.3/test/multi_type_matrix_test.cpp --- mdds-2.0.2/test/multi_type_matrix_test.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_matrix_test.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -45,16 +45,29 @@ class custom_string { string m_val; + public: - custom_string() {} - custom_string(const string& val) : m_val(val) {} - custom_string(const custom_string& r) : m_val(r.m_val) {} - const string& get() const { return m_val; } - bool operator== (const custom_string& r) const { return m_val == r.m_val; } - bool operator!= (const custom_string& r) const { return !operator==(r); } + custom_string() + {} + custom_string(const string& val) : m_val(val) + {} + custom_string(const custom_string& r) : m_val(r.m_val) + {} + const string& get() const + { + return m_val; + } + bool operator==(const custom_string& r) const + { + return m_val == r.m_val; + } + bool operator!=(const custom_string& r) const + { + return !operator==(r); + } }; -ostream& operator<< (ostream& os, const custom_string& str) +ostream& operator<<(ostream& os, const custom_string& str) { os << str.get(); return os; @@ -87,7 +100,7 @@ bool check_copy(const mtx_type& mx1, const mtx_type& mx2) { - size_t row_count = min(mx1.size().row, mx2.size().row); + size_t row_count = min(mx1.size().row, mx2.size().row); size_t col_count = min(mx1.size().column, mx2.size().column); for (size_t i = 0; i < row_count; ++i) { @@ -108,31 +121,30 @@ cout << "check_copy: (row=" << i << ",column=" << j << ") different boolean values." << endl; return false; } - break; + break; case mtm::element_numeric: if (mx1.get(i, j) != mx2.get(i, j)) { cout << "check_copy: (row=" << i << ",column=" << j << ") different numeric values." << endl; return false; } - break; + break; case mtm::element_string: if (mx1.get(i, j) != mx2.get(i, j)) { cout << "check_copy: (row=" << i << ",column=" << j << ") different string values." << endl; return false; } - break; + break; case mtm::element_empty: - default: - ; + default:; } } } return true; } -} +} // namespace void mtm_test_construction() { @@ -156,10 +168,10 @@ mtx_type mtx(2, 5, string("foo")); mtx_type::size_pair_type sz = mtx.size(); assert(sz.row == 2 && sz.column == 5); - assert(mtx.get_type(0,0) == mtm::element_string); - assert(mtx.get_string(0,0) == "foo"); - assert(mtx.get_type(1,4) == mtm::element_string); - assert(mtx.get_string(1,4) == "foo"); + assert(mtx.get_type(0, 0) == mtm::element_string); + assert(mtx.get_string(0, 0) == "foo"); + assert(mtx.get_type(1, 4) == mtm::element_string); + assert(mtx.get_string(1, 4) == "foo"); } { @@ -172,10 +184,10 @@ mtx_type mtx(2, 2, vals.begin(), vals.end()); mtx_type::size_pair_type sz = mtx.size(); assert(sz.row == 2 && sz.column == 2); - assert(mtx.get_numeric(0,0) == 1.1); - assert(mtx.get_numeric(1,0) == 1.2); - assert(mtx.get_numeric(0,1) == 1.3); - assert(mtx.get_numeric(1,1) == 1.4); + assert(mtx.get_numeric(0, 0) == 1.1); + assert(mtx.get_numeric(1, 0) == 1.2); + assert(mtx.get_numeric(0, 1) == 1.3); + assert(mtx.get_numeric(1, 1) == 1.4); try { @@ -210,14 +222,14 @@ vals.push_back(custom_string("C")); vals.push_back(custom_string("D")); mtx_custom_type mtx(1, 4, vals.begin(), vals.end()); - assert(mtx.get_string(0,0).get() == "A"); - assert(mtx.get_string(0,1).get() == "B"); - assert(mtx.get_string(0,2).get() == "C"); - assert(mtx.get_string(0,3).get() == "D"); - assert(mtx.get_type(0,0) == mtm::element_string); - assert(mtx.get_type(0,1) == mtm::element_string); - assert(mtx.get_type(0,2) == mtm::element_string); - assert(mtx.get_type(0,3) == mtm::element_string); + assert(mtx.get_string(0, 0).get() == "A"); + assert(mtx.get_string(0, 1).get() == "B"); + assert(mtx.get_string(0, 2).get() == "C"); + assert(mtx.get_string(0, 3).get() == "D"); + assert(mtx.get_type(0, 0) == mtm::element_string); + assert(mtx.get_type(0, 1) == mtm::element_string); + assert(mtx.get_type(0, 2) == mtm::element_string); + assert(mtx.get_type(0, 3) == mtm::element_string); } { @@ -237,8 +249,8 @@ mtx_type::size_pair_type sz = mtx.size(); assert(sz.row == 3 && sz.column == 4); assert(!mtx.empty()); - assert(mtx.get_type(0,0) == mtm::element_empty); - assert(mtx.get_type(2,3) == mtm::element_empty); + assert(mtx.get_type(0, 0) == mtm::element_empty); + assert(mtx.get_type(2, 3) == mtm::element_empty); check_value(mtx, 1, 1, 1.2); check_value(mtx, 2, 1, true); check_value(mtx, 3, 1, false); @@ -246,13 +258,13 @@ check_value(mtx, 1, 2, 23.4); // Overwrite - assert(mtx.get_type(1,1) == mtm::element_numeric); + assert(mtx.get_type(1, 1) == mtm::element_numeric); check_value(mtx, 1, 1, string("baa")); // Setting empty. - assert(mtx.get_type(1,1) == mtm::element_string); + assert(mtx.get_type(1, 1) == mtm::element_string); mtx.set_empty(1, 1); - assert(mtx.get_type(1,1) == mtm::element_empty); + assert(mtx.get_type(1, 1) == mtm::element_empty); mtx.clear(); assert(mtx.size().row == 0); @@ -337,7 +349,7 @@ assert(mtx.get_boolean(0, 1) == true); assert(mtx.get_boolean(1, 0) == true); - assert(mtx.numeric()); // integers are considered numeric. + assert(mtx.numeric()); // integers are considered numeric. assert(mtx.get(0, 0) == 0); assert(mtx.get(1, 1) == 22); @@ -355,10 +367,7 @@ vector nodes; std::function f = - [&nodes](const mtx_type::element_block_node_type& node) - { - nodes.push_back(node); - }; + [&nodes](const mtx_type::element_block_node_type& node) { nodes.push_back(node); }; mtx.walk(f); @@ -371,7 +380,7 @@ assert(nodes[2].size == 2); { - auto it = nodes[2].begin(); + auto it = nodes[2].begin(); auto ite = nodes[2].end(); assert(*it == 987); ++it; @@ -1003,9 +1012,10 @@ { double result; - sum_all_values() : result(0.0) {} + sum_all_values() : result(0.0) + {} - void operator() (const mtx_type::element_block_node_type& blk) + void operator()(const mtx_type::element_block_node_type& blk) { mtv::double_element_block::const_iterator it = mtv::double_element_block::cbegin(*blk.data); mtv::double_element_block::const_iterator it_end = mtv::double_element_block::cend(*blk.data); @@ -1025,7 +1035,7 @@ stack_watch sw; double val = 1.0; std::vector vals; - vals.reserve(rowsize*colsize); + vals.reserve(rowsize * colsize); for (size_t i = 0; i < rowsize; ++i) { for (size_t j = 0; j < colsize; ++j) @@ -1043,7 +1053,8 @@ sum_all_values func; mx.walk(func); double val = func.result; - cout << "all element values added. (answer: " << val << ") (duration: " << sw.get_duration() << " sec)" << endl; + cout << "all element values added. (answer: " << val << ") (duration: " << sw.get_duration() << " sec)" + << endl; } } @@ -1085,7 +1096,7 @@ } } -int main (int argc, char **argv) +int main(int argc, char** argv) { try { diff -Nru mdds-2.0.2/test/multi_type_matrix_test_walk.cpp mdds-2.0.3/test/multi_type_matrix_test_walk.cpp --- mdds-2.0.2/test/multi_type_matrix_test_walk.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_matrix_test_walk.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -39,7 +39,7 @@ // Standard matrix that uses std::string as its string type. typedef multi_type_matrix mtx_type; -inline std::ostream& operator<< (std::ostream& os, const mtx_type::element_block_node_type& node) +inline std::ostream& operator<<(std::ostream& os, const mtx_type::element_block_node_type& node) { os << "(type=" << node.type << "; offset=" << node.offset << "; size=" << node.size << ")"; return os; @@ -48,7 +48,7 @@ template struct print_element { - void operator() (const _T& v) const + void operator()(const _T& v) const { cout << v << endl; } @@ -59,7 +59,7 @@ size_t m_node_count = 0; public: - void operator() (const mtx_type::element_block_node_type& node) + void operator()(const mtx_type::element_block_node_type& node) { switch (node.type) { @@ -92,15 +92,17 @@ break; case mtm::element_empty: cout << "- empty block -" << endl; - break; - default: - ; + break; + default:; } ++m_node_count; } - size_t get_node_count() const { return m_node_count; } + size_t get_node_count() const + { + return m_node_count; + } }; class walk_element_block_move_only @@ -108,26 +110,30 @@ size_t m_node_count = 0; public: - walk_element_block_move_only() {} + walk_element_block_move_only() + {} walk_element_block_move_only(walk_element_block_move_only&& other) : m_node_count(other.m_node_count) { other.m_node_count = 0; } - walk_element_block_move_only& operator= (walk_element_block_move_only&& other) + walk_element_block_move_only& operator=(walk_element_block_move_only&& other) { m_node_count = other.m_node_count; other.m_node_count = 0; return *this; } - void operator() (const mtx_type::element_block_node_type& /*node*/) + void operator()(const mtx_type::element_block_node_type& /*node*/) { ++m_node_count; } - size_t get_node_count() const { return m_node_count; } + size_t get_node_count() const + { + return m_node_count; + } }; void mtm_test_walk() @@ -164,7 +170,7 @@ mtx.set(1, 2, string("A2")); mtx.set(2, 2, false); walk_element_block func; - func = mtx.walk(func, mtx_type::size_pair_type(1,1), mtx_type::size_pair_type(2, 2)); + func = mtx.walk(func, mtx_type::size_pair_type(1, 1), mtx_type::size_pair_type(2, 2)); assert(func.get_node_count() == 3); } { @@ -177,7 +183,7 @@ mtx.set(2, 2, string("A3")); mtx.set(3, 2, string("A4")); walk_element_block func; - func = mtx.walk(func, mtx_type::size_pair_type(1,1), mtx_type::size_pair_type(2, 2)); + func = mtx.walk(func, mtx_type::size_pair_type(1, 1), mtx_type::size_pair_type(2, 2)); assert(func.get_node_count() == 3); } } @@ -187,30 +193,25 @@ { auto it = node.begin<_Blk>(); auto ite = node.end<_Blk>(); - std::for_each(it, ite, - [&](const typename _Blk::value_type& v) - { - ostringstream os; - os << v; - buf.push_back(os.str()); - } - ); + std::for_each(it, ite, [&](const typename _Blk::value_type& v) { + ostringstream os; + os << v; + buf.push_back(os.str()); + }); } template<> -void push_to_buffer(const mtx_type::element_block_node_type& node, std::vector& buf) +void push_to_buffer( + const mtx_type::element_block_node_type& node, std::vector& buf) { using blk_type = mtx_type::boolean_block_type; auto it = node.begin(); auto ite = node.end(); - std::for_each(it, ite, - [&](bool v) - { - ostringstream os; - os << (v ? "true" : "false"); - buf.push_back(os.str()); - } - ); + std::for_each(it, ite, [&](bool v) { + ostringstream os; + os << (v ? "true" : "false"); + buf.push_back(os.str()); + }); } class parallel_walk_element_block @@ -227,34 +228,33 @@ { case mtm::element_boolean: push_to_buffer(node, buf); - break; + break; case mtm::element_string: push_to_buffer(node, buf); - break; + break; case mtm::element_numeric: push_to_buffer(node, buf); - break; + break; case mtm::element_empty: for (size_t i = 0; i < node.size; ++i) buf.push_back("' '"); - break; - default: - ; + break; + default:; } } + public: - parallel_walk_element_block(std::string name) : - m_name(std::move(name)), - m_ls(std::make_shared()), - m_rs(std::make_shared()) {} - parallel_walk_element_block(const parallel_walk_element_block& other) : - m_name(other.m_name), - m_ls(other.m_ls), m_rs(other.m_rs) {} - parallel_walk_element_block(parallel_walk_element_block&& other) : - m_name(std::move(other.m_name)), - m_ls(std::move(other.m_ls)), m_rs(std::move(other.m_rs)) {} + parallel_walk_element_block(std::string name) + : m_name(std::move(name)), m_ls(std::make_shared()), m_rs(std::make_shared()) + {} + parallel_walk_element_block(const parallel_walk_element_block& other) + : m_name(other.m_name), m_ls(other.m_ls), m_rs(other.m_rs) + {} + parallel_walk_element_block(parallel_walk_element_block&& other) + : m_name(std::move(other.m_name)), m_ls(std::move(other.m_ls)), m_rs(std::move(other.m_rs)) + {} - parallel_walk_element_block& operator= (parallel_walk_element_block other) + parallel_walk_element_block& operator=(parallel_walk_element_block other) { swap(other); return *this; @@ -266,7 +266,7 @@ m_rs.swap(other.m_rs); } - void operator() (const mtx_type::element_block_node_type& left, const mtx_type::element_block_node_type& right) + void operator()(const mtx_type::element_block_node_type& left, const mtx_type::element_block_node_type& right) { cout << "--" << endl; cout << "l: " << left << endl; @@ -297,9 +297,15 @@ m_rs->clear(); } - const std::string& get_name() const { return m_name; } + const std::string& get_name() const + { + return m_name; + } - void set_name(std::string name) { m_name = std::move(name); } + void set_name(std::string name) + { + m_name = std::move(name); + } }; bool check_concat_buffer(std::vector concat, const char* expected[], size_t expected_size) @@ -342,19 +348,11 @@ assert(func.get_name() == "test0"); const char* expected[] = { - "122:'+'", - "' ':'+'", - "' ':1.2", - "' ':'+'", - "A12:'+'", - "A25:'+'", - "' ':'+'", - "' ':'+'", - "' ':false", - "' ':true", + "122:'+'", "' ':'+'", "' ':1.2", "' ':'+'", "A12:'+'", + "A25:'+'", "' ':'+'", "' ':'+'", "' ':false", "' ':true", }; - size_t n = MDDS_N_ELEMENTS(expected); + size_t n = std::size(expected); assert(check_concat_buffer(func.get_concat_buffer(), expected, n)); } @@ -366,16 +364,10 @@ assert(func.get_name() == "test0-2"); const char* expected[] = { - "' ':1.2", - "' ':'+'", - "A12:'+'", - "A25:'+'", - "' ':'+'", - "' ':'+'", - "' ':false", + "' ':1.2", "' ':'+'", "A12:'+'", "A25:'+'", "' ':'+'", "' ':'+'", "' ':false", }; - size_t n = MDDS_N_ELEMENTS(expected); + size_t n = std::size(expected); assert(check_concat_buffer(func.get_concat_buffer(), expected, n)); } @@ -391,7 +383,7 @@ "A12:'+'", }; - size_t n = MDDS_N_ELEMENTS(expected); + size_t n = std::size(expected); assert(check_concat_buffer(func.get_concat_buffer(), expected, n)); } } @@ -430,7 +422,7 @@ "50:D", }; - size_t n = MDDS_N_ELEMENTS(expected); + size_t n = std::size(expected); assert(check_concat_buffer(func.get_concat_buffer(), expected, n)); } @@ -453,7 +445,7 @@ "50:-9.9", }; - size_t n = MDDS_N_ELEMENTS(expected); + size_t n = std::size(expected); assert(check_concat_buffer(func.get_concat_buffer(), expected, n)); } } @@ -464,17 +456,14 @@ void mtm_test_walk_with_lambda() { stack_printer __stack_printer__("::mtm_test_walk_with_lambda"); - vector values = { 1.1, 1.2, 1.3, 1.4 }; + vector values = {1.1, 1.2, 1.3, 1.4}; mtx_type mtx(2, 2, values.begin(), values.end()); - mtx.walk( - [](const mtx_type::element_block_node_type& node) - { - assert(node.type == mdds::mtm::element_numeric); - assert(node.offset == 0); - assert(node.size == 4); - } - ); + mtx.walk([](const mtx_type::element_block_node_type& node) { + assert(node.type == mdds::mtm::element_numeric); + assert(node.offset == 0); + assert(node.size == 4); + }); struct section { @@ -482,29 +471,27 @@ size_t offset; size_t size; - bool operator== (const section& other) const + bool operator==(const section& other) const { return type == other.type && offset == other.offset && size == other.size; } }; std::vector
    expected = { - { mdds::mtm::element_numeric, 0, 1 }, - { mdds::mtm::element_numeric, 2, 1 }, + {mdds::mtm::element_numeric, 0, 1}, + {mdds::mtm::element_numeric, 2, 1}, }; std::vector
    actual; mtx.walk( - [&](const mtx_type::element_block_node_type& node) - { + [&](const mtx_type::element_block_node_type& node) { actual.emplace_back(); actual.back().type = node.type; actual.back().offset = node.offset; actual.back().size = node.size; - } - , - { 0, 0 }, { 0, 1 } // (row=0, column=0) to (row=0, column=1) + }, + {0, 0}, {0, 1} // (row=0, column=0) to (row=0, column=1) ); assert(expected == actual); @@ -514,7 +501,7 @@ { stack_printer __stack_printer__("::mtm_test_parallel_walk_with_lambda"); - vector values = { 1.1, 1.2, 1.3, 1.4 }; + vector values = {1.1, 1.2, 1.3, 1.4}; mtx_type mtx1(2, 2, values.begin(), values.end()); mtx_type mtx2(2, 2); @@ -529,7 +516,7 @@ size_t offset; size_t size; - bool operator== (const section& other) const + bool operator==(const section& other) const { return type == other.type && offset == other.offset && size == other.size; } @@ -540,15 +527,15 @@ section left; section right; - bool operator== (const section_pair& other) const + bool operator==(const section_pair& other) const { return left == other.left && right == other.right; } }; std::vector expected = { - { { mdds::mtm::element_numeric, 0, 2 }, { mdds::mtm::element_numeric, 0, 2 } }, - { { mdds::mtm::element_numeric, 2, 2 }, { mdds::mtm::element_boolean, 0, 2 } }, + {{mdds::mtm::element_numeric, 0, 2}, {mdds::mtm::element_numeric, 0, 2}}, + {{mdds::mtm::element_numeric, 2, 2}, {mdds::mtm::element_boolean, 0, 2}}, }; std::vector actual; @@ -556,19 +543,17 @@ cout << "--" << endl; mtx1.walk( - [&](const mtx_type::element_block_node_type& l, const mtx_type::element_block_node_type& r) - { + [&](const mtx_type::element_block_node_type& l, const mtx_type::element_block_node_type& r) { cout << "left: " << l << "; right: " << r << endl; actual.emplace_back(); - actual.back().left.type = l.type; + actual.back().left.type = l.type; actual.back().left.offset = l.offset; - actual.back().left.size = l.size; - actual.back().right.type = r.type; + actual.back().left.size = l.size; + actual.back().right.type = r.type; actual.back().right.offset = r.offset; - actual.back().right.size = r.size; + actual.back().right.size = r.size; }, - mtx2 - ); + mtx2); assert(expected == actual); @@ -583,15 +568,15 @@ mtx3.set(2, 2, false); expected = { - { { mdds::mtm::element_numeric, 0, 2 }, { mdds::mtm::element_string, 0, 2 } }, - { { mdds::mtm::element_boolean, 0, 1 }, { mdds::mtm::element_string, 2, 1 } }, + {{mdds::mtm::element_numeric, 0, 2}, {mdds::mtm::element_string, 0, 2}}, + {{mdds::mtm::element_boolean, 0, 1}, {mdds::mtm::element_string, 2, 1}}, - { { mdds::mtm::element_numeric, 0, 2 }, { mdds::mtm::element_numeric, 0, 2 } }, - { { mdds::mtm::element_numeric, 2, 1 }, { mdds::mtm::element_string, 0, 1 } }, + {{mdds::mtm::element_numeric, 0, 2}, {mdds::mtm::element_numeric, 0, 2}}, + {{mdds::mtm::element_numeric, 2, 1}, {mdds::mtm::element_string, 0, 1}}, - { { mdds::mtm::element_numeric, 4, 1 }, { mdds::mtm::element_numeric, 0, 1 } }, - { { mdds::mtm::element_boolean, 0, 1 }, { mdds::mtm::element_numeric, 1, 1 } }, - { { mdds::mtm::element_boolean, 1, 1 }, { mdds::mtm::element_string, 0, 1 } }, + {{mdds::mtm::element_numeric, 4, 1}, {mdds::mtm::element_numeric, 0, 1}}, + {{mdds::mtm::element_boolean, 0, 1}, {mdds::mtm::element_numeric, 1, 1}}, + {{mdds::mtm::element_boolean, 1, 1}, {mdds::mtm::element_string, 0, 1}}, }; actual.clear(); @@ -599,20 +584,17 @@ cout << "--" << endl; mtx3.walk( - [&](const mtx_type::element_block_node_type& l, const mtx_type::element_block_node_type& r) - { + [&](const mtx_type::element_block_node_type& l, const mtx_type::element_block_node_type& r) { cout << "left: " << l << "; right: " << r << endl; actual.emplace_back(); - actual.back().left.type = l.type; + actual.back().left.type = l.type; actual.back().left.offset = l.offset; - actual.back().left.size = l.size; - actual.back().right.type = r.type; + actual.back().left.size = l.size; + actual.back().right.type = r.type; actual.back().right.offset = r.offset; - actual.back().right.size = r.size; + actual.back().right.size = r.size; }, - mtx4, - { 0, 0 }, { 2, 2 } - ); + mtx4, {0, 0}, {2, 2}); assert(expected.size() == actual.size()); assert(expected[0] == actual[0]); @@ -624,7 +606,7 @@ assert(expected[6] == actual[6]); } -int main (int argc, char **argv) +int main(int argc, char** argv) { try { diff -Nru mdds-2.0.2/test/multi_type_vector/collection/aos/test_main.cpp mdds-2.0.3/test/multi_type_vector/collection/aos/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/collection/aos/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/collection/aos/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -42,7 +42,7 @@ #include "all.inl" -int main () +int main() { try { @@ -66,4 +66,3 @@ cout << "Test finished successfully!" << endl; return EXIT_SUCCESS; } - diff -Nru mdds-2.0.2/test/multi_type_vector/collection/soa/test_main.cpp mdds-2.0.3/test/multi_type_vector/collection/soa/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/collection/soa/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/collection/soa/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -42,7 +42,7 @@ #include "all.inl" -int main () +int main() { try { @@ -66,4 +66,3 @@ cout << "Test finished successfully!" << endl; return EXIT_SUCCESS; } - diff -Nru mdds-2.0.2/test/multi_type_vector/collection/tc/all.inl mdds-2.0.3/test/multi_type_vector/collection/tc/all.inl --- mdds-2.0.2/test/multi_type_vector/collection/tc/all.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/collection/tc/all.inl 2022-05-11 00:33:24.000000000 +0000 @@ -160,7 +160,8 @@ cols_type collection(vectors.begin(), vectors.end()); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} vectors.clear(); vectors.emplace_back(0); @@ -302,7 +303,8 @@ collection.set_element_range(0, 0); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} try { @@ -310,7 +312,8 @@ collection.set_element_range(5, 1); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} try { @@ -318,7 +321,8 @@ collection.set_element_range(0, 6); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} } void mtv_test_sub_collection_ranges_invalid() @@ -339,7 +343,8 @@ collection.set_collection_range(0, 0); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} try { @@ -347,7 +352,8 @@ collection.set_collection_range(5, 1); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} try { @@ -355,7 +361,8 @@ collection.set_collection_range(0, 6); assert(!"invalid_arg_error is expected to be thrown"); } - catch (const mdds::invalid_arg_error&) {} + catch (const mdds::invalid_arg_error&) + {} } void mtv_test_boolean_block() @@ -385,4 +392,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_basic.cpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_basic.cpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_basic.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_basic.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "basic.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_main.cpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -34,7 +34,7 @@ using namespace std; -int main () +int main() { try { diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_main.hpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -39,7 +39,8 @@ using mtv_type = mdds::mtv::aos::multi_type_vector>; using mtv_fruit_type = mdds::mtv::aos::multi_type_vector>; -using mtv3_type = mdds::mtv::aos::multi_type_vector>; +using mtv3_type = + mdds::mtv::aos::multi_type_vector>; void mtv_test_misc_types(); void mtv_test_misc_block_identifier(); @@ -55,4 +56,3 @@ void mtv_test_swap_2(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_managed_block.cpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_managed_block.cpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_managed_block.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_managed_block.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "managed_block.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_misc.cpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_misc.cpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_misc.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_misc.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "misc.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_swap.cpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_swap.cpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_swap.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_swap.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "swap.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/aos/test_transfer.cpp mdds-2.0.3/test/multi_type_vector/custom/aos/test_transfer.cpp --- mdds-2.0.2/test/multi_type_vector/custom/aos/test_transfer.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/aos/test_transfer.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "transfer.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/common_types.hpp mdds-2.0.3/test/multi_type_vector/custom/common_types.hpp --- mdds-2.0.2/test/multi_type_vector/custom/common_types.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/common_types.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -36,8 +36,10 @@ { double value; - user_cell() : value(0.0) {} - user_cell(double _v) : value(_v) {} + user_cell() : value(0.0) + {} + user_cell(double _v) : value(_v) + {} }; /** @@ -48,13 +50,24 @@ { double value; - muser_cell() : value(0.0) {} - muser_cell(const muser_cell& r) : value(r.value) {} - muser_cell(double _v) : value(_v) {} - ~muser_cell() {} + muser_cell() : value(0.0) + {} + muser_cell(const muser_cell& r) : value(r.value) + {} + muser_cell(double _v) : value(_v) + {} + ~muser_cell() + {} }; -enum my_fruit_type { unknown_fruit = 0, apple, orange, mango, peach }; +enum my_fruit_type +{ + unknown_fruit = 0, + apple, + orange, + mango, + peach +}; struct date { @@ -62,15 +75,17 @@ int month; int day; - date() : year(0), month(0), day(0) {} - date(int _year, int _month, int _day) : year(_year), month(_month), day(_day) {} + date() : year(0), month(0), day(0) + {} + date(int _year, int _month, int _day) : year(_year), month(_month), day(_day) + {} }; /** custom cell type definition. */ constexpr mdds::mtv::element_t element_type_user_block = mdds::mtv::element_type_user_start; -constexpr mdds::mtv::element_t element_type_muser_block = mdds::mtv::element_type_user_start+1; -constexpr mdds::mtv::element_t element_type_fruit_block = mdds::mtv::element_type_user_start+2; -constexpr mdds::mtv::element_t element_type_date_block = mdds::mtv::element_type_user_start+3; +constexpr mdds::mtv::element_t element_type_muser_block = mdds::mtv::element_type_user_start + 1; +constexpr mdds::mtv::element_t element_type_fruit_block = mdds::mtv::element_type_user_start + 2; +constexpr mdds::mtv::element_t element_type_date_block = mdds::mtv::element_type_user_start + 3; using user_cell_block = mdds::mtv::default_element_block; using muser_cell_block = mdds::mtv::managed_element_block; @@ -86,6 +101,7 @@ class cell_pool { std::vector> m_pool; + public: cell_pool() = default; cell_pool(const cell_pool&) = delete; @@ -97,13 +113,15 @@ return m_pool.back().get(); } - void clear() { m_pool.clear(); } + void clear() + { + m_pool.clear(); + } }; class user_cell_pool : public cell_pool { public: - user_cell* construct(double val) { user_cell* p = cell_pool::construct(); @@ -113,4 +131,3 @@ }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_basic.cpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_basic.cpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_basic.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_basic.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "basic.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_main.cpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -29,7 +29,7 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { @@ -57,4 +57,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_main.hpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -57,4 +57,3 @@ void mtv_test_swap_2(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_managed_block.cpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_managed_block.cpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_managed_block.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_managed_block.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "managed_block.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_misc.cpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_misc.cpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_misc.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_misc.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "misc.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_swap.cpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_swap.cpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_swap.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_swap.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "swap.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/soa/test_transfer.cpp mdds-2.0.3/test/multi_type_vector/custom/soa/test_transfer.cpp --- mdds-2.0.2/test/multi_type_vector/custom/soa/test_transfer.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/soa/test_transfer.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "transfer.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/tc/basic.inl mdds-2.0.3/test/multi_type_vector/custom/tc/basic.inl --- mdds-2.0.2/test/multi_type_vector/custom/tc/basic.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/tc/basic.inl 2022-04-22 00:12:40.000000000 +0000 @@ -214,4 +214,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/tc/managed_block.inl mdds-2.0.3/test/multi_type_vector/custom/tc/managed_block.inl --- mdds-2.0.2/test/multi_type_vector/custom/tc/managed_block.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/tc/managed_block.inl 2022-04-22 00:12:40.000000000 +0000 @@ -291,9 +291,9 @@ mtv_type db(2); db.set(0, new muser_cell(1.0)); db.set(1, new muser_cell(2.0)); - double vals[] = { 3.0 }; + double vals[] = {3.0}; const double* p = &vals[0]; - db.set(0, p, p+1); + db.set(0, p, p + 1); assert(db.get(0) == 3.0); assert(db.get(1)->value == 2.0); } @@ -303,9 +303,9 @@ mtv_type db(2); db.set(0, new muser_cell(1.0)); db.set(1, new muser_cell(2.0)); - double vals[] = { 3.0 }; + double vals[] = {3.0}; const double* p = &vals[0]; - db.set(1, p, p+1); + db.set(1, p, p + 1); assert(db.get(0)->value == 1.0); assert(db.get(1) == 3.0); } @@ -317,9 +317,9 @@ db.set(1, new muser_cell(1.0)); db.set(2, new muser_cell(2.0)); db.set(3, new muser_cell(3.0)); - double vals[] = { 4.0 }; + double vals[] = {4.0}; const double* p = &vals[0]; - db.set(2, p, p+1); + db.set(2, p, p + 1); assert(db.get(1)->value == 1.0); assert(db.get(2) == 4.0); assert(db.get(3)->value == 3.0); @@ -362,9 +362,9 @@ db.set(2, 1.2); db.set(3, new muser_cell(3.0)); db.set(4, new muser_cell(4.0)); - uint64_t vals[] = { 5, 6, 7 }; + uint64_t vals[] = {5, 6, 7}; const uint64_t* p = &vals[0]; - db.set(1, p, p+3); + db.set(1, p, p + 3); } { @@ -432,9 +432,9 @@ mtv_type db(2); db.set(0, new muser_cell(2.1)); db.set(1, new muser_cell(2.2)); - double vals[] = { 3.1, 3.2 }; + double vals[] = {3.1, 3.2}; const double* p = &vals[0]; - db.insert(1, p, p+2); + db.insert(1, p, p + 2); } { @@ -653,4 +653,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/tc/misc.inl mdds-2.0.3/test/multi_type_vector/custom/tc/misc.inl --- mdds-2.0.2/test/multi_type_vector/custom/tc/misc.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/tc/misc.inl 2022-04-22 00:12:40.000000000 +0000 @@ -91,8 +91,8 @@ // Insert custom elements. db.set(0, new muser_cell(12.3)); db.set(1, apple); - db.set(2, date(1989,12,13)); - db.set(3, date(2011,8,7)); + db.set(2, date(1989, 12, 13)); + db.set(3, date(2011, 8, 7)); assert(db.get_type(0) == element_type_muser_block); assert(db.get_type(1) == element_type_fruit_block); assert(db.get_type(2) == element_type_date_block); @@ -198,4 +198,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/tc/swap.inl mdds-2.0.3/test/multi_type_vector/custom/tc/swap.inl --- mdds-2.0.2/test/multi_type_vector/custom/tc/swap.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/tc/swap.inl 2022-04-22 00:12:40.000000000 +0000 @@ -182,4 +182,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom/tc/transfer.inl mdds-2.0.3/test/multi_type_vector/custom/tc/transfer.inl --- mdds-2.0.2/test/multi_type_vector/custom/tc/transfer.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom/tc/transfer.inl 2022-04-22 00:12:40.000000000 +0000 @@ -426,4 +426,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/aos/Makefile.in mdds-2.0.3/test/multi_type_vector/custom-trait/aos/Makefile.in --- mdds-2.0.2/test/multi_type_vector/custom-trait/aos/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/aos/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,8 +170,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -354,6 +352,7 @@ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log @@ -390,9 +389,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -404,11 +404,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -739,7 +738,7 @@ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -794,7 +793,6 @@ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/aos/test_loop_unrolling.cpp mdds-2.0.3/test/multi_type_vector/custom-trait/aos/test_loop_unrolling.cpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/aos/test_loop_unrolling.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/aos/test_loop_unrolling.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "loop_unrolling.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/aos/test_main.cpp mdds-2.0.3/test/multi_type_vector/custom-trait/aos/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/aos/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/aos/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -29,7 +29,7 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/aos/test_main.hpp mdds-2.0.3/test/multi_type_vector/custom-trait/aos/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/aos/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/aos/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -42,4 +42,3 @@ void mtv_test_loop_unrolling_32(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/Makefile.in mdds-2.0.3/test/multi_type_vector/custom-trait/Makefile.in --- mdds-2.0.2/test/multi_type_vector/custom-trait/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -148,8 +148,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -189,9 +187,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -203,11 +202,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -418,7 +416,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/soa/Makefile.in mdds-2.0.3/test/multi_type_vector/custom-trait/soa/Makefile.in --- mdds-2.0.2/test/multi_type_vector/custom-trait/soa/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/soa/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -173,8 +173,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -357,6 +355,7 @@ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log @@ -393,9 +392,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -407,11 +407,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -744,7 +743,7 @@ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -799,7 +798,6 @@ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_loop_unrolling.cpp mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_loop_unrolling.cpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_loop_unrolling.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_loop_unrolling.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "loop_unrolling.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_loop_unrolling_simd.cpp mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_loop_unrolling_simd.cpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_loop_unrolling_simd.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_loop_unrolling_simd.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -60,7 +60,7 @@ } } -} +} // namespace #if SIZEOF_VOID_P == 8 && defined(__SSE2__) @@ -199,4 +199,3 @@ #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_main.cpp mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -29,7 +29,7 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_main.hpp mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/custom-trait/soa/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/soa/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -51,4 +51,3 @@ void mtv_test_loop_unrolling_avx2_x64_8(); // SoA only /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/custom-trait/tc/loop_unrolling.inl mdds-2.0.3/test/multi_type_vector/custom-trait/tc/loop_unrolling.inl --- mdds-2.0.2/test/multi_type_vector/custom-trait/tc/loop_unrolling.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/custom-trait/tc/loop_unrolling.inl 2022-04-22 00:12:40.000000000 +0000 @@ -38,7 +38,7 @@ constexpr static lu_factor_t loop_unrolling = F; }; -} +} // namespace template void mtv_test_loop_unrolling() @@ -96,4 +96,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/debug-util/Makefile.in mdds-2.0.3/test/multi_type_vector/debug-util/Makefile.in --- mdds-2.0.2/test/multi_type_vector/debug-util/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/debug-util/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -148,8 +148,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -189,9 +187,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -203,11 +202,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -417,7 +415,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_vector/debug-util/soa/Makefile.in mdds-2.0.3/test/multi_type_vector/debug-util/soa/Makefile.in --- mdds-2.0.2/test/multi_type_vector/debug-util/soa/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/debug-util/soa/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -158,8 +158,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no @@ -342,6 +340,7 @@ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log @@ -378,9 +377,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -392,11 +392,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -723,7 +722,7 @@ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -778,7 +777,6 @@ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_vector/debug-util/soa/test_trace.cpp mdds-2.0.3/test/multi_type_vector/debug-util/soa/test_trace.cpp --- mdds-2.0.2/test/multi_type_vector/debug-util/soa/test_trace.cpp 2022-02-12 00:45:00.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/debug-util/soa/test_trace.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -49,13 +49,13 @@ std::string function_name; trace_method_t type = trace_method_t::unspecified; - bool operator== (const checked_method_props& other) const + bool operator==(const checked_method_props& other) const { return instance == other.instance && function_name == other.function_name && type == other.type; } }; -std::ostream& operator<< (std::ostream& os, const checked_method_props& v) +std::ostream& operator<<(std::ostream& os, const checked_method_props& v) { os << "{instance: " << v.instance << ", function_name: " << v.function_name << ", type: " << int(v.type); return os; @@ -78,9 +78,10 @@ std::vector m_expected; std::vector& m_observed; int m_line_number; + public: - test_scope(std::vector& observed, int line_number) : - m_observed(observed), m_line_number(line_number) + test_scope(std::vector& observed, int line_number) + : m_observed(observed), m_line_number(line_number) { std::cout << "--" << std::endl; } @@ -107,10 +108,8 @@ { static void trace(const mdds::mtv::trace_method_properties_t& props) { - std::cout << "[" << props.instance << "]: {" << props.function_name - << ": " << props.function_args - << "}; type=" << int(props.type) - << std::endl; + std::cout << "[" << props.instance << "]: {" << props.function_name << ": " << props.function_args + << "}; type=" << int(props.type) << std::endl; // Some compilers put an extra space after the 'operator'. Let's delete that extra space char. std::string func_name = props.function_name; @@ -119,7 +118,7 @@ std::string rest = func_name.substr(9); func_name = "operator" + rest; } - observed.push_back({ props.instance, func_name, props.type }); + observed.push_back({props.instance, func_name, props.type}); } }; @@ -146,16 +145,16 @@ db.clear(); ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "begin", trace_method_t::accessor }, - { &db, "set", trace_method_t::mutator_with_pos_hint }, - { &db, "set", trace_method_t::mutator_with_pos_hint }, - { &db, "get", trace_method_t::accessor }, - { &db, "is_empty", trace_method_t::accessor }, - { &db, "get_type", trace_method_t::accessor }, - { &db, "size", trace_method_t::accessor }, - { &db, "clear", trace_method_t::mutator }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "begin", trace_method_t::accessor}, + {&db, "set", trace_method_t::mutator_with_pos_hint}, + {&db, "set", trace_method_t::mutator_with_pos_hint}, + {&db, "get", trace_method_t::accessor}, + {&db, "is_empty", trace_method_t::accessor}, + {&db, "get_type", trace_method_t::accessor}, + {&db, "size", trace_method_t::accessor}, + {&db, "clear", trace_method_t::mutator}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -179,15 +178,15 @@ [[maybe_unused]] auto it_end = db.end(); ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "set", trace_method_t::mutator }, - { &db, "set", trace_method_t::mutator }, - { &db, "block_size", trace_method_t::accessor }, - { &db, "empty", trace_method_t::accessor }, - { &db, "get", trace_method_t::accessor }, - { &db, "clear", trace_method_t::mutator }, - { &db, "end", trace_method_t::accessor }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "set", trace_method_t::mutator}, + {&db, "set", trace_method_t::mutator}, + {&db, "block_size", trace_method_t::accessor}, + {&db, "empty", trace_method_t::accessor}, + {&db, "get", trace_method_t::accessor}, + {&db, "clear", trace_method_t::mutator}, + {&db, "end", trace_method_t::accessor}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -197,7 +196,7 @@ test_scope ts(observed, __LINE__); { mtv_type db1; - mtv_type db2{ mtv_type::event_func() }; // move + mtv_type db2{mtv_type::event_func()}; // move mtv_type::event_func ef; mtv_type db3(ef); // copy @@ -206,30 +205,30 @@ [[maybe_unused]] const auto& cref_ef = cdb3.event_handler(); // const ref mtv_type db4(20, true); // constructor with one init value - std::vector values = { 1, 2, 3, 4, 5 }; + std::vector values = {1, 2, 3, 4, 5}; mtv_type db5(5, values.begin(), values.end()); // constructor with a series of values mtv_type db6(db5); // copy constructor mtv_type db7(std::move(db6)); // move constructor ts.expected() = { - { &db1, "multi_type_vector", trace_method_t::constructor }, - { &db2, "multi_type_vector", trace_method_t::constructor }, - { &db3, "multi_type_vector", trace_method_t::constructor }, - { &db3, "event_handler", trace_method_t::accessor }, - { &db3, "event_handler", trace_method_t::accessor }, - { &db4, "multi_type_vector", trace_method_t::constructor }, - { &db5, "multi_type_vector", trace_method_t::constructor }, - { &db6, "multi_type_vector", trace_method_t::constructor }, - { &db7, "multi_type_vector", trace_method_t::constructor }, - - { &db7, "~multi_type_vector", trace_method_t::destructor }, - { &db6, "~multi_type_vector", trace_method_t::destructor }, - { &db5, "~multi_type_vector", trace_method_t::destructor }, - { &db4, "~multi_type_vector", trace_method_t::destructor }, - { &db3, "~multi_type_vector", trace_method_t::destructor }, - { &db2, "~multi_type_vector", trace_method_t::destructor }, - { &db1, "~multi_type_vector", trace_method_t::destructor }, + {&db1, "multi_type_vector", trace_method_t::constructor}, + {&db2, "multi_type_vector", trace_method_t::constructor}, + {&db3, "multi_type_vector", trace_method_t::constructor}, + {&db3, "event_handler", trace_method_t::accessor}, + {&db3, "event_handler", trace_method_t::accessor}, + {&db4, "multi_type_vector", trace_method_t::constructor}, + {&db5, "multi_type_vector", trace_method_t::constructor}, + {&db6, "multi_type_vector", trace_method_t::constructor}, + {&db7, "multi_type_vector", trace_method_t::constructor}, + + {&db7, "~multi_type_vector", trace_method_t::destructor}, + {&db6, "~multi_type_vector", trace_method_t::destructor}, + {&db5, "~multi_type_vector", trace_method_t::destructor}, + {&db4, "~multi_type_vector", trace_method_t::destructor}, + {&db3, "~multi_type_vector", trace_method_t::destructor}, + {&db2, "~multi_type_vector", trace_method_t::destructor}, + {&db1, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -248,13 +247,13 @@ cpos = cdb.position(pos_hint, 1); ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "position", trace_method_t::accessor }, - { &db, "begin", trace_method_t::accessor }, - { &db, "position", trace_method_t::accessor_with_pos_hint }, - { &db, "position", trace_method_t::accessor }, - { &db, "position", trace_method_t::accessor_with_pos_hint }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "position", trace_method_t::accessor}, + {&db, "begin", trace_method_t::accessor}, + {&db, "position", trace_method_t::accessor_with_pos_hint}, + {&db, "position", trace_method_t::accessor}, + {&db, "position", trace_method_t::accessor_with_pos_hint}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -264,7 +263,7 @@ test_scope ts(observed, __LINE__); { mtv_type db(10); - std::vector values = { 3, 4, 5, 6 }; + std::vector values = {3, 4, 5, 6}; auto pos_hint = db.set(2, values.begin(), values.end()); pos_hint = db.set(pos_hint, 4, values.begin(), values.end()); db.push_back(456); @@ -278,19 +277,19 @@ db.insert_empty(pos_hint, 15, 2); ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "set", trace_method_t::mutator }, - { &db, "set", trace_method_t::mutator_with_pos_hint }, - { &db, "push_back", trace_method_t::mutator }, - { &db, "push_back_empty", trace_method_t::mutator }, - { &db, "insert", trace_method_t::mutator }, - { &db, "insert", trace_method_t::mutator_with_pos_hint }, - { &db, "set_empty", trace_method_t::mutator }, - { &db, "set_empty", trace_method_t::mutator_with_pos_hint }, - { &db, "erase", trace_method_t::mutator }, - { &db, "insert_empty", trace_method_t::mutator }, - { &db, "insert_empty", trace_method_t::mutator_with_pos_hint }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "set", trace_method_t::mutator}, + {&db, "set", trace_method_t::mutator_with_pos_hint}, + {&db, "push_back", trace_method_t::mutator}, + {&db, "push_back_empty", trace_method_t::mutator}, + {&db, "insert", trace_method_t::mutator}, + {&db, "insert", trace_method_t::mutator_with_pos_hint}, + {&db, "set_empty", trace_method_t::mutator}, + {&db, "set_empty", trace_method_t::mutator_with_pos_hint}, + {&db, "erase", trace_method_t::mutator}, + {&db, "insert_empty", trace_method_t::mutator}, + {&db, "insert_empty", trace_method_t::mutator_with_pos_hint}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -304,18 +303,18 @@ pos_hint = src.transfer(pos_hint, 6, 8, dst, 6); ts.expected() = { - { &src, "multi_type_vector", trace_method_t::constructor }, - { &dst, "multi_type_vector", trace_method_t::constructor }, + {&src, "multi_type_vector", trace_method_t::constructor}, + {&dst, "multi_type_vector", trace_method_t::constructor}, // transfer() calls destination's size() and set_empty() internally. - { &src, "transfer", trace_method_t::mutator }, - { &dst, "size", trace_method_t::accessor }, - { &dst, "set_empty", trace_method_t::mutator }, + {&src, "transfer", trace_method_t::mutator}, + {&dst, "size", trace_method_t::accessor}, + {&dst, "set_empty", trace_method_t::mutator}, // same here... - { &src, "transfer", trace_method_t::mutator_with_pos_hint }, - { &dst, "size", trace_method_t::accessor }, - { &dst, "set_empty", trace_method_t::mutator }, - { &dst, "~multi_type_vector", trace_method_t::destructor }, - { &src, "~multi_type_vector", trace_method_t::destructor }, + {&src, "transfer", trace_method_t::mutator_with_pos_hint}, + {&dst, "size", trace_method_t::accessor}, + {&dst, "set_empty", trace_method_t::mutator}, + {&dst, "~multi_type_vector", trace_method_t::destructor}, + {&src, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -332,12 +331,12 @@ db.release(); // final variant ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "release", trace_method_t::mutator }, - { &db, "release", trace_method_t::mutator }, - { &db, "release", trace_method_t::mutator_with_pos_hint }, - { &db, "release", trace_method_t::mutator }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "release", trace_method_t::mutator}, + {&db, "release", trace_method_t::mutator}, + {&db, "release", trace_method_t::mutator_with_pos_hint}, + {&db, "release", trace_method_t::mutator}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -351,10 +350,10 @@ pos_hint = db.release_range(pos_hint, 5, 7); ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "release_range", trace_method_t::mutator }, - { &db, "release_range", trace_method_t::mutator_with_pos_hint }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "release_range", trace_method_t::mutator}, + {&db, "release_range", trace_method_t::mutator_with_pos_hint}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -383,20 +382,20 @@ crit = cdb.crend(); ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "begin", trace_method_t::accessor }, - { &db, "end", trace_method_t::accessor }, - { &db, "cbegin", trace_method_t::accessor }, - { &db, "cend", trace_method_t::accessor }, - { &db, "begin", trace_method_t::accessor }, - { &db, "end", trace_method_t::accessor }, - { &db, "rbegin", trace_method_t::accessor }, - { &db, "rend", trace_method_t::accessor }, - { &db, "rbegin", trace_method_t::accessor }, - { &db, "rend", trace_method_t::accessor }, - { &db, "crbegin", trace_method_t::accessor }, - { &db, "crend", trace_method_t::accessor }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "begin", trace_method_t::accessor}, + {&db, "end", trace_method_t::accessor}, + {&db, "cbegin", trace_method_t::accessor}, + {&db, "cend", trace_method_t::accessor}, + {&db, "begin", trace_method_t::accessor}, + {&db, "end", trace_method_t::accessor}, + {&db, "rbegin", trace_method_t::accessor}, + {&db, "rend", trace_method_t::accessor}, + {&db, "rbegin", trace_method_t::accessor}, + {&db, "rend", trace_method_t::accessor}, + {&db, "crbegin", trace_method_t::accessor}, + {&db, "crend", trace_method_t::accessor}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -418,16 +417,16 @@ b = db != db2; ts.expected() = { - { &db, "multi_type_vector", trace_method_t::constructor }, - { &db, "resize", trace_method_t::mutator }, - { &db2, "multi_type_vector", trace_method_t::constructor }, - { &db2, "swap", trace_method_t::mutator }, - { &db2, "swap", trace_method_t::mutator }, - { &db2, "shrink_to_fit", trace_method_t::mutator }, - { &db, "operator==", trace_method_t::accessor }, - { &db, "operator!=", trace_method_t::accessor }, - { &db2, "~multi_type_vector", trace_method_t::destructor }, - { &db, "~multi_type_vector", trace_method_t::destructor }, + {&db, "multi_type_vector", trace_method_t::constructor}, + {&db, "resize", trace_method_t::mutator}, + {&db2, "multi_type_vector", trace_method_t::constructor}, + {&db2, "swap", trace_method_t::mutator}, + {&db2, "swap", trace_method_t::mutator}, + {&db2, "shrink_to_fit", trace_method_t::mutator}, + {&db, "operator==", trace_method_t::accessor}, + {&db, "operator!=", trace_method_t::accessor}, + {&db2, "~multi_type_vector", trace_method_t::destructor}, + {&db, "~multi_type_vector", trace_method_t::destructor}, }; } } @@ -440,7 +439,7 @@ mtv_type db, db2; observed.clear(); db = db2; // copy - checked_method_props expected{ &db, "operator=", trace_method_t::mutator }; + checked_method_props expected{&db, "operator=", trace_method_t::mutator}; assert(compare(observed.at(0), expected)); observed.clear(); diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_basic.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_basic.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_basic.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_basic.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "basic.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_construction.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_construction.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_construction.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_construction.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "construction.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_empty_cells.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_empty_cells.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_empty_cells.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_empty_cells.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "empty_cells.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_erase.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_erase.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_erase.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_erase.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "erase.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_hints.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_hints.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_hints.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_hints.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "hints.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_insert.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_insert.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_insert.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_insert.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "insert.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators_insert.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators_insert.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators_insert.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators_insert.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators_insert.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators_set.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators_set.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators_set.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators_set.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators_set.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators_set_empty.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators_set_empty.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_iterators_set_empty.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_iterators_set_empty.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators_set_empty.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_main.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -28,7 +28,7 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_main.hpp mdds-2.0.3/test/multi_type_vector/default/aos/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -93,4 +93,3 @@ void mtv_test_transfer(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_misc.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_misc.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_misc.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_misc.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "misc.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_position.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_position.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_position.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_position.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "position.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_set.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_set.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_set.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_set.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "set.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_swap_range.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_swap_range.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_swap_range.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_swap_range.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "swap_range.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/aos/test_transfer.cpp mdds-2.0.3/test/multi_type_vector/default/aos/test_transfer.cpp --- mdds-2.0.2/test/multi_type_vector/default/aos/test_transfer.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/aos/test_transfer.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "transfer.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_basic.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_basic.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_basic.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_basic.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "basic.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_construction.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_construction.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_construction.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_construction.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "construction.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_empty_cells.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_empty_cells.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_empty_cells.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_empty_cells.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "empty_cells.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_erase.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_erase.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_erase.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_erase.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "erase.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_hints.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_hints.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_hints.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_hints.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "hints.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_insert.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_insert.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_insert.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_insert.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "insert.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators_insert.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators_insert.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators_insert.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators_insert.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators_insert.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators_set.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators_set.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators_set.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators_set.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators_set.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators_set_empty.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators_set_empty.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_iterators_set_empty.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_iterators_set_empty.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "iterators_set_empty.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_main.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -29,7 +29,7 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { @@ -82,4 +82,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_main.hpp mdds-2.0.3/test/multi_type_vector/default/soa/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -90,4 +90,3 @@ void mtv_test_transfer(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_misc.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_misc.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_misc.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_misc.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "misc.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_position.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_position.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_position.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_position.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "position.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_set.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_set.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_set.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_set.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "set.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_swap_range.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_swap_range.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_swap_range.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_swap_range.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "swap_range.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/soa/test_transfer.cpp mdds-2.0.3/test/multi_type_vector/default/soa/test_transfer.cpp --- mdds-2.0.2/test/multi_type_vector/default/soa/test_transfer.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/soa/test_transfer.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "transfer.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/basic.inl mdds-2.0.3/test/multi_type_vector/default/tc/basic.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/basic.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/basic.inl 2022-04-22 00:12:40.000000000 +0000 @@ -113,7 +113,7 @@ { mtv_type col_db(4); - long order[] = { 3, 1, 2, 0 }; + long order[] = {3, 1, 2, 0}; double val = 1.0; for (size_t i = 0; i < 4; ++i, ++val) { @@ -124,7 +124,7 @@ { mtv_type col_db(4); - long order[] = { 0, 3, 1, 2 }; + long order[] = {0, 3, 1, 2}; double val = 1.0; for (size_t i = 0; i < 4; ++i, ++val) { @@ -135,7 +135,7 @@ { mtv_type col_db(4); - long order[] = { 0, 2, 3, 1 }; + long order[] = {0, 2, 3, 1}; double val = 1.0; for (size_t i = 0; i < 4; ++i, ++val) { @@ -146,7 +146,7 @@ { mtv_type col_db(5); - long order[] = { 0, 4, 3, 2, 1 }; + long order[] = {0, 4, 3, 2, 1}; double val = 1.0; for (size_t i = 0; i < 5; ++i, ++val) { @@ -667,4 +667,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/construction.inl mdds-2.0.3/test/multi_type_vector/default/tc/construction.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/construction.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/construction.inl 2022-04-22 00:12:40.000000000 +0000 @@ -107,4 +107,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/empty_cells.inl mdds-2.0.3/test/multi_type_vector/default/tc/empty_cells.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/empty_cells.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/empty_cells.inl 2022-04-22 00:12:40.000000000 +0000 @@ -108,7 +108,7 @@ // Empty multiple cells at the middle part of a block. mtv_type db(4); for (size_t i = 0; i < 4; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); for (size_t i = 0; i < 4; ++i) { @@ -447,4 +447,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/erase.inl mdds-2.0.3/test/multi_type_vector/default/tc/erase.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/erase.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/erase.inl 2022-04-22 00:12:40.000000000 +0000 @@ -54,7 +54,7 @@ // Single non-empty block. mtv_type db(5); for (long i = 0; i < 5; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); assert(db.block_size() == 1); assert(db.size() == 5); @@ -76,7 +76,7 @@ // Two blocks - non-empty to empty blocks. mtv_type db(8); for (long i = 0; i < 4; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); assert(db.block_size() == 2); assert(db.size() == 8); @@ -105,10 +105,10 @@ // Two blocks - non-empty to non-empty blocks. mtv_type db(8); for (long i = 0; i < 4; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); for (long i = 4; i < 8; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); assert(db.block_size() == 2); assert(db.size() == 8); @@ -138,15 +138,15 @@ // 3 blocks, all non-empty. mtv_type db(9); for (long i = 0; i < 3; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); for (long i = 3; i < 6; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); for (long i = 6; i < 9; ++i) { std::ostringstream os; - os << i+1; + os << i + 1; db.set(i, os.str()); } @@ -358,4 +358,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/hints.inl mdds-2.0.3/test/multi_type_vector/default/tc/hints.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/hints.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/hints.inl 2022-04-22 00:12:40.000000000 +0000 @@ -184,4 +184,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/insert.inl mdds-2.0.3/test/multi_type_vector/default/tc/insert.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/insert.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/insert.inl 2022-04-22 00:12:40.000000000 +0000 @@ -37,7 +37,7 @@ // Insert data from row 0 to 4. for (long i = 0; i < 5; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); assert(db.block_size() == 2); assert(db.size() == 10); @@ -63,7 +63,7 @@ { mtv_type db(5); for (long i = 0; i < 5; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); assert(db.block_size() == 1); assert(db.size() == 5); @@ -158,9 +158,9 @@ assert(db.block_size() == 1); assert(db.size() == 1); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(0, p, p+3); + db.insert(0, p, p + 3); assert(db.block_size() == 1); assert(db.size() == 4); assert(db.get(0) == 2.1); @@ -175,9 +175,9 @@ assert(db.block_size() == 1); assert(db.size() == 1); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(0, p, p+3); + db.insert(0, p, p + 3); assert(db.block_size() == 2); assert(db.size() == 4); assert(db.get(0) == 2.1); @@ -192,9 +192,9 @@ assert(db.block_size() == 2); assert(db.size() == 2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(1, p, p+3); + db.insert(1, p, p + 3); assert(db.block_size() == 2); assert(db.size() == 5); assert(db.get(0) == 1.1); @@ -210,9 +210,9 @@ assert(db.block_size() == 2); assert(db.size() == 2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(1, p, p+3); + db.insert(1, p, p + 3); assert(db.block_size() == 3); assert(db.size() == 5); assert(db.get(0) == 23); @@ -224,9 +224,9 @@ { mtv_type db(2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(1, p, p+3); + db.insert(1, p, p + 3); assert(db.block_size() == 3); assert(db.size() == 5); assert(db.is_empty(0)); @@ -243,9 +243,9 @@ assert(db.block_size() == 2); assert(db.size() == 2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(1, p, p+3); + db.insert(1, p, p + 3); assert(db.block_size() == 2); assert(db.size() == 5); assert(db.get(0) == 1.1); @@ -262,9 +262,9 @@ assert(db.block_size() == 2); assert(db.size() == 2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(1, p, p+3); + db.insert(1, p, p + 3); assert(db.block_size() == 3); assert(db.size() == 5); assert(db.get(0) == true); @@ -281,9 +281,9 @@ assert(db.block_size() == 1); assert(db.size() == 2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.insert(1, p, p+3); + db.insert(1, p, p + 3); assert(db.block_size() == 3); assert(db.size() == 5); assert(db.get(0) == 12); @@ -300,9 +300,9 @@ db.set(2, std::string("baa")); assert(db.size() == 3); assert(db.block_size() == 2); - double vals[] = { 2.1 }; + double vals[] = {2.1}; const double* p = &vals[0]; - db.insert(2, p, p+1); + db.insert(2, p, p + 1); assert(db.size() == 4); assert(db.block_size() == 4); } @@ -311,15 +311,15 @@ mtv_type db(2); db.set(0, static_cast(11)); db.set(1, static_cast(12)); - double vals[] = { 1.2 }; + double vals[] = {1.2}; const double* p = &vals[0]; - db.insert(1, p, p+1); + db.insert(1, p, p + 1); assert(db.block_size() == 3); // Append value to the top block. - uint64_t vals2[] = { 22 }; + uint64_t vals2[] = {22}; const uint64_t* p2 = &vals2[0]; - db.insert(1, p2, p2+1); + db.insert(1, p2, p2 + 1); assert(db.block_size() == 3); assert(db.get(0) == 11); assert(db.get(1) == 22); @@ -332,7 +332,7 @@ db.push_back(1.1); db.push_back(1.2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; const double* p = vals; db.insert(2, p, p + 3); assert(db.block_size() == 4); @@ -354,7 +354,7 @@ db.push_back(12); db.push_back(34); - int16_t vals[] = { 5, 6, 7 }; + int16_t vals[] = {5, 6, 7}; const int16_t* p = vals; db.insert(1, p, p + 3); assert(db.block_size() == 2); @@ -373,4 +373,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/iterators.inl mdds-2.0.3/test/multi_type_vector/default/tc/iterators.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/iterators.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/iterators.inl 2022-04-22 00:12:40.000000000 +0000 @@ -162,7 +162,8 @@ assert(it_blk->data); { mdds::mtv::double_element_block::const_iterator it_data = mdds::mtv::double_element_block::begin(*it_blk->data); - mdds::mtv::double_element_block::const_iterator it_data_end = mdds::mtv::double_element_block::end(*it_blk->data); + mdds::mtv::double_element_block::const_iterator it_data_end = + mdds::mtv::double_element_block::end(*it_blk->data); assert(it_data != it_data_end); assert(*it_data == 1.1); ++it_data; @@ -197,8 +198,10 @@ assert(it_blk->size == 4); assert(it_blk->data); { - mdds::mtv::string_element_block::const_reverse_iterator it_data = mdds::mtv::string_element_block::rbegin(*it_blk->data); - mdds::mtv::string_element_block::const_reverse_iterator it_data_end = mdds::mtv::string_element_block::rend(*it_blk->data); + mdds::mtv::string_element_block::const_reverse_iterator it_data = + mdds::mtv::string_element_block::rbegin(*it_blk->data); + mdds::mtv::string_element_block::const_reverse_iterator it_data_end = + mdds::mtv::string_element_block::rend(*it_blk->data); assert(it_data != it_data_end); assert(*it_data == "D"); ++it_data; @@ -214,8 +217,10 @@ { // Test crbegin() and crend() too, which should be identical to the // const variants of rbegin() and rend() from above. - mdds::mtv::string_element_block::const_reverse_iterator it_data = mdds::mtv::string_element_block::crbegin(*it_blk->data); - mdds::mtv::string_element_block::const_reverse_iterator it_data_end = mdds::mtv::string_element_block::crend(*it_blk->data); + mdds::mtv::string_element_block::const_reverse_iterator it_data = + mdds::mtv::string_element_block::crbegin(*it_blk->data); + mdds::mtv::string_element_block::const_reverse_iterator it_data_end = + mdds::mtv::string_element_block::crend(*it_blk->data); assert(it_data != it_data_end); assert(*it_data == "D"); ++it_data; @@ -249,8 +254,7 @@ * @param it this is passed as a const reference, yet it should still allow * being dereferenced as long as no data is modified. */ - auto check_block_iterator = [](const mtv_type::iterator& it, mdds::mtv::element_t expected) - { + auto check_block_iterator = [](const mtv_type::iterator& it, mdds::mtv::element_t expected) { mdds::mtv::element_t actual = it->type; const mtv_type::element_block_type* data = (*it).data; assert(actual == expected); @@ -357,4 +361,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/iterators_insert.inl mdds-2.0.3/test/multi_type_vector/default/tc/iterators_insert.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/iterators_insert.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/iterators_insert.inl 2022-04-22 00:12:40.000000000 +0000 @@ -230,4 +230,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/iterators_set_empty.inl mdds-2.0.3/test/multi_type_vector/default/tc/iterators_set_empty.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/iterators_set_empty.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/iterators_set_empty.inl 2022-04-22 00:12:40.000000000 +0000 @@ -213,4 +213,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/iterators_set.inl mdds-2.0.3/test/multi_type_vector/default/tc/iterators_set.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/iterators_set.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/iterators_set.inl 2022-04-22 00:12:40.000000000 +0000 @@ -887,4 +887,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/misc.inl mdds-2.0.3/test/multi_type_vector/default/tc/misc.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/misc.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/misc.inl 2022-04-22 00:12:40.000000000 +0000 @@ -26,23 +26,39 @@ * ************************************************************************/ -enum test_mtv_type { - _mtv_bool, _mtv_int8, _mtv_uint8, _mtv_int16, _mtv_uint16, _mtv_int32, _mtv_uint32, _mtv_int64, _mtv_uint64, _mtv_float, _mtv_double, _mtv_string, +enum test_mtv_type +{ + _mtv_bool, + _mtv_int8, + _mtv_uint8, + _mtv_int16, + _mtv_uint16, + _mtv_int32, + _mtv_uint32, + _mtv_int64, + _mtv_uint64, + _mtv_float, + _mtv_double, + _mtv_string, }; -#define TEST_TYPE(_type_,_type_enum_) test_mtv_type test_type(_type_) { return _type_enum_; } -TEST_TYPE(bool, _mtv_bool) -TEST_TYPE(int8_t, _mtv_int8) -TEST_TYPE(uint8_t, _mtv_uint8) -TEST_TYPE(int16_t, _mtv_int16) +#define TEST_TYPE(_type_, _type_enum_) \ + test_mtv_type test_type(_type_) \ + { \ + return _type_enum_; \ + } +TEST_TYPE(bool, _mtv_bool) +TEST_TYPE(int8_t, _mtv_int8) +TEST_TYPE(uint8_t, _mtv_uint8) +TEST_TYPE(int16_t, _mtv_int16) TEST_TYPE(uint16_t, _mtv_uint16) -TEST_TYPE(int32_t, _mtv_int32) +TEST_TYPE(int32_t, _mtv_int32) TEST_TYPE(uint32_t, _mtv_uint32) -TEST_TYPE(int64_t, _mtv_int64) +TEST_TYPE(int64_t, _mtv_int64) TEST_TYPE(uint64_t, _mtv_uint64) -TEST_TYPE(float, _mtv_float) -TEST_TYPE(double, _mtv_double) -TEST_TYPE(std::string, _mtv_string) +TEST_TYPE(float, _mtv_float) +TEST_TYPE(double, _mtv_double) +TEST_TYPE(std::string, _mtv_string) void mtv_test_misc_types() { @@ -311,12 +327,9 @@ db.set(3, int32_t(12)); db.set(4, int16_t(8)); - std::for_each(db.begin(), db.end(), - [](const mtv_type::value_type& node) - { - cout << "type: " << node.type << " size: " << node.size << " data: " << node.data << endl; - } - ); + std::for_each(db.begin(), db.end(), [](const mtv_type::value_type& node) { + cout << "type: " << node.type << " size: " << node.size << " data: " << node.data << endl; + }); } void mtv_test_misc_block_identifier() @@ -456,8 +469,7 @@ { stack_printer __stack_printer__(__FUNCTION__); - auto run = [](auto& db) - { + auto run = [](auto& db) { auto pos1 = db.position(9); // last valid position. pos1 = mtv_type::next_position(pos1); auto pos2 = db.position(10); // end position - one position past the last valid position @@ -542,4 +554,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/position.inl mdds-2.0.3/test/multi_type_vector/default/tc/position.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/position.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/position.inl 2022-04-22 00:12:40.000000000 +0000 @@ -200,4 +200,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/set.inl mdds-2.0.3/test/multi_type_vector/default/tc/set.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/set.inl 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/set.inl 2022-04-22 00:12:40.000000000 +0000 @@ -38,7 +38,7 @@ std::vector vals; vals.reserve(5); for (size_t i = 0; i < db.size(); ++i) - vals.push_back(double(i+1)); + vals.push_back(double(i + 1)); db.set(0, vals.begin(), vals.end()); @@ -55,7 +55,7 @@ for (size_t i = 0; i < db.size(); ++i) { std::ostringstream os; - os << (i+1); + os << (i + 1); vals.push_back(os.str()); } @@ -69,7 +69,7 @@ } { - double vals[] = { 5.0, 6.0, 7.0, 8.0, 9.0 }; + double vals[] = {5.0, 6.0, 7.0, 8.0, 9.0}; double* p = &vals[0]; double* p_end = p + 5; db.set(0, p, p_end); @@ -83,7 +83,7 @@ { // Replace the whole block of the same type, which shouldn't // delete the old data array. - double vals[] = { 5.1, 6.1, 7.1, 8.1, 9.1 }; + double vals[] = {5.1, 6.1, 7.1, 8.1, 9.1}; double* p = &vals[0]; double* p_end = p + 5; db.set(0, p, p_end); @@ -93,7 +93,7 @@ db.get(4, test); assert(test == 9.1); - double vals2[] = { 8.2, 9.2 }; + double vals2[] = {8.2, 9.2}; p = &vals2[0]; p_end = p + 2; db.set(3, p, p_end); @@ -105,7 +105,7 @@ { // Replace the upper part of a single block. - uint64_t vals[] = { 1, 2, 3 }; + uint64_t vals[] = {1, 2, 3}; uint64_t* p = &vals[0]; uint64_t* p_end = p + 3; db.set(0, p, p_end); @@ -123,7 +123,7 @@ { // Merge with the previos block and erase the whole block. - uint64_t vals[] = { 4, 5 }; + uint64_t vals[] = {4, 5}; uint64_t* p = &vals[0]; uint64_t* p_end = p + 2; db.set(3, p, p_end); @@ -168,13 +168,13 @@ { mtv_type db(5); for (size_t i = 0; i < 5; ++i) - db.set(i, static_cast(i+1)); + db.set(i, static_cast(i + 1)); assert(db.block_size() == 1); assert(db.size() == 5); { - uint64_t vals[] = { 10, 11 }; + uint64_t vals[] = {10, 11}; uint64_t* p = &vals[0]; uint64_t* p_end = p + 2; db.set(3, p, p_end); @@ -211,9 +211,9 @@ { mtv_type db(6); - double vals_d[] = { 1.0, 1.1, 1.2, 1.3, 1.4, 1.5 }; - uint64_t vals_i[] = { 12, 13, 14, 15 }; - std::string vals_s[] = { "a", "b" }; + double vals_d[] = {1.0, 1.1, 1.2, 1.3, 1.4, 1.5}; + uint64_t vals_i[] = {12, 13, 14, 15}; + std::string vals_s[] = {"a", "b"}; { double* p = &vals_d[0]; @@ -262,7 +262,7 @@ { mtv_type db(3); { - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; double* p_end = p + 3; db.set(0, p, p_end); @@ -294,7 +294,7 @@ db.set(1, std::string("foo")); assert(db.block_size() == 2); - double vals[] = { 2.1, 2.2 }; + double vals[] = {2.1, 2.2}; double* p = &vals[0]; double* p_end = p + 2; db.set(0, p, p_end); @@ -316,7 +316,7 @@ db.set(1, std::string("foo")); db.set(2, std::string("baa")); - double vals[] = { 2.1, 2.2 }; + double vals[] = {2.1, 2.2}; double* p = &vals[0]; double* p_end = p + 2; db.set(0, p, p_end); @@ -342,7 +342,7 @@ assert(db.block_size() == 2); assert(db.size() == 3); - double vals[] = { 2.1, 2.2 }; + double vals[] = {2.1, 2.2}; double* p = &vals[0]; double* p_end = p + 2; db.set(1, p, p_end); @@ -365,7 +365,7 @@ db.set(4, 1.4); assert(db.block_size() == 3); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; double* p_end = p + 3; db.set(1, p, p_end); @@ -386,9 +386,9 @@ db.set(3, 1.2); assert(db.block_size() == 2); - double vals[] = { 2.1, 2.2, 2.3 }; + double vals[] = {2.1, 2.2, 2.3}; double* p = &vals[0]; - db.set(1, p, p+3); + db.set(1, p, p + 3); assert(db.block_size() == 2); assert(db.get(0) == std::string("A")); assert(db.get(1) == 2.1); @@ -404,9 +404,9 @@ db.set(3, 1.2); assert(db.block_size() == 2); - double vals[] = { 2.1, 2.2 }; + double vals[] = {2.1, 2.2}; double* p = &vals[0]; - db.set(1, p, p+2); + db.set(1, p, p + 2); assert(db.block_size() == 2); assert(db.get(0) == std::string("A")); assert(db.get(1) == 2.1); @@ -423,9 +423,9 @@ db.set(4, static_cast(12)); assert(db.block_size() == 3); - uint64_t vals[] = { 21, 22, 23 }; + uint64_t vals[] = {21, 22, 23}; uint64_t* p = &vals[0]; - db.set(1, p, p+3); + db.set(1, p, p + 3); assert(db.block_size() == 2); assert(db.get(0) == std::string("A")); assert(db.get(1) == 21); @@ -441,9 +441,9 @@ db.set(2, 1.2); assert(db.block_size() == 2); - uint64_t vals[] = { 11, 12 }; + uint64_t vals[] = {11, 12}; uint64_t* p = &vals[0]; - db.set(0, p, p+2); + db.set(0, p, p + 2); assert(db.block_size() == 2); assert(db.get(0) == 11); assert(db.get(1) == 12); @@ -458,9 +458,9 @@ db.set(3, 1.2); assert(db.block_size() == 3); - uint64_t vals[] = { 11, 12 }; + uint64_t vals[] = {11, 12}; uint64_t* p = &vals[0]; - db.set(1, p, p+2); + db.set(1, p, p + 2); assert(db.block_size() == 2); assert(db.get(0) == 35); assert(db.get(1) == 11); @@ -475,9 +475,9 @@ db.set(1, 1.2); assert(db.block_size() == 2); - double vals[] = { 2.1, 2.2 }; + double vals[] = {2.1, 2.2}; double* p = &vals[0]; - db.set(0, p, p+2); + db.set(0, p, p + 2); assert(db.block_size() == 1); assert(db.get(0) == 2.1); assert(db.get(1) == 2.2); @@ -489,9 +489,9 @@ db.set(2, 1.2); assert(db.block_size() == 3); - double vals[] = { 2.1, 2.2 }; + double vals[] = {2.1, 2.2}; double* p = &vals[0]; - db.set(1, p, p+2); + db.set(1, p, p + 2); assert(db.block_size() == 1); assert(db.get(0) == 1.1); assert(db.get(1) == 2.1); @@ -505,9 +505,9 @@ db.set(4, std::string("C")); assert(db.block_size() == 2); - double vals[] = { 1.1, 1.2, 1.3 }; + double vals[] = {1.1, 1.2, 1.3}; double* p = &vals[0]; - db.set(1, p, p+3); + db.set(1, p, p + 3); assert(db.block_size() == 3); assert(db.is_empty(0)); @@ -608,7 +608,7 @@ db.push_back(i); for (int i = 0; i < 2; ++i) - db.push_back(i+20); + db.push_back(i + 20); std::vector data(3, 15); db.set(2, data.begin(), data.end()); @@ -633,7 +633,7 @@ db.push_back(i); for (int i = 0; i < 2; ++i) - db.push_back(i+20); + db.push_back(i + 20); std::vector data(3, 15); db.set(1, data.begin(), data.end()); @@ -650,4 +650,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/swap_range.inl mdds-2.0.3/test/multi_type_vector/default/tc/swap_range.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/swap_range.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/swap_range.inl 2022-04-22 00:12:40.000000000 +0000 @@ -317,12 +317,12 @@ // Do the same, but merge with the next block in the source. db1 = mtv_type(3, true); - db1.set(2, int_val+1); + db1.set(2, int_val + 1); db2 = mtv_type(1, int_val); db1.swap(1, 1, db2, 0); assert(db1.get(0) == true); assert(db1.get(1) == int_val); - assert(db1.get(2) == int_val+1); + assert(db1.get(2) == int_val + 1); assert(db2.get(0) == true); // Replace the middle of existing source block. @@ -451,7 +451,7 @@ // The source range is in the middle of a block. db1 = mtv_type(8); for (int32_t i = 0; i < 8; ++i) - db1.set(i, i+2); + db1.set(i, i + 2); db2 = mtv_type(4); db2.set(0, 12); db2.set(1, 13); @@ -519,7 +519,7 @@ // Leave some empty range. db2 = mtv_type(10); for (int32_t i = 0; i < 10; ++i) - db2.set(i, 10+i); + db2.set(i, 10 + i); db2.set(5, 'Z'); db1.swap(1, 7, db2, 2); @@ -549,4 +549,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/default/tc/transfer.inl mdds-2.0.3/test/multi_type_vector/default/tc/transfer.inl --- mdds-2.0.2/test/multi_type_vector/default/tc/transfer.inl 2021-11-23 00:27:27.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/default/tc/transfer.inl 2022-04-22 00:12:40.000000000 +0000 @@ -389,4 +389,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/aos/test_block_counter.cpp mdds-2.0.3/test/multi_type_vector/event/aos/test_block_counter.cpp --- mdds-2.0.2/test/multi_type_vector/event/aos/test_block_counter.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/aos/test_block_counter.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "block_counter.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/aos/test_block_init.cpp mdds-2.0.3/test/multi_type_vector/event/aos/test_block_init.cpp --- mdds-2.0.2/test/multi_type_vector/event/aos/test_block_init.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/aos/test_block_init.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "block_init.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/aos/test_main.cpp mdds-2.0.3/test/multi_type_vector/event/aos/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/event/aos/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/aos/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -28,12 +28,13 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { mtv_test_block_counter(); mtv_test_block_init(); + mtv_test_swap(); } catch (const std::exception& e) { diff -Nru mdds-2.0.2/test/multi_type_vector/event/aos/test_main.hpp mdds-2.0.3/test/multi_type_vector/event/aos/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/event/aos/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/aos/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -40,6 +40,6 @@ void mtv_test_block_counter(); void mtv_test_block_init(); +void mtv_test_swap(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/aos/test_swap.cpp mdds-2.0.3/test/multi_type_vector/event/aos/test_swap.cpp --- mdds-2.0.2/test/multi_type_vector/event/aos/test_swap.cpp 1970-01-01 00:00:00.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/aos/test_swap.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * Copyright (c) 2022 Kohei Yoshida + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + ************************************************************************/ + +#include "test_global.hpp" // This must be the first header to be included. +#include "test_main.hpp" + +#include "swap.inl" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff -Nru mdds-2.0.2/test/multi_type_vector/event/soa/test_block_counter.cpp mdds-2.0.3/test/multi_type_vector/event/soa/test_block_counter.cpp --- mdds-2.0.2/test/multi_type_vector/event/soa/test_block_counter.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/soa/test_block_counter.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "block_counter.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/soa/test_block_init.cpp mdds-2.0.3/test/multi_type_vector/event/soa/test_block_init.cpp --- mdds-2.0.2/test/multi_type_vector/event/soa/test_block_init.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/soa/test_block_init.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -32,4 +32,3 @@ #include "block_init.inl" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/soa/test_main.cpp mdds-2.0.3/test/multi_type_vector/event/soa/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/event/soa/test_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/soa/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -28,7 +28,7 @@ #include "test_global.hpp" // This must be the first header to be included. #include "test_main.hpp" -int main () +int main() { try { diff -Nru mdds-2.0.2/test/multi_type_vector/event/soa/test_main.hpp mdds-2.0.3/test/multi_type_vector/event/soa/test_main.hpp --- mdds-2.0.2/test/multi_type_vector/event/soa/test_main.hpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/soa/test_main.hpp 2022-04-22 00:12:40.000000000 +0000 @@ -40,6 +40,6 @@ void mtv_test_block_counter(); void mtv_test_block_init(); +void mtv_test_swap(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/tc/block_counter.inl mdds-2.0.3/test/multi_type_vector/event/tc/block_counter.inl --- mdds-2.0.2/test/multi_type_vector/event/tc/block_counter.inl 2021-11-23 02:58:16.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/tc/block_counter.inl 2022-04-22 00:12:40.000000000 +0000 @@ -28,7 +28,7 @@ struct event_block_counter { - size_t block_count; // number of element (data) blocks + size_t block_count; // number of element (data) blocks size_t block_count_numeric; size_t block_count_string; size_t block_count_int16; @@ -41,37 +41,19 @@ size_t block_count_int8; size_t block_count_uint8; - event_block_counter() : - block_count(0), - block_count_numeric(0), - block_count_string(0), - block_count_int16(0), - block_count_uint16(0), - block_count_int32(0), - block_count_uint32(0), - block_count_int64(0), - block_count_uint64(0), - block_count_boolean(0), - block_count_int8(0), - block_count_uint8(0) + event_block_counter() + : block_count(0), block_count_numeric(0), block_count_string(0), block_count_int16(0), block_count_uint16(0), + block_count_int32(0), block_count_uint32(0), block_count_int64(0), block_count_uint64(0), + block_count_boolean(0), block_count_int8(0), block_count_uint8(0) {} /** * This copy constructor intentionally does not copy the counters. */ - event_block_counter(const event_block_counter&) : - block_count(0), - block_count_numeric(0), - block_count_string(0), - block_count_int16(0), - block_count_uint16(0), - block_count_int32(0), - block_count_uint32(0), - block_count_int64(0), - block_count_uint64(0), - block_count_boolean(0), - block_count_int8(0), - block_count_uint8(0) + event_block_counter(const event_block_counter&) + : block_count(0), block_count_numeric(0), block_count_string(0), block_count_int16(0), block_count_uint16(0), + block_count_int32(0), block_count_uint32(0), block_count_int64(0), block_count_uint64(0), + block_count_boolean(0), block_count_int8(0), block_count_uint8(0) {} void element_block_acquired(const mdds::mtv::base_element_block* block) @@ -82,39 +64,38 @@ { case mdds::mtv::element_type_double: ++block_count_numeric; - break; + break; case mdds::mtv::element_type_string: ++block_count_string; - break; + break; case mdds::mtv::element_type_int16: ++block_count_int16; - break; + break; case mdds::mtv::element_type_uint16: ++block_count_uint16; - break; + break; case mdds::mtv::element_type_int32: ++block_count_int32; - break; + break; case mdds::mtv::element_type_uint32: ++block_count_uint32; - break; + break; case mdds::mtv::element_type_int64: ++block_count_int64; - break; + break; case mdds::mtv::element_type_uint64: ++block_count_uint64; - break; + break; case mdds::mtv::element_type_boolean: ++block_count_boolean; - break; + break; case mdds::mtv::element_type_int8: ++block_count_int8; - break; + break; case mdds::mtv::element_type_uint8: ++block_count_uint8; - break; - default: - ; + break; + default:; } } @@ -126,39 +107,38 @@ { case mdds::mtv::element_type_double: --block_count_numeric; - break; + break; case mdds::mtv::element_type_string: --block_count_string; - break; + break; case mdds::mtv::element_type_int16: --block_count_int16; - break; + break; case mdds::mtv::element_type_uint16: --block_count_uint16; - break; + break; case mdds::mtv::element_type_int32: --block_count_int32; - break; + break; case mdds::mtv::element_type_uint32: --block_count_uint32; - break; + break; case mdds::mtv::element_type_int64: --block_count_int64; - break; + break; case mdds::mtv::element_type_uint64: --block_count_uint64; - break; + break; case mdds::mtv::element_type_boolean: --block_count_boolean; - break; + break; case mdds::mtv::element_type_int8: --block_count_int8; - break; + break; case mdds::mtv::element_type_uint8: --block_count_uint8; - break; - default: - ; + break; + default:; } } }; @@ -191,13 +171,13 @@ assert(db.event_handler().block_count == 0); assert(db.event_handler().block_count_numeric == 0); - db.push_back(5.5); // create a new block. + db.push_back(5.5); // create a new block. assert(db.event_handler().block_count == 1); assert(db.event_handler().block_count_numeric == 1); - db.push_back(6.6); // no new block creation. + db.push_back(6.6); // no new block creation. assert(db.event_handler().block_count == 1); assert(db.event_handler().block_count_numeric == 1); - db.push_back(std::string("foo")); // another new block. + db.push_back(std::string("foo")); // another new block. assert(db.event_handler().block_count == 2); assert(db.event_handler().block_count_numeric == 1); assert(db.event_handler().block_count_string == 1); @@ -295,9 +275,9 @@ { mtv_type db(2); - db.set(1, 1.2); // This creates a new element block. + db.set(1, 1.2); // This creates a new element block. assert(db.event_handler().block_count == 1); - db.set(0, 1.1); // The element block count should not change. + db.set(0, 1.1); // The element block count should not change. assert(db.event_handler().block_count == 1); } @@ -325,7 +305,7 @@ mtv_type db(2); db.set(0, std::string("test")); // This creates a new string block. assert(db.event_handler().block_count == 1); - db.set(1, std::string("foo")); // This appends to the existing string block. + db.set(1, std::string("foo")); // This appends to the existing string block. assert(db.event_handler().block_count == 1); assert(db.event_handler().block_count_string == 1); } @@ -381,7 +361,7 @@ } { - std::vector vals = { 1.1, 1.2, 1.3 }; + std::vector vals = {1.1, 1.2, 1.3}; mtv_type db(vals.size(), vals.begin(), vals.end()); assert(db.event_handler().block_count == 1); @@ -504,7 +484,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(4); db.set(0, 0.1); db.set(1, 0.2); @@ -519,7 +499,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(4); db.set(0, int32_t(5)); db.set(1, int32_t(10)); @@ -532,7 +512,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(4); db.set(0, int32_t(5)); db.set(1, int32_t(10)); @@ -548,7 +528,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(4, std::string("foo")); assert(db.event_handler().block_count == 1); assert(db.event_handler().block_count_string == 1); @@ -559,7 +539,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(4, std::string("foo")); assert(db.event_handler().block_count == 1); db.set(2, vals.begin(), vals.end()); // replace the lower part of the last block. @@ -567,7 +547,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(4, std::string("foo")); db.push_back(int64_t(100)); assert(db.event_handler().block_count == 2); @@ -579,7 +559,7 @@ } { - std::vector vals = { 1.1, 1.2 }; + std::vector vals = {1.1, 1.2}; mtv_type db(6, std::string("foo")); assert(db.event_handler().block_count == 1); db.set(2, vals.begin(), vals.end()); // set the values to the middle of a block. @@ -597,7 +577,7 @@ assert(db.event_handler().block_count_int32 == 1); assert(db.event_handler().block_count_numeric == 1); - std::vector vals = { 1.1, 1.2, 1.3 }; // same type as the top block. + std::vector vals = {1.1, 1.2, 1.3}; // same type as the top block. db.set(0, vals.begin(), vals.end()); // overwrite multiple blocks. assert(db.event_handler().block_count == 1); assert(db.event_handler().block_count_numeric == 1); @@ -612,7 +592,7 @@ assert(db.event_handler().block_count_int32 == 1); assert(db.event_handler().block_count_string == 1); - std::vector vals = { 1.1, 1.2, 1.3 }; // differene type from that of the top block. + std::vector vals = {1.1, 1.2, 1.3}; // differene type from that of the top block. db.set(0, vals.begin(), vals.end()); // overwrite multiple blocks. assert(db.event_handler().block_count == 1); assert(db.event_handler().block_count_numeric == 1); @@ -1110,7 +1090,7 @@ // Leave some empty range. mtv_type db2(10); for (int32_t i = 0; i < 10; ++i) - db2.set(i, 10+i); + db2.set(i, 10 + i); db2.set(5, 'Z'); assert(db1.event_handler().block_count == 2); @@ -1136,4 +1116,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/tc/block_init.inl mdds-2.0.3/test/multi_type_vector/event/tc/block_init.inl --- mdds-2.0.2/test/multi_type_vector/event/tc/block_init.inl 2021-11-23 02:58:16.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/tc/block_init.inl 2022-04-22 00:12:40.000000000 +0000 @@ -31,13 +31,19 @@ std::string name; std::string ctor_type; - event_block_init() : ctor_type("empty") {} - event_block_init(const std::string& _name) : name(_name), ctor_type("normal") {} - event_block_init(const event_block_init& other) : name(other.name), ctor_type("copy") {} - event_block_init(event_block_init&& other) : name(std::move(other.name)), ctor_type("move") {} - - void element_block_acquired(const mdds::mtv::base_element_block* /*block*/) {} - void element_block_released(const mdds::mtv::base_element_block* /*block*/) {} + event_block_init() : ctor_type("empty") + {} + event_block_init(const std::string& _name) : name(_name), ctor_type("normal") + {} + event_block_init(const event_block_init& other) : name(other.name), ctor_type("copy") + {} + event_block_init(event_block_init&& other) : name(std::move(other.name)), ctor_type("move") + {} + + void element_block_acquired(const mdds::mtv::base_element_block* /*block*/) + {} + void element_block_released(const mdds::mtv::base_element_block* /*block*/) + {} }; struct eb_init_trait @@ -73,4 +79,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/multi_type_vector/event/tc/swap.inl mdds-2.0.3/test/multi_type_vector/event/tc/swap.inl --- mdds-2.0.2/test/multi_type_vector/event/tc/swap.inl 1970-01-01 00:00:00.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/event/tc/swap.inl 2022-05-11 00:33:24.000000000 +0000 @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * Copyright (c) 2022 Kohei Yoshida + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + ************************************************************************/ + +struct event_handler : public mdds::mtv::empty_event_func +{ + std::string name; + + event_handler() + {} +}; + +struct trait : public mdds::mtv::default_trait +{ + using event_func = event_handler; +}; + +using mtv_type = mtv_template_type; + +void mtv_test_swap() +{ + stack_printer __stack_printer__(__FUNCTION__); + + mtv_type db1(10), db2(2); + db1.event_handler().name = "db1"; + db2.event_handler().name = "db2"; + + assert(db1.size() == 10); + assert(db2.size() == 2); + assert(db1.event_handler().name == "db1"); + assert(db2.event_handler().name == "db2"); + + // This should also swap the event handlers. + db1.swap(db2); + + assert(db1.size() == 2); + assert(db2.size() == 10); + assert(db1.event_handler().name == "db2"); + assert(db2.event_handler().name == "db1"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff -Nru mdds-2.0.2/test/multi_type_vector/Makefile.in mdds-2.0.3/test/multi_type_vector/Makefile.in --- mdds-2.0.2/test/multi_type_vector/Makefile.in 2022-02-12 00:45:23.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/Makefile.in 2022-05-11 01:41:21.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -148,8 +148,6 @@ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -189,9 +187,10 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CPPFLAGS_NODEBUG = @CPPFLAGS_NODEBUG@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ @@ -203,11 +202,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ -EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ EXPECT = @EXPECT@ GDB = @GDB@ -GREP = @GREP@ HAVE_CXX17 = @HAVE_CXX17@ INCDIR = @INCDIR@ INSTALL = @INSTALL@ @@ -417,7 +415,6 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am diff -Nru mdds-2.0.2/test/multi_type_vector/perf/test_main.cpp mdds-2.0.3/test/multi_type_vector/perf/test_main.cpp --- mdds-2.0.2/test/multi_type_vector/perf/test_main.cpp 2021-11-23 00:24:18.000000000 +0000 +++ mdds-2.0.3/test/multi_type_vector/perf/test_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -51,13 +51,13 @@ // from the position of the first block. As such, as the block size // grows, so does the time it takes to search for the right block. - mtv_type db(n*2); + mtv_type db(n * 2); double val1 = 1.1; int val2 = 23; stack_printer __stack_printer__("::mtv_perf_test_block_position_lookup::default insertion"); for (size_t i = 0; i < n; ++i) { - size_t pos1 = i*2, pos2 = i*2 + 1; + size_t pos1 = i * 2, pos2 = i * 2 + 1; db.set(pos1, val1); db.set(pos2, val2); } @@ -67,14 +67,14 @@ // As a solution for this, we can use an iterator to specify the start // position, which eliminates the above scalability problem nicely. - mtv_type db(n*2); + mtv_type db(n * 2); mtv_type::iterator pos_hint = db.begin(); double val1 = 1.1; int val2 = 23; stack_printer __stack_printer__("::mtv_perf_test_block_position_lookup::insertion with position hint"); for (size_t i = 0; i < n; ++i) { - size_t pos1 = i*2, pos2 = i*2 + 1; + size_t pos1 = i * 2, pos2 = i * 2 + 1; pos_hint = db.set(pos_hint, pos1, val1); pos_hint = db.set(pos_hint, pos2, val2); } @@ -90,7 +90,7 @@ mtv_type::iterator it = db.begin(); for (size_t i = 0, n = db.size() / 2; i < n; ++i) { - it = db.set(it, i*2, 1.1); + it = db.set(it, i * 2, 1.1); } } @@ -117,9 +117,10 @@ } } -} +} // namespace -int main () try +int main() +try { mtv_perf_test_block_position_lookup(); mtv_perf_test_insert_via_position_object(); diff -Nru mdds-2.0.2/test/point_quad_tree_test.cpp mdds-2.0.3/test/point_quad_tree_test.cpp --- mdds-2.0.2/test/point_quad_tree_test.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/point_quad_tree_test.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -40,7 +40,7 @@ struct data_printer { - void operator() (const string* p) + void operator()(const string* p) { cout << *p << " "; } @@ -49,7 +49,7 @@ template struct search_result_printer { - void operator() (const pair& r) const + void operator()(const pair& r) const { cout << " (x=" << r.first.x << ", y=" << r.first.y << ", value='" << *r.second << "')" << endl; } @@ -77,9 +77,9 @@ string N("N"); db.insert(25, 32, &A); - db.insert( 5, 45, &B); + db.insert(5, 45, &B); db.insert(52, 10, &C); - db.insert(80, 5, &D); + db.insert(80, 5, &D); db.insert(40, 50, &E); db.insert(10, 10, &F); db.insert(20, 20, &G); @@ -159,8 +159,8 @@ { for (int32_t j = 0; j < 10; ++j) { - int32_t x = i*10 + 1, y = j*10 + 1; - size_t index = i*10 + j; + int32_t x = i * 10 + 1, y = j * 10 + 1; + size_t index = i * 10 + j; const string* data_ptr = data_store[index].get(); cout << "inserting '" << *data_ptr << "' at (" << x << "," << y << ")" << endl; db.insert(x, y, data_ptr); @@ -168,8 +168,8 @@ vector stored_data; db.get_all_stored_data(stored_data); - assert(stored_data.size() == (index+1)); - assert(db.size() == (index+1)); + assert(stored_data.size() == (index + 1)); + assert(db.size() == (index + 1)); assert(!db.empty()); bool success = db.verify_data(expected); assert(success); @@ -183,10 +183,11 @@ { for (int32_t j = 0; j < 10; ++j) { - int32_t x = i*10 + 1, y = j*10 + 1; + int32_t x = i * 10 + 1, y = j * 10 + 1; db.remove(x, y); size_t n = db.size(); - cout << "removing node at (" << x << "," << y << ") " << "size after removal: " << n << endl; + cout << "removing node at (" << x << "," << y << ") " + << "size after removal: " << n << endl; --node_count; assert(node_count == n); } @@ -359,8 +360,7 @@ template bool verify_find( - const _DbType& db, - typename _DbType::key_type x, typename _DbType::key_type y, + const _DbType& db, typename _DbType::key_type x, typename _DbType::key_type y, const typename _DbType::value_type data) { try diff -Nru mdds-2.0.2/test/ref_pair_test.cpp mdds-2.0.3/test/ref_pair_test.cpp --- mdds-2.0.2/test/ref_pair_test.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/ref_pair_test.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -72,9 +72,10 @@ int m_v1 = 222; int m_v2 = 456; - fake_iterator() {} + fake_iterator() + {} - rp_type operator* () + rp_type operator*() { return rp_type(m_v1, m_v2); } diff -Nru mdds-2.0.2/test/rtree/test_basic.cpp mdds-2.0.3/test/rtree/test_basic.cpp --- mdds-2.0.2/test/rtree/test_basic.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/rtree/test_basic.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -71,10 +71,9 @@ size_t n = std::distance(it, it_end); assert(n == 2); - std::unordered_map expected_values = - { - { "test", {{ 0, 0}, {2, 2}} }, - { "more test", {{-2, 1}, {3, 6}} }, + std::unordered_map expected_values = { + {"test", {{0, 0}, {2, 2}}}, + {"more test", {{-2, 1}, {3, 6}}}, }; for (; it != it_end; ++it) @@ -87,8 +86,7 @@ } // Perform an out-of-bound search by point. - std::vector pts = - { + std::vector pts = { {-10, -10}, {1, 7}, {6, 3}, @@ -111,7 +109,7 @@ rt_type tree; const rt_type& ctree = tree; - tree.insert({{-2,-2}, {2,2}}, "erase me"); + tree.insert({{-2, -2}, {2, 2}}, "erase me"); assert(!tree.empty()); assert(tree.size() == 1); @@ -128,9 +126,9 @@ assert(tree.size() == 0); assert(rt_type::extent_type() == tree.extent()); - tree.insert({{0,0}, {2,2}}, "erase me"); - tree.insert({{-10,-4}, {0,0}}, "erase me"); - rt_type::extent_type expected_bb({-10,-4}, {2,2}); + tree.insert({{0, 0}, {2, 2}}, "erase me"); + tree.insert({{-10, -4}, {0, 0}}, "erase me"); + rt_type::extent_type expected_bb({-10, -4}, {2, 2}); assert(tree.extent() == expected_bb); assert(tree.size() == 2); @@ -141,11 +139,10 @@ tree.erase(it); assert(!tree.empty()); // there should be one value stored in the tree. assert(tree.size() == 1); - expected_bb = {{0,0}, {2,2}}; + expected_bb = {{0, 0}, {2, 2}}; assert(tree.extent() == expected_bb); tree.check_integrity(check_props); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/rtree/test_bulkload_main.cpp mdds-2.0.3/test/rtree/test_bulkload_main.cpp --- mdds-2.0.2/test/rtree/test_bulkload_main.cpp 2021-11-01 19:32:05.000000000 +0000 +++ mdds-2.0.3/test/rtree/test_bulkload_main.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -91,13 +91,9 @@ std::string value; }; - std::vector values = - { - { { 0, 0}, "origin" }, - { {125, 125}, "middle" }, - { { 22, 987}, "somewhere" }, - { {-34, -200}, "negative" }, - { { 2, 3}, "near origin" }, + std::vector values = { + {{0, 0}, "origin"}, {{125, 125}, "middle"}, {{22, 987}, "somewhere"}, + {{-34, -200}, "negative"}, {{2, 3}, "near origin"}, }; // Insert less than max node size in order to test the packing @@ -151,30 +147,15 @@ double value; }; - std::vector values = - { - { 2142, 2777, 1781, 1273, 1.0 }, - { 5063, 2396, 765, 1019, 1.1 }, - { 1887, 4935, 1400, 892, 1.2 }, - { 4428, 4046, 1527, 1146, 1.3 }, - { 2268, 6713, 1146, 2162, 1.4 }, - { 7729, 7094, 2924, 1908, 1.5 }, - { 10396, 2014, 6480, 892, 1.6 }, - { 3158, 12302, 2035, 2289, 1.7 }, - { 10777, 11032, 3432, 2289, 1.8 }, - { 14334, 5063, 1781, 2797, 1.9 }, - { 8365, 4301, 3051, 1019, 2.0 }, - { 16619, 11794, 638, 511, 2.1 }, - { 15222, 9254, 892, 511, 2.2 }, - { 8111, 10142, 765, 638, 2.3 }, - { 6587, 10397, 765, 511, 2.4 }, - { 7475, 11793, 638, 1146, 2.5 }, - { 8746, 11285, 765, 892, 2.6 }, - { 16620, 3665, 511, 2162, 2.7 }, - { 6332, 14714, 2162, 1908, 2.8 }, - { 1634, 12048, 765, 5083, 2.9 }, - { 15349, 16238, 1400, 1400, 3.0 }, - { 11666, 14587, 1400, 1146, 3.1 }, + std::vector values = { + {2142, 2777, 1781, 1273, 1.0}, {5063, 2396, 765, 1019, 1.1}, {1887, 4935, 1400, 892, 1.2}, + {4428, 4046, 1527, 1146, 1.3}, {2268, 6713, 1146, 2162, 1.4}, {7729, 7094, 2924, 1908, 1.5}, + {10396, 2014, 6480, 892, 1.6}, {3158, 12302, 2035, 2289, 1.7}, {10777, 11032, 3432, 2289, 1.8}, + {14334, 5063, 1781, 2797, 1.9}, {8365, 4301, 3051, 1019, 2.0}, {16619, 11794, 638, 511, 2.1}, + {15222, 9254, 892, 511, 2.2}, {8111, 10142, 765, 638, 2.3}, {6587, 10397, 765, 511, 2.4}, + {7475, 11793, 638, 1146, 2.5}, {8746, 11285, 765, 892, 2.6}, {16620, 3665, 511, 2162, 2.7}, + {6332, 14714, 2162, 1908, 2.8}, {1634, 12048, 765, 5083, 2.9}, {15349, 16238, 1400, 1400, 3.0}, + {11666, 14587, 1400, 1146, 3.1}, }; for (size_t n_values = 5; n_values <= values.size(); ++n_values) @@ -184,7 +165,7 @@ for (size_t i = 0; i < n_values; ++i) { const auto& v = values[i]; - extent_type extent{{v.x, v.y}, {int16_t(v.x+v.w), int16_t(v.y+v.h)}}; + extent_type extent{{v.x, v.y}, {int16_t(v.x + v.w), int16_t(v.y + v.h)}}; only_movable vv(v.value); loader.insert(extent, std::move(vv)); @@ -198,7 +179,7 @@ for (size_t i = 0; i < n_values; ++i) { const auto& v = values[i]; - extent_type extent{{v.x, v.y}, {int16_t(v.x+v.w), int16_t(v.y+v.h)}}; + extent_type extent{{v.x, v.y}, {int16_t(v.x + v.w), int16_t(v.y + v.h)}}; auto res = tree.search(extent, search_type::match); assert(std::distance(res.begin(), res.end()) == 1); assert(res.begin()->get() == v.value); @@ -227,53 +208,22 @@ double value; }; - std::vector values = - { - { 2142, 2777, 1781, 1273, 1.0 }, - { 5063, 2396, 765, 1019, 1.1 }, - { 1887, 4935, 1400, 892, 1.2 }, - { 4428, 4046, 1527, 1146, 1.3 }, - { 2268, 6713, 1146, 2162, 1.4 }, - { 7729, 7094, 2924, 1908, 1.5 }, - { 10396, 2014, 6480, 892, 1.6 }, - { 2904, 11286, 2035, 2289, 1.7 }, - { 11412, 10524, 3432, 2289, 1.8 }, - { 14334, 5063, 1781, 2797, 1.9 }, - { 8365, 4301, 3051, 1019, 2.0 }, - { 16619, 11794, 638, 511, 2.1 }, - { 15222, 9254, 892, 511, 2.2 }, - { 8111, 10142, 765, 638, 2.3 }, - { 6587, 10397, 765, 511, 2.4 }, - { 7475, 11793, 638, 1146, 2.5 }, - { 8746, 11285, 765, 892, 2.6 }, - { 16620, 3665, 511, 2162, 2.7 }, - { 1760, 17762, 2162, 1908, 2.8 }, - { 1634, 12048, 765, 5083, 2.9 }, - { 15349, 16238, 1400, 1400, 3.0 }, - { 11793, 13190, 1400, 1146, 3.1 }, - { 4174, 6078, 1019, 638, 3.2 }, - { 13191, 3412, 1781, 257, 3.3 }, - { 6714, 11413, 511, 765, 3.4 }, - { 2903, 14969, 892, 511, 3.5 }, - { 3919, 16366, 638, 511, 3.6 }, - { 4554, 15222, 892, 638, 3.7 }, - { 2904, 16238, 511, 892, 3.8 }, - { 1507, 20557, 6099, 257, 3.9 }, - { 4047, 7221, 1273, 384, 4.0 }, - { 12301, 3538, 638, 1908, 4.1 }, - { 12174, 6460, 1146, 511, 4.2 }, - { 13318, 4046, 1273, 384, 4.3 }, - { 16620, 6459, 1019, 638, 4.4 }, - { 14080, 8238, 511, 765, 4.5 }, - { 8365, 12555, 765, 384, 4.6 }, - { 16493, 7349, 511, 511, 4.7 }, - { 7603, 11031, 511, 384, 4.8 }, - { 13571, 13191, 638, 1527, 4.9 }, - { 15858, 13826, 2035, 2035, 5.0 }, - { 7094, 1380, 892, 3305, 5.1 }, - { 7094, 6332, 1400, 1400, 5.2 }, - { 10142, 8237, 2162, 384, 5.3 }, - { 13444, 9761, 4, 130, 5.4 }, + std::vector values = { + {2142, 2777, 1781, 1273, 1.0}, {5063, 2396, 765, 1019, 1.1}, {1887, 4935, 1400, 892, 1.2}, + {4428, 4046, 1527, 1146, 1.3}, {2268, 6713, 1146, 2162, 1.4}, {7729, 7094, 2924, 1908, 1.5}, + {10396, 2014, 6480, 892, 1.6}, {2904, 11286, 2035, 2289, 1.7}, {11412, 10524, 3432, 2289, 1.8}, + {14334, 5063, 1781, 2797, 1.9}, {8365, 4301, 3051, 1019, 2.0}, {16619, 11794, 638, 511, 2.1}, + {15222, 9254, 892, 511, 2.2}, {8111, 10142, 765, 638, 2.3}, {6587, 10397, 765, 511, 2.4}, + {7475, 11793, 638, 1146, 2.5}, {8746, 11285, 765, 892, 2.6}, {16620, 3665, 511, 2162, 2.7}, + {1760, 17762, 2162, 1908, 2.8}, {1634, 12048, 765, 5083, 2.9}, {15349, 16238, 1400, 1400, 3.0}, + {11793, 13190, 1400, 1146, 3.1}, {4174, 6078, 1019, 638, 3.2}, {13191, 3412, 1781, 257, 3.3}, + {6714, 11413, 511, 765, 3.4}, {2903, 14969, 892, 511, 3.5}, {3919, 16366, 638, 511, 3.6}, + {4554, 15222, 892, 638, 3.7}, {2904, 16238, 511, 892, 3.8}, {1507, 20557, 6099, 257, 3.9}, + {4047, 7221, 1273, 384, 4.0}, {12301, 3538, 638, 1908, 4.1}, {12174, 6460, 1146, 511, 4.2}, + {13318, 4046, 1273, 384, 4.3}, {16620, 6459, 1019, 638, 4.4}, {14080, 8238, 511, 765, 4.5}, + {8365, 12555, 765, 384, 4.6}, {16493, 7349, 511, 511, 4.7}, {7603, 11031, 511, 384, 4.8}, + {13571, 13191, 638, 1527, 4.9}, {15858, 13826, 2035, 2035, 5.0}, {7094, 1380, 892, 3305, 5.1}, + {7094, 6332, 1400, 1400, 5.2}, {10142, 8237, 2162, 384, 5.3}, {13444, 9761, 4, 130, 5.4}, }; for (size_t n_values = 22; n_values <= values.size(); ++n_values) @@ -283,7 +233,7 @@ for (size_t i = 0; i < n_values; ++i) { const auto& v = values[i]; - extent_type extent{{v.x, v.y}, {int16_t(v.x+v.w), int16_t(v.y+v.h)}}; + extent_type extent{{v.x, v.y}, {int16_t(v.x + v.w), int16_t(v.y + v.h)}}; only_copyable vv(v.value); loader.insert(extent, vv); @@ -297,7 +247,7 @@ for (size_t i = 0; i < n_values; ++i) { const auto& v = values[i]; - extent_type extent{{v.x, v.y}, {int16_t(v.x+v.w), int16_t(v.y+v.h)}}; + extent_type extent{{v.x, v.y}, {int16_t(v.x + v.w), int16_t(v.y + v.h)}}; auto res = tree.search(extent, search_type::match); assert(std::distance(res.begin(), res.end()) == 1); assert(res.begin()->get() == v.value); @@ -329,4 +279,3 @@ } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff -Nru mdds-2.0.2/test/rtree/test_copy.cpp mdds-2.0.3/test/rtree/test_copy.cpp --- mdds-2.0.2/test/rtree/test_copy.cpp 2021-09-01 12:05:15.000000000 +0000 +++ mdds-2.0.3/test/rtree/test_copy.cpp 2022-04-22 00:12:40.000000000 +0000 @@ -49,18 +49,11 @@ double value; }; - std::vector