11 Commits

157 changed files with 1355635 additions and 592941 deletions

276
+ Normal file
View File

@@ -0,0 +1,276 @@
### psi specific - select compiler
#source <this_autogen_file> <facility> <target_language>
#<facility = sls sls2 sf> default is sf
#<target_language = cpp matlab python>
module unload gcc
module load gcc/7.3.0
### psi specific - end
rm -f configure.ac
ln -s configurePSI.ac configure.ac
rm -f ./aclocal.m4
rm -rf ./autom4te.cache
aclocal --force -I m4
/opt/gfa/python-3.7/latest/bin/libtoolize --force --copy #select libtools 2.4.6
autoconf --force #interprets configure.ac
autoheader --force
automake --force --add-missing --copy
#autoreconf not wanted
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
#source cafeVersion-gcc-7.3.0
CAFE_V="cafe-1.14.1"
#For later check of existence of HOST_ARCH for $EPICS/include/os/$HOST_ARCH
#Assume Linux but check if Darwin
CAFE_HOST_FLAG_DARWIN=$(echo ${EPICS_HOST_ARCH} | grep -c "Darwin")
export CAFE_HOST_FLAG_DARWIN=$CAFE_HOST_FLAG_DARWIN
RETURN_ON_WRONG_INPUT=true
RETURN_FLAG=false
EPICS_BASE=$(readlink ${EPICS}/base)
#EB=$(readlink /afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/base)
echo $EPICS_BASE
if [ -z "$EPICS_BASE" ]
then
EPICS_BASE='base-7.4.1' #7.0 = 7+0 = 7 for major release
fi
echo 'input' "$0" "$1" "$2"
echo $EPICS_BASE
FACILITY=$(echo "$1" | tr '[:upper:]' '[:lower:]')
CACLIENT=$(echo "$2" | tr '[:upper:]' '[:lower:]')
FACILITY_DEFAULT="sf"
CACLIENT_DEFAULT="python"
FACILITY_TEMP=""
CACLIENT_TEMP=""
echo 'input arg. facility/target' $FACILITY $CACLIENT
if [ -n "$FACILITY" ]
then
if [ "$FACILITY" = "matlab" ] || [ "$FACILITY" = "python" ] || \
[ "$FACILITY" = "py37" ] || [ "$FACILITY" = "py35" ] || \
[ "$FACILITY" = "julia" ] || [ "$FACILITY" = "cpp" ] || \
[ "$FACILITY" = "cc" ]
then
CACLIENT_TEMP=$FACILITY
FACILITY_TEMP=$2
fi
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "sls" ] || [ "$CACLIENT" = "sls2" ] || \
[ "$CACLIENT" = "sf" ] || [ "$CACLIENT" = "swissfel" ] || \
[ "$CACLIENT" = "sfel" ] || [ "$CACLIENT" = "hipa" ]
then
if [ -z $FACILITY_TEMP ]
then
FACILITY_TEMP=$CACLIENT
CACLIENT_TEMP=$1
fi
fi
fi
if [ -z "$FACILITY" ]
then
FACILITY="sf"
echo "FACILITY = " $FACILITY
if [ -z $CACLIENT ]
then
CACLIENT=$CACLIENT_DEFAULT
fi
elif [ "$FACILITY" = "sls" ] || [ "$FACILITY" = "sls2" ] || \
[ "$FACILITY" = "sf" ] || [ "$FACILITY" = "swissfel" ] || \
[ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "hipa" ]
then
echo "FACILITY = " $FACILITY
elif [ -n "$FACILITY_TEMP" ]
then
if [ "$FACILITY_TEMP" = "sls" ] || [ "$FACILITY_TEMP" = "sls2" ] || \
[ "$FACILITY_TEMP" = "sf" ] || [ "$FACILITY_TEMP" = "swissfel" ] || \
[ "$FACILITY_TEMP" = "sfel" ] || [ "$FACILITY_TEMP" = "hipa" ]
then
FACILITY=$FACILITY_TEMP
else
if [ -n "$2" ]
then
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
fi
echo "***OTHERWISE THE DEFAULT FACILITY IS:" $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT FACILITY IS: " $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "matlab" ] || [ "$CACLIENT" = "python" ] || \
[ "$CACLIENT" = "py37" ] || [ "$CACLIENT" = "py35" ] || \
[ "$CACLIENT" = "julia" ] || [ "$CACLIENT" = "cpp" ] || \
[ "$CACLIENT" = "cc" ]
then
echo "CA TARGET = " $CACLIENT
else
if [ -n "$CACLIENT_TEMP" ]
then
if [ "$CACLIENT_TEMP" = "matlab" ] || [ "$CACLIENT_TEMP" = "python" ] || \
[ "$CACLIENT_TEMP" = "py37" ] || [ "$CACLIENT_TEMP" = "py35" ] || \
[ "$CACLIENT_TEMP" = "julia" ] || [ "$CACLIENT_TEMP" = "cpp" ] || \
[ "$CACLIENT_TEMP" = "cc" ]
then
CACLIENT=$CACLIENT_TEMP
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
fi
else
CACLIENT=$CACLIENT_DEFAULT
fi
if [ $RETURN_ON_WRONG_INPUT = true ] ; then
if [ $RETURN_FLAG = true ] ; then
return 1 2>/dev/null
exit 1
fi
fi
echo "FACILITY SELECTED = " $FACILITY
echo "CA TARGET SELECTED = " $CACLIENT
ENABLE_OPTIONS="--enable-boost-inc"
if [ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "swissfel" ]
then
FACILITY="sf"
fi
if [ "$CACLIENT" = "python" ] || [ "$CACLIENT" = "julia" ]
then
CACLIENT="py37"
fi
if [ "$FACILITY" = "sls2" ]
then
ENABLE_OPTIONS+=" --enable-epics7"
CAFE_V+="-sls2"
else
ENABLE_OPTIONS+=" --enable-epics3"
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
CAFE_V+="-sf"
fi
fi
if [ "$CACLIENT" = "py35" ]
then
ENABLE_OPTIONS+=" --enable-python35"
ENABLE_OPTIONS+=" --enable-qt4"
CAFE_V+="-py35"
elif [ "$CACLIENT" = "py37" ]
then
ENABLE_OPTIONS+=" --enable-python37"
ENABLE_OPTIONS+=" --enable-qt5"
CAFE_V+="-py37"
#else
#ENABLE_OPTIONS+=" --enable-qt5"
fi
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
#rm -f src/PyCafe.cpp
#ln -s PyCafe3.cpp src/PyCafe.cpp
ENABLE_OPTIONS+=" --enable-json"
ENABLE_OPTIONS+=" --enable-zeromq"
ENABLE_OPTIONS+=" --enable-curl"
ENABLE_OPTIONS+=" --enable-lz4"
#else
#rm -f src/PyCafe.cpp
#ln -s PyCafe_sls.cpp src/PyCafe.cpp
fi
CAFE_V+="-gcc-"$GCC_VERSION
echo "CAFE VERSION: $CAFE_V"
#echo 'EPICS BASE IS='$EPICS_BASE
#echo 'EPICS BASE DIR='${EPICS}/base-7.0.4.1
EB1=$(echo $EPICS_BASE | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
#echo $EBMIN1
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#ENABLE_OPTIONS+=" --enable-qt5"
##ENABLE_OPTIONS+=" --enable-qt4"
#ENABLE_OPTIONS+=" --enable-python37"
##ENABLE_OPTIONS+=" --enable-python35"
#ENABLE_OPTIONS+=" --enable-json"
#ENABLE_OPTIONS+=" --enable-zeromq"
#ENABLE_OPTIONS+=" --enable-curl"
#ENABLE_OPTIONS+=" --enable-lz4"
echo 'ENABLE_OPTIONS='$ENABLE_OPTIONS
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_V} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_V}/lib/${EPICS_HOST_ARCH} \
${ENABLE_OPTIONS} \
--with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--with-epics7=${EPICS}/base-7.0.4.1 \
--with-epics3=${EPICS}/base \
--with-python37=/opt/gfa/python-3.7/latest \
--with-python35=/opt/gfa/python-3.5/latest \
--with-qt5=/opt/gfa/python-3.7/latest \
--with-qt4=/opt/gfa/python-3.5/latest \
--with-json=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2 \
--with-zeromq=/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0 \
--with-curl=/opt/gfa/zmq/curl-7.55.1 \
--with-lz4=/opt/gfa/zmq/lz4/lib
unset CAFE_EPICS_V_PATCH
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_MAJOR
unset CAFE_HOST_FLAG_DARWIN

15
INSTALL
View File

@@ -1,8 +1,8 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
@@ -304,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@@ -362,4 +368,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

30
README
View File

@@ -4,8 +4,17 @@ autogen_rel_py3_noqt.sh ==> generates library for use from within python and C
autogen_rel_noqt.sh ==> generates library for building a mex file (remove Qt4 dependence as matlab requires Qt5)
autogen_rel.sh ==> normal c++ release
##
Libraries are only made available when the appropriate is enabld
#ENABLE_OPTIONS+=" --enable-qt5"
##ENABLE_OPTIONS+=" --enable-qt4"
#ENABLE_OPTIONS+=" --enable-python37"
##ENABLE_OPTIONS+=" --enable-python35"
#ENABLE_OPTIONS+=" --enable-json"
#ENABLE_OPTIONS+=" --enable-zeromq"
#ENABLE_OPTIONS+=" --enable-curl"
#ENABLE_OPTIONS+=" --enable-lz4"
##
## --------------------------------------------------------------------------
## autogen.sh
##
@@ -16,18 +25,21 @@ autogen_rel.sh ==> normal c++ release
## installed
## --with-boost: base directory for the boost header files
## --with-epics: epics top level directory
## Note that configure.ac assume that the architecture is
## base/lib/${EPICS_HOST_ARCH}
## --with-qt-inc Qt include directory (optional)
## --with-qt-lib Qt lib directory (optional)
## --with-python-inc Python include directory, if building PyCafe
## --with-python-lib Python lib directory, if bulding PyCafe
## --with-epics7: epics7 top level directory
## --with-epics3: epics3 top level directory
## Note that configure.ac assume that the architecture is
## base/lib/${EPICS_HOST_ARCH}
## --with-qt5: Qt5 base directory (optional)
## --with-python37: Python 3.7 directory, if building PyCafe
## --with-python35: Python 3.5 directory, if bulding PyCafe
## Remaining libraries are specific to swissfel zmq streams
## --------------------------------------------------------------------------
1) Modify autogen.sh according to above
2) 'source autogen.sh'
3) 'make install' This installs cafe headers/libraries to the directories
3) 'make'
4) 'make install' This installs cafe headers/libraries to the directories
specified by --prefix/--libdir in the above

86
autogen.sh Normal file
View File

@@ -0,0 +1,86 @@
### psi specific - select compiler
rm -f configure.ac
ln -s configurePSI.ac configure.ac
rm -f src/PyCafe.cpp
ln -s PyCafe_sls.cpp src/PyCafe.cpp
rm -f ./aclocal.m4
rm -rf ./autom4te.cache
aclocal --force -I m4
/opt/gfa/python-3.7/latest/bin/libtoolize --force --copy #select libtools 2.4.6
autoconf --force #interprets configure.ac
autoheader --force
automake --force --add-missing --copy
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
#source cafeVersion-gcc-7.3.0
CAFE_V="cafe-1.13.0"
#For later check of existence of HOST_ARCH for $EPICS/include/os/$HOST_ARCH
#Assume Linux but check if Darwin
CAFE_HOST_FLAG_DARWIN=$(echo ${EPICS_HOST_ARCH} | grep -c "Darwin")
echo 'darwin' $CAFE_HOST_FLAG_DARWIN
export CAFE_HOST_FLAG_DARWIN=$CAFE_HOST_FLAG_DARWIN
EPICS_BASE=$(readlink ${EPICS}/base)
#EB=$(readlink /afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/base)
echo $EPICS_BASE
if [ -z "$EPICS_BASE" ]
then
EPICS_BASE='base-7.4.1' #7.0 = 7+0 = 7 for major release
fi
echo 'input' "$0" "$1" "$2"
echo $EPICS_BASE
EB1=$(echo $EPICS_BASE | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
#echo $EBMIN1
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
ENABLE_OPTIONS="--enable-boost-inc"
ENABLE_OPTIONS+=" --enable-epics3"
#ENABLE_OPTIONS+=" --enable-epics7"
ENABLE_OPTIONS+=" --enable-qt5"
#ENABLE_OPTIONS+=" --enable-qt4"
ENABLE_OPTIONS+=" --enable-python37"
#ENABLE_OPTIONS+=" --enable-python35"
#ENABLE_OPTIONS+=" --enable-json"
#ENABLE_OPTIONS+=" --enable-zeromq"
#ENABLE_OPTIONS+=" --enable-curl"
#ENABLE_OPTIONS+=" --enable-lz4"
echo 'ENABLE_OPTIONS='$ENABLE_OPTIONS
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_V} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_V}/lib/${EPICS_HOST_ARCH} \
${ENABLE_OPTIONS} \
--with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--with-epics7=${EPICS}/base-7.0.4.1 \
--with-epics3=${EPICS}/base \
--with-python37=/opt/gfa/python-3.7/latest \
--with-python35=/opt/gfa/python-3.5/latest \
--with-qt5=/opt/gfa/python-3.7/latest \
--with-qt4=/opt/gfa/python-3.5/latest \
--with-json=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2 \
--with-zeromq=/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0 \
--with-curl=/opt/gfa/zmq/curl-7.55.1 \
--with-lz4=/opt/gfa/zmq/lz4/lib
unset CAFE_EPICS_V_PATCH
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_MAJOR
unset CAFE_HOST_FLAG_DARWIN

293
autogen_psi.sh Normal file
View File

@@ -0,0 +1,293 @@
### psi specific - select compiler
#source <this_autogen_file> <facility> <target_language>
#<facility = sls sls2 sf> default is sf
#<target_language = cpp matlab python>
module unload gcc
module load gcc/9.3.0
### psi specific - end
rm -f configure.ac
ln -s configurePSI.ac configure.ac
rm -f ./aclocal.m4
rm -rf ./autom4te.cache
aclocal --force -I m4
/opt/gfa/python-3.7/latest/bin/libtoolize --force --copy #select libtools 2.4.6
autoconf --force #interprets configure.ac
autoheader --force
automake --force --add-missing --copy
#autoreconf not wanted
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
#source cafeVersion-gcc-7.3.0
CAFE_V="cafe-1.14.4"
#For later check of existence of HOST_ARCH for $EPICS/include/os/$HOST_ARCH
#Assume Linux but check if Darwin
CAFE_HOST_FLAG_DARWIN=$(echo ${EPICS_HOST_ARCH} | grep -c "Darwin")
export CAFE_HOST_FLAG_DARWIN=$CAFE_HOST_FLAG_DARWIN
RETURN_ON_WRONG_INPUT=true
RETURN_FLAG=false
EPICS_BASE=$(readlink ${EPICS}/base)
#EB=$(readlink /afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/base)
echo $EPICS_BASE
if [ -z "$EPICS_BASE" ]
then
EPICS_BASE='base-7' #7.0 = 7+0 = 7 for major release
fi
echo 'input' "$0" "$1" "$2"
echo $EPICS_BASE
FACILITY=$(echo "$1" | tr '[:upper:]' '[:lower:]')
CACLIENT=$(echo "$2" | tr '[:upper:]' '[:lower:]')
FACILITY_DEFAULT="sf"
CACLIENT_DEFAULT="python"
FACILITY_TEMP=""
CACLIENT_TEMP=""
echo 'input arg. facility/target' $FACILITY $CACLIENT
if [ -n "$FACILITY" ]
then
if [ "$FACILITY" = "matlab" ] || [ "$FACILITY" = "python" ] || \
[ "$FACILITY" = "py310" ] || [ "$FACILITY" = "py38" ] || \
[ "$FACILITY" = "py37" ] || [ "$FACILITY" = "py35" ] || \
[ "$FACILITY" = "julia" ] || [ "$FACILITY" = "cpp" ] || \
[ "$FACILITY" = "cc" ]
then
CACLIENT_TEMP=$FACILITY
FACILITY_TEMP=$2
fi
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "sls" ] || [ "$CACLIENT" = "sls2" ] || \
[ "$CACLIENT" = "sf" ] || [ "$CACLIENT" = "swissfel" ] || \
[ "$CACLIENT" = "sfel" ] || [ "$CACLIENT" = "hipa" ]
then
if [ -z $FACILITY_TEMP ]
then
FACILITY_TEMP=$CACLIENT
CACLIENT_TEMP=$1
fi
fi
fi
if [ -z "$FACILITY" ]
then
FACILITY="sf"
echo "FACILITY = " $FACILITY
if [ -z $CACLIENT ]
then
CACLIENT=$CACLIENT_DEFAULT
fi
elif [ "$FACILITY" = "sls" ] || [ "$FACILITY" = "sls2" ] || \
[ "$FACILITY" = "sf" ] || [ "$FACILITY" = "swissfel" ] || \
[ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "hipa" ]
then
echo "FACILITY = " $FACILITY
elif [ -n "$FACILITY_TEMP" ]
then
if [ "$FACILITY_TEMP" = "sls" ] || [ "$FACILITY_TEMP" = "sls2" ] || \
[ "$FACILITY_TEMP" = "sf" ] || [ "$FACILITY_TEMP" = "swissfel" ] || \
[ "$FACILITY_TEMP" = "sfel" ] || [ "$FACILITY_TEMP" = "hipa" ]
then
FACILITY=$FACILITY_TEMP
else
if [ -n "$2" ]
then
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
fi
echo "***OTHERWISE THE DEFAULT FACILITY IS:" $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT FACILITY IS: " $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "matlab" ] || [ "$CACLIENT" = "python" ] || \
[ "$CACLIENT" = "py310" ] || [ "$CACLIENT" = "py38" ] || \
[ "$CACLIENT" = "py37" ] || [ "$CACLIENT" = "py35" ] || \
[ "$CACLIENT" = "julia" ] || [ "$CACLIENT" = "cpp" ] || \
[ "$CACLIENT" = "cc" ]
then
echo "CA TARGET = " $CACLIENT
else
if [ -n "$CACLIENT_TEMP" ]
then
if [ "$CACLIENT_TEMP" = "matlab" ] || [ "$CACLIENT_TEMP" = "python" ] || \
[ "$CACLIENT_TEMP" = "py310" ] || [ "$CACLIENT_TEMP" = "py38" ] || \
[ "$CACLIENT_TEMP" = "py37" ] || [ "$CACLIENT_TEMP" = "py35" ] || \
[ "$CACLIENT_TEMP" = "julia" ] || [ "$CACLIENT_TEMP" = "cpp" ] || \
[ "$CACLIENT_TEMP" = "cc" ]
then
CACLIENT=$CACLIENT_TEMP
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
fi
else
CACLIENT=$CACLIENT_DEFAULT
fi
if [ $RETURN_ON_WRONG_INPUT = true ] ; then
if [ $RETURN_FLAG = true ] ; then
return 1 2>/dev/null
exit 1
fi
fi
echo "FACILITY SELECTED = " $FACILITY
echo "CA TARGET SELECTED = " $CACLIENT
ENABLE_OPTIONS="--enable-boost-inc"
if [ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "swissfel" ]
then
FACILITY="sf"
fi
if [ "$CACLIENT" = "python" ] || [ "$CACLIENT" = "julia" ]
then
CACLIENT="py37"
fi
if [ "$FACILITY" = "sls2" ]
then
ENABLE_OPTIONS+=" --enable-epics7"
CAFE_V+="-sls2"
else
ENABLE_OPTIONS+=" --enable-epics3"
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
CAFE_V+="-sf"
fi
fi
if [ "$CACLIENT" = "py35" ]
then
ENABLE_OPTIONS+=" --enable-python35"
ENABLE_OPTIONS+=" --enable-qt4"
CAFE_V+="-py35"
elif [ "$CACLIENT" = "py37" ]
then
ENABLE_OPTIONS+=" --enable-python37"
ENABLE_OPTIONS+=" --enable-qt5"
CAFE_V+="-py37"
elif [ "$CACLIENT" = "py38" ]
then
ENABLE_OPTIONS+=" --enable-python38"
ENABLE_OPTIONS+=" --enable-qt5py38"
CAFE_V+="-py38"
elif [ "$CACLIENT" = "py310" ]
then
ENABLE_OPTIONS+=" --enable-python310"
#ENABLE_OPTIONS+=" --enable-qt5py310"
CAFE_V+="-py310"
else
ENABLE_OPTIONS+=" --enable-qt5"
fi
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
#rm -f src/PyCafe.cpp
#ln -s PyCafe3.cpp src/PyCafe.cpp
ENABLE_OPTIONS+=" --enable-json"
ENABLE_OPTIONS+=" --enable-zeromq"
ENABLE_OPTIONS+=" --enable-curl"
ENABLE_OPTIONS+=" --enable-lz4"
#else
#rm -f src/PyCafe.cpp
#ln -s PyCafe_sls.cpp src/PyCafe.cpp
fi
CAFE_V+="-gcc-"$GCC_VERSION
echo "$CAFE_V"
#echo 'EPICS BASE IS='$EPICS_BASE
#echo 'EPICS BASE DIR='${EPICS}/base-7.0.4.1
EB1=$(echo $EPICS_BASE | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
#echo $EBMIN1
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#ENABLE_OPTIONS+=" --enable-qt5"
##ENABLE_OPTIONS+=" --enable-qt4"
#ENABLE_OPTIONS+=" --enable-python37"
##ENABLE_OPTIONS+=" --enable-python35"
#ENABLE_OPTIONS+=" --enable-json"
#ENABLE_OPTIONS+=" --enable-zeromq"
#ENABLE_OPTIONS+=" --enable-curl"
#ENABLE_OPTIONS+=" --enable-lz4"
echo 'ENABLE_OPTIONS='$ENABLE_OPTIONS
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_V} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_V}/lib/${EPICS_HOST_ARCH} \
${ENABLE_OPTIONS} \
--with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--with-epics3=${EPICS}/base \
--with-python310=/ioc/python/latest \
--with-python38=/opt/gfa/python-3.8/latest \
--with-python37=/opt/gfa/python-3.7/latest \
--with-python35=/opt/gfa/python-3.5/latest \
--with-qt5py310=/ioc/python/latest \
--with-qt5py38=/opt/gfa/python-3.8/latest \
--with-qt5=/opt/gfa/python-3.7/latest \
--with-qt4=/opt/gfa/python-3.5/latest \
--with-json=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2 \
--with-zeromq=/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0 \
--with-curl=/opt/gfa/zmq/curl-7.55.1 \
--with-lz4=/opt/gfa/zmq/lz4/lib \
--with-epics7=${EPICS}/base-7.0.6
unset CAFE_EPICS_V_PATCH
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_MAJOR
unset CAFE_HOST_FLAG_DARWIN

286
autogen_psi.sh- Normal file
View File

@@ -0,0 +1,286 @@
### psi specific - select compiler
#source <this_autogen_file> <facility> <target_language>
#<facility = sls sls2 sf> default is sf
#<target_language = cpp matlab python>
module unload gcc
module load gcc/9.4.0
### psi specific - end
rm -f configure.ac
ln -s configurePSI.ac configure.ac
rm -f ./aclocal.m4
rm -rf ./autom4te.cache
aclocal --force -I m4
/opt/gfa/python-3.7/latest/bin/libtoolize --force --copy #select libtools 2.4.6
autoconf --force #interprets configure.ac
autoheader --force
automake --force --add-missing --copy
#autoreconf not wanted
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
#source cafeVersion-gcc-7.3.0
CAFE_V="cafe-1.14.4"
#For later check of existence of HOST_ARCH for $EPICS/include/os/$HOST_ARCH
#Assume Linux but check if Darwin
CAFE_HOST_FLAG_DARWIN=$(echo ${EPICS_HOST_ARCH} | grep -c "Darwin")
export CAFE_HOST_FLAG_DARWIN=$CAFE_HOST_FLAG_DARWIN
RETURN_ON_WRONG_INPUT=true
RETURN_FLAG=false
EPICS_BASE=$(readlink ${EPICS}/base)
#EB=$(readlink /afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/base)
echo $EPICS_BASE
if [ -z "$EPICS_BASE" ]
then
EPICS_BASE='base-7' #7.0 = 7+0 = 7 for major release
fi
echo 'input' "$0" "$1" "$2"
echo $EPICS_BASE
FACILITY=$(echo "$1" | tr '[:upper:]' '[:lower:]')
CACLIENT=$(echo "$2" | tr '[:upper:]' '[:lower:]')
FACILITY_DEFAULT="sf"
CACLIENT_DEFAULT="python"
FACILITY_TEMP=""
CACLIENT_TEMP=""
echo 'input arg. facility/target' $FACILITY $CACLIENT
if [ -n "$FACILITY" ]
then
if [ "$FACILITY" = "matlab" ] || [ "$FACILITY" = "python" ] || \
[ "$FACILITY" = "py38" ] ||
[ "$FACILITY" = "py37" ] || [ "$FACILITY" = "py35" ] || \
[ "$FACILITY" = "julia" ] || [ "$FACILITY" = "cpp" ] || \
[ "$FACILITY" = "cc" ]
then
CACLIENT_TEMP=$FACILITY
FACILITY_TEMP=$2
fi
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "sls" ] || [ "$CACLIENT" = "sls2" ] || \
[ "$CACLIENT" = "sf" ] || [ "$CACLIENT" = "swissfel" ] || \
[ "$CACLIENT" = "sfel" ] || [ "$CACLIENT" = "hipa" ]
then
if [ -z $FACILITY_TEMP ]
then
FACILITY_TEMP=$CACLIENT
CACLIENT_TEMP=$1
fi
fi
fi
if [ -z "$FACILITY" ]
then
FACILITY="sf"
echo "FACILITY = " $FACILITY
if [ -z $CACLIENT ]
then
CACLIENT=$CACLIENT_DEFAULT
fi
elif [ "$FACILITY" = "sls" ] || [ "$FACILITY" = "sls2" ] || \
[ "$FACILITY" = "sf" ] || [ "$FACILITY" = "swissfel" ] || \
[ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "hipa" ]
then
echo "FACILITY = " $FACILITY
elif [ -n "$FACILITY_TEMP" ]
then
if [ "$FACILITY_TEMP" = "sls" ] || [ "$FACILITY_TEMP" = "sls2" ] || \
[ "$FACILITY_TEMP" = "sf" ] || [ "$FACILITY_TEMP" = "swissfel" ] || \
[ "$FACILITY_TEMP" = "sfel" ] || [ "$FACILITY_TEMP" = "hipa" ]
then
FACILITY=$FACILITY_TEMP
else
if [ -n "$2" ]
then
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
fi
echo "***OTHERWISE THE DEFAULT FACILITY IS:" $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT FACILITY IS: " $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "matlab" ] || [ "$CACLIENT" = "python" ] || \
[ "$CACLIENT" = "py38" ] || \
[ "$CACLIENT" = "py37" ] || [ "$CACLIENT" = "py35" ] || \
[ "$CACLIENT" = "julia" ] || [ "$CACLIENT" = "cpp" ] || \
[ "$CACLIENT" = "cc" ]
then
echo "CA TARGET = " $CACLIENT
else
if [ -n "$CACLIENT_TEMP" ]
then
if [ "$CACLIENT_TEMP" = "matlab" ] || [ "$CACLIENT_TEMP" = "python" ] || \
[ "$CACLIENT_TEMP" = "py38" ] || \
[ "$CACLIENT_TEMP" = "py37" ] || [ "$CACLIENT_TEMP" = "py35" ] || \
[ "$CACLIENT_TEMP" = "julia" ] || [ "$CACLIENT_TEMP" = "cpp" ] || \
[ "$CACLIENT_TEMP" = "cc" ]
then
CACLIENT=$CACLIENT_TEMP
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
fi
else
CACLIENT=$CACLIENT_DEFAULT
fi
if [ $RETURN_ON_WRONG_INPUT = true ] ; then
if [ $RETURN_FLAG = true ] ; then
return 1 2>/dev/null
exit 1
fi
fi
echo "FACILITY SELECTED = " $FACILITY
echo "CA TARGET SELECTED = " $CACLIENT
ENABLE_OPTIONS="--enable-boost-inc"
if [ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "swissfel" ]
then
FACILITY="sf"
fi
if [ "$CACLIENT" = "python" ] || [ "$CACLIENT" = "julia" ]
then
CACLIENT="py37"
fi
if [ "$FACILITY" = "sls2" ]
then
ENABLE_OPTIONS+=" --enable-epics7"
CAFE_V+="-sls2"
else
ENABLE_OPTIONS+=" --enable-epics3"
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
CAFE_V+="-sf"
fi
fi
if [ "$CACLIENT" = "py35" ]
then
ENABLE_OPTIONS+=" --enable-python35"
ENABLE_OPTIONS+=" --enable-qt4"
CAFE_V+="-py35"
elif [ "$CACLIENT" = "py37" ]
then
ENABLE_OPTIONS+=" --enable-python37"
ENABLE_OPTIONS+=" --enable-qt5"
CAFE_V+="-py37"
elif [ "$CACLIENT" = "py38" ]
then
ENABLE_OPTIONS+=" --enable-python38"
ENABLE_OPTIONS+=" --enable-qt5py38"
CAFE_V+="-py38"
else
ENABLE_OPTIONS+=" --enable-qt5"
fi
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
#rm -f src/PyCafe.cpp
#ln -s PyCafe3.cpp src/PyCafe.cpp
ENABLE_OPTIONS+=" --enable-json"
ENABLE_OPTIONS+=" --enable-zeromq"
ENABLE_OPTIONS+=" --enable-curl"
ENABLE_OPTIONS+=" --enable-lz4"
#else
#rm -f src/PyCafe.cpp
#ln -s PyCafe_sls.cpp src/PyCafe.cpp
fi
CAFE_V+="-gcc-"$GCC_VERSION
echo "$CAFE_V"
#echo 'EPICS BASE IS='$EPICS_BASE
#echo 'EPICS BASE DIR='${EPICS}/base-7.0.4.1
EB1=$(echo $EPICS_BASE | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
#echo $EBMIN1
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#ENABLE_OPTIONS+=" --enable-qt5"
##ENABLE_OPTIONS+=" --enable-qt4"
#ENABLE_OPTIONS+=" --enable-python37"
##ENABLE_OPTIONS+=" --enable-python35"
#ENABLE_OPTIONS+=" --enable-json"
#ENABLE_OPTIONS+=" --enable-zeromq"
#ENABLE_OPTIONS+=" --enable-curl"
#ENABLE_OPTIONS+=" --enable-lz4"
echo 'ENABLE_OPTIONS='$ENABLE_OPTIONS
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_V} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_V}/lib/${EPICS_HOST_ARCH} \
${ENABLE_OPTIONS} \
--with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--with-epics3=${EPICS}/base \
--with-python38=/opt/gfa/python-3.8/latest \
--with-python37=/opt/gfa/python-3.7/latest \
--with-python35=/opt/gfa/python-3.5/latest \
--with-qt5py38=/opt/gfa/python-3.8/latest \
--with-qt5=/opt/gfa/python-3.7/latest \
--with-qt4=/opt/gfa/python-3.5/latest \
--with-json=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2 \
--with-zeromq=/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0 \
--with-curl=/opt/gfa/zmq/curl-7.55.1 \
--with-lz4=/opt/gfa/zmq/lz4/lib \
--with-epics7=${EPICS}/base-7.0.6
unset CAFE_EPICS_V_PATCH
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_MAJOR
unset CAFE_HOST_FLAG_DARWIN

View File

@@ -1,46 +0,0 @@
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
CAFE_VERSION=cafe-1.8.0-gcc-6.3.0
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_VERSION} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include
# --enable-boost-lib --with-boost-lib=/opt/gfa/cafe/boost/boost_1_61_0/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/cafe/config.h

View File

@@ -1,44 +0,0 @@
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
CAFE_VERSION=cafe-noqt-1.8.0
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_VERSION} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/cafe-noqt/config.h

View File

@@ -1,46 +0,0 @@
source usePy3
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CYCAFE_VERSION=pycafe-1.8.0
./configure \
--prefix=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/ \
--libdir=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include \
--enable-python-inc --with-python-inc=/opt/gfa/python-3.5/latest/include/python3.5m \
--enable-python-lib --with-python-lib=/opt/gfa/python-3.5/latest/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/pycafe35/config.h

View File

@@ -1,45 +0,0 @@
source usePy3
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CAFE_VERSION=cafe-1.8.0
CYCAFE_VERSION=pycafe-noqt-1.8.0
./configure \
--prefix=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/ \
--libdir=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/lib \
--enable-boost --with-boost=/opt/gfa/cafe/boost/boost_1_57_0 \
--enable-epics --with-epics=${EPICS} \
--enable-python-inc --with-python-inc=/opt/gfa/python-3.5/latest/include/python3.5m \
--enable-python-lib --with-python-lib=/opt/gfa/python-3.5/latest/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
#--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
#--enable-qt4-inc --with-qt4-inc=/usr/include \

277
autogen_slsbd.sh Normal file
View File

@@ -0,0 +1,277 @@
### psi specific - select compiler
#source <this_autogen_file> <facility> <target_language>
#<facility = sls sls2 sf> default is sf
#<target_language = cpp matlab python>
module unload gcc
module load gcc/7.3.0
### psi specific - end
rm -f configure.ac
ln -s configurePSI.ac configure.ac
rm -f ./aclocal.m4
rm -rf ./autom4te.cache
aclocal --force -I m4
/opt/gfa/python-3.7/latest/bin/libtoolize --force --copy #select libtools 2.4.6
autoconf --force #interprets configure.ac
autoheader --force
automake --force --add-missing --copy
#autoreconf not wanted
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
#source cafeVersion-gcc-7.3.0
CAFE_V="cafe-1.14.1"
#For later check of existence of HOST_ARCH for $EPICS/include/os/$HOST_ARCH
#Assume Linux but check if Darwin
CAFE_HOST_FLAG_DARWIN=$(echo ${EPICS_HOST_ARCH} | grep -c "Darwin")
export CAFE_HOST_FLAG_DARWIN=$CAFE_HOST_FLAG_DARWIN
RETURN_ON_WRONG_INPUT=true
RETURN_FLAG=false
EPICS_BASE=$(readlink ${EPICS}/base)
#EB=$(readlink /afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/base)
echo $EPICS_BASE
if [ -z "$EPICS_BASE" ]
then
EPICS_BASE='base-7.4.1' #7.0 = 7+0 = 7 for major release
fi
echo 'input' "$0" "$1" "$2"
echo $EPICS_BASE
FACILITY=$(echo "$1" | tr '[:upper:]' '[:lower:]')
CACLIENT=$(echo "$2" | tr '[:upper:]' '[:lower:]')
FACILITY_DEFAULT="sf"
CACLIENT_DEFAULT="python"
FACILITY_TEMP=""
CACLIENT_TEMP=""
echo 'input arg. facility/target' $FACILITY $CACLIENT
if [ -n "$FACILITY" ]
then
if [ "$FACILITY" = "matlab" ] || [ "$FACILITY" = "python" ] || \
[ "$FACILITY" = "py37" ] || [ "$FACILITY" = "py35" ] || \
[ "$FACILITY" = "julia" ] || [ "$FACILITY" = "cpp" ] || \
[ "$FACILITY" = "cc" ]
then
CACLIENT_TEMP=$FACILITY
FACILITY_TEMP=$2
fi
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "sls" ] || [ "$CACLIENT" = "sls2" ] || \
[ "$CACLIENT" = "sf" ] || [ "$CACLIENT" = "swissfel" ] || \
[ "$CACLIENT" = "sfel" ] || [ "$CACLIENT" = "hipa" ]
then
if [ -z $FACILITY_TEMP ]
then
FACILITY_TEMP=$CACLIENT
CACLIENT_TEMP=$1
fi
fi
fi
if [ -z "$FACILITY" ]
then
FACILITY="sf"
echo "FACILITY = " $FACILITY
if [ -z $CACLIENT ]
then
CACLIENT=$CACLIENT_DEFAULT
fi
elif [ "$FACILITY" = "sls" ] || [ "$FACILITY" = "sls2" ] || \
[ "$FACILITY" = "sf" ] || [ "$FACILITY" = "swissfel" ] || \
[ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "hipa" ]
then
echo "FACILITY = " $FACILITY
elif [ -n "$FACILITY_TEMP" ]
then
if [ "$FACILITY_TEMP" = "sls" ] || [ "$FACILITY_TEMP" = "sls2" ] || \
[ "$FACILITY_TEMP" = "sf" ] || [ "$FACILITY_TEMP" = "swissfel" ] || \
[ "$FACILITY_TEMP" = "sfel" ] || [ "$FACILITY_TEMP" = "hipa" ]
then
FACILITY=$FACILITY_TEMP
else
if [ -n "$2" ]
then
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
fi
echo "***OTHERWISE THE DEFAULT FACILITY IS:" $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT FACILITY***" $FACILITY
echo "***VALID VALUES ARE: sls sls2 sf hipa"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT FACILITY IS: " $FACILITY_DEFAULT
FACILITY=$FACILITY_DEFAULT
fi
if [ -n "$CACLIENT" ]
then
if [ "$CACLIENT" = "matlab" ] || [ "$CACLIENT" = "python" ] || \
[ "$CACLIENT" = "py37" ] || [ "$CACLIENT" = "py35" ] || \
[ "$CACLIENT" = "julia" ] || [ "$CACLIENT" = "cpp" ] || \
[ "$CACLIENT" = "cc" ]
then
echo "CA TARGET = " $CACLIENT
else
if [ -n "$CACLIENT_TEMP" ]
then
if [ "$CACLIENT_TEMP" = "matlab" ] || [ "$CACLIENT_TEMP" = "python" ] || \
[ "$CACLIENT_TEMP" = "py37" ] || [ "$CACLIENT_TEMP" = "py35" ] || \
[ "$CACLIENT_TEMP" = "julia" ] || [ "$CACLIENT_TEMP" = "cpp" ] || \
[ "$CACLIENT_TEMP" = "cc" ]
then
CACLIENT=$CACLIENT_TEMP
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
else
echo "***UNRECOGNIZED INPUT CA TARGET***" $CACLIENT
echo "***VALID VALUES ARE: cpp matlab python"
RETURN_FLAG=true
echo "***OTHERWISE THE DEFAULT CA TARGET IS:" $CACLIENT_DEFAULT
CACLIENT=$CACLIENT_DEFAULT
fi
fi
else
CACLIENT=$CACLIENT_DEFAULT
fi
if [ $RETURN_ON_WRONG_INPUT = true ] ; then
if [ $RETURN_FLAG = true ] ; then
return 1 2>/dev/null
exit 1
fi
fi
echo "FACILITY SELECTED = " $FACILITY
echo "CA TARGET SELECTED = " $CACLIENT
ENABLE_OPTIONS="--enable-boost-inc"
if [ "$FACILITY" = "sfel" ] || [ "$FACILITY" = "swissfel" ]
then
FACILITY="sf"
fi
if [ "$CACLIENT" = "python" ] || [ "$CACLIENT" = "julia" ]
then
CACLIENT="py37"
fi
if [ "$FACILITY" = "sls2" ]
then
ENABLE_OPTIONS+=" --enable-epics7"
CAFE_V+="-sls2"
else
ENABLE_OPTIONS+=" --enable-epics3"
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
CAFE_V+="-sf"
fi
fi
if [ "$CACLIENT" = "py35" ]
then
ENABLE_OPTIONS+=" --enable-python35"
ENABLE_OPTIONS+=" --enable-qt4"
CAFE_V+="-py35"
elif [ "$CACLIENT" = "py37" ]
then
ENABLE_OPTIONS+=" --enable-python37"
ENABLE_OPTIONS+=" --enable-qt5"
CAFE_V+="-py37"
#else
#ENABLE_OPTIONS+=" --enable-qt5"
fi
if [ "$FACILITY" = "sf" ] && [ "$CACLIENT" != "matlab" ]
then
#rm -f src/PyCafe.cpp
#ln -s PyCafe3.cpp src/PyCafe.cpp
ENABLE_OPTIONS+=" --enable-json"
ENABLE_OPTIONS+=" --enable-zeromq"
ENABLE_OPTIONS+=" --enable-curl"
ENABLE_OPTIONS+=" --enable-lz4"
#else
#rm -f src/PyCafe.cpp
#ln -s PyCafe_sls.cpp src/PyCafe.cpp
fi
CAFE_V+="-gcc-"$GCC_VERSION
echo "CAFE VERSION: $CAFE_V"
#echo 'EPICS BASE IS='$EPICS_BASE
#echo 'EPICS BASE DIR='${EPICS}/base-7.0.4.1
EB1=$(echo $EPICS_BASE | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
#echo $EBMIN1
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#ENABLE_OPTIONS+=" --enable-qt5"
##ENABLE_OPTIONS+=" --enable-qt4"
#ENABLE_OPTIONS+=" --enable-python37"
##ENABLE_OPTIONS+=" --enable-python35"
#ENABLE_OPTIONS+=" --enable-json"
#ENABLE_OPTIONS+=" --enable-zeromq"
#ENABLE_OPTIONS+=" --enable-curl"
#ENABLE_OPTIONS+=" --enable-lz4"
echo 'ENABLE_OPTIONS='$ENABLE_OPTIONS
echo 'EPICS='${EPICS}
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_V} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_V}/lib/${EPICS_HOST_ARCH} \
${ENABLE_OPTIONS} \
--with-boost-inc=/afs/psi.ch/project/cafe/gitlab/CAFE/boost/boost_1_61_0/include \
--with-epics7=${EPICS}/base-7.0.4.1 \
--with-epics3=${EPICS}/base \
--with-python37=/opt/gfa/python-3.7/latest \
--with-python35=/opt/gfa/python-3.5/latest \
--with-qt5=/opt/gfa/python-3.7/latest \
--with-qt4=/opt/gfa/python-3.5/latest \
--with-json=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2 \
--with-zeromq=/opt/gfa/zmq/zeromq-4.2.3-gcc-6.3.0 \
--with-curl=/opt/gfa/zmq/curl-7.55.1 \
--with-lz4=/opt/gfa/zmq/lz4/lib
unset CAFE_EPICS_V_PATCH
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_MAJOR
unset CAFE_HOST_FLAG_DARWIN

File diff suppressed because it is too large Load Diff

1189
configurePSI.ac Normal file

File diff suppressed because it is too large Load Diff

1052
configurePSI.ac- Normal file

File diff suppressed because it is too large Load Diff

1118
configurePSI.ac-- Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
examples/cafeTest/cafeTest- Executable file

Binary file not shown.

View File

@@ -7,7 +7,7 @@
#CAFE version to link to
CAFE_VERSION=cafe-1.8.0-gcc-6.3.0
CAFE_VERSION=cafe-1.14.4-gcc-7.3.0
#PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
#PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
@@ -17,25 +17,27 @@ EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE)
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib/${EPICS_HOST_ARCH} \
-L/opt/gfa/python-3.7/latest/lib \
-Wl,-rpath,/opt/gfa/python-3.7/latest/lib
LIBS += -lcafe -lca -lCom
LIBS += -lcafe -lca -lCom -lQt5Core
cafeTest: cafeTest.cc callbacks.h
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,46 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build a simple C++ cafe client
#
#CAFE version to link to
CAFE_VERSION=cafe-1.14.4-sls2-gcc-7.3.0
#PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
#PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base-7.0.6
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/compiler/gcc \
-I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE)
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib/${EPICS_HOST_ARCH} \
-L/opt/gfa/python-3.7/latest/lib \
-Wl,-rpath,/opt/gfa/python-3.7/latest/lib
LIBS += -lcafe -lca -lCom -lQt5Core
cafeTest: cafeTest.cc callbacks.h
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,46 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build a simple C++ cafe client
#
#CAFE version to link to
CAFE_VERSION=cafe-1.14.1-gcc-7.3.0
#PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
#PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/cpp
CAFE_BASE=/afs/psi.ch/project/cafe/gitlab/CAFE/
CAFE_CPP_BASE=${CAFE_BASE}
CAFE_VERSION=cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE)
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib
LIBS += -lcafe -lca -lCom
cafeTest: cafeTest.cc callbacks.h
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -9,37 +9,40 @@
#CAFE version to link to
CAFE_VERSION=pycafe-1.8.0-gcc-6.3.0
CAFE_VERSION=pyzcafe-1.12.5-gcc-7.3.0
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
PYTHON_INCLUDE=/opt/gfa/python-3.7/latest/include/python3.7m
PYTHON_LIB=/opt/gfa/python-3.7/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.7
CAFE_BASE=/afs/psi.ch/project/cafe/gitlab/CAFE/
CAFE_CPP_BASE=${CAFE_BASE}
CAFE_VERSION=cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/src/.libs \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/src/.libs \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB)
LIBS += -lcafe -lca -lCom -lpython3.5m
LIBS += -lcafe -lca -lCom -lpython3.7m
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)

View File

@@ -0,0 +1,50 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=pycafe-1.8.0-gcc-6.3.0
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB)
LIBS += -lcafe -lca -lCom -lpython3.5m
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -16,7 +16,8 @@
* \brief This class is the holder of values associated with the
* EPICS DBR_CTRL_(dataType) control structure of a given handle/pv
*/
class PVCtrlHolder : public PVHolder {
class PVCtrlHolder : public PVHolder
{
friend class CAFE;
friend class Connect;
@@ -92,7 +93,8 @@ public:
val.reset( new CAFE_DATATYPE_UNION[nelem] );
for (unsigned int i=0; i<nelem; ++i) {
for (unsigned int i=0; i<nelem; ++i)
{
val[i].d=0.0;
};
};
@@ -112,7 +114,8 @@ public:
{
_nelem>0 ? nelem=_nelem : nelem=1;
if (_nelem>size) {
if (_nelem>size)
{
size=_nelem;
@@ -131,27 +134,31 @@ public:
{
return units;
}
std::string getUnitsAsString() const
{
return (std::string) units;
}
/*Defined in PVHolder.h
short getNoEnumStrings () const
{
return noStr;
};
char * getEnumString(short indx) const
{
return (char *) strs[indx];
return (char *) strs[indx];
};
*/
std::vector<std::string> getEnumStrings() const
{
std::vector<std::string> vEnumStrings;
vEnumStrings.reserve(noStr>0?noStr:1);
for ( short i=0; i<noStr; ++i) {
for ( short i=0; i<noStr; ++i)
{
vEnumStrings.push_back(strs[i]);
}
return vEnumStrings;
@@ -161,10 +168,12 @@ public:
short getEnumFromString(std::string enumString)
{
short returnValue=-1;
short returnValue=INVALID_ENUM_RETURN_VALUE;
for ( short i=0; i<noStr; ++i) {
if (strcmp(enumString.c_str(), strs[i])==0) {
for ( short i=0; i<noStr; ++i)
{
if (strcmp(enumString.c_str(), strs[i])==0)
{
return i;
}
}
@@ -173,19 +182,33 @@ public:
char pvStripped[MAX_ENUM_STRING_SIZE];
helper.removeLeadingAndTrailingSpaces((char *) enumString.c_str(), pvStripped);
for ( short i=0; i<noStr; ++i) {
if (strcmp(pvStripped, strs[i])==0) {
for ( short i=0; i<noStr; ++i)
{
if (strcmp(pvStripped, strs[i])==0)
{
return i;
}
}
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
std::cout << "*** Method getEnumFromString(string enumString) ***" << std::endl;
std::cout << "The given input string '" << enumString << "' was not recognized! " << std::endl;
std::cout << "Valid values are: " << std::endl;
for ( short i=0; i<noStr; ++i) {
std::cout << i << ":" << strs[i] << std::endl;
}
if (dataType==CAFE_ENUM) {
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
std::cout << "*** Method getEnumFromString(string enumString) ***" << std::endl;
std::cout << "The given input string '" << enumString << "' was not recognized! " << std::endl;
if (noStr > 0) {
std::cout << "Valid values are: " << std::endl;
for ( short i=0; i<noStr; ++i)
{
std::cout << i << ":" << strs[i] << std::endl;
}
}
}
else
{
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
std::cout << "*** Method getEnumFromString(string enumString) ***" << std::endl;
std::cout << "Native DataType " << (CAFEDataTypeCode().asString((CAFE_DATATYPE) dataType)).c_str()
<< " is not the enumerated type, DBF_ENUM " << std::endl;
}
return returnValue;
@@ -194,26 +217,48 @@ public:
std::string getStringFromEnum(unsigned short enumValue) const
{
std::string returnValue="";
std::string returnValue=INVALID_ENUM_RETURN_STRING;
if (enumValue<noStr) {
if (enumValue<noStr)
{
return (std::string) strs[enumValue];
}
else {
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
std::cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << std::endl;
std::cout << "The given input index " << enumValue << " exceeds the number of enum states " << noStr << std::endl;
std::cout << "Valid values are: " << std::endl;
for ( short i=0; i<noStr; ++i) {
std::cout << i << ":" << strs[i] << std::endl;
else
{
if (dataType==CAFE_ENUM) {
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
std::cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << std::endl;
std::cout << "The given input index [" << enumValue << "] exceeds the number of enum states " << noStr << std::endl;
if (noStr > 0)
{
std::cout << "Valid values are: " << std::endl;
for ( short i=0; i<noStr; ++i)
{
std::cout << i << ":" << strs[i] << std::endl;
}
}
}
else
{
std::cout << "*** WARNING FROM PvCtrlHolder.h ***" << std::endl;
std::cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << std::endl;
std::cout << "Native DataType " << (CAFEDataTypeCode().asString((CAFE_DATATYPE) dataType)).c_str()
<< " is not the enumerated type, DBF_ENUM " << std::endl;
}
if (enumValue<MAX_ENUM_STATES) {
return returnValue;
/*
if (enumValue<MAX_ENUM_STATES)
{
return (std::string) strs[enumValue];
}
else {
else
{
return returnValue;
}
*/
}
}
@@ -346,7 +391,8 @@ public:
std::cout << "------------------------------------------" << std::endl;
std::cout << "PVCtrlHolder:" << std::endl;
std::cout << "processVariable= " << pv << std::endl;
if (strcmp(pvAlias,pv)) {
if (strcmp(pvAlias,pv))
{
std::cout << "pvAlias = " << pvAlias << std::endl;
}
std::cout << "device = " << device << std::endl;
@@ -354,7 +400,8 @@ public:
std::cout << "dataType = " << cafeDataTypeCode.message(dataType).c_str()
<< " (" << dataType << ") " << std::endl;
std::cout << "dbrTypeRequest = " << dbr_type_to_text(dbrDataType)<< std::endl;
if (dataType!=CAFE_NO_ACCESS || dataType != CAFE_TYPENOTCONN) {
if (dataType!=CAFE_NO_ACCESS || dataType != CAFE_TYPENOTCONN)
{
std::cout << "nelem = " << nelem << std::endl;
//std::cout << "alarmStatus = " << alarmStatus << " [" << acond.asString(alarmStatus)<< "]" << std::endl;
@@ -377,66 +424,79 @@ public:
std::cout << "RISC_Pad = " << (dbr_short_t) RISC_pad.f << std::endl;
}
*/
if (dataType!=CAFE_ENUM) {
std::cout << "upperDispLimit = " << getAsString(upperDispLimit) << std::endl;
std::cout << "lowerDispLimit = " << getAsString(lowerDispLimit) << std::endl;
std::cout << "upperAlarmLimit= " << getAsString(upperAlarmLimit) << std::endl;
std::cout << "upperWarnLimit = " << getAsString(upperWarningLimit) << std::endl;
std::cout << "lowerWarnLimit = " << getAsString(lowerWarningLimit) << std::endl;
std::cout << "lowerAlarmLimit= " << getAsString(lowerAlarmLimit) << std::endl;
if(dbr_type_is_CTRL(dbrDataType)) {
std::cout << "upperCtrlLimit = " << getAsString(upperCtrlLimit) << std::endl;
std::cout << "lowerCtrlLimit = " << getAsString(lowerCtrlLimit) << std::endl;
}
//if (dataType!=CAFE_ENUM) {
std::cout << "upperDispLimit = " << getAsString(upperDispLimit) << std::endl;
std::cout << "lowerDispLimit = " << getAsString(lowerDispLimit) << std::endl;
std::cout << "upperAlarmLimit= " << getAsString(upperAlarmLimit) << std::endl;
std::cout << "upperWarnLimit = " << getAsString(upperWarningLimit) << std::endl;
std::cout << "lowerWarnLimit = " << getAsString(lowerWarningLimit) << std::endl;
std::cout << "lowerAlarmLimit= " << getAsString(lowerAlarmLimit) << std::endl;
if(dbr_type_is_CTRL(dbrDataType))
{
std::cout << "upperCtrlLimit = " << getAsString(upperCtrlLimit) << std::endl;
std::cout << "lowerCtrlLimit = " << getAsString(lowerCtrlLimit) << std::endl;
}
else {
//}
//else {
if (dataType==CAFE_ENUM)
{
std::cout << "NoStr (ENUM) = " << noStr << std::endl;
std::cout << "strs (ENUM) = " ;
for (short i=0; i< noStr; ++i) {
for (short i=0; i< noStr; ++i)
{
std::cout << "{" << strs[i] << "} " ;
}
std::cout <<std::endl;
}
std::cout << "status = " << cafeStatusCode.message(status).c_str() << std::endl;
if(nelem>0) {
if(nelem>0)
{
std::cout << "value(s) = " ;
}
switch (dataType) {
switch (dataType)
{
case CAFE_STRING:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout << val[i].str << " [" << i << "] " ;
}
break;
case CAFE_SHORT:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout << val[i].s << " [" << i << "] " ;
}
break;
case CAFE_FLOAT:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout << val[i].f << " [" << i << "] " ;
}
break;
case CAFE_ENUM:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout <<
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;
}
break;
case CAFE_CHAR:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout << (unsigned short) val[i].ch << " [" << i << "] " ;
}
break;
case CAFE_LONG:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout << val[i].l << " [" << i << "] " ;
}
break;
case CAFE_DOUBLE:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout << val[i].d << " [" << i << "] " ;
}
break;

View File

@@ -16,7 +16,8 @@
* \brief This class is the holder of data values associated with
* the EPICS DBR_TIME_(dataType) structure of a given handle/pv
*/
class PVDataHolder : public PVHolder {
class PVDataHolder : public PVHolder
{
friend class CAFE;
friend class PVGroup;
@@ -38,8 +39,8 @@ public:
bool hasTS;
etsNorm _etsNorm;
etsDate _etsDate;
TMwdayText tmDay;
TMmonthpText tmMonth;
TMwdayText tmDay;
TMmonthpText tmMonth;
//Derived class does not inherit constructors
PVDataHolder(unsigned int _sizeOfArray)
@@ -67,7 +68,8 @@ public:
val.reset( new CAFE_DATATYPE_UNION[nelem] );
for (unsigned int i=0; i<nelem; ++i) {
for (unsigned int i=0; i<nelem; ++i)
{
val[i].d=0.0;
};
};
@@ -121,7 +123,8 @@ public:
void setHasTS(bool t)
{
hasTS=t;
if (t) {
if (t)
{
hasAlarm=t; //TS will also retrieve alarmStatus
}
return;
@@ -137,7 +140,8 @@ public:
_nelem>0 ? nelem=_nelem : nelem=1;
if (nelem>size) {
if (nelem>size)
{
size=nelem;
val.reset( new CAFE_DATATYPE_UNION[size] );
}
@@ -150,7 +154,7 @@ public:
return ts;
};
etsNorm getEpicsTimeStampAsUInt32()
{
@@ -166,7 +170,8 @@ public:
//This may happen in timeouts; epicsTime convertor will report overflow error
//However this possibility is now captured in conduitFriend.h and other
if(ts.nsec >= 1000000000) {
if(ts.nsec >= 1000000000)
{
std::cout << "OVERFLOW IN gets.nsec CORRECTED for epicsTime converter " << std::endl;
ts.nsec=0;
}
@@ -181,11 +186,11 @@ public:
_etsDate.min = local.ansi_tm.tm_min;
_etsDate.sec = local.ansi_tm.tm_sec;
_etsDate.nsec = (unsigned long) ts.nsec;
_etsDate.wday = local.ansi_tm.tm_wday;
_etsDate.yday = local.ansi_tm.tm_yday;
_etsDate.isdst = local.ansi_tm.tm_isdst;
_etsDate.wday = local.ansi_tm.tm_wday;
_etsDate.yday = local.ansi_tm.tm_yday;
_etsDate.isdst = local.ansi_tm.tm_isdst;
return _etsDate;
}
@@ -205,47 +210,49 @@ public:
_etsDate.min = local->tm_min;
_etsDate.sec = local->tm_sec;
_etsDate.nsec = (unsigned long) ts.nsec;
_etsDate.wday = local->tm_wday;
_etsDate.yday = local->tm_yday;
_etsDate.isdst = local->tm_isdst;
_etsDate.wday = local->tm_wday;
_etsDate.yday = local->tm_yday;
_etsDate.isdst = local->tm_isdst;
return _etsDate;
}
std::string getEpicsTimeStampAsString() {
std::string getEpicsTimeStampAsString()
{
time_t t= ts.secPastEpoch;
struct tm * local;
local=localtime(&t);
char buf[40];
local->tm_year=local->tm_year+20; //EPICS Time is 20 years out!
strftime (buf,80,"%b %d, %Y %T.",local);
std::string date=(std::string) buf;
char buft[10];
sprintf(buft,"%d",ts.nsec);
date.append((std::string) buft);
return date;
}
std::string getBSTimeStampAsString() {
char buf[40];
local->tm_year=local->tm_year+20; //EPICS Time is 20 years out!
strftime (buf,80,"%b %d, %Y %T.",local);
std::string date=(std::string) buf;
char buft[10];
sprintf(buft,"%d",ts.nsec);
date.append((std::string) buft);
return date;
}
std::string getBSTimeStampAsString()
{
time_t t= ts.secPastEpoch;
struct tm * local;
local=localtime(&t);
char buf[40];
strftime (buf,80,"%b %d, %Y %T.",local);
std::string date=(std::string) buf;
char buft[10];
sprintf(buft,"%d",ts.nsec);
date.append((std::string) buft);
return date;
}
char buf[40];
strftime (buf,80,"%b %d, %Y %T.",local);
std::string date=(std::string) buf;
char buft[10];
sprintf(buft,"%d",ts.nsec);
date.append((std::string) buft);
return date;
}
@@ -257,7 +264,8 @@ public:
void print(unsigned int nelemToPrint)
{
nelemToPrint=std::min(nelemToPrint,nelem);
if (strcmp(pv,"")==0) {
if (strcmp(pv,"")==0)
{
std::cout << "Process Variable NOT ASSIGNED!" << std::endl;
std::cout << "Variable has not been applied to a get operation!" << std::endl;
return;
@@ -268,7 +276,8 @@ public:
std::cout << "processVariable= " << pv << std::endl;
if (strcmp(pvAlias,pv) && strcmp(pvAlias,"")) {
if (strcmp(pvAlias,pv) && strcmp(pvAlias,""))
{
std::cout << "pvAlias = " << pvAlias << std::endl;
}
std::cout << "device = " << device << std::endl;
@@ -280,34 +289,41 @@ public:
//std::cout << "dataType = " << CAFEDataTypeCode.message(dataType).c_str() << std::endl;
if (dataType != CAFE_NO_ACCESS && dataType != CAFE_TYPENOTCONN) {
if (dataType != CAFE_NO_ACCESS && dataType != CAFE_TYPENOTCONN)
{
std::cout << "nelem = ";
}
else {
else
{
std::cout << "nelem = ";
}
std::cout << nelem;
std::cout << std::endl;
if(!rule) {
if(!rule)
{
std::cout << "rule (0=false) = " << rule <<std::endl;
}
if (dbr_type_is_STS(dbrDataType) || dbr_type_is_TIME(dbrDataType) ) {
if (dbr_type_is_STS(dbrDataType) || dbr_type_is_TIME(dbrDataType) )
{
std::cout << "alarmStatus = " << acond.asString(alarmStatus) << " (" << alarmStatus << ")" << std::endl;
std::cout << "alarmSeverity = " << aseve.asString(alarmSeverity) << " (" <<alarmSeverity << ")" << std::endl;
if (dbr_type_is_TIME(dbrDataType)) {
if (dbr_type_is_TIME(dbrDataType))
{
std::cout << "timeStamp = " << ts.secPastEpoch << " sec. and " << ts.nsec << " nsec" << std::endl;
}
}
if(beamEventNo!=0) {
if(beamEventNo!=0)
{
std::cout << "pulseID = " << beamEventNo << std::endl;
};
std::cout << "status = " << cafeStatusCode.message(status).c_str() << " (" << status << ") " << std::endl;
std::cout << "value(s) = " ;
switch (dataType) {
switch (dataType)
{
case CAFE_STRING:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].str << " [" << i << "] " ;
break;
@@ -318,7 +334,8 @@ public:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].f << " [" << i << "] " ;
break;
case CAFE_ENUM:
for (unsigned int i=0; i <nelemToPrint; ++i ) {
for (unsigned int i=0; i <nelemToPrint; ++i )
{
std::cout <<
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;
}

View File

@@ -16,7 +16,8 @@
* class MemberMap
* maps string to index
*/
class MemberMap {
class MemberMap
{
typedef std::map<long, std::string> mapLongString;
private:
mapLongString mapNameIndex;
@@ -47,9 +48,11 @@ public:
helper.removeLeadingAndTrailingSpaces(_Name.c_str(), pvStripped);
std::string Name=pvStripped;
for (pos=mapNameIndex.begin(); pos != mapNameIndex.end(); ++pos) {
for (pos=mapNameIndex.begin(); pos != mapNameIndex.end(); ++pos)
{
if (pos->second==Name) {
if (pos->second==Name)
{
return pos->first;
}
// String searches such as s.find(s1) return string::npos on failure
@@ -66,7 +69,8 @@ public:
* This class is the holder of PVDataHolder objects associated with
* of group of handles
*/
class PVGroup {
class PVGroup
{
friend class Connect;
friend class CAFE;
//if HAVE_LIBQTXML
@@ -103,9 +107,10 @@ public:
{
return pvdata;
};
PVDataHolder getPVData(unsigned int idx) throw(std::out_of_range)
PVDataHolder getPVData(unsigned int idx) noexcept(false) //throw(std::out_of_range)
{
if(isIndexOutOfRange(idx)) {
if(isIndexOutOfRange(idx))
{
std::ostringstream oss;
oss << "Exception! Index " << idx <<
" to PVGroup.pvdata() is out of range. Valid range is from 0 to " << npv-1;
@@ -115,13 +120,15 @@ public:
};
void setHasAlarm(bool h)
{
for (unsigned int i=0; i<npv; ++i) {
for (unsigned int i=0; i<npv; ++i)
{
pvdata[i].setHasAlarm(h);
}
}
void setHasTS(bool h)
{
for (unsigned int i=0; i<npv; ++i) {
for (unsigned int i=0; i<npv; ++i)
{
pvdata[i].setHasTS(h);
}
}
@@ -231,11 +238,13 @@ public:
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
std::cout << "PRINTING THE REQUESTED " << npvToPrint << " MEMBERS " << std::endl;
std::cout << "OVERALL STATUS OF GROUP REPORTS " << statusGroup << std::endl;
if (statusGroup!=ICAFE_NORMAL) {
if (statusGroup!=ICAFE_NORMAL)
{
CAFEStatus cstat;
cstat.report(statusGroup);
}
for (unsigned int i=0; i<npvToPrint; ++i) {
for (unsigned int i=0; i<npvToPrint; ++i)
{
std::cout << "------------------------------------------" << std::endl;
std::cout << "Element [" << i << "] of " << npvToPrint << " in group: " << name << std::endl;
pvdata[i].print();
@@ -248,11 +257,13 @@ public:
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
std::cout << "PRINTING THE REQUESTED " << npvToPrint << " MEMBERS " << std::endl;
std::cout << "OVERALL STATUS OF GROUP REPORTS " << statusGroup << std::endl;
if (statusGroup!=ICAFE_NORMAL) {
if (statusGroup!=ICAFE_NORMAL)
{
CAFEStatus cstat;
cstat.report(statusGroup);
}
for (unsigned int i=0; i<npvToPrint; ++i) {
for (unsigned int i=0; i<npvToPrint; ++i)
{
std::cout << "------------------------------------------" << std::endl;
std::cout << "Element [" << i << "] of " << npvToPrint << " in group: " << name << std::endl;
pvdata[i].print(std::min(maxNelemWF,pvdata[i].getNelem()));
@@ -263,9 +274,12 @@ public:
{
unsigned int npvToPrint=npv;
bool iErrorFound=false;
for (unsigned int i=0; i<npvToPrint; ++i) {
if (pvdata[i].getStatus() != ICAFE_NORMAL) {
if(!iErrorFound) {
for (unsigned int i=0; i<npvToPrint; ++i)
{
if (pvdata[i].getStatus() != ICAFE_NORMAL)
{
if(!iErrorFound)
{
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
std::cout << "PRINTING PV TRANSACTIONS WITH ERRORS " << std::endl;
iErrorFound=true;

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,5 @@
/* Generated by Cython 0.29.2 */
#ifndef __PYX_HAVE__PyCafe
#define __PYX_HAVE__PyCafe
@@ -5,24 +7,39 @@
#ifndef __PYX_HAVE_API__PyCafe
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(_T) _T
#define DL_IMPORT(_T) _T
#endif
__PYX_EXTERN_C DL_IMPORT(void) py_cb_wrapper(PVDataHolder, unsigned int, std::string);
__PYX_EXTERN_C DL_IMPORT(void) py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_wrapper(unsigned int);
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_monid_wrapper(unsigned int, unsigned long);
__PYX_EXTERN_C void cy_monitor_handler_wrapper(void *);
__PYX_EXTERN_C void cy_data_event_handler_wrapper(void *, unsigned int, std::string, PVDataHolder);
__PYX_EXTERN_C void cy_ctrl_event_handler_wrapper(void *, unsigned int, std::string, PVCtrlHolder);
__PYX_EXTERN_C void cy_event_handler_wrapper(void *, unsigned int, std::string);
__PYX_EXTERN_C void cy_handle_handler_wrapper(void *, unsigned int);
__PYX_EXTERN_C void cy_connect_handler_wrapper(void *, unsigned int, std::string, int);
__PYX_EXTERN_C void py_cb_wrapper(PVDataHolder, unsigned int, std::string);
__PYX_EXTERN_C void py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
__PYX_EXTERN_C void py_cb_handle_wrapper(unsigned int);
__PYX_EXTERN_C void py_cb_handle_monid_wrapper(unsigned int, unsigned long);
__PYX_EXTERN_C void cy_cb_handle_get_wrapper(void *, unsigned int);
__PYX_EXTERN_C void py_cb_handle_get_wrapper(unsigned int);
__PYX_EXTERN_C void cy_cb_handle_put_wrapper(void *, unsigned int);
__PYX_EXTERN_C void py_cb_handle_put_wrapper(unsigned int);
__PYX_EXTERN_C void py_cb_handle_open_wrapper(unsigned int, int);
__PYX_EXTERN_C void py_cb_handle_connect_wrapper(unsigned int, std::string, int);
#endif /* !__PYX_HAVE_API__PyCafe */
/* WARNING: the interface of the module init function changed in CPython 3.5. */
/* It now returns a PyModuleDef instance instead of a PyModule instance. */
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initPyCafe(void);
#else

View File

@@ -1,125 +0,0 @@
/* Generated by Cython 0.23.4 */
#ifndef __PYX_HAVE_API__PyCafe
#define __PYX_HAVE_API__PyCafe
#include "Python.h"
static void (*__pyx_api_f_6PyCafe_py_cb_wrapper)(PVDataHolder, unsigned int, std::string) = 0;
#define py_cb_wrapper __pyx_api_f_6PyCafe_py_cb_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_ctrl_wrapper)(PVCtrlHolder, unsigned int, std::string) = 0;
#define py_cb_ctrl_wrapper __pyx_api_f_6PyCafe_py_cb_ctrl_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_wrapper)(unsigned int) = 0;
#define py_cb_handle_wrapper __pyx_api_f_6PyCafe_py_cb_handle_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper)(unsigned int, unsigned long) = 0;
#define py_cb_handle_monid_wrapper __pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper)(unsigned int) = 0;
#define py_cb_handle_get_wrapper __pyx_api_f_6PyCafe_py_cb_handle_get_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper)(unsigned int) = 0;
#define py_cb_handle_put_wrapper __pyx_api_f_6PyCafe_py_cb_handle_put_wrapper
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name)
{
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = __Pyx_PyIdentifier_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig)
{
PyObject *d = 0;
PyObject *cobj = 0;
union {
void (*fp)(void);
void *p;
} tmp;
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
if (!d)
goto bad;
cobj = PyDict_GetItemString(d, funcname);
if (!cobj) {
PyErr_Format(PyExc_ImportError,
"%.200s does not export expected C function %.200s",
PyModule_GetName(module), funcname);
goto bad;
}
#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
goto bad;
}
tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
{
const char *desc, *s1, *s2;
desc = (const char *)PyCObject_GetDesc(cobj);
if (!desc)
goto bad;
s1 = desc;
s2 = sig;
while (*s1 != '\0' && *s1 == *s2) {
s1++;
s2++;
}
if (*s1 != *s2) {
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, desc);
goto bad;
}
tmp.p = PyCObject_AsVoidPtr(cobj);
}
#endif
*f = tmp.fp;
if (!(*f))
goto bad;
Py_DECREF(d);
return 0;
bad:
Py_XDECREF(d);
return -1;
}
#endif
static int import_PyCafe(void)
{
PyObject *module = 0;
module = __Pyx_ImportModule("PyCafe");
if (!module) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_wrapper, "void (PVDataHolder, unsigned int, std::string)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_ctrl_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_ctrl_wrapper, "void (PVCtrlHolder, unsigned int, std::string)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_wrapper, "void (unsigned int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_monid_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper, "void (unsigned int, unsigned long)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_get_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper, "void (unsigned int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_put_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper, "void (unsigned int)") < 0) goto bad;
Py_DECREF(module);
module = 0;
return 0;
bad:
Py_XDECREF(module);
return -1;
}
#endif /* !__PYX_HAVE_API__PyCafe */

View File

@@ -16,6 +16,10 @@ static void (*__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper)(unsigned int) = 0;
#define py_cb_handle_get_wrapper __pyx_api_f_6PyCafe_py_cb_handle_get_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper)(unsigned int) = 0;
#define py_cb_handle_put_wrapper __pyx_api_f_6PyCafe_py_cb_handle_put_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_open_wrapper)(unsigned int, int) = 0;
#define py_cb_handle_open_wrapper __pyx_api_f_6PyCafe_py_cb_handle_open_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_connect_wrapper)(unsigned int, std::string, int) = 0;
#define py_cb_handle_connect_wrapper __pyx_api_f_6PyCafe_py_cb_handle_connect_wrapper
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
@@ -48,7 +52,8 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
{
PyObject *d = 0;
PyObject *cobj = 0;
union {
union
{
void (*fp)(void);
void *p;
} tmp;
@@ -56,14 +61,16 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
if (!d)
goto bad;
cobj = PyDict_GetItemString(d, funcname);
if (!cobj) {
if (!cobj)
{
PyErr_Format(PyExc_ImportError,
"%.200s does not export expected C function %.200s",
PyModule_GetName(module), funcname);
goto bad;
}
#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
if (!PyCapsule_IsValid(cobj, sig))
{
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
@@ -78,11 +85,13 @@ static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**
goto bad;
s1 = desc;
s2 = sig;
while (*s1 != '\0' && *s1 == *s2) {
while (*s1 != '\0' && *s1 == *s2)
{
s1++;
s2++;
}
if (*s1 != *s2) {
if (*s1 != *s2)
{
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, desc);
@@ -114,6 +123,8 @@ static int import_PyCafe(void)
if (__Pyx_ImportFunction(module, "py_cb_handle_monid_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper, "void (unsigned int, unsigned long)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_get_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper, "void (unsigned int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_put_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper, "void (unsigned int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_open_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_open_wrapper, "void (unsigned int, int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_connect_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_connect_wrapper, "void (unsigned int, std::string, int)") < 0) goto bad;
Py_DECREF(module);
module = 0;
return 0;

46
include/PyCafe_sf.h Normal file
View File

@@ -0,0 +1,46 @@
/* Generated by Cython 0.29.2 */
#ifndef __PYX_HAVE__PyCafe
#define __PYX_HAVE__PyCafe
#ifndef __PYX_HAVE_API__PyCafe
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(_T) _T
#endif
__PYX_EXTERN_C void cy_data_event_handler_wrapper(void *, unsigned int, std::string, PVDataHolder);
__PYX_EXTERN_C void cy_ctrl_event_handler_wrapper(void *, unsigned int, std::string, PVCtrlHolder);
__PYX_EXTERN_C void cy_event_handler_wrapper(void *, unsigned int, std::string);
__PYX_EXTERN_C void cy_handle_handler_wrapper(void *, unsigned int);
__PYX_EXTERN_C void cy_connect_handler_wrapper(void *, unsigned int, std::string, int);
__PYX_EXTERN_C void py_cb_wrapper(PVDataHolder, unsigned int, std::string);
__PYX_EXTERN_C void py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
__PYX_EXTERN_C void py_cb_handle_wrapper(unsigned int);
__PYX_EXTERN_C void py_cb_handle_monid_wrapper(unsigned int, unsigned long);
__PYX_EXTERN_C void py_cb_handle_get_wrapper(unsigned int);
__PYX_EXTERN_C void py_cb_handle_put_wrapper(unsigned int);
__PYX_EXTERN_C void py_cb_handle_open_wrapper(unsigned int, int);
__PYX_EXTERN_C void py_cb_handle_connect_wrapper(unsigned int, std::string, int);
#endif /* !__PYX_HAVE_API__PyCafe */
/* WARNING: the interface of the module init function changed in CPython 3.5. */
/* It now returns a PyModuleDef instance instead of a PyModule instance. */
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initPyCafe(void);
#else
PyMODINIT_FUNC PyInit_PyCafe(void);
#endif
#endif /* !__PYX_HAVE__PyCafe */

View File

@@ -0,0 +1,123 @@
/*
* Bitshuffle - Filter for improving compression of typed binary data.
*
* This file is part of Bitshuffle
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*
*
* Header File
*
* Worker routines return an int64_t which is the number of bytes processed
* if positive or an error code if negative.
*
* Error codes:
* -1 : Failed to allocate memory.
* -11 : Missing SSE.
* -12 : Missing AVX.
* -80 : Input size not a multiple of 8.
* -81 : block_size not multiple of 8.
* -91 : Decompression error, wrong number of bytes processed.
* -1YYY : Error internal to compression routine with error code -YYY.
*/
#ifndef BITSHUFFLE_H
#define BITSHUFFLE_H
#include <stdlib.h>
#include "bitshuffle_core.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ---- bshuf_compress_lz4_bound ----
*
* Bound on size of data compressed with *bshuf_compress_lz4*.
*
* Parameters
* ----------
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Process in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* Bound on compressed data size.
*
*/
size_t bshuf_compress_lz4_bound(const size_t size,
const size_t elem_size, size_t block_size);
/* ---- bshuf_compress_lz4 ----
*
* Bitshuffled and compress the data using LZ4.
*
* Transpose within elements, in blocks of data of *block_size* elements then
* compress the blocks using LZ4. In the output buffer, each block is prefixed
* by a 4 byte integer giving the compressed size of that block.
*
* Output buffer must be large enough to hold the compressed data. This could
* be in principle substantially larger than the input buffer. Use the routine
* *bshuf_compress_lz4_bound* to get an upper limit.
*
* Parameters
* ----------
* in : input buffer, must be of size * elem_size bytes
* out : output buffer, must be large enough to hold data.
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Process in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* number of bytes used in output buffer, negative error-code if failed.
*
*/
int64_t bshuf_compress_lz4(const void* in, void* out, const size_t size, const size_t
elem_size, size_t block_size);
/* ---- bshuf_decompress_lz4 ----
*
* Undo compression and bitshuffling.
*
* Decompress data then un-bitshuffle it in blocks of *block_size* elements.
*
* To properly unshuffle bitshuffled data, *size*, *elem_size* and *block_size*
* must patch the parameters used to compress the data.
*
* NOT TO BE USED WITH UNTRUSTED DATA: This routine uses the function
* LZ4_decompress_fast from LZ4, which does not protect against maliciously
* formed datasets. By modifying the compressed data, this function could be
* coerced into leaving the boundaries of the input buffer.
*
* Parameters
* ----------
* in : input buffer
* out : output buffer, must be of size * elem_size bytes
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Process in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* number of bytes consumed in *input* buffer, negative error-code if failed.
*
*/
int64_t bshuf_decompress_lz4(const void* in, void* out, const size_t size,
const size_t elem_size, size_t block_size);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // BITSHUFFLE_H

View File

@@ -0,0 +1,156 @@
/*
* Bitshuffle - Filter for improving compression of typed binary data.
*
* This file is part of Bitshuffle
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*
*
* Header File
*
* Worker routines return an int64_t which is the number of bytes processed
* if positive or an error code if negative.
*
* Error codes:
* -1 : Failed to allocate memory.
* -11 : Missing SSE.
* -12 : Missing AVX.
* -80 : Input size not a multiple of 8.
* -81 : block_size not multiple of 8.
* -91 : Decompression error, wrong number of bytes processed.
* -1YYY : Error internal to compression routine with error code -YYY.
*/
#ifndef BITSHUFFLE_CORE_H
#define BITSHUFFLE_CORE_H
// We assume GNU g++ defining `__cplusplus` has stdint.h
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199900L) || defined(__cplusplus)
#include <stdint.h>
#else
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif
#include <stdlib.h>
// These are usually set in the setup.py.
#ifndef BSHUF_VERSION_MAJOR
#define BSHUF_VERSION_MAJOR 0
#define BSHUF_VERSION_MINOR 3
#define BSHUF_VERSION_POINT 4
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* --- bshuf_using_SSE2 ----
*
* Whether routines where compiled with the SSE2 instruction set.
*
* Returns
* -------
* 1 if using SSE2, 0 otherwise.
*
*/
int bshuf_using_SSE2(void);
/* ---- bshuf_using_AVX2 ----
*
* Whether routines where compiled with the AVX2 instruction set.
*
* Returns
* -------
* 1 if using AVX2, 0 otherwise.
*
*/
int bshuf_using_AVX2(void);
/* ---- bshuf_default_block_size ----
*
* The default block size as function of element size.
*
* This is the block size used by the blocked routines (any routine
* taking a *block_size* argument) when the block_size is not provided
* (zero is passed).
*
* The results of this routine are guaranteed to be stable such that
* shuffled/compressed data can always be decompressed.
*
* Parameters
* ----------
* elem_size : element size of data to be shuffled/compressed.
*
*/
size_t bshuf_default_block_size(const size_t elem_size);
/* ---- bshuf_bitshuffle ----
*
* Bitshuffle the data.
*
* Transpose the bits within elements, in blocks of *block_size*
* elements.
*
* Parameters
* ----------
* in : input buffer, must be of size * elem_size bytes
* out : output buffer, must be of size * elem_size bytes
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Do transpose in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* number of bytes processed, negative error-code if failed.
*
*/
int64_t bshuf_bitshuffle(const void* in, void* out, const size_t size,
const size_t elem_size, size_t block_size);
/* ---- bshuf_bitunshuffle ----
*
* Unshuffle bitshuffled data.
*
* Untranspose the bits within elements, in blocks of *block_size*
* elements.
*
* To properly unshuffle bitshuffled data, *size*, *elem_size* and *block_size*
* must match the parameters used to shuffle the data.
*
* Parameters
* ----------
* in : input buffer, must be of size * elem_size bytes
* out : output buffer, must be of size * elem_size bytes
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Do transpose in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* number of bytes processed, negative error-code if failed.
*
*/
int64_t bshuf_bitunshuffle(const void* in, void* out, const size_t size,
const size_t elem_size, size_t block_size);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // BITSHUFFLE_CORE_H

View File

@@ -0,0 +1,75 @@
/*
* Bitshuffle - Filter for improving compression of typed binary data.
*
* This file is part of Bitshuffle
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*/
#ifndef BITSHUFFLE_INTERNALS_H
#define BITSHUFFLE_INTERNALS_H
// We assume GNU g++ defining `__cplusplus` has stdint.h
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199900L) || defined(__cplusplus)
#include <stdint.h>
#else
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif
#include <stdlib.h>
#include "iochain.h"
// Constants.
#ifndef BSHUF_MIN_RECOMMEND_BLOCK
#define BSHUF_MIN_RECOMMEND_BLOCK 128
#define BSHUF_BLOCKED_MULT 8 // Block sizes must be multiple of this.
#define BSHUF_TARGET_BLOCK_SIZE_B 8192
#endif
// Macros.
#define CHECK_ERR_FREE(count, buf) if (count < 0) { free(buf); return count; }
#ifdef __cplusplus
extern "C" {
#endif
/* ---- Utility functions for internal use only ---- */
int64_t bshuf_trans_bit_elem(const void* in, void* out, const size_t size,
const size_t elem_size);
/* Read a 32 bit unsigned integer from a buffer big endian order. */
uint32_t bshuf_read_uint32_BE(const void* buf);
/* Write a 32 bit unsigned integer to a buffer in big endian order. */
void bshuf_write_uint32_BE(void* buf, uint32_t num);
int64_t bshuf_untrans_bit_elem(const void* in, void* out, const size_t size,
const size_t elem_size);
/* Function definition for worker functions that process a single block. */
typedef int64_t (*bshufBlockFunDef)(ioc_chain* C_ptr,
const size_t size, const size_t elem_size);
/* Wrap a function for processing a single block to process an entire buffer in
* parallel. */
int64_t bshuf_blocked_wrap_fun(bshufBlockFunDef fun, const void* in, void* out,
const size_t size, const size_t elem_size, size_t block_size);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // BITSHUFFLE_INTERNALS_H

View File

@@ -0,0 +1,59 @@
/*
* Bitshuffle HDF5 filter
*
* This file is part of Bitshuffle
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*
*
* Header File
*
* Filter Options
* --------------
* block_size (option slot 0) : interger (optional)
* What block size to use (in elements not bytes). Default is 0,
* for which bitshuffle will pick a block size with a target of 8kb.
* Compression (option slot 1) : 0 or BSHUF_H5_COMPRESS_LZ4
* Whether to apply LZ4 compression to the data after bitshuffling.
* This is much faster than applying compression as a second filter
* because it is done when the small block of data is already in the
* L1 cache.
*
* For LZ4 compression, the compressed format of the data is the same as
* for the normal LZ4 filter described in
* http://www.hdfgroup.org/services/filters/HDF5_LZ4.pdf.
*
*/
#ifndef BSHUF_H5FILTER_H
#define BSHUF_H5FILTER_H
#define H5Z_class_t_vers 2
#include "hdf5.h"
#define BSHUF_H5FILTER 32008
#define BSHUF_H5_COMPRESS_LZ4 2
extern H5Z_class_t bshuf_H5Filter[1];
/* ---- bshuf_register_h5filter ----
*
* Register the bitshuffle HDF5 filter within the HDF5 library.
*
* Call this before using the bitshuffle HDF5 filter from C unless
* using dynamically loaded filters.
*
*/
int bshuf_register_h5filter(void);
#endif // BSHUF_H5FILTER_H

View File

@@ -0,0 +1,94 @@
/*
* IOchain - Distribute a chain of dependant IO events amoung threads.
*
* This file is part of Bitshuffle
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*
*
* Header File
*
* Similar in concept to a queue. Each task includes reading an input
* and writing output, but the location of the input/output (the pointers)
* depend on the previous item in the chain.
*
* This is designed for parallelizing blocked compression/decompression IO,
* where the destination of a compressed block depends on the compressed size
* of all previous blocks.
*
* Implemented with OpenMP locks.
*
*
* Usage
* -----
* - Call `ioc_init` in serial block.
* - Each thread should create a local variable *size_t this_iter* and
* pass its address to all function calls. Its value will be set
* inside the functions and is used to identify the thread.
* - Each thread must call each of the `ioc_get*` and `ioc_set*` methods
* exactly once per iteration, starting with `ioc_get_in` and ending
* with `ioc_set_next_out`.
* - The order (`ioc_get_in`, `ioc_set_next_in`, *work*, `ioc_get_out`,
* `ioc_set_next_out`, *work*) is most efficient.
* - Have each thread call `ioc_end_pop`.
* - `ioc_get_in` is blocked until the previous entry's
* `ioc_set_next_in` is called.
* - `ioc_get_out` is blocked until the previous entry's
* `ioc_set_next_out` is called.
* - There are no blocks on the very first iteration.
* - Call `ioc_destroy` in serial block.
* - Safe for num_threads >= IOC_SIZE (but less efficient).
*
*/
#ifndef IOCHAIN_H
#define IOCHAIN_H
#include <stdlib.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#define IOC_SIZE 33
typedef struct ioc_ptr_and_lock {
#ifdef _OPENMP
omp_lock_t lock;
#endif
void *ptr;
} ptr_and_lock;
typedef struct ioc_const_ptr_and_lock {
#ifdef _OPENMP
omp_lock_t lock;
#endif
const void *ptr;
} const_ptr_and_lock;
typedef struct ioc_chain {
#ifdef _OPENMP
omp_lock_t next_lock;
#endif
size_t next;
const_ptr_and_lock in_pl[IOC_SIZE];
ptr_and_lock out_pl[IOC_SIZE];
} ioc_chain;
void ioc_init(ioc_chain *C, const void *in_ptr_0, void *out_ptr_0);
void ioc_destroy(ioc_chain *C);
const void * ioc_get_in(ioc_chain *C, size_t *this_iter);
void ioc_set_next_in(ioc_chain *C, size_t* this_iter, void* in_ptr);
void * ioc_get_out(ioc_chain *C, size_t *this_iter);
void ioc_set_next_out(ioc_chain *C, size_t *this_iter, void* out_ptr);
#endif // IOCHAIN_H

View File

@@ -7,6 +7,7 @@
#ifndef CAFE_H
#define CAFE_H
#include <hashConduit.h>
#include <connect.h>
#include <conduitEventHandlerArgs.h>
#include <instant.h>
@@ -25,7 +26,8 @@ using namespace CAFEBS;
* \class CAFE
* \brief Methods for synchronous and asynchronous interactions
*/
class CAFE : public Connect {
class CAFE : public Connect
{
private:
Instant<dbr_string_t> cafeSoluble;
Instant<dbr_float_t> cafeFrappuccino;
@@ -63,8 +65,8 @@ public:
channelRequestPolicyMasterPut.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
CAFENUM::NO_WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITHOUT_CALLBACK)
//channelRequestPolicyMasterGet.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITHOUT_CALLBACK);
// channelRequestPolicyMasterGet.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); // WITHOUT_CALLBACK);
//channelRequestPolicyMasterGetCtrl.setPolicy(CAFENUM::FLUSH_AFTER_EACH_MESSAGE,
// CAFENUM::WAIT, CAFENUM::WITH_CALLBACK_DEFAULT); //WITH_CALLBACK_DEFAULT);
};
@@ -146,13 +148,16 @@ public:
{
unsigned int handle;
status=ICAFE_NORMAL;
try {
try
{
status = open(pv, handle);
}
catch (CAFEException_open & e) {
catch (CAFEException_open & e)
{
return e.pvEx.statusCode;
}
if (status == ICAFE_NORMAL) {
if (status == ICAFE_NORMAL)
{
status=getWFAsString(handle, message);
}
return status;
@@ -163,13 +168,16 @@ public:
{
unsigned int handle;
status=ICAFE_NORMAL;
try {
try
{
status = open(pv, handle);
}
catch (CAFEException_open & e) {
catch (CAFEException_open & e)
{
return e.pvEx.statusCode;
}
if (status == ICAFE_NORMAL) {
if (status == ICAFE_NORMAL)
{
status=getWFAsStringCache(handle, message);
}
return status;
@@ -182,26 +190,40 @@ public:
return ss.str();
}
int getAllChannelInfo(unsigned int handle, ChannelRegalia & channelInfo, PVCtrlHolder & pvc, PVDataHolder &pvd, std::string & desc);
int getChannelDataStore(unsigned int handle, ChannelDataStore & cds);
int getAllChannelInfo(unsigned int handle, ChannelRegalia & channelInfo, PVCtrlHolder & pvc, PVDataHolder &pvd, std::string & desc);
int getChannelDataStore(unsigned int handle, ChannelDataStore & cds);
int supplementHandles();
int supplementHandlesV(std::vector<unsigned int> hV);
int supplementHandle(unsigned int handle) {
std::vector<unsigned int> hV;
hV.push_back(handle);
return supplementHandlesV(hV);
}
int supplementHandle(unsigned int handle)
{
std::vector<unsigned int> hV;
hV.push_back(handle);
return supplementHandlesV(hV);
}
int addWidget(unsigned int _handle, void * widget)
{
return handleHelper.addWidget(_handle, widget);
}
int removeWidget (unsigned int _handle, void * widget)
{
return handleHelper.removeWidget(_handle, widget);
}
int getWidgets(unsigned int _handle, std::vector<void *> & widgetV)
{
return handleHelper.getWidgets(_handle, widgetV);
}
#if HAVE_ZEROMQ
int calcDBPMStatus(int, int, std::string);
int initBSwithCA(CAFEBS::BSDataHolder &bsd);
int setBS2CA_Step1(CAFEBS::BSDataHolder &bsd);
int setBS2CA_Step2(CAFEBS::BSDataHolder &bsd);
int setBS2CA_Step3(CAFEBS::BSDataHolder &bsd);
int setBS2CAGroup(CAFEBS::BSDataHolder &bsd);
int setBS2CA(CAFEBS::BSDataHolder &bsd);
int setBS(CAFEBS::BSDataHolder &bsd, bool closeCA);
int setBS(CAFEBS::BSDataHolder &bsd);
int getBS(CAFEBS::BSDataHolder &bsd);
int closeBS(CAFEBS::BSDataHolder &bsd);
int setPulseIDBufferSize(unsigned int _handle, unsigned short _bsize)
@@ -219,22 +241,25 @@ public:
}
int getDBPM(DBPMKeeper &dbpm);
int readDBPMOffsets(DBPMKeeper &dbpm);
#if HAVE_LIBQTXML
int prepareDBPM(std::vector<std::string> &_glist, std::vector<unsigned int> &_hV, std::vector<std::string> &dev, std::vector<float> &pos) ;
int prepareDBPM(std::vector<std::string> &_glist, std::vector<unsigned int> &_hV, std::map<float, std::string> &posDev) ;
#endif
#endif
//Standard BLOCKING get
//0+
int get(const unsigned int handle, std::string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int nn=handleHelper.getNelemClient(handle);
if (nn==0) {
if (nn==0)
{
return ECAFE_INVALID_HANDLE;
}
//check on handle number before proceeding!
dbr_string_t * _val = new dbr_string_t[nn];
status=cafeSoluble.get(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -244,12 +269,14 @@ public:
int get(const unsigned int handle, std::string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int nn=handleHelper.getNelemClient(handle);
if (nn==0) {
if (nn==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t * _val = new dbr_string_t[nn];
status=cafeSoluble.get(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -259,12 +286,14 @@ public:
int get(const unsigned int handle, std::string * valStr)
{
unsigned int nn=handleHelper.getNelemClient(handle);
if (nn==0) {
if (nn==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t * _val = new dbr_string_t[nn];
status=cafeSoluble.get(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -367,7 +396,10 @@ public:
{
return cafeDoppio.get (handle, DBR_DOUBLE, _val);
};
//Arrays
//Arrays -user allocates space
int getCharArray(const unsigned int handle, dbr_char_t * _val)
{
return cafeCappuccino.get (handle, DBR_CHAR, _val);
@@ -405,17 +437,20 @@ public:
return cafeSoluble.get(handle, DBR_STRING, _val);
};
//0
//single values
int getString(const unsigned int handle, std::string & valStr) //0+
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -425,12 +460,14 @@ public:
int get(const unsigned int handle, std::string & valStr) //0+
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -440,12 +477,14 @@ public:
int get(const unsigned int handle, std::string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //0
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -456,12 +495,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -472,12 +513,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -487,12 +530,14 @@ public:
int get(const unsigned int handle, dbr_string_t & _val) //0
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
sprintf(_val, val[0]);
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -502,12 +547,14 @@ public:
int get(const unsigned int handle, dbr_string_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //0
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
sprintf(_val, val[0]);
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -518,12 +565,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1]= {""};
status=cafeSoluble.get(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
sprintf(_val, val[0]);
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -533,12 +582,14 @@ public:
int get(const unsigned int handle, dbr_short_t & _val) //1
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_short_t val[1]= {0};
status=cafeSchale.get(handle, DBR_SHORT, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -547,12 +598,14 @@ public:
int get(const unsigned int handle, dbr_short_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //1
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_short_t val[1]= {0};
status=cafeSchale.get(handle, DBR_STS_SHORT, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -562,12 +615,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //1
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_short_t val[1]= {0};
status=cafeSchale.get(handle, DBR_TIME_SHORT, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -576,12 +631,14 @@ public:
int get(const unsigned int handle, dbr_float_t &_val) //2
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_float_t val[1]= {0};
status=cafeFrappuccino.get(handle, DBR_FLOAT, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -590,12 +647,14 @@ public:
int get(const unsigned int handle, dbr_float_t &_val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //2
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_float_t val[1]= {0};
status=cafeFrappuccino.get(handle, DBR_STS_FLOAT, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -605,12 +664,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //2
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_float_t val[1]= {0};
status=cafeFrappuccino.get(handle, DBR_TIME_FLOAT, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -619,12 +680,14 @@ public:
int get(const unsigned int handle, dbr_enum_t & _val) //3
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_enum_t val[1]= {0};
status=cafeEspresso.get(handle, DBR_ENUM, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -633,12 +696,14 @@ public:
int get(const unsigned int handle, dbr_enum_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //3
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_enum_t val[1]= {0};
status=cafeEspresso.get(handle, DBR_STS_ENUM, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -648,12 +713,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //3
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_enum_t val[1]= {0};
status=cafeEspresso.get(handle, DBR_TIME_ENUM, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -662,12 +729,14 @@ public:
int get(const unsigned int handle, dbr_char_t & _val) //4
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_char_t val[1]= {0};
status=cafeCappuccino.get(handle, DBR_CHAR, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -676,12 +745,14 @@ public:
int get(const unsigned int handle, dbr_char_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //4
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_char_t val[1]= {0};
status=cafeCappuccino.get(handle, DBR_STS_CHAR, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -691,12 +762,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //4
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_char_t val[1]= {0};
status=cafeCappuccino.get(handle, DBR_TIME_CHAR, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -705,12 +778,14 @@ public:
int getLong(const unsigned int handle, dbr_long_t & _val) //5
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_long_t val[1]= {0};
status=cafeLatte.get(handle, DBR_LONG, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -719,12 +794,14 @@ public:
int get(const unsigned int handle, dbr_long_t & _val) //5
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_long_t val[1]= {0};
status=cafeLatte.get(handle, DBR_LONG, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -734,12 +811,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //5
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_long_t val[1]= {0};
status=cafeLatte.get(handle, DBR_STS_LONG, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -749,12 +828,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //5
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_long_t val[1]= {0};
status=cafeLatte.get(handle, DBR_TIME_LONG, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -764,12 +845,14 @@ public:
int get(const unsigned int handle, long long & _val) //5+ long long
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
long long val[1]= {0};
status=CAFE::get(handle, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -779,12 +862,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //5+ long long
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
long long val[1]= {0};
status=CAFE::get(handle, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -794,12 +879,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //5+ long long
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
long long val[1]= {0};
status=CAFE::get(handle, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -809,12 +896,14 @@ public:
int getDouble(const unsigned int handle, dbr_double_t & _val) //6
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_double_t val[1]= {0};
status=cafeDoppio.get(handle, DBR_DOUBLE, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -823,12 +912,14 @@ public:
int get(const unsigned int handle, dbr_double_t & _val) //6
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_double_t val[1]= {0};
status=cafeDoppio.get(handle, DBR_DOUBLE, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -837,12 +928,14 @@ public:
int get(const unsigned int handle, dbr_double_t & _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //6
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_double_t val[1]= {0};
status=cafeDoppio.get(handle, DBR_STS_DOUBLE, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -852,12 +945,14 @@ public:
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //6
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_double_t val[1]= {0};
status=cafeDoppio.get(handle, DBR_TIME_DOUBLE, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
_val=val[0];
}
CAFE::setNelemToPrevious(handle, nelemPrevious);
@@ -1001,6 +1096,24 @@ public:
return cafeDoppio.set (handle, DBR_DOUBLE, _val);
};
/* NOT REQUIRED
int setStringWF(const unsigned int handle, std::string wfStr) {
dbr_char_t * wfChar = new dbr_char_t[wfStr.size()];
unsigned short iCount = 0;
for (std::string::size_type i=0; i < wfStr.size(); ++i) {
if (wfStr[i].compare("\\") == 0 ) {
wfChar[iCount] = '\n';
++i;
}
else {
wfChar[iCount] = wfStr[i]
}
++iCount;
}
return cafeCappuccino.set (handle, DBR_CHAR, wfChar);
delete [] wfChar;
}
*/
//set for PythonTypes
//0
@@ -1051,7 +1164,7 @@ public:
return set (handle, _val);
};
//5
int setLong(const unsigned int handle, const dbr_long_t _val)
int setLong(const unsigned int handle, const dbr_long_t _val)
{
return set (handle, _val);
};
@@ -1071,7 +1184,8 @@ public:
int set(const unsigned int handle, std::string _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1];
@@ -1088,7 +1202,8 @@ public:
int set(const unsigned int handle, const dbr_string_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_string_t val[1];
@@ -1101,7 +1216,8 @@ public:
int set(const unsigned int handle, const dbr_short_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_short_t val[1];
@@ -1114,7 +1230,8 @@ public:
int set(const unsigned int handle, const dbr_float_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_float_t val[1];
@@ -1127,7 +1244,8 @@ public:
int set(const unsigned int handle, const dbr_enum_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_enum_t val[1];
@@ -1140,7 +1258,8 @@ public:
int set(const unsigned int handle, const dbr_char_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_char_t val[1];
@@ -1153,7 +1272,8 @@ public:
int set(const unsigned int handle, const dbr_long_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_long_t val[1];
@@ -1166,15 +1286,18 @@ public:
int set(const unsigned int handle, const long long _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
if (_val <= LONG_MAX) {
if (_val <= LONG_MAX)
{
dbr_long_t val[1];
val[0]=_val;
status=CAFE::set(handle, val);
}
else {
else
{
dbr_double_t val[1];
val[0]=_val;
status=CAFE::set(handle, val);
@@ -1186,7 +1309,8 @@ public:
int set(const unsigned int handle, const dbr_double_t _val)
{
unsigned int nelemPrevious=CAFE::setNelemToOne(handle);
if (nelemPrevious==0) {
if (nelemPrevious==0)
{
return ECAFE_INVALID_HANDLE;
}
dbr_double_t val[1];
@@ -1321,7 +1445,8 @@ public:
std::vector<unsigned int> closeDisconnectedChannelsFromWithinGroupV(const unsigned int groupHandle)
{
std::vector<unsigned int> dhV=handleHelper.getDisconnectedHandlesFromWithinGroupV(groupHandle);
if (dhV.size() >0) {
if (dhV.size() >0)
{
closeChannelsKeepHandles(dhV);
}
return dhV;

View File

@@ -79,17 +79,22 @@ int getCachePVArrayNoWait (std::vector<unsigned int> handleV, PVDataHolder * pv
{
int overallStatus=ICAFE_NORMAL;
for (size_t i=0; i< (size_t) handleV.size(); ++i) {
for (size_t i=0; i< (size_t) handleV.size(); ++i)
{
status=getCacheNoWait(handleV[i], pvd[i]);
//cout << "handle= " << handleV[i] << " pvFromHandle= " << CAFE::getPVFromHandle(handleV[i]) << " status= " << pvd[i].getStatus() << " val= " << pvd[i].getAsString() << endl;
if (status!=ICAFE_NORMAL) {
//std::cout << "handle= " << handleV[i] << " pvFromHandle= " << CAFE::getPVFromHandle(handleV[i]) << " status= " << pvd[i].getStatus() << " val= " << pvd[i].getAsString() << std::endl;
if (status!=ICAFE_NORMAL)
{
resetCallbackGet(handleV[i]);
if(overallStatus==ICAFE_NORMAL) {
if(overallStatus==ICAFE_NORMAL)
{
overallStatus=status;
}
}
if (pvd[i].getStatus() !=ICAFE_NORMAL) {
if(overallStatus==ICAFE_NORMAL) {
if (pvd[i].getStatus() !=ICAFE_NORMAL)
{
if(overallStatus==ICAFE_NORMAL)
{
overallStatus=pvd[i].getStatus();
}
}
@@ -259,7 +264,8 @@ int getCacheStringArray(const unsigned int handle, std::string * valStr)
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -269,7 +275,8 @@ int getCache(const unsigned int handle, std::string * valStr)
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -279,7 +286,8 @@ int getCache(const unsigned int handle, std::string * valStr, dbr_short_t &al
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -289,7 +297,8 @@ int getCache(const unsigned int handle, std::string * valStr, dbr_short_t &al
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -302,7 +311,8 @@ int getCacheString(const unsigned int handle, std::string & valStr) //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
@@ -314,7 +324,8 @@ int getCache(const unsigned int handle, std::string & valStr) //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
@@ -325,7 +336,8 @@ int getCache(const unsigned int handle, std::string & valStr, dbr_short_t &ala
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
@@ -337,7 +349,8 @@ int getCache(const unsigned int handle, std::string & valStr,
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
@@ -396,7 +409,8 @@ int getCache(const unsigned int *handleArray, unsigned int nelem, std::strin
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< nelem; ++i) {
for (unsigned int i=0; i< nelem; ++i)
{
valStr[i]=val[i];
}
delete [] val;
@@ -408,7 +422,8 @@ int getCache(const unsigned int *handleArray, unsigned int nelem, std::strin
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
for (unsigned int i=0; i< nelem; ++i) {
for (unsigned int i=0; i< nelem; ++i)
{
valStr[i]=val[i];
}
delete [] val;
@@ -418,7 +433,8 @@ int getCache (const unsigned int *handleArray, unsigned int nelem, std::strin
{
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
for (unsigned int i=0; i< nelem; ++i) {
for (unsigned int i=0; i< nelem; ++i)
{
valStr[i]=val[i];
}
delete [] val;
@@ -740,7 +756,8 @@ int getCache(const char * pv, std::string * valStr)
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -751,7 +768,8 @@ int getCache(const char * pv, std::string * valStr, dbr_short_t &alarmStatus,
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;
@@ -762,7 +780,8 @@ int getCache(const char * pv, std::string * valStr, dbr_short_t &alarmStatus,
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i)
{
valStr[i]=_val[i];
}
delete [] _val;

View File

@@ -1,748 +0,0 @@
///
/// \file cafeCache.h
/// \brief CAFE methods retrieving data from cache. (Belongs to cafe.h)
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFECACHE_H
#define CAFECACHE_H
int getPulseID(unsigned int * handle, unsigned int nelem, unsigned int * pulseID)
{
int status=ICAFE_NORMAL;
int statusLocal=ICAFE_NORMAL;
for (unsigned int i=0; i<nelem; ++i) {
statusLocal=handleHelper.getPulseID(handle[i], pulseID[i]);
if (statusLocal!=ICAFE_NORMAL && status==ICAFE_NORMAL) {
status=statusLocal;
}
}
return status;
}
int getPulseID(unsigned int handle, unsigned int &pulseID)
{
pulseID=0;
return handleHelper.getPulseID(handle, pulseID);
}
int getPulseID(char * pv, unsigned int &pulseID)
{
pulseID=0;
unsigned int handle=handleHelper.getHandleFromPV(pv);
return handleHelper.getPulseID(handle, pulseID);
}
unsigned int getPulseIDFromTS(epicsTimeStamp ts)
{
return handleHelper.getPulseIDFromTS(ts);
}
vector<unsigned int>getPulseIDFromTS(PVDataHolder * pvd, unsigned int nelem)
{
vector<unsigned int> vui;
vui.clear();
vui.reserve(nelem);
for (unsigned int i=0; i<nelem; ++i) {
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
}
return vui;
}
vector<unsigned int>getPulseIDFromTS(PVGroup pvg)
{
vector<unsigned int> vui;
vui.clear();
vui.reserve(pvg.getNPV());
PVDataHolder * pvd=pvg.getPVData();
for (unsigned int i=0; i<pvg.getNPV(); ++i) {
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
}
return vui;
}
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd)
{
unsigned int * handleArray = new unsigned int [handleV.size()];
for (size_t i=0; i< (size_t) handleV.size(); ++i) {
handleArray[i]= (unsigned int) handleV[i];
}
status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
delete [] handleArray;
return status;
};
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd)
{
unsigned int * handleArray = new unsigned int [handleV.size()];
int overallStatus=ICAFE_NORMAL;
for (size_t i=0; i< (size_t) handleV.size(); ++i) {
handleArray[i]= (unsigned int) handleV[i];
status=getCacheNoWait(handleArray[i], pvd[i]);
if (status!=ICAFE_NORMAL) {
resetCallbackGet(handleArray[i]);
if(overallStatus==ICAFE_NORMAL) {
overallStatus=status;
}
}
}
delete [] handleArray;
return status;
};
int resetCallbackGet(const unsigned int handle);
int resetCallbackPut(const unsigned int handle);
int getCacheNoWait(const unsigned int handle, PVDataHolder & pvd);
int getCache (const unsigned int handle, PVDataHolder & pvd);
int getCache (const unsigned int *handleArray, unsigned int nelem, PVDataHolder * pvd);
int getCtrlCache (const unsigned int handle, PVCtrlHolder & pvc);
int getCtrlCache (const unsigned int *handleArray, unsigned int nelem, PVCtrlHolder * pvc);
int getCache (const char * pv, PVDataHolder & pvd)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return getCache(handle, pvd);
}
int getCtrlCache (const char * pv, PVCtrlHolder & pvc)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return getCtrlCache(handle, pvc);
}
//6
int getCacheDoubleArray(const unsigned int handle, dbr_double_t * _val)
{
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const unsigned int handle, dbr_double_t * _val)
{
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
};
//5+ long long
int getCache(const unsigned int handle, long long * _val);
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
//5
int getCacheLongArray(const unsigned int handle, dbr_long_t * _val)
{
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const unsigned int handle, dbr_long_t * _val)
{
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
};
//4
int getCache(const unsigned int handle, dbr_char_t * _val)
{
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
};
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//3
int getCache(const unsigned int handle, dbr_enum_t * _val)
{
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
};
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//2
int getCacheFloatArray(const unsigned int handle, dbr_float_t * _val)
{
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const unsigned int handle, dbr_float_t * _val)
{
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
};
//1
int getCache(const unsigned int handle, dbr_short_t * _val)
{
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
};
int getCacheDbrStringArray(const unsigned int handle, dbr_string_t * _val)
{
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
//0
int getCache(const unsigned int handle, dbr_string_t * _val)
{
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
}
//0+
int getCacheStringArray(const unsigned int handle, string * valStr)
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
};
int getCache(const unsigned int handle, string * valStr)
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
};
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
};
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
}
//Single value
//0+
int getCacheString(const unsigned int handle, string & valStr) //0
{
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr) //0
{
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //0
{
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //0
{
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle);
dbr_string_t val[1]= {""};
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {
valStr=val[0];
}
CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, dbr_string_t & val); //0
int getCache(const unsigned int handle, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
int getCache(const unsigned int handle, dbr_string_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
int getCache(const unsigned int handle, dbr_short_t & val); //1
int getCache(const unsigned int handle, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
int getCache(const unsigned int handle, dbr_short_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
int getCache(const unsigned int handle, dbr_float_t & val); //2
int getCache(const unsigned int handle, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
int getCache(const unsigned int handle, dbr_float_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
int getCache(const unsigned int handle, dbr_enum_t & val); //3
int getCache(const unsigned int handle, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
int getCache(const unsigned int handle, dbr_enum_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
int getCache(const unsigned int handle, dbr_char_t & val); //4
int getCache(const unsigned int handle, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
int getCache(const unsigned int handle, dbr_char_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
int getCacheLong(const unsigned int handle, dbr_long_t & val)
{
return getCache(handle, val);
}
int getCache(const unsigned int handle, dbr_long_t & val); //5
int getCache(const unsigned int handle, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
int getCache(const unsigned int handle, dbr_long_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
int getCache(const unsigned int handle, long long & val); //5+
int getCache(const unsigned int handle, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5+
int getCache(const unsigned int handle, long long & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5+
int getCacheDouble(const unsigned int handle, dbr_double_t & val)
{
return getCache(handle, val);
}
int getCache(const unsigned int handle, dbr_double_t & val); //6
int getCache(const unsigned int handle, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
int getCache(const unsigned int handle, dbr_double_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
//getCache by array of handles
//0+
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< nelem; ++i) {
valStr[i]=val[i];
}
delete [] val;
return status;
};
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
for (unsigned int i=0; i< nelem; ++i) {
valStr[i]=val[i];
}
delete [] val;
return status;
};
int getCache (const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray)
{
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
for (unsigned int i=0; i< nelem; ++i) {
valStr[i]=val[i];
}
delete [] val;
return status;
}
//0
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray)
{
return cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
}
//1
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeSchale.getCache(handleArray, nelem, DBR_TIME_SHORT, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeSchale.getCache(handleArray, nelem, DBR_STS_SHORT, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray)
{
return cafeSchale.getCache(handleArray, nelem, DBR_SHORT, val, statusArray);
}
//2
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeFrappuccino.getCache(handleArray, nelem, DBR_TIME_FLOAT, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeFrappuccino.getCache(handleArray, nelem, DBR_STS_FLOAT, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray)
{
return cafeFrappuccino.getCache(handleArray, nelem, DBR_FLOAT, val, statusArray);
}
//3
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeEspresso.getCache(handleArray, nelem, DBR_TIME_ENUM, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeEspresso.getCache(handleArray, nelem, DBR_STS_ENUM, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray)
{
return cafeEspresso.getCache(handleArray, nelem, DBR_ENUM, val, statusArray);
}
//4
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeCappuccino.getCache(handleArray, nelem, DBR_TIME_CHAR, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeCappuccino.getCache(handleArray, nelem, DBR_STS_CHAR, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray)
{
return cafeCappuccino.getCache(handleArray, nelem, DBR_CHAR, val, statusArray);
}
//5
int getCache(unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeLatte.getCache(handleArray, nelem, DBR_TIME_LONG, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeLatte.getCache(handleArray, nelem, DBR_STS_LONG, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray)
{
return cafeLatte.getCache(handleArray, nelem, DBR_LONG, val, statusArray);
}
//5+ long long
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity);
int getCache (const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray);
//6
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts)
{
return cafeDoppio.getCache(handleArray, nelem, DBR_TIME_DOUBLE, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity)
{
return cafeDoppio.getCache(handleArray, nelem, DBR_STS_DOUBLE, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray)
{
return cafeDoppio.getCache(handleArray, nelem, DBR_DOUBLE, val, statusArray);
}
////////////////////////////////////////////// by PV name ///////////////////////////////////
int getCache(const char * pv, string & valStr); //0+
int getCache(const char * pv, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0+
int getCache(const char * pv, string & valStr,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0+
int getCache(const char * pv, dbr_string_t & val); //0
int getCache(const char * pv, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
int getCache(const char * pv, dbr_string_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
int getCache(const char * pv, dbr_short_t & val); //1
int getCache(const char * pv, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
int getCache(const char * pv, dbr_short_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
int getCache(const char * pv, dbr_float_t & val); //2
int getCache(const char * pv, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
int getCache(const char * pv, dbr_float_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
int getCache(const char * pv, dbr_enum_t & val); //3
int getCache(const char * pv, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
int getCache(const char * pv, dbr_enum_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
int getCache(const char * pv, dbr_char_t & val); //4
int getCache(const char * pv, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
int getCache(const char * pv, dbr_char_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
int getCache(const char * pv, dbr_long_t & val); //5
int getCache(const char * pv, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
int getCache(const char * pv, dbr_long_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
int getCache(const char * pv, long long & val) //5+
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val);
}
int getCache(const char * pv, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) //5+
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity);
}
int getCache(const char * pv, long long & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) //5+
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity, ts);
}
int getCache(const char * pv, dbr_double_t & val); //6
int getCache(const char * pv, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
int getCache(const char * pv, dbr_double_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
//6
int getCache(const char * pv, dbr_double_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
};
//5+
int getCache(const char * pv, long long * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val);
};
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity, ts);
};
//5
int getCache(const char * pv, dbr_long_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
};
//4
int getCache(const char * pv, dbr_char_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
};
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//3
int getCache(const char * pv, dbr_enum_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
};
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//2
int getCache(const char * pv, dbr_float_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
};
//1
int getCache(const char * pv, dbr_short_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
};
//0
int getCache(const char * pv, dbr_string_t * _val)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
}
//0+
int getCache(const char * pv, string * valStr)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
};
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
};
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts)
{
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) {
valStr[i]=_val[i];
}
delete [] _val;
return status;
}
#endif // CAFECACHE_H

View File

@@ -26,7 +26,8 @@
* method getAsString() converts CTYPE to string \n
*
*/
template <class CTYPE> class CAFEConvert {
template <class CTYPE> class CAFEConvert
{
private:
CTYPE returnVal[1];
public:
@@ -55,20 +56,25 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (CAFE_DATATYPE dt, CAFE_D
// Valid for all types that have numeric_limits support
// (brackets required) to avoid compiler error should isnan also be a native macro
switch (dt) {
switch (dt)
{
case CAFE_DOUBLE:
if ( (boost::math::isnan)((CTYPE) val.d) ) {
if ( (boost::math::isnan)((CTYPE) val.d) )
{
returnVal[0]= (CTYPE) val.d;
}
else {
else
{
returnVal[0]= (CTYPE) 0;
}
break;
case CAFE_FLOAT:
if ( (boost::math::isnan)((CTYPE) val.f) ) {
if ( (boost::math::isnan)((CTYPE) val.f) )
{
returnVal[0]= (CTYPE) val.f;
}
else {
else
{
returnVal[0]= 0;
}
break;
@@ -135,7 +141,8 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (unsigned int index, CAFE
{
#define __METHOD__ "CAFEConvert<CTYPE>::get(index, dt, val[])"
switch (dt) {
switch (dt)
{
case CAFE_DOUBLE:
returnVal[0]= (CTYPE) val[index].d;
break;
@@ -213,30 +220,38 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getStringFromEnum (unsigned i
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStr; ++j) {
if (strcmp(stig[j],"")==0) {
for (unsigned int j=0; j<noStr; ++j)
{
if (strcmp(stig[j],"")==0)
{
++noEmptyStrings;
}
}
if (noStr==noEmptyStrings) {
std::cout << "*** WARNING FROM " << __METHOD__ << " *** " << std::endl;
std::cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << std::endl;
std::cout << "BADLY CONFIGURED EPICS RECORD. " << std::endl;
}
// Some developers do not populate enum string values
//if (noStr==noEmptyStrings)
//{
// std::cout << "*** WARNING FROM " << __METHOD__ << " *** " << std::endl;
// std::cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << std::endl;
// std::cout << "BADLY CONFIGURED EPICS RECORD. " << std::endl;
//}
if (index < noStr && noStr!=noEmptyStrings) {
if (index < noStr && noStr!=noEmptyStrings)
{
sprintf(returnVal[0], "%s", stig[val[index].us] );
}
else {
else
{
sprintf(returnVal[0], "%d", val[index].us );
if ( val[index].us>= noStr) {
if ( val[index].us>= noStr)
{
std::cout << "*** WARNING FROM " << __METHOD__ << " *** " << std::endl;
std::cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << std::endl;
std::cout << "VALUE (unsigned short) = " << val[index].us << std::endl;
std::cout << "NO OF ENUMERATED STRINGS = " << noStr << " WITH VALUES: " << std::endl;
for (unsigned int j=0; j<noStr; ++j) {
for (unsigned int j=0; j<noStr; ++j)
{
std::cout << stig[j] << " [" <<j << "] ";
}
std::cout << std::endl;
@@ -259,7 +274,8 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (unsigned int index
{
#define __METHOD__ "CAFEConvert<CTYPE>::getString(nelem, dt, val[])"
switch (dt) {
switch (dt)
{
case CAFE_STRING:
sprintf(returnVal[0], "%s", val[index].str);
break;
@@ -329,7 +345,8 @@ template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (CAFE_DATATYPE dt,
{
#define __METHOD__ "CAFEConvert<CTYPE>::getString(dt, val[])"
switch (dt) {
switch (dt)
{
case CAFE_STRING:
sprintf(returnVal[0], "%s", val.str);
break;

View File

@@ -13,7 +13,8 @@
#include <string>
#include <map>
enum CAFE_DATATYPE {
enum CAFE_DATATYPE
{
CAFE_TYPENOTCONN = TYPENOTCONN, // -1 val returned by ca_field_type when channel not connected
CAFE_STRING = DBF_STRING, // 0
CAFE_SHORT = DBF_SHORT, // 1
@@ -34,7 +35,8 @@ enum CAFE_DATATYPE {
* Provides methods to convert between
* the CAFE_DATATYPES and text equivalent
*/
class CAFEDataTypeCode {
class CAFEDataTypeCode
{
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapDataType;
@@ -97,12 +99,13 @@ public:
void print ( )
{
std::cout << "------------------" << std::endl;
std::cout << "CAFE_DATATYPE LIST" << std::endl;
std::cout << "-----------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
std::cout << "CAFE_DATATYPE LIST" << std::endl;
std::cout << "------------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "-----------------" << std::endl;
std::cout << "------------------" << std::endl;
};
};
@@ -110,7 +113,8 @@ public:
/**
* A union of CAFE primitive datatypes
*/
union CAFE_DATATYPE_UNION {
union CAFE_DATATYPE_UNION
{
dbr_string_t str;
dbr_short_t s;
dbr_float_t f;
@@ -124,4 +128,5 @@ typedef CAFE_DATATYPE_UNION * CAFE_DATATYPE_UNION_SEQ;
#endif

View File

@@ -14,7 +14,8 @@
#include <map>
#include <cafeDataType.h>
class CafeDataTypeHelper {
class CafeDataTypeHelper
{
private:
CAFE_DATATYPE_UNION cdu;
CAFE_DATATYPE dataType;

View File

@@ -10,13 +10,15 @@
#include <cadef.h>
namespace CAFENUM {
namespace CAFENUM
{
/**
* Data request buffer types \n
* i.e. whether PRIMITIVE, STS, TIME, GR or CTRL
*/
enum DBR_TYPE {
enum DBR_TYPE
{
DBR_PRIMITIVE,
DBR_PLAIN=DBR_PRIMITIVE,
DBR_STS,
@@ -33,7 +35,8 @@ enum DBR_TYPE {
/**
* Define enum type to flush io after creating channels
*/
enum ChannelFlushSendBufferPolicyKind {
enum ChannelFlushSendBufferPolicyKind
{
WITH_FLUSH_IO,
WITH_PEND_IO, // needs timeout duration
WITH_PEND_EVENT, // needs timeout duration
@@ -44,7 +47,8 @@ enum ChannelFlushSendBufferPolicyKind {
/**
* Define enum type defining when to flush io after creating channels
*/
enum ChannelWhenToFlushSendBufferPolicyKind {
enum ChannelWhenToFlushSendBufferPolicyKind
{
FLUSH_AUTOMATIC=0,
FLUSH_NOW=FLUSH_AUTOMATIC,
FLUSH_AFTER_EACH_CHANNEL_CREATION=FLUSH_NOW, // instantly
@@ -61,16 +65,16 @@ enum ChannelWhenToFlushSendBufferPolicyKind {
* an independent virtual circuit, and associated data structures, is
* created for each priority that is used on a particular server
*/
enum ChannelServerDispatchPriority {
enum ChannelServerDispatchPriority
{
CA_SERVER_DISPATCH_PRIORITY_MIN =CA_PRIORITY_MIN, //0
CA_SERVER_DISPATCH_PRIORITY_VERYLOW =CA_PRIORITY_MIN+1,
CA_SERVER_DISPATCH_PRIORITY_DEFAULT =CA_PRIORITY_MAX, //CA_SERVER_DISPATCH_PRIORITY_VERYLOW, //1
CA_SERVER_DISPATCH_PRIORITY_VERYLOW =CA_PRIORITY_MIN+1,
CA_SERVER_DISPATCH_PRIORITY_LOW =CA_PRIORITY_MIN+25,
CA_SERVER_DISPATCH_PRIORITY_MED =CA_PRIORITY_MIN+50,
CA_SERVER_DISPATCH_PRIORITY_HIGH =CA_PRIORITY_MIN+75,
CA_SERVER_DISPATCH_PRIORITY_VERYHIGH=CA_PRIORITY_MIN+98,
CA_SERVER_DISPATCH_PRIORITY_MAX =CA_PRIORITY_MAX
CA_SERVER_DISPATCH_PRIORITY_MAX =CA_PRIORITY_MAX,
CA_SERVER_DISPATCH_PRIORITY_DEFAULT =CA_PRIORITY_MAX
};
@@ -79,7 +83,8 @@ enum ChannelServerDispatchPriority {
* Meant for use within callbacks to ensure that cache operations
* are never blocked
*/
enum ChannelGetCacheWaitPolicyKind {
enum ChannelGetCacheWaitPolicyKind
{
GET_CACHE_NO_CHECK=0,
GET_CACHE_NO_WAIT,
GET_CACHE_NOW =GET_CACHE_NO_WAIT,
@@ -92,7 +97,8 @@ enum ChannelGetCacheWaitPolicyKind {
* monitor is in place
*
*/
enum ChannelGetActionWhenMonitorPolicyKind {
enum ChannelGetActionWhenMonitorPolicyKind
{
GET_FROM_CACHE,
GET_FROM_IOC
};
@@ -102,7 +108,8 @@ enum ChannelGetActionWhenMonitorPolicyKind {
* Blocking can be achieved with or without callback.
* Callback can further be supplied by the user
*/
enum ChannelRequestPolicyKind {
enum ChannelRequestPolicyKind
{
WITHOUT_CALLBACK,
WITH_CALLBACK_DEFAULT,
WITH_CALLBACK_USER_SUPPLIED
@@ -113,7 +120,8 @@ enum ChannelRequestPolicyKind {
* Enum type defining level of datatype conversion at the IOC
*
*/
enum ChannelRequestDataTypePolicyKind {
enum ChannelRequestDataTypePolicyKind
{
NATIVE_DATATYPE,
LOWEST_DATATYPE // The smaller in byte size of type requested and native datatype
};
@@ -124,7 +132,8 @@ enum ChannelRequestDataTypePolicyKind {
* from a message sent with a callback, whether it be
* user supplied or the CAFE default.
*/
enum ChannelWaitForResponsePolicyKind {
enum ChannelWaitForResponsePolicyKind
{
BLOCKING=0,
WAIT=BLOCKING,
NON_BLOCKING=1,
@@ -132,7 +141,8 @@ enum ChannelWaitForResponsePolicyKind {
};
enum StatusMessageKind {
enum StatusMessageKind
{
NO_MESSAGE,
PRE_REQUEST,
FROM_REQUEST,
@@ -141,7 +151,8 @@ enum StatusMessageKind {
FROM_MESSAGE
};
enum CallbackProgressKind {
enum CallbackProgressKind
{
NOT_INITIATED,
PENDING,
COMPLETE

View File

@@ -123,10 +123,12 @@ int match(std::string valSet, unsigned int handleMatch,
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -139,10 +141,12 @@ int match(std::string valSet, unsigned int handleMatch,
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -170,10 +174,12 @@ int match(dbr_string_t valSet, unsigned int handleMatch,
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -186,10 +192,12 @@ int match(dbr_string_t valSet, unsigned int handleMatch,
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -269,16 +277,19 @@ int matchMany(std::vector<std::string> valSetV, std::vector<unsigned int> handle
std::istringstream ss;
dbr_double_t d=0;
dbr_double_t toleranceDouble = 0;
for (size_t i=0; i< valSetV.size(); ++i) {
for (size_t i=0; i< valSetV.size(); ++i)
{
d=0;
ss.clear();
ss.str(valSetV[i]);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDoubleV.push_back(d);
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -293,10 +304,12 @@ int matchMany(std::vector<std::string> valSetV, std::vector<unsigned int> handle
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -380,16 +393,19 @@ int setAndMatchMany(std::vector<unsigned int> handleSetV, std::vector<std::strin
std::istringstream ss;
dbr_double_t d=0;
dbr_double_t toleranceDouble = 0;
for (size_t i=0; i< valSetV.size(); ++i) {
for (size_t i=0; i< valSetV.size(); ++i)
{
d=0;
ss.clear();
ss.str(valSetV[i]);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDoubleV.push_back(d);
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -404,10 +420,12 @@ int setAndMatchMany(std::vector<unsigned int> handleSetV, std::vector<std::strin
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -515,16 +533,19 @@ int gameSetAndMatch(std::vector<unsigned int> handleSetV, std::vector<std::strin
std::istringstream ss;
dbr_double_t d=0;
dbr_double_t toleranceDouble = 0;
for (size_t i=0; i< valSetV.size(); ++i) {
for (size_t i=0; i< valSetV.size(); ++i)
{
d=0;
ss.clear();
ss.str(valSetV[i]);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDoubleV.push_back(d);
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -539,10 +560,12 @@ int gameSetAndMatch(std::vector<unsigned int> handleSetV, std::vector<std::strin
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -618,10 +641,12 @@ int setAndMatch(const unsigned int handleSet, dbr_string_t valSet, const unsigne
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -634,10 +659,12 @@ int setAndMatch(const unsigned int handleSet, dbr_string_t valSet, const unsigne
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -662,10 +689,12 @@ int setAndMatch(const unsigned int handleSet, std::string valSet, const unsigned
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
valSetDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";
@@ -678,10 +707,12 @@ int setAndMatch(const unsigned int handleSet, std::string valSet, const unsigned
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
if ( !ss.fail())
{
toleranceDouble=d;
}
else {
else
{
std::cout << __METHOD__ << __LINE__ << std::endl;
std::cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << std::endl;
std::cout << "***WARNING*** COULD NOT CONVERT: ";

View File

@@ -11,6 +11,7 @@
#include <string>
#include <vector>
int get(const unsigned int _handle, std::vector<std::string> & V); //0
int get(const unsigned int _handle, std::vector<short> & V); //1
int get(const unsigned int _handle, std::vector<float> & V); //2
@@ -19,6 +20,16 @@ int get(const unsigned int _handle, std::vector<unsigned char> & V); //4
int get(const unsigned int _handle, std::vector<dbr_long_t> & V); //5
int get(const unsigned int _handle, std::vector<long long> & V); //5
int get(const unsigned int _handle, std::vector<double> & V); //6
int getStringVector(const unsigned int _handle, std::vector<std::string> & V) {return get(_handle, V);}; //0
int getShortVector(const unsigned int _handle, std::vector<short> & V) {return get(_handle, V);}; //1
int getFloatVector(const unsigned int _handle, std::vector<float> & V) {return get(_handle, V);}; //2
int getUShortVector(const unsigned int _handle, std::vector<unsigned short> & V) {return get(_handle, V);};//3
int getUCharVector(const unsigned int _handle, std::vector<unsigned char> & V) {return get(_handle, V);}; //4
int getLongVector(const unsigned int _handle, std::vector<dbr_long_t> & V) {return get(_handle, V);}; //5
int getLongLongVector(const unsigned int _handle, std::vector<long long> & V) {return get(_handle, V);}; //5
int getDoubleVector(const unsigned int _handle, std::vector<double> & V) {return get(_handle, V);}; //6
int get(const unsigned int _handle, std::vector<std::string> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//0
int get(const unsigned int _handle, std::vector<short> & V,
@@ -171,6 +182,7 @@ int getScalars(std::vector<unsigned int> handleV, std::vector<dbr_double_t> & V
int getCacheVStr(std::vector<unsigned int> handleV, std::vector<std::string> & V, std::vector<int> &statusV)
{
return getCache(handleV, V, statusV);

View File

@@ -10,11 +10,11 @@
#include <config.h>
//if HAVE_LIBQTXML - needed for externsions
#if HAVE_LIBQTXML //- needed for externsions
int loadCollectionsFromXML(const char * collectionsFile);
int loadGroupsFromXML (const char * groupsFile);
int restoreFromXML(const char * snapshotFile);
//endif
#endif
int snapshot2XML (PVGroup pg);
void openGroupXMLFile(std::string fileName);

View File

@@ -17,7 +17,8 @@
* Provides methods to convert between
* the CA_OP_xx and text equivalent
*/
class CAOPCodes {
class CAOPCodes
{
typedef std::map<int, std::string> mapIntString;
private:
mapIntString mapDataType;
@@ -62,7 +63,8 @@ public:
std::cout << "------------------" << std::endl;
std::cout << "CA_OP_LIST" << std::endl;
std::cout << "-----------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "-----------------" << std::endl;

View File

@@ -33,7 +33,8 @@
* Struct defining channel properties and connection status for use in Conduit container
*
*/
class ChannelRegalia {
class ChannelRegalia
{
private:
CAFEStatus cafeStatus;
public:
@@ -164,13 +165,16 @@ public:
};
std::string getConnectionStateAsString()
{
if(connectionState==CA_OP_CONN_UP) {
if(connectionState==CA_OP_CONN_UP)
{
return "CA_OP_CONN_UP";
}
else if(connectionState==CA_OP_CONN_DOWN) {
else if(connectionState==CA_OP_CONN_DOWN)
{
return "CA_OP_CONN_DOWN";
}
else {
else
{
return "CA_OP_CONN is UNKNOWN: THIS SHOULD NEVER APPEAR!";
}
};
@@ -204,21 +208,23 @@ public:
* Struct defining channel properties and connection status for use in displays
*
*/
class ChannelDataStore {
class ChannelDataStore
{
public:
std::string description;
ChannelRegalia info;
PVDataHolder pvd;
PVCtrlHolder pvc;
ChannelDataStore() {
};
std::string description;
ChannelRegalia info;
PVDataHolder pvd;
PVCtrlHolder pvc;
ChannelDataStore()
{
};
~ChannelDataStore() {};
};
@@ -228,7 +234,8 @@ public:
* Stores strings for Enum datatypes
*
*/
class ChannelEnumStrings {
class ChannelEnumStrings
{
public:
friend struct change_eventHandlerArgs;
private:
@@ -244,7 +251,8 @@ public:
{
std::vector<std::string> optionsV;
optionsV.reserve(noOptions);
for ( short i=0; i<noOptions; ++i) {
for ( short i=0; i<noOptions; ++i)
{
optionsV.push_back(options[i]);
}
return optionsV;
@@ -256,7 +264,8 @@ public:
* Stores device/attribute pairing
*
*/
class ChannelDeviceAttribute {
class ChannelDeviceAttribute
{
private:
std::string pv;
std::string device;
@@ -271,18 +280,21 @@ public:
pv=_pv;
deliminator=_deliminator;
short posOfSeparator=pv.find_first_of(deliminator);
if (posOfSeparator<0) {
if (posOfSeparator<0)
{
device="";
attribute="";
return ECAFE_DEVICE_ATTRIB_NOT_FOUND;
}
else {
else
{
device= pv.substr(0,posOfSeparator);
attribute=pv.substr(posOfSeparator+1,pv.size());
//Check for .VAL and remove
//Check for .VAL and remove
std::size_t found = attribute.find(".");
if (found != std::string::npos) {
attribute=attribute.substr(0, found);
if (found != std::string::npos)
{
attribute=attribute.substr(0, found);
}
}
return ICAFE_NORMAL;
@@ -323,7 +335,8 @@ public:
* 0. Struct defining channel datatype/nelem executed by CAFE for use in Conduit container
*
*/
class ChannelRequestMetaData {
class ChannelRequestMetaData
{
public:
friend struct change_connectionHandlerArgs;
friend struct change_dataBufferSize_CTRL;
@@ -377,7 +390,8 @@ public:
void setDbrTypesFromCafeDbrType(CAFENUM::DBR_TYPE cd)
{
cafeDbrType=cd;
switch(cafeDbrType) {
switch(cafeDbrType)
{
case CAFENUM::DBR_TIME:
dbrDataType = dbf_type_to_DBR_TIME(dataType);
break;
@@ -457,7 +471,8 @@ public:
* -1. Struct defining channel datatype/nelem requested by client for use in Conduit container
*
*/
class ChannelRequestMetaDataClient: public ChannelRequestMetaData {
class ChannelRequestMetaDataClient: public ChannelRequestMetaData
{
public:
//protected:
@@ -478,7 +493,8 @@ public:
* messageStatus = requestStatus or messageStatus=callbackStatus (if policy WITH_CALLBACK)
*
*/
class ChannelRequestStatus {
class ChannelRequestStatus
{
private:
int preRequestStatus; // current status of channel
@@ -550,16 +566,20 @@ public:
{
hasCallbackInitiated=hasInit;
hasCallbackTriggered=hasTrig;
if ( hasInit && !hasTrig) {
if ( hasInit && !hasTrig)
{
callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::PENDING;
}
else if (!hasInit && hasTrig) {
else if (!hasInit && hasTrig)
{
callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::COMPLETE;
}
else if (!hasInit && !hasTrig) {
else if (!hasInit && !hasTrig)
{
callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::NOT_INITIATED;
}
else {
else
{
std::cout << "CAFE INTERNAL POLICY ERROR" << std::endl;
std::cout << "ChannelRequestStatus::setCallbackKind gives an INVALID callbackProgressKind" << std::endl;
}

View File

@@ -13,31 +13,31 @@
#include <config.h>
#include <cadef.h>
#include <channelRegalia.h>
#include <PVDataHolder.h>
#include <PVCtrlHolder.h>
#include <policies.h>
#include <deque>
#if HAVE_PYTHON_H
#if HAVE_PYTHON_H
#if HAVE_PYCAFE_EXT
#include <Python.h> //required for PyCafe.h
#include <PyCafe.h>
#else
#include <PyCafe_api.h>
#endif
#endif
using namespace boost::posix_time;
/**
* Principal constructor has:\n
* \param _pv process variable
* \param _ccc ca_client_context
*/
class Conduit {
class Conduit
{
public:
friend struct change_alarmStatus;
friend struct change_alarmSeverity;
@@ -48,7 +48,7 @@ public:
friend struct change_accessWrite;
friend struct change_beamEventNo;
friend struct change_channelDeviceAttribute;
friend struct change_channelID;
friend struct change_channelRegalia;
@@ -99,6 +99,9 @@ public:
friend struct change_monitorAction;
friend struct change_monitorActionClear;
friend struct change_monitorActionErase;
friend struct change_monitorPolicy;
friend struct change_monitorPolicyErase;
friend struct change_monitorPolicyInsert;
@@ -108,12 +111,24 @@ public:
//friend struct change_rule;
friend struct change_pvAlias;
#if HAVE_PYTHON_H
friend struct change_pyOpenCallbackFlag;
#endif
friend struct change_status;
friend struct change_supplementHandle;
friend struct change_supplementDescription;
friend struct change_supplementAlarmSeverity;
friend struct change_usrArgs;
friend struct change_widgetInsert;
friend struct change_widgetErase;
friend struct change_pyGetCallbackFn;
friend struct change_pyPutCallbackFn;
friend struct change_pyConnectCallbackFn;
friend struct free_dataBuffers;
friend class Connect;
@@ -141,20 +156,19 @@ private:
union db_access_val * putBuffer;
union db_access_val * stsackBuffer;
//struct connection_handler_args connectionHandlerArgs;
//struct event_handler_args eventHandlerArgs;
short alarmStatus;
short alarmSeverity;
epicsTimeStamp ts;
//New Oct. 2018
std::string desc;
//short hhsv;
//short hsv;
//short lsv;
//short llsv;
alarmSeverityStruct aSevStruct;
bool hasDesc;
bool hasAlarmSevStruct;
alarmSeverityStruct aSevStruct;
bool hasDesc;
bool hasAlarmSevStruct;
void * usrArgs; //Filled in conduitEventHandlerArgs.h; used by getUsrArgsAsUInt in CyCafe
@@ -164,7 +178,7 @@ private:
//Reserved
unsigned long long beamEventNo;
std:: deque<PVDataHolder> dequePulseID;
std::map<unsigned long long, PVDataHolder> mapPulseID;
@@ -217,11 +231,26 @@ private:
ChannelRequestMetaData channelRequestMetaSTSACK;// (CAFENUM::DBR_TYPE DBR_STSACK);//1
ChannelRequestMetaData channelRequestMetaPrimitive; //Put operations
#if HAVE_PYTHON_H
void * PyEventHandler() const;
void * PyEventHandler(unsigned int) const;
void * PyDataEventHandler() const;
void * PyCtrlEventHandler() const;
#if HAVE_PYTHON_H
//void * PyEventHandler() const;
//void * PyEventHandler(unsigned int) const;
//void * PyDataEventHandler() const;
//void * PyCtrlEventHandler() const;
void * CyMonitorHandler() const; //can handle all three cb signatures
//void * CyHandleHandler() const; //handle
//void * CyEventHandler() const; //handle, pv
//void * CyDataEventHandler() const; //handle, pv, pvdata
void * CyCtrlEventHandler() const; //handle, pv, pvctrl
bool pyOpenCallbackFlag;
void * pyGetCallbackFn;
void * pyPutCallbackFn;
void * pyConnectCallbackFn;
std::vector<void *> pyConnectCallbackVector;
#endif
int putWithCallback(pCallback callbackHandlerPut) const;
@@ -240,6 +269,8 @@ private:
//map<unsigned long,MonitorPolicy> lump;
//map<unsigned long,MonitorPolicy>::iterator ilump;
////MonitorPolicy mpBase;
std::vector<MonitorPolicy> mpV;
std::vector<MonitorPolicy> mpInWaitingV;
@@ -249,12 +280,42 @@ private:
std::vector<std::string> monitorAction;
std::vector<void *> widgetV;
bool hasNewData; // used by HandleHelper.getMonitorAction();
public:
#if HAVE_PYTHON_H
void * PyGetHandler() const;
void * PyPutHandler() const;
bool getPyOpenCallbackFlag() const
{
return pyOpenCallbackFlag;
}
//void * PyOpenHandler() const; //make public so that it can be called from a callback fn
void * PyConnectHandler() const; //make public so that it can be called from a callback fn
void * getPyGetCallbackFn(void) const
{
return pyGetCallbackFn;
};
void * getPyPutCallbackFn(void) const
{
return pyPutCallbackFn;
};
void * getPyConnectCallbackFn(void) const
{
return pyConnectCallbackFn;
};
std::vector<void *> getPyConnectCallbackVector(void) const
{
return pyConnectCallbackVector;
};
#endif
Conduit(void );
@@ -277,20 +338,27 @@ public:
int status;
friend std::ostream& operator<<(std::ostream& os, const Conduit& e)
{
os<< "handle=" << e.handle<<" pv=" << e.pv<< std::endl;
return os;
};
//struct connection_handler_args getConnectionHandlerArgs(void) const{
// return connectionHandlerArgs;
//};
//struct event_handler_args getEventHandlerArgs(void) const {
// return eventHandlerArgs;
//};
bool getPyCafe() const
{
return pyCafeFlag;
};
bool operator<(const Conduit& c)const
{
return handle<c.handle;
@@ -305,6 +373,11 @@ public:
return channelDeviceAttribute.getAttribute();
};
const char * getClassName(void) const
{
return channelRegalia.className;
};
const char * getHostName(void) const
{
return channelRegalia.hostName;
@@ -317,7 +390,7 @@ public:
std::string getDescription(void) const
{
return desc;
}
}
epicsTimeStamp getTimeStamp(void) const
{
@@ -349,44 +422,64 @@ public:
}
alarmSeverityStruct getAlarmSeverityStruct(void) const
{
return aSevStruct;
return aSevStruct;
}
bool hasDescription(void) const
{
return hasDesc;
}
bool hasAlarmSeverityStruct(void) const
{
return hasAlarmSevStruct;
}
bool hasDescription(void) const
{
return hasDesc;
}
bool hasAlarmSeverityStruct(void) const
{
return hasAlarmSevStruct;
}
bool hasAlarmSeverity(void) const
{
if (aSevStruct.hhsv>SEV_NO_ALARM && aSevStruct.hhsv<=SEV_INVALID) {return true;}
else if (aSevStruct.hsv>SEV_NO_ALARM && aSevStruct.hsv<=SEV_INVALID) {return true;}
else if (aSevStruct.lsv>SEV_NO_ALARM && aSevStruct.lsv<=SEV_INVALID) {return true;}
else if (aSevStruct.llsv>SEV_NO_ALARM && aSevStruct.llsv<=SEV_INVALID) {return true;}
if (!hasAlarmSevStruct)
{
return false;
}
if (aSevStruct.hhsv>SEV_NO_ALARM && aSevStruct.hhsv<=SEV_INVALID)
{
return true;
}
else if (aSevStruct.hsv>SEV_NO_ALARM && aSevStruct.hsv<=SEV_INVALID)
{
return true;
}
else if (aSevStruct.lsv>SEV_NO_ALARM && aSevStruct.lsv<=SEV_INVALID)
{
return true;
}
else if (aSevStruct.llsv>SEV_NO_ALARM && aSevStruct.llsv<=SEV_INVALID)
{
return true;
}
return false;
}
std::string getAlarmStatusAsString(void) const
{
if (alarmStatus>-1 && alarmStatus<ALARM_STATUS_STRING_LENGTH) {
if (alarmStatus>-1 && alarmStatus<ALARM_STATUS_STRING_LENGTH)
{
return (std::string) epicsAlarmConditionStrings[alarmStatus];
}
else {
else
{
std::cout << "alarmStatusValue=" << alarmStatus << " is not within the valid range of 0-3!" << std::endl;
return (std::string) "ALARM_UNKNOWN";
}
}
std::string getAlarmSeverityAsString(void) const
{
if (alarmSeverity>-1 && alarmSeverity<ALARM_SEVERITY_STRING_LENGTH) {
if (alarmSeverity>-1 && alarmSeverity<ALARM_SEVERITY_STRING_LENGTH)
{
return (std::string) epicsAlarmSeverityStrings[alarmSeverity];
}
else {
else
{
std::cout << "alarmStatusSeverity=" << alarmSeverity << " is not within the valid range of 0-21!" << std::endl;
return (std::string) "SEVERITY_UNKNOWN";
}
@@ -411,6 +504,7 @@ public:
return beamEventNo;
};
/*
PVDataHolder getPVDataFromPulseID(unsigned long long globalPulseID) const {
PVDataHolder pvd;
@@ -519,18 +613,20 @@ public:
int getPVDataHolder(PVDataHolder &) const ;
int getPVCtrlHolder(PVCtrlHolder &) const ;
std::string getUnits(void) const {
std::string getUnits(void) const
{
PVCtrlHolder pvc;
getPVCtrlHolder(pvc);
return pvc.getUnitsAsString();
return pvc.getUnitsAsString();
};
short getPrecision(void) const {
short getPrecision(void) const
{
PVCtrlHolder pvc;
getPVCtrlHolder(pvc);
return pvc.getPrecision();
return pvc.getPrecision();
};
//bool getRule(void) const {return rule;};
@@ -621,10 +717,40 @@ public:
//ChannelRequestMetaDataRepository getChannelRequestMetaPrimitiveRepository(void) const {return channelRequestMetaPrimitiveRepository;}; //1
////MonitorPolicy getMonitorPolicy(void) const {return mpBase;};
MonitorPolicy getMonitorPolicy(unsigned int monitor_id) const
{
bool mpidFound=false;
//Iterate
for (size_t i=0; i< mpV.size(); ++i)
{
if ( mpV[i].getID() == monitor_id)
{
mpidFound=true;
return mpV[i];
}
}
if (!mpidFound)
{
std::cout << __FILE__ << "//" << __LINE__ << std::endl;
std::cout << "getMonitorPolicyVector(monitor_id): " << monitor_id << " NOT FOUND! " << std::endl;
std::cout << "Could not modify entry!" << std::endl;
}
MonitorPolicy mp;
return mp;
};
std::vector<MonitorPolicy> getMonitorPolicyVector(void) const
{
return mpV;
};
std::vector<MonitorPolicy> getMonitorPolicyInWaitingVector(void) const
{
return mpInWaitingV;
@@ -634,6 +760,12 @@ public:
{
return monitorAction;
};
std::vector<void *> getWidgetV(void) const
{
return std::vector<void *>(widgetV);
};
bool getHasNewData(void) const
{
return hasNewData;

View File

@@ -15,34 +15,39 @@
/**
* Friend to Conduit/CAFEGroup records the connection_handler_args struct from callback fns
* in hash table
* Function is not invoked on closechannel by user
*/
struct change_connectionHandlerArgs {
struct change_connectionHandlerArgs
{
#define __METHOD__ "change_connectionHandlerArgs"
change_connectionHandlerArgs (const struct connection_handler_args & new_connectionHandlerArgs):
new_connectionHandlerArgs(new_connectionHandlerArgs) {}
void operator() (Conduit& c)
{
chtype nativeDataType = ca_field_type(new_connectionHandlerArgs.chid);
//c.connectionHandlerArgs = new_connectionHandlerArgs;
c.channelRegalia.connectionState=new_connectionHandlerArgs.op;
// Data type code will be one of DBF_. The constant TYPENOTCONN=-1 is
// returned if the channel is not connected
// but we do not overwrite it upon disconnect.
//std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
//std::cout << new_connectionHandlerArgs.op << std::endl;
//connectFlag
if (new_connectionHandlerArgs.op == CA_OP_CONN_UP) {
if (new_connectionHandlerArgs.op == CA_OP_CONN_UP)
{
//std::cout << " change_connectionHandlerArgs: bytesize UP " << c.channelRequestMetaData.byteSize << std::endl;
//channelRegalia
c.channelRegalia.nelem = ca_element_count(new_connectionHandlerArgs.chid);
c.channelRegalia.connectFlag = true;
c.channelRegalia.hostName = (const char *) ca_host_name (new_connectionHandlerArgs.chid);
c.channelRegalia.hostName = (const char *) ca_host_name (new_connectionHandlerArgs.chid);
if (c.channelRegalia.channelID != new_connectionHandlerArgs.chid) {
if (c.channelRegalia.channelID != new_connectionHandlerArgs.chid)
{
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
std::cout << "Internal CAFE WARNING for handle : " << c.handle << std::endl;
std::cout << "Channel ID has changed from " << c.channelRegalia.channelID
@@ -65,7 +70,8 @@ struct change_connectionHandlerArgs {
// Check if c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN or not!
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN )
{
c.channelRequestMetaDataClient.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaDataClient.nelem = c.channelRegalia.nelem;
c.channelRequestMetaDataClient.nelemCache = c.channelRegalia.nelem;
@@ -73,7 +79,8 @@ struct change_connectionHandlerArgs {
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
//but will be overwritten by whatever the client needs
switch (c.channelRequestMetaDataClient.cafeDbrType) {
switch (c.channelRequestMetaDataClient.cafeDbrType)
{
case CAFENUM::DBR_TIME:
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
break;
@@ -104,7 +111,8 @@ struct change_connectionHandlerArgs {
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
//cafeDbrType can only be overwritten by an explicit method invocation
switch (c.channelRequestMetaData.cafeDbrType) {
switch (c.channelRequestMetaData.cafeDbrType)
{
case CAFENUM::DBR_TIME:
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
break;
@@ -127,16 +135,19 @@ struct change_connectionHandlerArgs {
//No of elements for Ctrl Buffers
unsigned int nelem_ctrl_buffer=1;
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_CTRL_BUFFER) {
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_CTRL_BUFFER)
{
nelem_ctrl_buffer = DEFAULT_NELEM_FOR_CTRL_BUFFER;
}
else {
else
{
nelem_ctrl_buffer = c.channelRegalia.nelem;
}
//ctrl data CLIENT
//Ctrl data requested by Client
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN )
{
c.channelRequestMetaCtrlClient.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaCtrlClient.nelem = c.channelRegalia.nelem; //nelem_ctrl_buffer;
c.channelRequestMetaCtrlClient.nelemCache = c.channelRegalia.nelem;
@@ -144,7 +155,8 @@ struct change_connectionHandlerArgs {
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
//but will be overwritten by whatever the client needs
switch (c.channelRequestMetaCtrlClient.cafeDbrType) {
switch (c.channelRequestMetaCtrlClient.cafeDbrType)
{
case CAFENUM::DBR_CTRL:
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
break;
@@ -168,7 +180,8 @@ struct change_connectionHandlerArgs {
c.channelRequestMetaCtrl.dataType = nativeDataType;
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
//cafeDbrType can only be overwritten by an explicit method invocation
switch (c.channelRequestMetaCtrl.cafeDbrType) {
switch (c.channelRequestMetaCtrl.cafeDbrType)
{
case CAFENUM::DBR_CTRL:
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
break;
@@ -186,10 +199,12 @@ struct change_connectionHandlerArgs {
//No of elements for STSACK Buffers
unsigned int nelem_stsack_buffer;
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_STSACK_BUFFER) {
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_STSACK_BUFFER)
{
nelem_stsack_buffer = DEFAULT_NELEM_FOR_STSACK_BUFFER;
}
else {
else
{
nelem_stsack_buffer = c.channelRegalia.nelem;
}
@@ -213,7 +228,8 @@ struct change_connectionHandlerArgs {
///////////////////////////////////////////////////////////////////////////
if ( c.channelRegalia.nelem>1) {
if ( c.channelRegalia.nelem>1)
{
double tout= ((unsigned int) (c.channelRegalia.nelem*0.000001)); // 1 sec per million
c.channelRequestDataTypePolicy.setRequestKind(CAFENUM::LOWEST_DATATYPE);
c.channelTimeoutPolicyGet.setTimeout(std::max(DEFAULT_TIMEOUT_PEND_IO_WF, tout));
@@ -225,7 +241,8 @@ struct change_connectionHandlerArgs {
c.channelRegalia.cafeConnectionState = ICAFE_CS_CONN;
c.status = ICAFE_CA_OP_CONN_UP;
}
else {
else
{
//nativeType not known on disconnect!!
@@ -234,7 +251,7 @@ struct change_connectionHandlerArgs {
c.channelRequestStatusPut.setCallbackKind(false, true); //fake completion
c.channelRegalia.cafeConnectionState =ICAFE_CS_DISCONN;
c.channelRegalia.connectFlag = false;
c.status = ICAFE_CA_OP_CONN_DOWN;
c.status = ICAFE_CA_OP_CONN_DOWN;
}
@@ -251,7 +268,8 @@ private:
* Friend to Conduit/CAFEGroup permitting fast modification to the ctrlBuffer
* This is the ctrlBuffer for _CTRL data requested through ca_get
*/
struct change_dataBufferSize_CTRL {
struct change_dataBufferSize_CTRL
{
#define __METHOD__ "change_dataBufferSize_CTRL"
change_dataBufferSize_CTRL (const chtype & new_ctrlTypeBuffer): new_ctrlTypeBuffer(new_ctrlTypeBuffer) {}
@@ -263,11 +281,13 @@ struct change_dataBufferSize_CTRL {
bool allocateMemory=false ;
if(c.ctrlBuffer==NULL) {
if(c.ctrlBuffer==NULL)
{
allocateMemory=true;
}
else if ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) > c.channelRequestMetaCtrl.getByteSize() ) {
else if ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) > c.channelRequestMetaCtrl.getByteSize() )
{
std::cout << "ctrlBuffer already exists= " << c.ctrlBuffer << " for channel " << c.pv
<< " with handle " << c.handle << std::endl;
std::cout << "Freeing and reallocating ctrlBuffer" << std::endl;
@@ -275,14 +295,16 @@ struct change_dataBufferSize_CTRL {
allocateMemory=true;
}
if (allocateMemory) {
if (allocateMemory)
{
//std::cout << "sizeof c.ctrlBuffer " << dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) << std::endl;
c.ctrlBuffer = (db_access_val *) malloc ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) );
c.channelRequestMetaCtrl.byteSize=dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem());
}
if (c.ctrlBuffer==0) {
if (c.ctrlBuffer==0)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
@@ -300,7 +322,8 @@ private:
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the dataBuffer of type DBR (putBuffer)
* This is used in ca_put methods when input data that is not already in native data type is thus converted
*/
struct change_dataBufferSize_PRIMITIVE {
struct change_dataBufferSize_PRIMITIVE
{
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
change_dataBufferSize_PRIMITIVE (const chtype & new_dataTypeBufferNative): new_dataTypeBufferNative(new_dataTypeBufferNative) {}
@@ -309,12 +332,14 @@ struct change_dataBufferSize_PRIMITIVE {
bool allocateMemory=false ;
if(c.putBuffer==NULL) {
if(c.putBuffer==NULL)
{
allocateMemory=true;
}
else if ( dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
c.channelRequestMetaPrimitive.getNelem())
> c.channelRequestMetaPrimitive.getByteSize() ) {
> c.channelRequestMetaPrimitive.getByteSize() )
{
std::cout << "putBuffer already exists= " << c.putBuffer << " for channel " << c.pv
<< " with handle " << c.handle << std::endl;
std::cout << "Freeing and reallocating putBuffer" << std::endl;
@@ -322,7 +347,8 @@ struct change_dataBufferSize_PRIMITIVE {
allocateMemory=true;
}
if (allocateMemory) {
if (allocateMemory)
{
//std::cout << "sizeof c.putBuffer " << dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
// c.channelRequestMetaPrimitive.getNelem()) << std::endl;
c.putBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
@@ -333,7 +359,8 @@ struct change_dataBufferSize_PRIMITIVE {
c.channelRequestMetaPrimitive.getNelem());
}
if (c.putBuffer==0) {
if (c.putBuffer==0)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
@@ -353,7 +380,8 @@ private:
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the ctrlBuffer
* This is the ctrlBuffer for _CTRL data requested through ca_get
*/
struct change_dataBufferSize_STSACK {
struct change_dataBufferSize_STSACK
{
#define __METHOD__ "change_dataBufferSize_STSACK"
change_dataBufferSize_STSACK () {}
@@ -362,14 +390,16 @@ struct change_dataBufferSize_STSACK {
bool allocateMemory=false ;
if(c.stsackBuffer==NULL) {
if(c.stsackBuffer==NULL)
{
allocateMemory=true;
}
else if ( dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
c.channelRequestMetaSTSACK.getNelem())
> c.channelRequestMetaSTSACK.getByteSize() ) {
> c.channelRequestMetaSTSACK.getByteSize() )
{
std::cout << "stsackBuffer already exists= " << c.stsackBuffer << " for channel " << c.pv
<< " with handle " << c.handle << std::endl;
std::cout << "Freeing and reallocating putBuffer" << std::endl;
@@ -377,7 +407,8 @@ struct change_dataBufferSize_STSACK {
allocateMemory=true;
}
if (allocateMemory) {
if (allocateMemory)
{
//std::cout << "sizeof c.stsackBuffer " << dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
// c.channelRequestMetaSTSACK.getNelem()) << std::endl;
c.stsackBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
@@ -397,7 +428,8 @@ struct change_dataBufferSize_STSACK {
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the dataBuffer of type DBR_TIME (dataBuffer)
* This is the main dataBuffer for data requested through ca_get
*/
struct change_dataBufferSize_TIME {
struct change_dataBufferSize_TIME
{
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
change_dataBufferSize_TIME (const chtype & new_dataTypeBuffer): new_dataTypeBuffer(new_dataTypeBuffer) {}
@@ -411,12 +443,14 @@ struct change_dataBufferSize_TIME {
bool allocateMemory=false ;
if(c.dataBuffer==NULL) {
if(c.dataBuffer==NULL)
{
allocateMemory=true;
}
else if ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) > c.channelRequestMetaData.getByteSize() ) {
else if ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) > c.channelRequestMetaData.getByteSize() )
{
std::cout << "dataBuffer already exists= " << c.dataBuffer << " for channel " << c.pv
<< " with handle " << c.handle << std::endl;
std::cout << "Freeing and reallocating dataBuffer" << std::endl;
@@ -428,14 +462,16 @@ struct change_dataBufferSize_TIME {
}
if (allocateMemory) {
if (allocateMemory)
{
//std::cout << "sizeof c.dataBuffer " << dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) << std::endl;
c.dataBuffer = (db_access_val *) malloc ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) );
c.channelRequestMetaData.byteSize=dbr_size_n(new_dataTypeBuffer,c.channelRequestMetaData.getNelem());
}
if (c.dataBuffer==NULL) {
if (c.dataBuffer==NULL)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
@@ -453,7 +489,8 @@ private:
/**
* Friend to CAFEConduit/CAFEGroup - releases resources
*/
struct free_dataBuffers {
struct free_dataBuffers
{
free_dataBuffers () {}
void operator() (Conduit& c)
@@ -461,19 +498,23 @@ struct free_dataBuffers {
//std::cout << "c.handle=" << c.handle << " " << c.pv << std::endl;
if(c.dataBuffer) {
if(c.dataBuffer)
{
free(c.dataBuffer); // _TIME data buffer for ca_get
}
if(c.ctrlBuffer) {
if(c.ctrlBuffer)
{
free(c.ctrlBuffer); // _CTRL data buffer for ca_get
}
if(c.stsackBuffer) {
if(c.stsackBuffer)
{
free(c.stsackBuffer); // _STSACK_STRING data buffer for ca_get
}
if(c.putBuffer) {
if(c.putBuffer)
{
free(c.putBuffer); // data buffer for ca_put
}

View File

@@ -17,19 +17,24 @@
* Friend to Conduit/CAFEGroup permitting the event_handler_args.dbr data from callback fn
* to be recorded in hash table
*/
struct change_eventHandlerArgs {
struct change_eventHandlerArgs
{
#define __METHOD__ "change_eventHandlerArgs"
change_eventHandlerArgs (const struct event_handler_args & new_eventHandlerArgs) :
new_eventHandlerArgs(new_eventHandlerArgs) {}
void operator() (Conduit& c)
{
//c.eventHandlerArgs = new_eventHandlerArgs;
c.status= new_eventHandlerArgs.status;
if(c.status!=ECA_NORMAL) return;
if(c.status!=ECA_NORMAL) {
std::cout << __METHOD__ << " STATUS IS " << c.status << std::endl;
std::cout << __METHOD__ << " return from method ***IS*** enforced " << std::endl;
return;
}
//std::cout << __METHOD__ << " STATUS IS " << c.status << std::endl;
Helper helper;
@@ -39,8 +44,6 @@ struct change_eventHandlerArgs {
//Let is do comparison!
CAFENUM::DBR_TYPE dbrTypeClass=helper.convertToCAFEDbrTypeClass(new_eventHandlerArgs.type);
c.usrArgs = new_eventHandlerArgs.usr;
c.dataType= requestedT;
c.dbrDataType= bufferType;
@@ -49,16 +52,20 @@ struct change_eventHandlerArgs {
c.hasNewData=true; //flag used by getMonitorAction for CAFE extensions!
if (new_eventHandlerArgs.type < DBR_GR_STRING) {
if (new_eventHandlerArgs.type < DBR_GR_STRING)
{
bufferType = dbf_type_to_DBR_TIME(requestedT);
}
else if (new_eventHandlerArgs.type < DBR_PUT_ACKT) {
else if (new_eventHandlerArgs.type < DBR_PUT_ACKT)
{
bufferType = dbf_type_to_DBR_CTRL(requestedT);
}
else if (new_eventHandlerArgs.type < (LAST_BUFFER_TYPE+1)) {
else if (new_eventHandlerArgs.type < (LAST_BUFFER_TYPE+1))
{
// keep default
}
else {
else
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
std::cout << "CAFE INTERNAL FUNNY: UNKNOWN event_handler_args.type= "
<< new_eventHandlerArgs.type << std::endl;
@@ -70,8 +77,8 @@ struct change_eventHandlerArgs {
unsigned int navailable = nrequired;
switch(dbrTypeClass) {
switch(dbrTypeClass)
{
case CAFENUM::DBR_STSACK:
navailable = c.channelRequestMetaSTSACK.byteSize;
c.channelRequestMetaSTSACK.nelem = new_eventHandlerArgs.count;
@@ -83,9 +90,7 @@ struct change_eventHandlerArgs {
case CAFENUM::DBR_PRIMITIVE:
case CAFENUM::DBR_STS:
case CAFENUM::DBR_TIME:
navailable = c.channelRequestMetaData.byteSize; //
navailable = c.channelRequestMetaData.byteSize;
c.channelRequestMetaData.nelem = new_eventHandlerArgs.count;
c.channelRequestMetaData.dataType = requestedT;
@@ -94,7 +99,8 @@ struct change_eventHandlerArgs {
c.channelRequestMetaData.usrArg = new_eventHandlerArgs.usr; //c.channelRequestMetaDataClient.usrArg;
//Do this check here already
if (nrequired > navailable) {
if (nrequired > navailable)
{
c.channelRequestMetaData.byteSize = nrequired;
}
@@ -107,7 +113,8 @@ struct change_eventHandlerArgs {
c.channelRequestMetaCtrl.dbrDataType = new_eventHandlerArgs.type;
c.channelRequestMetaCtrl.cafeDbrType = dbrTypeClass;
c.channelRequestMetaCtrl.usrArg = new_eventHandlerArgs.usr; //c.channelRequestMetaDataClient.usrArg;
if (nrequired > navailable) {
if (nrequired > navailable)
{
c.channelRequestMetaCtrl.byteSize = nrequired;
}
break;
@@ -122,9 +129,8 @@ struct change_eventHandlerArgs {
}
if (nrequired > navailable) {
if (nrequired > navailable)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
std::cout << "CHANGE OF BUFFER SIZE: FROM " << navailable << " bytes TO " << nrequired << " bytes" << std::endl;
@@ -133,13 +139,16 @@ struct change_eventHandlerArgs {
<< " type=" << dbr_type_to_text(new_eventHandlerArgs.type) << std::endl;
//check DataBuffers
switch(dbrTypeClass) {
switch(dbrTypeClass)
{
case CAFENUM::DBR_STSACK: //value is of type dbr_string_t
if (c.stsackBuffer!=NULL) {
if (c.stsackBuffer!=NULL)
{
free(c.stsackBuffer);
}
else {
else
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
std::cout << "CAFE INTERNAL FUNNY: HOW CAN stsackBuffer NOT ALREADY EXIST?" << std::endl;
std::cout << "CREATING stsackBuffer " << std::endl;
@@ -148,7 +157,8 @@ struct change_eventHandlerArgs {
c.stsackBuffer = (db_access_val *) malloc (nrequired);
if (c.stsackBuffer==NULL) {
if (c.stsackBuffer==NULL)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
@@ -166,7 +176,8 @@ struct change_eventHandlerArgs {
case CAFENUM::DBR_TIME:
// Check that buffer is large enough! Do not expect this part ever to be invoked
if (c.dataBuffer != NULL) {
if (c.dataBuffer != NULL)
{
// Only re-allocate buffer if the number of native elements has increased without the
// the callback function first being called. i.e. nelemNative was changed on the fly!
@@ -174,7 +185,8 @@ struct change_eventHandlerArgs {
free(c.dataBuffer);
}
else {
else
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
std::cout << "CAFE INTERNAL FUNNY: HOW CAN dataBuffer NOT ALREADY EXIST?" << std::endl;
std::cout << "CREATING dataBuffer " << std::endl;
@@ -182,7 +194,8 @@ struct change_eventHandlerArgs {
c.dataBuffer = (db_access_val *) malloc (nrequired);
if (c.dataBuffer==NULL) {
if (c.dataBuffer==NULL)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
@@ -196,7 +209,8 @@ struct change_eventHandlerArgs {
case CAFENUM::DBR_CTRL:
// Check that buffer is large enough! Do not expect this part ever to be invoked
if (c.ctrlBuffer != NULL) {
if (c.ctrlBuffer != NULL)
{
// Only re-allocate buffer if the number of native elements has increased without the
// the callback function first being called. i.e. nelemNative was changed on the fly!
@@ -204,7 +218,8 @@ struct change_eventHandlerArgs {
free(c.ctrlBuffer);
}
else {
else
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
std::cout << "CAFE INTERNAL FUNNY: HOW CAN dataBuffer NOT ALREADY EXIST?" << std::endl;
std::cout << "CREATING dataBuffer " << std::endl;
@@ -212,7 +227,8 @@ struct change_eventHandlerArgs {
c.ctrlBuffer = (db_access_val *) malloc (nrequired);
if (c.ctrlBuffer==NULL) {
if (c.ctrlBuffer==NULL)
{
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
@@ -234,13 +250,18 @@ struct change_eventHandlerArgs {
} // if new buffer size required
if (new_eventHandlerArgs.count > 0) {
if ((unsigned int) new_eventHandlerArgs.count > c.channelRegalia.nelem) {
if (new_eventHandlerArgs.count > 0)
{
if ((unsigned int) new_eventHandlerArgs.count > c.channelRegalia.nelem)
{
c.channelRegalia.nelem = (unsigned int) new_eventHandlerArgs.count;
}
}
switch(dbrTypeClass) {
switch(dbrTypeClass)
{
case CAFENUM::DBR_PRIMITIVE:
//c.hasAlarmStatus =false;
//c.hasAlarmSeverity=false;
@@ -300,10 +321,12 @@ struct change_eventHandlerArgs {
//Now fill buffers
switch(new_eventHandlerArgs.type) {
switch(new_eventHandlerArgs.type)
{
case DBR_DOUBLE: //6
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->doubleval)+i))
= (*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->doubleval)+i));
}
@@ -312,7 +335,8 @@ struct change_eventHandlerArgs {
case DBR_FLOAT: // 2
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->fltval)+i))
= (dbr_float_t) (*(&( ( (union db_access_val *) new_eventHandlerArgs.dbr)->fltval)+i));
}
@@ -322,7 +346,8 @@ struct change_eventHandlerArgs {
case DBR_LONG: // 5
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->longval)+i))
= (*(&(( (union db_access_val *) new_eventHandlerArgs.dbr)->longval)+i));
}
@@ -330,7 +355,8 @@ struct change_eventHandlerArgs {
case DBR_SHORT: // 1
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->shrtval)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->shrtval)+i));
}
@@ -338,7 +364,8 @@ struct change_eventHandlerArgs {
case DBR_STRING: // 0
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
strcpy ((*(&((c.dataBuffer)->strval)+i)),
(*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->strval)+i)) );
}
@@ -346,7 +373,8 @@ struct change_eventHandlerArgs {
case DBR_ENUM: // 3
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->enmval)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->enmval)+i));
}
@@ -354,7 +382,8 @@ struct change_eventHandlerArgs {
case DBR_CHAR: // 4
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->charval)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->charval)+i));
}
@@ -363,7 +392,8 @@ struct change_eventHandlerArgs {
case DBR_STS_DOUBLE: // 13
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->sdblval.value)+i))
= (*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->sdblval.value)+i));
}
@@ -377,7 +407,8 @@ struct change_eventHandlerArgs {
case DBR_STS_FLOAT: // 9
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->sfltval.value)+i))
= (dbr_float_t) (*(&( ( (union db_access_val *) new_eventHandlerArgs.dbr)->sfltval.value)+i));
}
@@ -392,7 +423,8 @@ struct change_eventHandlerArgs {
case DBR_STS_LONG: // 12
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->slngval.value)+i))
= (*(&(( (union db_access_val *) new_eventHandlerArgs.dbr)->slngval.value)+i));
}
@@ -407,7 +439,8 @@ struct change_eventHandlerArgs {
case DBR_STS_SHORT: // 8
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->sshrtval.value)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->sshrtval.value)+i));
}
@@ -420,7 +453,8 @@ struct change_eventHandlerArgs {
case DBR_STS_STRING: // 7
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
strcpy ((*(&((c.dataBuffer)->sstrval.value)+i)),
(*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->sstrval.value)+i)) );
}
@@ -434,7 +468,8 @@ struct change_eventHandlerArgs {
case DBR_STS_ENUM: // 10
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->senmval.value)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->senmval.value)+i));
}
@@ -448,7 +483,8 @@ struct change_eventHandlerArgs {
case DBR_STS_CHAR: // 11
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->schrval.value)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->schrval.value)+i));
}
@@ -463,7 +499,8 @@ struct change_eventHandlerArgs {
case DBR_TIME_DOUBLE: // 20
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->tdblval.value)+i))
= (*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->tdblval.value)+i));
}
@@ -481,7 +518,8 @@ struct change_eventHandlerArgs {
case DBR_TIME_FLOAT: //16
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->tfltval.value)+i))
= (dbr_float_t) (*(&( ( (union db_access_val *) new_eventHandlerArgs.dbr)->tfltval.value)+i));
@@ -501,7 +539,8 @@ struct change_eventHandlerArgs {
case DBR_TIME_LONG: //19
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->tlngval.value)+i))
= (*(&(( (union db_access_val *) new_eventHandlerArgs.dbr)->tlngval.value)+i));
}
@@ -516,7 +555,8 @@ struct change_eventHandlerArgs {
break;
case DBR_TIME_SHORT:
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->tshrtval.value)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tshrtval.value)+i));
}
@@ -533,7 +573,8 @@ struct change_eventHandlerArgs {
case DBR_TIME_STRING: //14
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
strcpy ((*(&((c.dataBuffer)->tstrval.value)+i)),
(*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tstrval.value)+i)) );
}
@@ -551,7 +592,8 @@ struct change_eventHandlerArgs {
case DBR_TIME_ENUM: //17
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->tenmval.value)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tenmval.value)+i));
}
@@ -569,7 +611,8 @@ struct change_eventHandlerArgs {
case DBR_TIME_CHAR: //18
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.dataBuffer)->tchrval.value)+i))
= (*(&(((union db_access_val *) new_eventHandlerArgs.dbr)->tchrval.value)+i));
@@ -585,7 +628,8 @@ struct change_eventHandlerArgs {
case DBR_CTRL_DOUBLE: //34
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->cdblval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cdblval.value)+i));
}
@@ -598,9 +642,16 @@ struct change_eventHandlerArgs {
((struct dbr_ctrl_double *) new_eventHandlerArgs.dbr)->precision;
(*(&((c.ctrlBuffer)->cdblval.RISC_pad0))) =
(dbr_short_t) ((struct dbr_ctrl_double *) new_eventHandlerArgs.dbr)->RISC_pad0; //dbr_short_t
//std::cout << __METHOD__ << __LINE__ << std::endl;
//std::cout << ((struct dbr_ctrl_double *) new_eventHandlerArgs.dbr)->units << std::endl;
memcpy((*(&((c.ctrlBuffer)->cdblval.units))),
&(((struct dbr_ctrl_double *) new_eventHandlerArgs.dbr)->units),
sizeof(char[MAX_UNITS_SIZE]));
sizeof( char[MAX_UNITS_SIZE])); // (((struct dbr_ctrl_double *) new_eventHandlerArgs.dbr)->units) ));
(*(&((c.ctrlBuffer)->cdblval.upper_disp_limit))) =
((struct dbr_ctrl_double *) new_eventHandlerArgs.dbr)->upper_disp_limit;
(*(&((c.ctrlBuffer)->cdblval.lower_disp_limit))) =
@@ -622,7 +673,8 @@ struct change_eventHandlerArgs {
case DBR_CTRL_LONG: //33
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->clngval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->clngval.value)+i));
}
@@ -663,7 +715,8 @@ struct change_eventHandlerArgs {
case DBR_CTRL_CHAR: //32
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->gchrval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cchrval.value)+i));
}
@@ -704,7 +757,8 @@ struct change_eventHandlerArgs {
case DBR_CTRL_ENUM: //31
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->cenmval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cenmval.value)+i));
}
@@ -738,7 +792,8 @@ struct change_eventHandlerArgs {
case DBR_CTRL_FLOAT: //30
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->cfltval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cfltval.value)+i));
}
@@ -784,7 +839,8 @@ struct change_eventHandlerArgs {
case DBR_CTRL_SHORT: //29
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->gshrtval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cshrtval.value)+i));
}
@@ -826,7 +882,9 @@ struct change_eventHandlerArgs {
case DBR_CTRL_STRING: //28
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
strcpy( (*(&((c.ctrlBuffer)->cstrval.value)+i)),
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->cstrval.value)+i)));
}
@@ -839,11 +897,13 @@ struct change_eventHandlerArgs {
//c.alarmStatus =((struct dbr_sts_string *) new_eventHandlerArgs.dbr)->status;
//c.alarmSeverity=((struct dbr_sts_string *) new_eventHandlerArgs.dbr)->severity;
break;
case DBR_GR_DOUBLE: //27
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->gdblval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gdblval.value)+i));
}
@@ -883,7 +943,8 @@ struct change_eventHandlerArgs {
case DBR_GR_LONG: //26
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->glngval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->glngval.value)+i));
}
@@ -920,7 +981,8 @@ struct change_eventHandlerArgs {
case DBR_GR_CHAR: //25
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->gchrval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gchrval.value)+i));
}
@@ -957,7 +1019,8 @@ struct change_eventHandlerArgs {
case DBR_GR_ENUM: //24
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->genmval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->genmval.value)+i));
}
@@ -992,7 +1055,8 @@ struct change_eventHandlerArgs {
case DBR_GR_FLOAT: //23
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->gfltval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gfltval.value)+i));
}
@@ -1034,7 +1098,8 @@ struct change_eventHandlerArgs {
case DBR_GR_SHORT: //22
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
(*(&((c.ctrlBuffer)->gshrtval.value)+i)) =
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gshrtval.value)+i));
}
@@ -1071,7 +1136,8 @@ struct change_eventHandlerArgs {
case DBR_GR_STRING: //21
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
strcpy( (*(&((c.ctrlBuffer)->gstrval.value)+i)),
(*(&( ((union db_access_val *) new_eventHandlerArgs.dbr)->gstrval.value)+i)));
}
@@ -1102,7 +1168,8 @@ struct change_eventHandlerArgs {
// (*(&(((struct dbr_stsack_string *) new_eventHandlerArgs.dbr)->value)+0))
// << std::endl;
for (long i=0; i<new_eventHandlerArgs.count; ++i) {
for (long i=0; i<new_eventHandlerArgs.count; ++i)
{
strcpy ((*(&((c.stsackBuffer)->sastrval.value)+i)),
(*(&(((struct dbr_stsack_string *) new_eventHandlerArgs.dbr)->value)+i)) );
//std::cout << " VAL " << (*(&((c.stsackBuffer)->sastrval.value)+i)) << " [" << i << "] ";
@@ -1169,7 +1236,8 @@ struct change_eventHandlerArgs {
//Do this to prevent overflow error in epicsTime time(ts) routines!
//This bad number can occur in timeouts
if(c.ts.nsec>1000000000) {
if(c.ts.nsec>1000000000)
{
c.ts.nsec=0;
}

View File

@@ -15,7 +15,8 @@
/**
* Friend to Conduit/CAFEGroup permitting fast modification to STS recorded in hash table
*/
struct change_alarmStatus {
struct change_alarmStatus
{
change_alarmStatus (const dbr_short_t & new_alarmStatus): new_alarmStatus(new_alarmStatus) {}
void operator() (Conduit& c)
@@ -28,7 +29,8 @@ struct change_alarmStatus {
private:
dbr_short_t new_alarmStatus;
};
struct change_alarmSeverity {
struct change_alarmSeverity
{
change_alarmSeverity (const dbr_short_t & new_alarmSeverity): new_alarmSeverity(new_alarmSeverity) {}
void operator() (Conduit& c)
@@ -41,7 +43,8 @@ struct change_alarmSeverity {
private:
dbr_short_t new_alarmSeverity;
};
struct change_epicsTimeStamp {
struct change_epicsTimeStamp
{
change_epicsTimeStamp (const epicsTimeStamp & new_epicsTimeStamp): new_epicsTimeStamp(new_epicsTimeStamp) {}
void operator() (Conduit& c)
@@ -50,7 +53,8 @@ struct change_epicsTimeStamp {
c.ts = new_epicsTimeStamp;
//Do this to prevent overflow error in epicsTime time(ts) routines!
//This bad number can occur in timeouts
if(c.ts.nsec>1000000000) {
if(c.ts.nsec>1000000000)
{
c.ts.nsec=0;
}
///////////////////////////////////////////////////////////////////////////
@@ -64,7 +68,8 @@ private:
/**
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
*/
struct change_accessRead {
struct change_accessRead
{
change_accessRead (const unsigned int & new_accessRead): new_accessRead(new_accessRead) {}
void operator() (Conduit& c)
@@ -82,7 +87,8 @@ private:
/**
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
*/
struct change_accessWrite {
struct change_accessWrite
{
change_accessWrite (const unsigned int & new_accessWrite): new_accessWrite(new_accessWrite) {}
void operator() (Conduit& c)
@@ -101,7 +107,8 @@ private:
* Friend toConduit/CAFEGroup permitting the access_rights_handler_args struct from callback fns
* to be recorded in hash table
*/
struct change_accessRightsHandlerArgs {
struct change_accessRightsHandlerArgs
{
change_accessRightsHandlerArgs (const struct access_rights_handler_args & new_accessRightsHandlerArgs):
new_accessRightsHandlerArgs(new_accessRightsHandlerArgs) {}
@@ -111,6 +118,8 @@ struct change_accessRightsHandlerArgs {
///////////////////////////////////////////////////////////////////////////
c.channelRegalia.accessRead = new_accessRightsHandlerArgs.ar.read_access;
c.channelRegalia.accessWrite= new_accessRightsHandlerArgs.ar.write_access;
//std::cout << "change_accessRightsHandlerArgs " << new_accessRightsHandlerArgs.ar.read_access << new_accessRightsHandlerArgs.ar.write_access << std:: endl;
//std::cout << "change_accessRightsHandlerArgs " << c.channelRegalia.accessRead << c.channelRegalia.accessWrite << std:: endl;
///////////////////////////////////////////////////////////////////////////
}
@@ -122,7 +131,8 @@ private:
/**
* Friend to Conduit permitting pulse_id f to be set in hash table
*/
struct change_beamEventNo {
struct change_beamEventNo
{
change_beamEventNo (const unsigned long long & new_beamEventNo): new_beamEventNo(new_beamEventNo) {}
void operator() (Conduit& c)
@@ -134,10 +144,14 @@ private:
unsigned long long new_beamEventNo;
};
/**
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
*/
struct change_channelDeviceAttribute {
struct change_channelDeviceAttribute
{
change_channelDeviceAttribute (const ChannelDeviceAttribute & new_channelDeviceAttribute):
new_channelDeviceAttribute(new_channelDeviceAttribute) {}
@@ -155,7 +169,8 @@ private:
/**
* Friend to Conduit/CAFEGroup records the channelID in hash table
*/
struct change_channelID {
struct change_channelID
{
change_channelID (const chid & new_channelID): new_channelID(new_channelID) {}
void operator() (Conduit& c)
@@ -173,7 +188,8 @@ private:
/**
* Friend to Conduit records the channelGetActionWhenMonitorPolicy in hash table
*/
struct change_channelGetActionWhenMonitorPolicy {
struct change_channelGetActionWhenMonitorPolicy
{
change_channelGetActionWhenMonitorPolicy (
const ChannelGetActionWhenMonitorPolicy & new_channelGetActionWhenMonitorPolicy):
new_channelGetActionWhenMonitorPolicy(new_channelGetActionWhenMonitorPolicy) {}
@@ -191,7 +207,8 @@ private:
/**
* Friend to Conduit records the channelGetCacheWaitPolicy in hash table
*/
struct change_channelGetCacheWaitPolicy {
struct change_channelGetCacheWaitPolicy
{
change_channelGetCacheWaitPolicy (
const ChannelGetCacheWaitPolicy & new_channelGetCacheWaitPolicy):
new_channelGetCacheWaitPolicy(new_channelGetCacheWaitPolicy) {}
@@ -212,7 +229,8 @@ private:
/**
* Friend to Conduit permitting hasNewData flag to be set in hash table
*/
struct change_hasNewData {
struct change_hasNewData
{
change_hasNewData (const bool & new_hasNewData): new_hasNewData(new_hasNewData) {}
void operator() (Conduit& c)
@@ -229,7 +247,8 @@ private:
/**
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
*/
struct change_channelRegalia {
struct change_channelRegalia
{
change_channelRegalia (const ChannelRegalia & new_channelRegalia): new_channelRegalia(new_channelRegalia) {}
void operator() (Conduit& c)
@@ -245,7 +264,8 @@ private:
/**
* Friend to Conduit records the channelRequestDataTypePolicy in hash table
*/
struct change_channelRequestDataTypePolicy {
struct change_channelRequestDataTypePolicy
{
change_channelRequestDataTypePolicy (
const ChannelRequestDataTypePolicy & new_channelRequestDataTypePolicy):
new_channelRequestDataTypePolicy(new_channelRequestDataTypePolicy) {}
@@ -264,7 +284,8 @@ private:
/**
* Friend to Conduit records the channelRequestMetaCtrl in hash table
*/
struct change_channelRequestMetaCtrl {
struct change_channelRequestMetaCtrl
{
change_channelRequestMetaCtrl (const ChannelRequestMetaData & new_channelData):
new_channelData(new_channelData) {}
@@ -282,7 +303,8 @@ private:
/**
* Friend to Conduit records the channelRequestMetaCtrlClient in hash table
*/
struct change_channelRequestMetaCtrlClient {
struct change_channelRequestMetaCtrlClient
{
change_channelRequestMetaCtrlClient (const ChannelRequestMetaDataClient & new_channelData):
new_channelData(new_channelData) {}
@@ -303,7 +325,8 @@ private:
/**
* Friend to Conduit records the channelRequestMetaData in hash table
*/
struct change_channelRequestMetaData {
struct change_channelRequestMetaData
{
change_channelRequestMetaData (const ChannelRequestMetaData & new_channelData):
new_channelData(new_channelData) {}
@@ -324,7 +347,8 @@ private:
/**
* Friend to Conduit records the channelRequestMetaDataClient in hash table
*/
struct change_channelRequestMetaDataClient {
struct change_channelRequestMetaDataClient
{
change_channelRequestMetaDataClient (const ChannelRequestMetaDataClient & new_channelData):
new_channelData(new_channelData) {}
@@ -343,7 +367,8 @@ private:
/**
* Friend to Conduit records the channelRequestMetaPrimitive in hash table
*/
struct change_channelRequestMetaPrimitive {
struct change_channelRequestMetaPrimitive
{
change_channelRequestMetaPrimitive (const ChannelRequestMetaData & new_channelData):
new_channelData(new_channelData) {}
@@ -360,7 +385,8 @@ private:
/**
* Friend to Conduit records the channelRequestPolicyGet in hash table
*/
struct change_channelRequestPolicyGet {
struct change_channelRequestPolicyGet
{
change_channelRequestPolicyGet (const ChannelRequestPolicy & new_ChannelRequestPolicy):
new_ChannelRequestPolicy(new_ChannelRequestPolicy) {}
@@ -377,7 +403,8 @@ private:
/**
* Friend to Conduit records the channelRequestPolicyGetCtrl in hash table
*/
struct change_channelRequestPolicyGetCtrl {
struct change_channelRequestPolicyGetCtrl
{
change_channelRequestPolicyGetCtrl (const ChannelRequestPolicy & new_ChannelRequestPolicy):
new_ChannelRequestPolicy(new_ChannelRequestPolicy) {}
@@ -395,7 +422,8 @@ private:
/**
* Friend to Conduit records the channelRequestPolicyPut in hash table
*/
struct change_channelRequestPolicyPut {
struct change_channelRequestPolicyPut
{
change_channelRequestPolicyPut (const ChannelRequestPolicy & new_ChannelRequestPolicy):
new_ChannelRequestPolicy(new_ChannelRequestPolicy) {}
@@ -414,7 +442,8 @@ private:
/**
* Friend to Conduit records the channelRequestStatusGet in hash table
*/
struct change_channelRequestStatusGet {
struct change_channelRequestStatusGet
{
change_channelRequestStatusGet (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
@@ -434,7 +463,8 @@ private:
/**
* Friend to Conduit records the channelRequestStatusGetCtrl in hash table
*/
struct change_channelRequestStatusGetCtrl {
struct change_channelRequestStatusGetCtrl
{
change_channelRequestStatusGetCtrl (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
@@ -451,7 +481,8 @@ private:
/**
* Friend to Conduit records the channelRequestStatusGetSTSACK in hash table
*/
struct change_channelRequestStatusGetSTSACK {
struct change_channelRequestStatusGetSTSACK
{
change_channelRequestStatusGetSTSACK (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
@@ -469,7 +500,8 @@ private:
/**
* Friend to Conduit records the channelRequestStatusGetClassName in hash table
*/
struct change_channelRequestStatusGetClassName {
struct change_channelRequestStatusGetClassName
{
change_channelRequestStatusGetClassName (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
@@ -486,7 +518,8 @@ private:
/**
* Friend to Conduit records the channelRequestStatusPut in hash table
*/
struct change_channelRequestStatusPut {
struct change_channelRequestStatusPut
{
change_channelRequestStatusPut (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus) {}
@@ -505,7 +538,8 @@ private:
/**
* Friend to Conduit records the channelTimeoutPolicyGet in hash table
*/
struct change_channelTimeoutPolicyGet {
struct change_channelTimeoutPolicyGet
{
change_channelTimeoutPolicyGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
@@ -522,7 +556,8 @@ private:
/**
* Friend to Conduit records the channelTimeoutPolicyPut in hash table
*/
struct change_channelTimeoutPolicyPut {
struct change_channelTimeoutPolicyPut
{
change_channelTimeoutPolicyPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
@@ -540,31 +575,31 @@ private:
/**
* Friend to Conduit permitting pvdata to be entered in queue
*/
struct change_dequePulseID {
struct change_dequePulseID
{
change_dequePulseID (const PVDataHolder & new_pvd): new_pvd(new_pvd) {}
void operator() (Conduit& c)
{
try {
try
{
c.dequePulseID.push_back(new_pvd);
if (c.dequePulseID.size() > c.mapPulseIDBufferSize) {
if (c.dequePulseID.size() > c.mapPulseIDBufferSize)
{
c.dequePulseID.pop_front();
}
}
catch (std::bad_alloc &e) {
catch (std::bad_alloc &e)
{
std::cout << "change_dequeuPulseID" << " //" << e.what() << std:: endl;
std::cout << "Critical error in change_dequeuPulseID. Force Exit" << std::endl;
std::cout << e.what() << std:: endl;
exit(1);
}
}
private:
@@ -576,36 +611,41 @@ private:
/**
* Friend to Conduit permitting pulse_id/pvdata to be set in hash table
*/
struct change_mapPulseID {
struct change_mapPulseID
{
change_mapPulseID (const PVDataHolder & new_pvd): new_pvd(new_pvd) {}
void operator() (Conduit& c)
{
try {
try
{
//std::pair<unsigned long long, PVDataHolder> p = std::make_pair(new_pvd.getPulseID(), new_pvd);
//Check if make_pair is a success
c.mapPulseID.insert(std::make_pair(new_pvd.getPulseID(), new_pvd));
if (c.mapPulseID.size() > c.mapPulseIDBufferSize) {
if (c.mapPulseID.size() > c.mapPulseIDBufferSize)
{
std::map<unsigned long long, PVDataHolder>::iterator pos=c.mapPulseID.begin();
if (pos != c.mapPulseID.end()) {
if (pos != c.mapPulseID.end())
{
c.mapPulseID.erase(pos);
}
else {
else
{
std::cout << "ITERATOR NOT FOUND in change_mapPulseID" << std::endl;
}
}
}
catch (std::bad_alloc &e) {
std::cout << "change_mapPulseID" << " //" << e.what() << std:: endl;
catch (std::bad_alloc &e)
{
std::cout << "Critical error in change_mapPulseID. Force Exit" << std::endl;
std::cout << e.what() << std:: endl;
exit(1);
}
@@ -617,26 +657,29 @@ private:
};
/**
* Friend to Conduit permitting size of map<pulseID, pvdata> size to be set;
* if new buffer size if smaller than previous, then erase excess elements
*/
struct change_mapPulseIDBufferSize {
struct change_mapPulseIDBufferSize
{
change_mapPulseIDBufferSize (const unsigned short & new_mapPulseIDBufferSize): new_mapPulseIDBufferSize(new_mapPulseIDBufferSize) {}
void operator() (Conduit& c)
{
ipos=0;
if (c.mapPulseIDBufferSize > new_mapPulseIDBufferSize) {
if (c.mapPulseIDBufferSize > new_mapPulseIDBufferSize)
{
std::map<unsigned long long, PVDataHolder>::iterator pos;
for (pos=c.mapPulseID.begin(); pos != c.mapPulseID.end();) {
for (pos=c.mapPulseID.begin(); pos != c.mapPulseID.end();)
{
++ipos;
if (ipos > new_mapPulseIDBufferSize) {
if (ipos > new_mapPulseIDBufferSize)
{
c.mapPulseID.erase(pos++);
}
else {
else
{
++pos;
}
}
@@ -654,7 +697,8 @@ private:
* Friend to Conduit permitting fast modification to std::vector<std::string> monitorAction
* (for CAFE Extensions)
*/
struct change_monitorAction {
struct change_monitorAction
{
change_monitorAction (std::string &new_monitorAction): new_monitorAction(new_monitorAction) {}
void operator() (Conduit& c)
@@ -671,7 +715,8 @@ private:
* Friend to Conduit permitting fast removal of all elements in std::vector<std::string> monitorAction
* (for CAFE Extensions)
*/
struct change_monitorActionClear {
struct change_monitorActionClear
{
change_monitorActionClear () {}
void operator() (Conduit& c)
@@ -687,7 +732,8 @@ struct change_monitorActionClear {
* Friend to Conduit permitting fast removal of an entry in std::vector<std::string> monitorAction
* (for CAFE Extensions)
*/
struct change_monitorActionErase {
struct change_monitorActionErase
{
change_monitorActionErase (std::string &new_monitorAction): new_monitorAction(new_monitorAction) {}
void operator() (Conduit& c)
@@ -696,17 +742,21 @@ struct change_monitorActionErase {
std::vector<std::string>::iterator it;
for (it = c.monitorAction.begin(); it != c.monitorAction.end(); ) {
if( (*it)==new_monitorAction) {
for (it = c.monitorAction.begin(); it != c.monitorAction.end(); )
{
if( (*it)==new_monitorAction)
{
it = c.monitorAction.erase(it);
maFound=true;
}
else {
else
{
++it;
}
}
if (!maFound) {
if (!maFound)
{
std::cout << "monitorAction " << new_monitorAction << " NOT FOUND! " << std::endl;
std::cout << "Could not delete entry!" << std::endl;
}
@@ -717,40 +767,93 @@ private:
};
/**
* Friend to Conduit permitting fast removal of an entry in the monitorPolicy vector
* Friend to Conduit permitting fast modification to monitorPolicy parameters
*
*/
struct change_monitorPolicyErase {
change_monitorPolicyErase (unsigned int & new_evid): new_evid(new_evid) {}
struct change_monitorPolicy
{
change_monitorPolicy (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy) {}
void operator() (Conduit& c)
{
bool evidFound=false;
std::vector<MonitorPolicy>::iterator it;
bool mpidFound=false;
//Iterate
for (it = c.mpV.begin(); it != c.mpV.end();) {
for (size_t i=0; i < c.mpV.size(); ++i)
{
//std::cout << "ID " << (*it).getID() << " " << std::endl;
if ( (*it).getID()==new_evid) {
evidFound=true;
if (c.mpV[i].getID()==new_monitorPolicy.getID())
{
mpidFound=true;
c.mpV[i] = new_monitorPolicy; //Must be a deep copy.
break;
}
}
if (!mpidFound)
{
std::cout << "mpid " << new_monitorPolicy.getID() << " NOT FOUND! " << std::endl;
std::cout << "Could not modify entry!" << std::endl;
}
}
private:
class MonitorPolicy new_monitorPolicy;
};
/**
* Friend to Conduit permitting fast removal of an entry in the monitorPolicy vector
*
*/
struct change_monitorPolicyErase
{
change_monitorPolicyErase (unsigned int & new_mpid): new_mpid(new_mpid) {}
void operator() (Conduit& c)
{
bool mpidFound=false;
std::vector<MonitorPolicy>::iterator it;
//Iterate
for (it = c.mpV.begin(); it != c.mpV.end();)
{
//std::cout << "ID " << (*it).getID() << " " << std::endl;
if ( (*it).getID()==new_mpid)
{
mpidFound=true;
it=(c.mpV).erase(it);
break;
}
else {
else
{
++it;
}
}
if (!evidFound) {
std::cout << "evid " << new_evid << " NOT FOUND! " << std::endl;
if (!mpidFound)
{
std::cout << "mpid " << new_mpid << " NOT FOUND! " << std::endl;
std::cout << "Could not delete entry!" << std::endl;
}
}
private:
unsigned int new_evid;
unsigned int new_mpid;
};
@@ -760,22 +863,22 @@ private:
* Friend to Conduit permitting fast insertion into the monitorPolicy vector
*
*/
struct change_monitorPolicyInsert {
struct change_monitorPolicyInsert
{
change_monitorPolicyInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy) {}
void operator() (Conduit& c)
{
//insert into mpV
(c.mpV).push_back(new_monitorPolicy);
if (c.mpV.size()>(MAX_NO_MONITORS_PER_CHANNEL/2)) {
if (c.mpV.size()>(MAX_NO_MONITORS_PER_CHANNEL/2))
{
std::cout << "HEY DUDE - YOU NOW HAVE " << c.mpV.size() << " MONITORS " << std::endl;
std::cout << "for channel " << c.pv << " with handle " << c.handle << std::endl;
}
}
private:
@@ -788,32 +891,36 @@ private:
* Friend to Conduit permitting fast removal of an entry in the monitorPolicyInWaiting vector
*
*/
struct change_monitorPolicyInWaitingErase {
change_monitorPolicyInWaitingErase (unsigned int & new_evid): new_evid(new_evid) {}
struct change_monitorPolicyInWaitingErase
{
change_monitorPolicyInWaitingErase (unsigned int & new_mpid): new_mpid(new_mpid) {}
void operator() (Conduit& c)
{
bool evidFound=false;
bool mpidFound=false;
std::vector<MonitorPolicy>::iterator it;
//Iterate
for (it = c.mpInWaitingV.begin(); it != c.mpInWaitingV.end(); ++it) {
for (it = c.mpInWaitingV.begin(); it != c.mpInWaitingV.end(); ++it)
{
if ( (*it).getID()==new_evid) {
evidFound=true;
if ( (*it).getID()==new_mpid)
{
mpidFound=true;
(c.mpInWaitingV).erase(it);
break;
}
}
if (!evidFound) {
std::cout << "evid " << new_evid << " NOT FOUND! " << std::endl;
if (!mpidFound)
{
std::cout << "mpid " << new_mpid << " NOT FOUND! " << std::endl;
std::cout << "Could not delete entry!" << std::endl;
}
}
private:
unsigned int new_evid;
unsigned int new_mpid;
};
@@ -822,7 +929,8 @@ private:
* Friend to Conduit permitting fast insertion into the monitorPolicyInWaiting vector
*
*/
struct change_monitorPolicyInWaitingInsert {
struct change_monitorPolicyInWaitingInsert
{
change_monitorPolicyInWaitingInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy) {}
void operator() (Conduit& c)
@@ -831,7 +939,8 @@ struct change_monitorPolicyInWaitingInsert {
//insert into mpnWaitingV
(c.mpInWaitingV).push_back(new_monitorPolicy);
if (c.mpInWaitingV.size()>6) {
if (c.mpInWaitingV.size()>4)
{
std::cout << "HEY DUDE - YOU NOW HAVE " << c.mpInWaitingV.size()
<< " MONITORS IN WAITING" << std::endl;
std::cout << "for channel " << c.pv << " with handle " << c.handle << std::endl;
@@ -846,13 +955,11 @@ private:
/**
* Friend to Conduit/CAFEGroup permitting fast modification to pvAlias in hash table
*/
struct change_pvAlias {
struct change_pvAlias
{
change_pvAlias (const char * & new_pvAlias): new_pvAlias(new_pvAlias) {}
void operator() (Conduit& c)
@@ -870,6 +977,88 @@ private:
#if HAVE_PYTHON_H
/**
* Friend to Conduit permitting fast modification to pyGetCallbackFn in hash table
*/
struct change_pyGetCallbackFn
{
change_pyGetCallbackFn (void * & new_pyGetCallbackFn): new_pyGetCallbackFn(new_pyGetCallbackFn) {}
void operator() (Conduit& c)
{
c.pyGetCallbackFn = new_pyGetCallbackFn;
}
private:
void * new_pyGetCallbackFn;
};
/**
* Friend to Conduit permitting fast modification to pyPutCallbackFn in hash table
*/
struct change_pyPutCallbackFn
{
change_pyPutCallbackFn (void * & new_pyPutCallbackFn): new_pyPutCallbackFn(new_pyPutCallbackFn) {}
void operator() (Conduit& c)
{
c.pyPutCallbackFn = new_pyPutCallbackFn;
}
private:
void * new_pyPutCallbackFn;
};
/**
* Friend to Conduit permitting fast modification to pyConnectCallbackFn in hash table
*/
struct change_pyConnectCallbackFn
{
change_pyConnectCallbackFn (void * & new_pyConnectCallbackFn): new_pyConnectCallbackFn(new_pyConnectCallbackFn) {}
void operator() (Conduit& c)
{
//c.pyConnectCallbackFn = new_pyConnectCallbackFn;
//insert into mpV
(c.pyConnectCallbackVector).push_back(new_pyConnectCallbackFn);
//for (unsigned int i=0; i < c.pyConnectCallbackVector.size(); ++i) {
// std::cout << "change_pyConnectCallbackFn: " << i << " " << c.pyConnectCallbackVector[i] << std::endl;
//}
}
private:
void * new_pyConnectCallbackFn;
};
/**
* Friend to Conduit permitting fast modification to pyOpenCallbackFlag in hash table
*/
struct change_pyOpenCallbackFlag
{
change_pyOpenCallbackFlag (bool & new_pyOpenCallbackFlag): new_pyOpenCallbackFlag(new_pyOpenCallbackFlag) {}
void operator() (Conduit& c)
{
c.pyOpenCallbackFlag = new_pyOpenCallbackFlag;
}
private:
bool new_pyOpenCallbackFlag;
};
#endif
/**
* Friend to Conduit permitting pyCafeFlag flag to be set in hash table
*
@@ -888,7 +1077,8 @@ private:
/**
* Friend to Conduit/CAFEGroup permitting fast modification to the status as given by the last method invocation
*/
struct change_status {
struct change_status
{
change_status (const int & new_status): new_status(new_status) {}
void operator() (Conduit& c)
{
@@ -906,52 +1096,159 @@ private:
/**
* Friend to Conduit permitting associated alarm Severity levels together with channel description to be entered into container
*/
struct change_supplementHandle {
struct change_supplementHandle
{
change_supplementHandle (const alarmSeverityStruct & new_alarmSeverity, const std::string & new_desc): new_alarmSeverity(new_alarmSeverity), new_desc(new_desc) {}
void operator() (Conduit& c)
{
c.aSevStruct.hhsv=new_alarmSeverity.hhsv;
c.aSevStruct.hsv=new_alarmSeverity.hsv;
c.aSevStruct.lsv=new_alarmSeverity.lsv;
c.aSevStruct.llsv=new_alarmSeverity.llsv;
c.desc=new_desc;
c.hasDesc=true;
c.hasAlarmSevStruct=true;
c.aSevStruct.hhsv=new_alarmSeverity.hhsv;
c.aSevStruct.hsv=new_alarmSeverity.hsv;
c.aSevStruct.lsv=new_alarmSeverity.lsv;
c.aSevStruct.llsv=new_alarmSeverity.llsv;
c.desc=new_desc;
c.hasDesc=true;
c.hasAlarmSevStruct=true;
}
private:
alarmSeverityStruct new_alarmSeverity;
std::string new_desc;
std::string new_desc;
};
/**
* Friend to Conduit permitting associated alarm Severity levels together with channel description to be entered into container
*/
struct change_supplementAlarmSeverity
{
change_supplementAlarmSeverity (const alarmSeverityStruct & new_alarmSeverity): new_alarmSeverity(new_alarmSeverity) {}
void operator() (Conduit& c)
{
c.aSevStruct.hhsv=new_alarmSeverity.hhsv;
c.aSevStruct.hsv=new_alarmSeverity.hsv;
c.aSevStruct.lsv=new_alarmSeverity.lsv;
c.aSevStruct.llsv=new_alarmSeverity.llsv;
c.hasAlarmSevStruct=true;
}
private:
alarmSeverityStruct new_alarmSeverity;
};
/**
* Friend to Conduit permitting associated alarm channel description to be entered into container
*/
struct change_supplementDescription
{
change_supplementDescription (const std::string & new_desc): new_desc(new_desc) {}
void operator() (Conduit& c)
{
c.desc=new_desc;
c.hasDesc=true;
}
private:
std::string new_desc;
};
/**
* Friend to Conduit/CAFEGroup permitting fast modification to the usrArgs as given by the last method invocation
*/
struct change_usrArgs {
struct change_usrArgs
{
change_usrArgs (const unsigned int & new_usrArgs): new_usrArgs(new_usrArgs) {}
void operator() (Conduit& c)
{
c.usrArgs = (void *) (unsigned long) new_usrArgs; // APRIL2018 - added to remove C++11 compiler warning
}
private:
unsigned int new_usrArgs;
};
/**
* friend to Conduit/CAFEGroup permitting the groupHandle to which the channel belongs to be recorded in hash table
* Friend to Conduit permitting fast removal of an entry in the widgetV vector
*
*/
struct change_groupHandle {
struct change_widgetErase
{
change_widgetErase (void * & new_widget): new_widget(new_widget) {}
void operator() (Conduit& c)
{
bool widgetFound=false;
std::vector<void *>::iterator it;
//Iterate
for (it = c.widgetV.begin(); it != c.widgetV.end(); ++it)
{
if ( (*it)==new_widget)
{
widgetFound=true;
(c.widgetV).erase(it);
break;
}
}
if (!widgetFound)
{
std::cout << "widget " << new_widget << " NOT FOUND! " << std::endl;
std::cout << "Could not delete entry from std::vector widgetV!" << std::endl;
}
}
private:
void * new_widget;
};
/**
* Friend to Conduit permitting fast insertion into the monitorPolicyInWaiting vector
*
*/
struct change_widgetInsert
{
change_widgetInsert (void * & new_widget): new_widget(new_widget) {}
void operator() (Conduit& c)
{
//insert into widgetV
(c.widgetV).push_back((void *)new_widget);
/*
std::vector<void *>::iterator it;
//Iterate
for (it = c.widgetV.begin(); it != c.widgetV.end(); ++it) {
std::cout << "widget in change " << (*it) << std::endl;
}
*/
}
private:
void * new_widget;
};
/**
* friend to Conduit/CAFEgroup permitting the groupHandle to which the channel belongs to be recorded in hash table
*/
struct change_groupHandle
{
change_groupHandle (const unsigned int & new_groupHandle): new_groupHandle(new_groupHandle) {}
void operator() (Conduit& c)

View File

@@ -24,7 +24,8 @@
* \param _memberCC CAFEConduit object representing each group member
* \param _groupStatus groupStatus: error indicates >0 members have an error
*/
class ConduitGroup {
class ConduitGroup
{
friend struct change_channelTimeoutPolicySGPut;
friend struct change_channelTimeoutPolicySGGet;
friend struct change_timeout_sg_pend_io;
@@ -122,7 +123,8 @@ public:
* Friend to ConduitGroup permitting fast modification of the rule in group hash table;
* the rule flag only functions within a PVGroup
*/
struct change_sg_rule {
struct change_sg_rule
{
change_sg_rule (const bool & new_rule, const unsigned int & iMember):
new_rule(new_rule),iMember(iMember) {}
@@ -140,7 +142,8 @@ private:
/**
* Friend to ConduitGroup permitting fast modification of status in group hash table;
*/
struct change_sg_status {
struct change_sg_status
{
change_sg_status (const int & new_status, const unsigned int & iMember):
new_status(new_status),iMember(iMember) {}
@@ -158,7 +161,8 @@ private:
* friend to ConduitGroup permitting fast modification to \n
* the timeout_sg_pend_event period recorded in ConduitGroup hash table
*/
struct change_timeout_sg_pend_io {
struct change_timeout_sg_pend_io
{
change_timeout_sg_pend_io (const double & new_timeout_sg_pend_io):
new_timeout_sg_pend_io(new_timeout_sg_pend_io) {}
void operator() (ConduitGroup& g)
@@ -174,7 +178,8 @@ private:
/**
* Friend to ConduitGroup records the channelTimeoutPolicySGGet in hash table
*/
struct change_channelTimeoutPolicySGGet {
struct change_channelTimeoutPolicySGGet
{
change_channelTimeoutPolicySGGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}
@@ -191,7 +196,8 @@ private:
/**
* Friend to ConduitGroup records the channelTimeoutPolicySGPut in hash table
*/
struct change_channelTimeoutPolicySGPut {
struct change_channelTimeoutPolicySGPut
{
change_channelTimeoutPolicySGPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy) {}

View File

@@ -35,7 +35,8 @@
class Connect {
class Connect
{
protected:
int status;
CAFEStatus cafeStatus;
@@ -68,10 +69,9 @@ protected:
static void callbackHandlerException (struct exception_handler_args args);
//connect.cpp
//int createHandle(const char * pv, ca_client_context * ccc, ChannelRequestPolicy channelRequestPolicyPut, unsigned int &handle)
int createChannel(unsigned int handle, const char * pv, chid &pCh);
int createHandle(const char * pv, ca_client_context * ccc, unsigned int &handle)
//int createHandle(const char * pv, ca_client_context * ccc, ChannelRequestPolicy channelRequestPolicyPut, unsigned int &handle)
throw (CAFEException_pv);
int createHandle(const char * pv, ca_client_context * ccc, unsigned int &handle) noexcept(false); // throw (CAFEException_pv);
int contextDestroy();
int contextDestroy(ca_client_context * cctLocal);
@@ -82,7 +82,7 @@ protected:
int createChannelWithinGroup(unsigned int handle, const char * pv, chid &pCh);
int createHandleWithinGroup(const char * pv, ca_client_context * ccc, unsigned int & _handle)
throw (CAFEException_pv);
noexcept(false); //throw (CAFEException_pv);
public:
@@ -212,11 +212,26 @@ public:
}
int _ca_pend_io(double t)
{
return ca_pend_io(t);
double _t=DEFAULT_TIMEOUT_PEND_IO;
if (t<=0)
{
_t=0.4;
std::cout << "Illegal timeout value: " << t << " for _ca_pend_io(timeout) "<< std::endl;
std::cout << "Setting timeout to default value of " << _t << " seconds" << std::endl;
}
return ca_pend_io(_t); //returns ECA_TIMEOUT if successful
}
int _ca_pend_event(double t)
{
return ca_pend_event(t);
double _t=t;
if (t<=0)
{
_t=DEFAULT_TIMEOUT_PEND_EVENT;
std::cout << "Illegal timeout value: " << t << " for _ca_pend_event(timeout) "<< std::endl;
std::cout << "Setting timeout to default vallue of " << _t << std::endl;
}
return ca_pend_event(_t); //returns ECA_TIMEOUT if successful
}
//connect.cc
@@ -224,48 +239,51 @@ public:
{
return pyCafeFlag=b;
};
bool getPyCafe()
{
return pyCafeFlag;
} ;
int init() throw (CAFEException_init);
int init(ca_preemptive_callback_select select) throw (CAFEException_init);
};
int init() noexcept(false); // throw (CAFEException_init);
int init(ca_preemptive_callback_select select) noexcept(false); // throw (CAFEException_init);
//std::string
int open(const std::string pvS, unsigned int &handle) throw (CAFEException_open)
int open(const std::string pvS, unsigned int &handle) noexcept(false) // throw (CAFEException_open)
{
try {
open (pvS.c_str(), handle);
try
{
return open (pvS.c_str(), handle);
}
catch(CAFEException_open &e) {
catch(CAFEException_open &e)
{
throw e;
};
}
int open(const std::string pvS, const std::string pvAliasS, unsigned int &handle)
throw (CAFEException_open)
int open(const std::string pvS, const std::string pvAliasS, unsigned int &handle)
noexcept(false) // throw (CAFEException_open)
{
try {
open (pvS.c_str(), pvAliasS.c_str(), handle);
try
{
return open (pvS.c_str(), pvAliasS.c_str(), handle);
}
catch(CAFEException_open &e) {
catch(CAFEException_open &e)
{
throw e;
};
}
int open(const std::string *pvArrayS, unsigned int *handleArray, const unsigned int nHandles)
throw (CAFEException_open);
int open(const std::string *pvArrayS, unsigned int *handleArray, const unsigned int nHandles) noexcept(false); // throw (CAFEException_open);
//const char *pv
int open(const char *pv, unsigned int &handle) throw (CAFEException_open);
int open(const char *pv, const char *pvAlias, unsigned int &handle)
throw (CAFEException_open);
int open(const char *pv, unsigned int &handle) noexcept(false); // throw (CAFEException_open);
int open(const char *pv, const char *pvAlias, unsigned int &handle) noexcept(false); // throw (CAFEException_open);
int open(const char **pvArray, unsigned int *handleArray, const unsigned int nHandles)
throw (CAFEException_open);
int open(std::vector<const char *>, std::vector<unsigned int> &) throw (CAFEException_open);
int open(std::vector<std::string>, std::vector<unsigned int> &) throw (CAFEException_open);
noexcept(false); // throw (CAFEException_open);
int open(std::vector<const char *>, std::vector<unsigned int> &) noexcept(false); // throw (CAFEException_open);
int open(std::vector<std::string>, std::vector<unsigned int> &) noexcept(false); // throw (CAFEException_open);
int openV(std::vector<std::string> s, std::vector<unsigned int> &i) throw (CAFEException_open)
int openV(std::vector<std::string> s, std::vector<unsigned int> &i) noexcept(false) // throw (CAFEException_open)
{
return open(s,i);
};
@@ -382,6 +400,10 @@ public:
//Pends for a maximimum of timeout seconds
void openNowAndWait(double _timeout);
//Pends for a maximimum of timeout seconds
void openNowAndWaitHandles(unsigned int * handleArray, unsigned int nHandles, double _timeout);
//Pends for a maximimum of timeout seconds
void openNowAndWaitHandleV(std::vector<unsigned int> handleV, double _timeout);
//Pends for default amount of time
void openNow()
@@ -396,6 +418,24 @@ public:
return;
}
//Pends for default amount of time
void openNowHandles(unsigned int * handleArray, unsigned int nHandles)
{
openNowAndWaitHandles(handleArray, nHandles, channelOpenPolicy.getTimeout());
return;
}
//Pends for default amount of time
void openNowHandleV(std::vector<unsigned int> handleV)
{
openNowAndWaitHandleV(handleV, channelOpenPolicy.getTimeout());
return;
}
//-------------------------------------------------------------------------
@@ -406,6 +446,17 @@ public:
bool initCallbackComplete(unsigned int * hArray, unsigned int nelem);
bool initCallbackCompleteV(std::vector<unsigned int> hV)
{
return initCallbackComplete(&hV[0], hV.size());
}
bool initCallbackCompleteHandle(unsigned int handle)
{
unsigned int hArray[1];
hArray[0]=handle;
return initCallbackComplete(hArray, 1);
}
//#################################################################################
@@ -453,7 +504,7 @@ public:
//return status;
return closeChannels(&v[0], v.size());
};
int close(unsigned int handle);
int closeChannel(unsigned int handle)
@@ -493,6 +544,29 @@ public:
{
return closeChannelsKeepHandles(&v[0], v.size());
}
int openChannelsWithHandles(unsigned int * handleArray, unsigned int nHandles);
int openChannelsWithHandlesV(std::vector<unsigned int> v)
{
return openChannelsWithHandles(&v[0], v.size());
}
int openChannelsWithHandles (std::vector<unsigned int> v)
{
return openChannelsWithHandles(&v[0], v.size());
}
int reconnect(std::vector<unsigned int> v)
{
int status1 = closeChannelsKeepHandles(&v[0], v.size());
openPrepare();
int status2 = openChannelsWithHandles(&v[0], v.size());
openNowAndWaitHandles(&v[0], v.size(), channelOpenPolicy.getTimeout());
if (status1 > status2) {
return status1;
}
return status2;
}
// Monitors
int monitorStart(unsigned int handle, MonitorPolicy &mp);
@@ -584,8 +658,10 @@ public:
bool isValid(unsigned int handle)
{
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
if ((*itcs).getHandle()==handle) {
for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
{
if ((*itcs).getHandle()==handle)
{
return true;
}
}
@@ -594,8 +670,10 @@ public:
bool allChannelsConnected()
{
for (itcs = cs.begin(); itcs != cs.end(); ++itcs) {
if (!(*itcs).isConnected()) {
for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
{
if (!(*itcs).isConnected())
{
return false;
}
}
@@ -612,41 +690,47 @@ public:
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if (it_handle != handle_index.end())
{
return (*it_handle).isConnected();
}
else {
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
else
{
std::cout<< "Input handle " << handle << " does not exist! " << std::endl;
return false;
}
}
int getChannelInfo(unsigned int handle, ChannelRegalia & channelInfo)
{
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if (it_handle != handle_index.end())
{
channelInfo=(*it_handle).getChannelRegalia();
return ICAFE_NORMAL;
}
else {
else
{
return ECAFE_INVALID_HANDLE;
}
};
chid getChannelID(unsigned int handle)
{
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if (it_handle != handle_index.end())
{
return (*it_handle).getChannelID();
}
else {
else
{
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return NULL;
}
@@ -665,10 +749,12 @@ public:
int attachContext(ca_client_context *ccc)
{
if (ccc != NULL) {
if (ccc != NULL)
{
return ca_attach_context(ccc);
}
else {
else
{
return ECAFE_NULLCONTEXT;
}
}
@@ -676,10 +762,12 @@ public:
int attachContextByPVName(const char * pvname)
{
ca_client_context * ccc=getClientContext(pvname);
if (ccc != NULL) {
if (ccc != NULL)
{
return ca_attach_context(ccc);
}
else {
else
{
return ECAFE_NULLCONTEXT;
}
}
@@ -687,10 +775,12 @@ public:
int attachContextByHandle(unsigned int handle)
{
ca_client_context * ccc=getClientContext(handle);
if (ccc != NULL) {
if (ccc != NULL)
{
return ca_attach_context(ccc);
}
else {
else
{
return ECAFE_NULLCONTEXT;
}
}
@@ -701,20 +791,25 @@ public:
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if (it_handle != handle_index.end())
{
if ( (*it_handle).getAccessRead() != ar ) {
if(MUTEX) {
if ( (*it_handle).getAccessRead() != ar )
{
if(MUTEX)
{
cafeMutex.lock();
}
handle_index.modify(it_handle, change_accessRead(ar));
if(MUTEX) {
if(MUTEX)
{
cafeMutex.unlock();
}
}
return ICAFE_NORMAL;
}
else {
else
{
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return ECAFE_INVALID_HANDLE;
}
@@ -725,19 +820,24 @@ public:
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if ( (*it_handle).getAccessWrite() != aw ) {
if(MUTEX) {
if (it_handle != handle_index.end())
{
if ( (*it_handle).getAccessWrite() != aw )
{
if(MUTEX)
{
cafeMutex.lock();
}
handle_index.modify(it_handle, change_accessWrite(aw));
if(MUTEX) {
if(MUTEX)
{
cafeMutex.unlock();
}
}
return ICAFE_NORMAL;
}
else {
else
{
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return ECAFE_INVALID_HANDLE;
}
@@ -748,10 +848,12 @@ public:
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if (it_handle != handle_index.end())
{
return (bool) (*it_handle).getAccessRead();
}
else {
else
{
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return false;
}
@@ -762,10 +864,12 @@ public:
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if (it_handle != handle_index.end())
{
return (bool) (*it_handle).getAccessWrite();
}
else {
else
{
std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return false;
}
@@ -794,7 +898,7 @@ public:
int printStatus(std::vector<std::string> pvV, std::vector<int> statusV);
int printStatusIfError(std::vector<std::string> pvV, std::vector<int> statusV);
int setPVAlias(unsigned int handle, const char * pv) throw (CAFEException_open);
int setPVAlias(unsigned int handle, const char * pv) noexcept(false); // throw (CAFEException_open);
// GROUP FUNCTIONS
@@ -833,11 +937,27 @@ public:
bool isGroup(const char *);
bool isCollection(const char *);
int groupOpen(const char *pv, unsigned int &groupHandle) throw (CAFEException_groupOpen);
int groupOpen(PVGroup &pvgroup, unsigned int &groupHandle) throw (CAFEException_groupOpen);
int groupOpen(const char *pv, unsigned int &groupHandle) noexcept(false); // throw (CAFEException_groupOpen);
int groupOpen(PVGroup &pvgroup, unsigned int &groupHandle) noexcept(false); // throw (CAFEException_groupOpen);
int groupOpenWithHandles(unsigned int groupHandle);
int groupClose(unsigned int groupHandle, bool keepGroupName) {
return Connect::groupClose(groupHandle, keepGroupName, false);
}
int groupClose(unsigned int groupHandle)
{
return Connect::groupClose(groupHandle, false, false);
};
int groupCloseKeepName(unsigned int groupHandle, bool keepGroupName) {
return Connect::groupClose(groupHandle, keepGroupName, false);
}
int groupClose(unsigned int groupHandle, bool keepGroupName, bool keepHandles);
int groupClose(unsigned int groupHandle);
int groupClose();
int groupCloseAll()
{
@@ -858,6 +978,9 @@ public:
std::vector<std::string> getFromGlobalChannelList(std::vector<std::string>);
int groupDefineFromCollection (const char * groupName, const char * collectionName, std::vector<std::string> attributeV) {
return groupDefine (groupName, collectionName, attributeV);
}
int groupDefine (const char * groupName, const char * collectionName, std::vector<std::string> attributeV);
int groupDefine (const char * groupName, const char * collectionName, std::vector<const char*> attributeV);

View File

@@ -10,7 +10,6 @@
#include <cadef.h>
#include <iostream>
#define EV EPICSVERSION(HAVE_EPICS)
#if (EPICS_MAJOR==3) && (EPICS_MINOR==14) && (EPICS_PATCH>=11)
@@ -27,14 +26,16 @@ const unsigned short ALARM_STATUS_STRING_LENGTH = 22; // "NO_ALARM","READ","WR
//"HIHI","HIGH","LOLO","LOW","STATE","COS","COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS","WRITE_ACCESS"
struct alarmSeverityStruct {
struct alarmSeverityStruct
{
short llsv;
short lsv;
short hsv;
short hhsv;
short lsv;
short hsv;
short hhsv;
};
struct etsDatePrevious {
struct etsDatePrevious
{
int year;
int mon;
int day;
@@ -44,7 +45,8 @@ struct etsDatePrevious {
unsigned long nsec;
};
struct etsDate {
struct etsDate
{
int year;
int mon;
int day;
@@ -52,12 +54,13 @@ struct etsDate {
int min;
int sec;
unsigned long nsec;
int wday;
int yday;
int isdst;
int wday;
int yday;
int isdst;
};
struct etsNorm {
struct etsNorm
{
unsigned int secPastEpoch;
unsigned int nsec;
};
@@ -103,24 +106,28 @@ const double NMEMBER_PER_SEC_SG_PEND_EVENT = 400; //
const double DEFAULT_TIMEOUT_SG_PEND_IO = 5.0;
// Otherwise too many large databuffers are created
const unsigned int MAX_NELEM_FOR_CTRL_BUFFER = 8192;
const unsigned int MAX_NELEM_FOR_CTRL_BUFFER = 256; //8192;
// Keep at 1, else becomes problematic when wf is made a syn. group member (ch disconnect occurs for STSACK cb)
const unsigned int MAX_NELEM_FOR_STSACK_BUFFER = 1;
const unsigned int DEFAULT_NELEM_FOR_CTRL_BUFFER = 256; // if nelem exceeds above
const unsigned int DEFAULT_NELEM_FOR_CTRL_BUFFER = 1; //256; // if nelem exceeds above
const unsigned int DEFAULT_NELEM_FOR_STSACK_BUFFER = 1; // if nelem exceeds above
const unsigned short MAX_NO_MONITORS_PER_CHANNEL = 4; // Can't start more than 4; 1 is more usual.
const std::string SYNCHRONOUS_GROUP_NAME_IN_BSDATAHOLDER = "gBS2CA";
const std::string INVALID_ENUM_RETURN_STRING = "invalid_enum_value";
const short INVALID_ENUM_RETURN_VALUE = -1;
//For BSREAD
const double BSREAD_MAX_CONNECT_TIME = 20; //20 seconds; typically 10 seconds is required
const double BSREAD_MAX_CONNECT_TIME = 15; //seconds; typically 10 seconds is required
const unsigned short BSREAD_ZEROMQ_HIGH_WATER_MARK = 1;
const short BSREAD_ZEROMQ_TIMEOUT_MS = 2000; //Can handle 10 Hz // -1 wait for ever
const unsigned short BSREAD_PREBLOB_BYTES = 12; //No of bytes pre-pending the binary blob with metadata
const std::string SF_PULSE_ID_PV = "SIN-TIMAST-EVG0:TX-PULSEID";
const unsigned short SF_PULSE_ID_BUFFER_SIZE = 10; //Size of map to store history of pulseIDs;
const unsigned short SF_PULSE_ID_BUFFER_SIZE = 100; //Size of map to store history of pulseIDs;
#endif // DEFINES_H

View File

@@ -14,7 +14,8 @@
#include <cstring>
#include <helper.h>
class collectionMember {
class collectionMember
{
public:
collectionMember():deviceName(""),devicePosition(0) {};
virtual ~collectionMember() {};
@@ -22,7 +23,8 @@ public:
float devicePosition;
};
class deviceCollection {
class deviceCollection
{
friend class Connect;
friend class CAFE;
//if HAVE_LIBQTXML
@@ -61,7 +63,8 @@ public:
std::vector<float> posV;
posV.clear();
posV.reserve(cMembers.size());
for (size_t i=0; i<cMembers.size(); ++i) {
for (size_t i=0; i<cMembers.size(); ++i)
{
posV.push_back(cMembers[i].devicePosition);
};
return posV;
@@ -70,8 +73,10 @@ public:
{
char _c[PVNAME_SIZE];
helper.removeLeadingAndTrailingSpaces(c, _c);
for (size_t i=0; i<cMembers.size(); ++i) {
if(strcmp(cMembers[i].deviceName.c_str(),_c)==0) {
for (size_t i=0; i<cMembers.size(); ++i)
{
if(strcmp(cMembers[i].deviceName.c_str(),_c)==0)
{
return cMembers[i].devicePosition;
}
}
@@ -85,7 +90,8 @@ public:
std::vector<std::string> memberV;
memberV.clear();
memberV.reserve(cMembers.size());
for (size_t i=0; i<cMembers.size(); ++i) {
for (size_t i=0; i<cMembers.size(); ++i)
{
memberV.push_back(cMembers[i].deviceName);
};
return memberV;
@@ -102,7 +108,8 @@ public:
};
class collectionInGroup {
class collectionInGroup
{
//friend class loadGroupXMLParser;
public:
collectionInGroup() {};
@@ -111,7 +118,8 @@ public:
std::string attrib;
};
class deviceGroup {
class deviceGroup
{
//if HAVE_LIBQTXML
friend class loadGroupXMLParser;
//endif

View File

@@ -19,18 +19,21 @@
template<typename T>
struct enumStrings {
struct enumStrings
{
static char const* data[];
};
template<typename T>
struct enumRefHolder {
struct enumRefHolder
{
T& enumVal;
enumRefHolder(T& enumVal): enumVal(enumVal) {}
};
template<typename T>
struct enumConstRefHolder {
struct enumConstRefHolder
{
T const& enumVal;
enumConstRefHolder(T const& enumVal): enumVal(enumVal) {}
};
@@ -40,10 +43,12 @@ inline std::ostream& operator<<(std::ostream& str, enumConstRefHolder<T> const&
{
//Add check on enumStrings<T>::data size to ensure correspondence with entries in cafeEnumEpics.h
if ( boost::size( enumStrings<T>::data) > (unsigned int) data.enumVal) {
if ( boost::size( enumStrings<T>::data) > (unsigned int) data.enumVal)
{
return str << enumStrings<T>::data[data.enumVal];
}
else {
else
{
return str << "ERROR: enumStrings.h reports data.enumVal= " << data.enumVal
<< " DOES NOT HAVE A STRING EQUIVALENT!";
}
@@ -65,14 +70,16 @@ inline std::istream& operator>>(std::istream& str, enumRefHolder<T> const& data)
//if (find != end)
if ( std::find( boost::begin(enumStrings<T>::data), boost::end( enumStrings<T>::data), value) !=
boost::end( enumStrings<T>::data)) {
boost::end( enumStrings<T>::data))
{
//data.enumVal = static_cast<T>(std::distance(begin, find));
data.enumVal = static_cast<T>(std::distance(boost::begin(enumStrings<T>::data),
std::find (boost::begin(enumStrings<T>::data), boost::end(enumStrings<T>::data), value ) ));
}
if (data.enumVal > boost::size( enumStrings<T>::data) ) {
if (data.enumVal > boost::size( enumStrings<T>::data) )
{
std::cout << "ERROR: enumStrings.h reports data.enumVal = " << data.enumVal
<< " is out of enum range = " << boost::size( enumStrings<T>::data) << std::endl;

View File

@@ -10,22 +10,24 @@
#include <exception>
#include <cstring>
#include <iostream>
#include <defines.h>
#include <cafeDataType.h>
/**
* The CAFEException_pv struct for pv error reporting
*/
struct CAFEException_pv {
struct CAFEException_pv
{
char pv [PVNAME_SIZE];
char pvAlias[PVNAME_SIZE];
unsigned int handle;
CAFE_DATATYPE dataTypeNative;
const char * dataTypeNativeText;
std::string dataTypeNativeText;
int statusCode;
const char * statusCodeText;
const char * statusMessage;
const char * source;
std::string statusCodeText;
std::string statusMessage;
std::string source;
unsigned int ln;
};
@@ -33,13 +35,14 @@ struct CAFEException_pv {
/**
* The CAFEException_group struct for group error reporting
*/
struct CAFEException_group {
struct CAFEException_group
{
char groupName [PVNAME_SIZE];
unsigned int groupHandle;
int statusCode;
const char * statusCodeText;
const char * statusMessage;
const char * source;
std::string statusCodeText;
std::string statusMessage;
std::string source;
unsigned int ln;
};
@@ -47,24 +50,49 @@ struct CAFEException_group {
/**
* The CAFEException_open class for ca open error reporting
*/
class CAFEException_open : public std::exception {
class CAFEException_open : public std::exception
{
private:
std::string ewhat;
public:
CAFEException_open() {
ewhat = "CAFEException_Open exception: Could not establish link to pv";
};
CAFEException_open(std::string _ewhat) {
ewhat = _ewhat;
};
CAFEException_pv pvEx;
virtual const char* what() const throw()
{
return "CAFEException_open exception: Could not establish link to pv";
return ewhat.c_str();
};
CAFEException_pv pvEx;
};
/**
* The CAFEException_groupOpen class for ca group open error reporting
*/
class CAFEException_groupOpen : public std::exception {
class CAFEException_groupOpen : public std::exception
{
private:
std::string ewhat;
public:
CAFEException_groupOpen() {
ewhat = "CAFEException_groupOpen exception: Could not establish link to group";
};
CAFEException_groupOpen(std::string _ewhat) {
ewhat = _ewhat;
};
virtual const char* what() const throw()
{
return "CAFEException_groupOpen exception: Could not establish link to group";
return ewhat.c_str();
};
CAFEException_group groupEx;
@@ -74,11 +102,12 @@ public:
/**
* The CAFEException_init
*/
class CAFEException_init: public std::exception {
class CAFEException_init: public std::exception
{
public:
virtual const char* what() const throw()
{
return "CAFEException_init exception: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create";
return "CAFEException_init: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create";
};
};
@@ -86,7 +115,8 @@ public:
/**
* The CAFEException_allocBufferMem
*/
class CAFEException_allocBufferMem: public std::exception {
class CAFEException_allocBufferMem: public std::exception
{
public:
virtual const char* what() const throw()
{

View File

@@ -12,20 +12,22 @@
#include <statusCodes.h>
#include <defines.h>
class ExceptionsHelper {
class ExceptionsHelper
{
private:
CAFEDataTypeCode cafeDataTypeCode;
CAFEStatus cafeStatus;
public:
CAFEException_pv prepareCAFEException_pv(const char *pv, const char *pvAlias,
CAFEException_pv prepareCAFEException_pv(
const char pv[PVNAME_SIZE], const char pvAlias[PVNAME_SIZE],
unsigned int handle, chid pCh, int status,
const char * source, unsigned int ln);
std::string source, unsigned int ln);
CAFEException_group prepareCAFEException_group(
char groupName [PVNAME_SIZE],
const char groupName [PVNAME_SIZE],
unsigned int groupHandle,
int statusCode,
const char * source,
std::string source,
unsigned int ln);
ExceptionsHelper(void) {};

View File

@@ -40,7 +40,7 @@ extern unsigned long nCBs;
extern bool callbackLiveFlag;
extern bool SF_WITH_PULSE_ID;
extern bool SF_WITH_PULSE_ID;
#endif // GLOBAL_H

View File

@@ -28,7 +28,8 @@
class Granules {
class Granules
{
public:
template <class CTYPE> friend class Instant;

View File

@@ -21,7 +21,8 @@
#include <tmDateMap.h>
class HandleHelper : public Helper {
class HandleHelper : public Helper
{
private:
CAFEStatus cafeStatus;
@@ -40,12 +41,6 @@ private:
PrintErrorPolicy printErrorPolicy;
// now in defines.h
//struct etsNorm{ unsigned int secPastEpoch; unsigned int nsec;};
//struct etsDate{ int year; int mon; int day;
// int hour; int min; int sec; unsigned long nsec;};
public:
HandleHelper() {};
@@ -60,6 +55,15 @@ public:
TMwdayText tmDay;
TMmonthpText tmMonth;
#if HAVE_PYTHON_H
int setPyConnectCallbackFn(unsigned int _handle, void * callbackFn);
int setPyGetCallbackFn(unsigned int _handle, void * callbackFn);
int setPyPutCallbackFn(unsigned int _handle, void * callbackFn);
#endif
int addWidget (unsigned int _handle, void * widget);
int removeWidget (unsigned int _handle, void * widget);
int getWidgets(unsigned int _handle, std::vector<void *> & widgetV);
int checkConsistency();
int checkConsistency(unsigned int _handle);
@@ -79,6 +83,17 @@ public:
ca_client_context * getContextFromPV (const char * _pv);
ca_client_context * getContextFromHandle (unsigned int _handle);
cafeConduit_set_by_handle::iterator getIterFromHandle(unsigned int handle);
cafeConduit_set_by_handle & getcsHandleIndex();
int modifyHandleIndexStatus(unsigned int handle, long status);
int modifyChannelRequestMetaDataClient(unsigned int handle,
ChannelRequestMetaDataClient channelRequestMetaDataClient);
int modifyChannelRequestStatusGet(unsigned int handle,
ChannelRequestStatus channelRequestStatusGet);
int modifyChannelTimeoutPolicyGet(unsigned int handle,
ChannelTimeoutPolicy channelTimeoutPolicyGet);
const char * getPVFromHandle (unsigned int _handle);
const char * getPVFromHandle (unsigned int _handle, ca_client_context * ccc);
@@ -89,6 +104,8 @@ public:
const char * getPVAlias (unsigned int _handle);
const char * getPVAlias (unsigned int _handle, ca_client_context * ccc);
unsigned int getHandleFromPV (const char * _pv);
unsigned int getHandleFromPV (const char * _pv, ca_client_context * ccc);
unsigned int getHandleFromPVAlias(const char * _pv);
@@ -110,7 +127,7 @@ public:
int getTimeStamp(unsigned int h, epicsTimeStamp &ts);
etsNorm getEpicsTimeStampAsUInt32(unsigned int h)
@@ -213,7 +230,8 @@ public:
}
std::string etsDateAsString(etsNorm ts) {
std::string etsDateAsString(etsNorm ts)
{
time_t t= ts.secPastEpoch;
@@ -232,12 +250,13 @@ public:
}
//Deprecated!!!
//Deprecated!!!
int getPulseID(unsigned int h, unsigned int &pulseID)
{
epicsTimeStamp ts;
int status=getTimeStamp(h, ts);
if (status==ICAFE_NORMAL) {
if (status==ICAFE_NORMAL)
{
std::string nsS = static_cast<std::ostringstream*>( &(std::ostringstream() << ts.nsec) )->str();
int l=nsS.length();
int startPos=std::max(l-6,0);
@@ -258,22 +277,26 @@ public:
return pulseID;
}
bool hasAlarmStatusSeverity(unsigned int h);
bool hasAlarmStatusSeverity(unsigned int h);
int getAlarmStatusSeverity(unsigned int h, dbr_short_t as[2]);
int getAlarmStatusSeverityAsString(unsigned int h, std::string asas[2]);
unsigned int getNoHandles();
unsigned int getNextFreeHandle();
bool hasDescription(unsigned int _handle);
int getDescription(unsigned int _handle, std::string & desc);
int getUnits (unsigned int h, std::string & units);
int getPrecision(unsigned int h, short &precision);
int getPrecision(unsigned int h, short &precision);
bool isChannelConnected(unsigned int handle);
bool allChannelsConnected();
bool areChannelsConnected(unsigned int * handleArray, const unsigned int nHandles);
bool areChannelsConnectedV(std::vector<unsigned int>);
bool allChannelsWithinGroupConnected();
bool allChannelsWithinGroupConnectedV(std::vector<unsigned int>);
int printHandle (unsigned int h);
int printHandlesV(std::vector<unsigned int> handleV);
int printHandles(unsigned int * handleArray, unsigned int nHandles);
@@ -303,7 +326,7 @@ public:
bool isEnum(unsigned int _handle);
short getEnumFromString(unsigned int _handle, std::string enumStringValue);
std::string getStringFromEnum(unsigned int _handle, unsigned short enumValue);
std::vector<std::string> getEnumStrings(unsigned int handle);
std::vector<std::string> getEnumStrings(unsigned int handle);
int getDataTypeNative (unsigned int _handle, chtype &ndt);
int getDataTypeRequest(unsigned int _handle, chtype &rdt);
@@ -317,6 +340,9 @@ public:
int getMonitorAction(unsigned int _handle, std::vector<std::string> &msV);
std::vector<std::string> getMonitorAction(bool onlyIfNewData); //all handles; false gives all
int updateMonitorPolicyDeltaMS(unsigned int _handle, unsigned int _monid,
unsigned short deltaMS);
int getMonitorPolicyVector(unsigned int _handle, std::vector<MonitorPolicy> &mpV);
int getMonitorPolicyInWaitingVector(unsigned int _handle, std::vector<MonitorPolicy> &mpV);
int getNmonitor(unsigned int _handle);
@@ -364,11 +390,13 @@ public:
void setFirstAndLastArrayElements(unsigned int _handle,
unsigned int _start, unsigned int _last)
{
if (_last > _start ) {
if (_last > _start )
{
setOffset(_handle, _start);
setNelem(_handle, _last);
}
else {
else
{
std::cout << " offset must be less than the nelements" <<std::endl;
};
};

View File

@@ -8,7 +8,7 @@
#ifndef HASHCONDUIT_GROUP_H
#define HASHCONDUIT_GROUP_H
#include "conduitGroup.h"
#include <conduitGroup.h>
// boost include
#include <boost/multi_index_container.hpp>

View File

@@ -19,7 +19,8 @@
#include <cafeEnum.h>
#include <defines.h>
class Helper {
class Helper
{
public:
Helper() {};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

61
include/instantT.h Normal file
View File

@@ -0,0 +1,61 @@
///
/// \file instantT.h
/// \author Jan Chrin, PSI
/// \date Release: July 2021
/// \version CAFE 1.14.2
///
#ifndef INSTANT_T_H
#define INSTANT_T_H
#include <instant.h>
template <class CTYPE> int Instant<CTYPE>::set(const unsigned int _handle,
const chtype _dbrType, const CTYPE * _val );
template <class CTYPE> int Instant<CTYPE>::get(const unsigned int _handle,
const chtype _dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
template <class CTYPE> int Instant<CTYPE>::getCache(const unsigned int _handle,
const chtype _dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
template <class CTYPE> int Instant<CTYPE>::getCache(const unsigned int *handleArray, const unsigned int nelem,
const chtype _dbrType, CTYPE * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
template <class CTYPE> int Instant<CTYPE>::set(const unsigned int *handleArray, const unsigned int nelem,
onst chtype _dbrType, const CTYPE * val, int *statusArray);
template <class CTYPE> int Instant<CTYPE>::clientRequests(
const unsigned int _handle,
const chtype _dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts, bool isCacheRequest);
template <class CTYPE> int Instant<CTYPE>::clientRequests(
const unsigned int _handle, const chtype _dbrType, const CTYPE * _val);
template <class CTYPE> int Instant<CTYPE>::setAndGet(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, CTYPE &valGet);
template <class CTYPE> int Instant<CTYPE>::setMany(std::vector<unsigned int> handleSet, const chtype dbrType, std::vector<CTYPE> valSet, bool printFlag);
template <class CTYPE> int Instant<CTYPE>::compareAndMatchMany(std::vector<unsigned int> handleSet, const chtype dbrType, std::vector<CTYPE> valSet, std::vector<unsigned int> handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
//template <class CTYPE> int Instant<CTYPE>::setTriggerAndMatchMany(std::vector<unsigned int> handleSet, chtype dbrType, std::vector<CTYPE> valSet,
template <class CTYPE> int Instant<CTYPE>::setAndMatchMany(std::vector<unsigned int> handleSet, chtype dbrType, std::vector<CTYPE> valSet, std::vector<unsigned int> handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
template <class CTYPE> int Instant<CTYPE>::setAndMatch(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, const unsigned int handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
template <class CTYPE> int Instant<CTYPE>::match(const chtype dbrType, CTYPE valSet, unsigned int handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
template <class CTYPE> int Instant<CTYPE>::matchMany(const chtype dbrType, std::vector<CTYPE> valSet, std::vector<unsigned int> handleMatch, CTYPE tolerance, double timeout, bool printFlag);
#endif

View File

@@ -6,19 +6,21 @@
///
#include <config.h>
#if HAVE_LIBQTXML
#ifndef LOADCOLLECTIONXMLPARSER_H
#define LOADCOLLECTIONXMLPARSER_H
#include <config.h>
#if HAVE_LIBQTXML
#include <deviceCollection.h>
#include <QtXml/QXmlDefaultHandler>
//include <QtXml/QXmlDefaultHandler>
#include <QXmlDefaultHandler>
class loadCollectionXMLParser : public QXmlDefaultHandler {
class loadCollectionXMLParser : public QXmlDefaultHandler
{
public:
loadCollectionXMLParser();
virtual ~loadCollectionXMLParser();
@@ -35,7 +37,8 @@ public:
private:
enum {
enum
{
NotWaiting,
WaitingForDescription,
WaitingForDevice,

View File

@@ -5,18 +5,26 @@
/// \version CAFE 1.0.0
///
#include <config.h>
#if HAVE_LIBQTXML
#ifndef LOADGROUPXMLPARSER_H
#define LOADGROUPXMLPARSER_H
#include <config.h>
#if HAVE_LIBQTXML
#include <stdio.h>
#include <stdlib.h>
#include <deviceCollection.h>
#include <QtXml/QXmlDefaultHandler>
//include <QtXml/QXmlDefaultHandler>
#include <QXmlDefaultHandler>
class loadGroupXMLParser : public QXmlDefaultHandler {
class loadGroupXMLParser : public QXmlDefaultHandler
{
public:
loadGroupXMLParser();
virtual ~loadGroupXMLParser();
@@ -26,7 +34,8 @@ public:
std::vector<deviceGroup> groups;
private:
enum {
enum
{
NotWaiting,
WaitingForDescription,
WaitingForStatusGroup,
@@ -61,6 +70,8 @@ private:
const static QString& tagCollectiveType;
};
#endif
#endif /* LOADGROUPXMLPARSER_H */
#endif

366
include/lz4.h Normal file
View File

@@ -0,0 +1,366 @@
/*
LZ4 - Fast LZ compression algorithm
Header File
Copyright (C) 2011-2015, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- LZ4 source repository : https://github.com/Cyan4973/lz4
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
*/
#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
/*
* lz4.h provides block compression functions, and gives full buffer control to programmer.
* If you need to generate inter-operable compressed data (respecting LZ4 frame specification),
* and can let the library handle its own memory, please use lz4frame.h instead.
*/
/**************************************
* Version
**************************************/
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
#define LZ4_VERSION_MINOR 7 /* for new (non-breaking) interface capabilities */
#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
int LZ4_versionNumber (void);
/**************************************
* Tuning parameter
**************************************/
/*
* LZ4_MEMORY_USAGE :
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
* Increasing memory usage improves compression ratio
* Reduced memory usage can improve speed, due to cache effect
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
*/
#define LZ4_MEMORY_USAGE 14
/**************************************
* Simple Functions
**************************************/
int LZ4_compress_default(const char* source, char* dest, int sourceSize, int maxDestSize);
int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxDecompressedSize);
/*
LZ4_compress_default() :
Compresses 'sourceSize' bytes from buffer 'source'
into already allocated 'dest' buffer of size 'maxDestSize'.
Compression is guaranteed to succeed if 'maxDestSize' >= LZ4_compressBound(sourceSize).
It also runs faster, so it's a recommended setting.
If the function cannot compress 'source' into a more limited 'dest' budget,
compression stops *immediately*, and the function result is zero.
As a consequence, 'dest' content is not valid.
This function never writes outside 'dest' buffer, nor read outside 'source' buffer.
sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE
maxDestSize : full or partial size of buffer 'dest' (which must be already allocated)
return : the number of bytes written into buffer 'dest' (necessarily <= maxOutputSize)
or 0 if compression fails
LZ4_decompress_safe() :
compressedSize : is the precise full size of the compressed block.
maxDecompressedSize : is the size of destination buffer, which must be already allocated.
return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize)
If destination buffer is not large enough, decoding will stop and output an error code (<0).
If the source stream is detected malformed, the function will stop decoding and return a negative result.
This function is protected against buffer overflow exploits, including malicious data packets.
It never writes outside output buffer, nor reads outside input buffer.
*/
/**************************************
* Advanced Functions
**************************************/
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
/*
LZ4_compressBound() :
Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
This function is primarily useful for memory allocation purposes (destination buffer size).
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
Note that LZ4_compress_default() compress faster when dest buffer size is >= LZ4_compressBound(srcSize)
inputSize : max supported value is LZ4_MAX_INPUT_SIZE
return : maximum output size in a "worst case" scenario
or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
*/
int LZ4_compressBound(int inputSize);
/*
LZ4_compress_fast() :
Same as LZ4_compress_default(), but allows to select an "acceleration" factor.
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
An acceleration value of "1" is the same as regular LZ4_compress_default()
Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1.
*/
int LZ4_compress_fast (const char* source, char* dest, int sourceSize, int maxDestSize, int acceleration);
/*
LZ4_compress_fast_extState() :
Same compression function, just using an externally allocated memory space to store compression state.
Use LZ4_sizeofState() to know how much memory must be allocated,
and allocate it on 8-bytes boundaries (using malloc() typically).
Then, provide it as 'void* state' to compression function.
*/
int LZ4_sizeofState(void);
int LZ4_compress_fast_extState (void* state, const char* source, char* dest, int inputSize, int maxDestSize, int acceleration);
/*
LZ4_compress_destSize() :
Reverse the logic, by compressing as much data as possible from 'source' buffer
into already allocated buffer 'dest' of size 'targetDestSize'.
This function either compresses the entire 'source' content into 'dest' if it's large enough,
or fill 'dest' buffer completely with as much data as possible from 'source'.
*sourceSizePtr : will be modified to indicate how many bytes where read from 'source' to fill 'dest'.
New value is necessarily <= old value.
return : Nb bytes written into 'dest' (necessarily <= targetDestSize)
or 0 if compression fails
*/
int LZ4_compress_destSize (const char* source, char* dest, int* sourceSizePtr, int targetDestSize);
/*
LZ4_decompress_fast() :
originalSize : is the original and therefore uncompressed size
return : the number of bytes read from the source buffer (in other words, the compressed size)
If the source stream is detected malformed, the function will stop decoding and return a negative result.
Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes.
note : This function fully respect memory boundaries for properly formed compressed data.
It is a bit faster than LZ4_decompress_safe().
However, it does not provide any protection against intentionally modified data stream (malicious input).
Use this function in trusted environment only (data to decode comes from a trusted source).
*/
int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
/*
LZ4_decompress_safe_partial() :
This function decompress a compressed block of size 'compressedSize' at position 'source'
into destination buffer 'dest' of size 'maxDecompressedSize'.
The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
reducing decompression time.
return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize)
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.
Always control how many bytes were decoded.
If the source stream is detected malformed, the function will stop decoding and return a negative result.
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets
*/
int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize);
/***********************************************
* Streaming Compression Functions
***********************************************/
#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(long long))
/*
* LZ4_stream_t
* information structure to track an LZ4 stream.
* important : init this structure content before first use !
* note : only allocated directly the structure if you are statically linking LZ4
* If you are using liblz4 as a DLL, please use below construction methods instead.
*/
typedef struct
{
long long table[LZ4_STREAMSIZE_U64];
} LZ4_stream_t;
/*
* LZ4_resetStream
* Use this function to init an allocated LZ4_stream_t structure
*/
void LZ4_resetStream (LZ4_stream_t* streamPtr);
/*
* LZ4_createStream will allocate and initialize an LZ4_stream_t structure
* LZ4_freeStream releases its memory.
* In the context of a DLL (liblz4), please use these methods rather than the static struct.
* They are more future proof, in case of a change of LZ4_stream_t size.
*/
LZ4_stream_t* LZ4_createStream(void);
int LZ4_freeStream (LZ4_stream_t* streamPtr);
/*
* LZ4_loadDict
* Use this function to load a static dictionary into LZ4_stream.
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
* Loading a size of 0 is allowed.
* Return : dictionary size, in bytes (necessarily <= 64 KB)
*/
int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
/*
* LZ4_compress_fast_continue
* Compress buffer content 'src', using data from previously compressed blocks as dictionary to improve compression ratio.
* Important : Previous data blocks are assumed to still be present and unmodified !
* 'dst' buffer must be already allocated.
* If maxDstSize >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
* If not, and if compressed data cannot fit into 'dst' buffer size, compression stops, and function returns a zero.
*/
int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int maxDstSize, int acceleration);
/*
* LZ4_saveDict
* If previously compressed data block is not guaranteed to remain available at its memory location
* save it into a safer place (char* safeBuffer)
* Note : you don't need to call LZ4_loadDict() afterwards,
* dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue()
* Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error
*/
int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dictSize);
/************************************************
* Streaming Decompression Functions
************************************************/
#define LZ4_STREAMDECODESIZE_U64 4
#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))
typedef struct
{
unsigned long long table[LZ4_STREAMDECODESIZE_U64];
} LZ4_streamDecode_t;
/*
* LZ4_streamDecode_t
* information structure to track an LZ4 stream.
* init this structure content using LZ4_setStreamDecode or memset() before first use !
*
* In the context of a DLL (liblz4) please prefer usage of construction methods below.
* They are more future proof, in case of a change of LZ4_streamDecode_t size in the future.
* LZ4_createStreamDecode will allocate and initialize an LZ4_streamDecode_t structure
* LZ4_freeStreamDecode releases its memory.
*/
LZ4_streamDecode_t* LZ4_createStreamDecode(void);
int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
/*
* LZ4_setStreamDecode
* Use this function to instruct where to find the dictionary.
* Setting a size of 0 is allowed (same effect as reset).
* Return : 1 if OK, 0 if error
*/
int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
/*
*_continue() :
These decoding functions allow decompression of multiple blocks in "streaming" mode.
Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB)
In the case of a ring buffers, decoding buffer must be either :
- Exactly same size as encoding buffer, with same update rule (block boundaries at same positions)
In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).
- Larger than encoding buffer, by a minimum of maxBlockSize more bytes.
maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block.
In which case, encoding and decoding buffers do not need to be synchronized,
and encoding ring buffer can have any size, including small ones ( < 64 KB).
- _At least_ 64 KB + 8 bytes + maxBlockSize.
In which case, encoding and decoding buffers do not need to be synchronized,
and encoding ring buffer can have any size, including larger than decoding buffer.
Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer,
and indicate where it is saved using LZ4_setStreamDecode()
*/
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize);
int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize);
/*
Advanced decoding functions :
*_usingDict() :
These decoding functions work the same as
a combination of LZ4_setStreamDecode() followed by LZ4_decompress_x_continue()
They are stand-alone. They don't need nor update an LZ4_streamDecode_t structure.
*/
int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxDecompressedSize, const char* dictStart, int dictSize);
int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
/**************************************
* Obsolete Functions
**************************************/
/* Deprecate Warnings */
/* Should these warnings messages be a problem,
it is generally possible to disable them,
with -Wno-deprecated-declarations for gcc
or _CRT_SECURE_NO_WARNINGS in Visual for example.
You can also define LZ4_DEPRECATE_WARNING_DEFBLOCK. */
#ifndef LZ4_DEPRECATE_WARNING_DEFBLOCK
# define LZ4_DEPRECATE_WARNING_DEFBLOCK
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# if (LZ4_GCC_VERSION >= 405) || defined(__clang__)
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif (LZ4_GCC_VERSION >= 301)
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
# elif defined(_MSC_VER)
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
# else
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
# define LZ4_DEPRECATED(message)
# endif
#endif /* LZ4_DEPRECATE_WARNING_DEFBLOCK */
/* Obsolete compression functions */
/* These functions are planned to start generate warnings by r131 approximately */
int LZ4_compress (const char* source, char* dest, int sourceSize);
int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
/* Obsolete decompression functions */
/* These function names are completely deprecated and must no longer be used.
They are only provided here for compatibility with older programs.
- LZ4_uncompress is the same as LZ4_decompress_fast
- LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe
These function prototypes are now disabled; uncomment them only if you really need them.
It is highly recommended to stop using these prototypes and migrate to maintained ones */
/* int LZ4_uncompress (const char* source, char* dest, int outputSize); */
/* int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize); */
/* Obsolete streaming functions; use new streaming interface whenever possible */
LZ4_DEPRECATED("use LZ4_createStream() instead") void* LZ4_create (char* inputBuffer);
LZ4_DEPRECATED("use LZ4_createStream() instead") int LZ4_sizeofStreamState(void);
LZ4_DEPRECATED("use LZ4_resetStream() instead") int LZ4_resetStreamState(void* state, char* inputBuffer);
LZ4_DEPRECATED("use LZ4_saveDict() instead") char* LZ4_slideInputBuffer (void* state);
/* Obsolete streaming decoding functions */
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
#if defined (__cplusplus)
}
#endif

View File

@@ -1,9 +1,8 @@
# makefile.in generated by automake 1.11.1 from makefile.am.
# makefile.in generated by automake 1.13.4 from makefile.am.
# include/makefile. Generated from makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,6 +15,51 @@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/cafe
pkgincludedir = $(includedir)/cafe
pkglibdir = $(libdir)/cafe
@@ -34,22 +78,50 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
#am__append_1 = PyCafe_api.h
#am__append_2 = PyCafe.h
#am__append_1 = zbsread.h zbsHash.h zbsdtHelper.h zbsDataHolders.h \
# bitshuffle/bitshuffle_core.h bitshuffle/bitshuffle.h bitshuffle/iochain.h \
# bitshuffle/bitshuffle_internals.h
#if HAVE_PYTHON_
#include_HEADERS += PyCafe_api.h
#endif
am__append_2 = PyCafe.h
#am__append_3 = PyCafe_api.h
subdir = include
DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/makefile.am \
$(srcdir)/makefile.in
DIST_COMMON = $(srcdir)/makefile.in $(srcdir)/makefile.am \
$(am__include_HEADERS_DIST)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/./include/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_$(V))
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__include_HEADERS_DIST = cafe.h cafeCache.h cafeConvert.h \
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__include_HEADERS_DIST = config.h cafe.h cafeCache.h cafeConvert.h \
cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h \
caopCodes.h channelRegalia.h conduit.h \
@@ -57,11 +129,14 @@ am__include_HEADERS_DIST = cafe.h cafeCache.h cafeConvert.h \
conduitFriends.h connect.h defines.h deviceCollection.h \
exceptions.h exceptionsHelper.h global.h enumStrings.h \
granules.h handleHelper.h hashConduit.h helper.h instant.h \
instant.cpp loadCollectionXMLParser.h loadGroupXMLParser.h \
loadCollectionXMLParser.h loadGroupXMLParser.h \
methodCallbacks.h policies.h policyHelper.h PVCtrlHolder.h \
PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h \
tmDateMap.h PyCafe_api.h PyCafe.h
tmDateMap.h zbsread.h zbsHash.h zbsdtHelper.h zbsDataHolders.h \
bitshuffle/bitshuffle_core.h bitshuffle/bitshuffle.h \
bitshuffle/iochain.h bitshuffle/bitshuffle_internals.h \
PyCafe.h PyCafe_api.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -83,57 +158,84 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(include_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
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
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run aclocal-1.11
AMTAR = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run tar
AM_CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
ACLOCAL = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing aclocal-1.13
AMTAR = $${TAR-tar}
AM_CPPFLAGS = -fexceptions -fPIC -std=c++1z -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/ioc/python/latest/include/python3.10 -I/ioc/python/latest/lib/python3.10/site-packages/numpy/core/include
AM_DEFAULT_VERBOSITY = 1
AM_LDFLAGS = -L/usr/local/epics/base/lib/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/RHEL7-x86_64 -L/ioc/python/latest/lib -Wl,-rpath,/ioc/python/latest/lib
AR = ar
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoconf
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoheader
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run automake-1.11
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing autoconf
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing autoheader
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing automake-1.13
AWK = gawk
CAFE_CPPFLAGS = -I$(top_srcdir)/include
CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
CC = /opt/psi/Programming/gcc/9.3.0/bin/gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc -E
CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
CXX = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++
CXXCPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++ -E
CPP = /opt/psi/Programming/gcc/9.3.0/bin/gcc -E
CPPFLAGS = -fexceptions -fPIC -std=c++1z -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/ioc/python/latest/include/python3.10 -I/ioc/python/latest/lib/python3.10/site-packages/numpy/core/include
CXX = /opt/psi/Programming/gcc/9.3.0/bin/g++
CXXCPP = /opt/psi/Programming/gcc/9.3.0/bin/g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = false
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EGREP = /usr/bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
FGREP = /usr/bin/grep -F
GREP = /usr/bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
LDFLAGS = -L/usr/local/epics/base/lib/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/RHEL7-x86_64 -L/ioc/python/latest/lib -Wl,-rpath,/ioc/python/latest/lib
LIBOBJS =
LIBS = -lQtXml -lQtCore
LIBS = -lpython3.10
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
LT_SYS_LIBRARY_PATH =
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
@@ -143,28 +245,30 @@ OTOOL64 =
PACKAGE = cafe
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
PACKAGE_NAME = CAFE
PACKAGE_STRING = CAFE 1.8.0
PACKAGE_STRING = CAFE 1.14.4
PACKAGE_TARNAME = cafe
PACKAGE_VERSION = 1.8.0
PACKAGE_URL =
PACKAGE_VERSION = 1.14.4
PATH_SEPARATOR = :
RANLIB = ranlib
SED = /bin/sed
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 1.8.0
VERSION = 1.14.4
abs_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/include
abs_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/include
abs_top_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
abs_top_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
ac_ct_CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
ac_ct_AR = ar
ac_ct_CC = /opt/psi/Programming/gcc/9.3.0/bin/gcc
ac_ct_CXX =
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
@@ -186,16 +290,15 @@ htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/install-sh
libdir = /opt/gfa/cafe/cpp/cafe-1.8.0-gcc-6.3.0/lib
libdir = /opt/gfa/cafe/cpp/cafe-1.14.4-py310-gcc-9.3.0/lib/RHEL7-x86_64
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
lt_ECHO = echo
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
mkdir_p = $(MKDIR_P)
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /opt/gfa/cafe/cpp/cafe-1.8.0-gcc-6.3.0
prefix = /opt/gfa/cafe/cpp/cafe-1.14.4-py310-gcc-9.3.0
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
@@ -206,18 +309,19 @@ target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.h \
cafeDataTypeHelper.h cafeEnum.h cafeEnumStrings.h cafeRoast.h \
cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h conduit.h \
include_HEADERS = config.h cafe.h cafeCache.h cafeConvert.h \
cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h \
caopCodes.h channelRegalia.h conduit.h \
conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h \
conduitFriends.h connect.h defines.h deviceCollection.h \
exceptions.h exceptionsHelper.h global.h enumStrings.h \
granules.h handleHelper.h hashConduit.h helper.h instant.h \
instant.cpp loadCollectionXMLParser.h loadGroupXMLParser.h \
loadCollectionXMLParser.h loadGroupXMLParser.h \
methodCallbacks.h policies.h policyHelper.h PVCtrlHolder.h \
PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h \
tmDateMap.h $(am__append_1) $(am__append_2)
tmDateMap.h $(am__append_1) $(am__append_2) $(am__append_3)
all: all-am
.SUFFIXES:
@@ -259,8 +363,11 @@ clean-libtool:
-rm -rf .libs _libs
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -274,30 +381,17 @@ uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -309,15 +403,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -326,6 +416,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -377,10 +482,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
@@ -460,24 +570,21 @@ uninstall-am: uninstall-includeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool cscopelist-am ctags ctags-am distclean \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-includeHEADERS
#if HAVE_ZEROMQ
#include_HEADERS += cafeService.h zhelpers.h
#endif
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -3,25 +3,28 @@
## input file for production of cafe library
##
include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h \
conduit.h conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h conduitFriends.h \
include_HEADERS = config.h cafe.h cafeCache.h cafeConvert.h cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h \
conduit.h conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h conduitFriends.h \
connect.h defines.h deviceCollection.h exceptions.h exceptionsHelper.h global.h \
enumStrings.h granules.h handleHelper.h hashConduit.h helper.h instant.h instant.cpp \
enumStrings.h granules.h handleHelper.h hashConduit.h helper.h instant.h \
loadCollectionXMLParser.h loadGroupXMLParser.h methodCallbacks.h policies.h policyHelper.h \
PVCtrlHolder.h PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h tmDateMap.h
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h tmDateMap.h
if HAVE_ZEROMQ_
include_HEADERS += zbsread.h zbsHash.h zbsdtHelper.h zbsDataHolders.h \
bitshuffle/bitshuffle_core.h bitshuffle/bitshuffle.h bitshuffle/iochain.h \
bitshuffle/bitshuffle_internals.h
endif
if HAVE_PYTHON_
#if HAVE_PYTHON_
#include_HEADERS += PyCafe_api.h
#endif
if HAVE_PYCAFE_EXT_
include_HEADERS += PyCafe.h
else
include_HEADERS += PyCafe_api.h
endif
if HAVE_PYCAFE_EXT
include_HEADERS += PyCafe.h
endif
#if HAVE_ZEROMQ
#include_HEADERS += cafeService.h zhelpers.h
#endif

View File

@@ -1,28 +1,33 @@
///
/// \file methodCallbacks.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
/// \date Release: February 2015; Updated: July 2019
/// \version CAFE 1.9.0
///
/// Added handlerGetDescription
#ifndef METHODCALLBACKS_H
#define METHODCALLBACKS_H
#include <config.h>
namespace CALLBACK_CAFE {
namespace CALLBACK_CAFE
{
#if HAVE_PYTHON_H
void PyHandlerPut( struct event_handler_args args);
void PyHandlerGet( struct event_handler_args args);
void PyHandlerPut(struct event_handler_args args);
void PyHandlerGet(struct event_handler_args args);
#endif
void handlerPulseID( struct event_handler_args args) ;
void handlerPut( struct event_handler_args args) ;
void handlerGet( struct event_handler_args args) ;
void handlerGetCtrl( struct event_handler_args args) ;
void handlerGetSTSACK( struct event_handler_args args) ;
void handlerGetClassName( struct event_handler_args args) ;
void handlerPulseID(struct event_handler_args args);
void handlerPut(struct event_handler_args args);
void handlerGet(struct event_handler_args args);
void handlerGetCtrl(struct event_handler_args args);
void handlerGetCtrlAtConnect(struct event_handler_args args); //Python option embedded
void handlerGetSTSACK(struct event_handler_args args);
void handlerGetClassName(struct event_handler_args args);
void handlerGetDescription(struct event_handler_args args);
};
#endif // METHODCALLBACKS_H

View File

@@ -25,6 +25,7 @@
#include <algorithm>
#include <cstring>
#include <iostream>
#include <boost/date_time/posix_time/posix_time.hpp>
//include <config.h> //In the below!
#include <methodCallbacks.h>
@@ -32,11 +33,13 @@
//include <enumStrings.h>
using namespace CAFENUM;
using namespace boost::posix_time;
/**
* Define Policy for printing messages
*/
class PrintErrorPolicy {
class PrintErrorPolicy
{
protected:
bool invalidHandle;
bool info;
@@ -88,15 +91,19 @@ public:
/**
* Define Policy for creating channel; this just sets the priority level
* Define Policy for creating channel; this also sets the priority level
* for dispatch within the server or network
*/
class ChannelCreatePolicy {
class ChannelCreatePolicy
{
private:
unsigned short priority;
//special method to find handle thru conduit_set iterator
pCallbackConnection handler;
bool pyCallbackFlag; //enable pyCallback
void * pyConnectHandler;
public:
static void callbackHandlerCreate(struct connection_handler_args args);
pCallbackConnection getHandler()
@@ -116,7 +123,27 @@ public:
priority=std::min(p,(unsigned short) CA_SERVER_DISPATCH_PRIORITY_MAX);
return priority;
}
ChannelCreatePolicy():priority(CA_SERVER_DISPATCH_PRIORITY_DEFAULT),handler(callbackHandlerCreate) {};
void setPyConnectHandler(void * cythonConnectCallbackFn){
pyConnectHandler=cythonConnectCallbackFn;
}
void * getPyConnectHandler(){
return pyConnectHandler;
}
void setPyCallbackFlag(bool b)
{
pyCallbackFlag=b;
}
bool getPyCallbackFlag() const
{
return pyCallbackFlag;
}
ChannelCreatePolicy():priority(CA_SERVER_DISPATCH_PRIORITY_DEFAULT),
handler(callbackHandlerCreate),
pyCallbackFlag(false),
pyConnectHandler(NULL) {};
};
@@ -124,7 +151,8 @@ public:
* Define Policy to open/close/monitor channels one-by-one
* or to accumulate messages for later dispatch
*/
class ChannelOpenPolicy {
class ChannelOpenPolicy
{
public:
//Constructors
@@ -134,16 +162,20 @@ public:
ChannelOpenPolicy(ChannelFlushSendBufferPolicyKind f,
ChannelWhenToFlushSendBufferPolicyKind w, double t)
{
if (f>=WITH_PEND_EVENT && f<=WITH_POLL) {
if (f>=WITH_PEND_EVENT && f<=WITH_POLL)
{
setFlushSendBufferKind(f);
}
else {
else
{
std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << std::endl;
}
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT) {
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
{
setWhenToFlushSendBuffer(w);
}
else {
else
{
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
}
setTimeout(t), setDefaultTimeout(DEFAULT_TIMEOUT_PEND_EVENT);
@@ -157,7 +189,8 @@ private:
public:
void flushSendBufferNow()
{
switch(flushKind) {
switch(flushKind)
{
case WITH_PEND_EVENT:
ca_pend_event(timeout);
break;
@@ -198,20 +231,24 @@ public:
void setFlushSendBufferKind(ChannelFlushSendBufferPolicyKind f)
{
if (f>=WITH_FLUSH_IO && f<=WITH_POLL) {
if (f>=WITH_FLUSH_IO && f<=WITH_POLL)
{
flushKind=f;
}
else {
else
{
std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << std::endl;
}
};
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w)
{
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT) {
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
{
whenKind=w;
}
else {
else
{
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
}
};
@@ -219,11 +256,13 @@ public:
double setTimeout(double t)
{
if (t<0) {
if (t<0)
{
std::cout << "CHANNELOPENPOLICY:setTimeout " << t << " seconds is an illegal value!" << std::endl;
return timeout;
}
else if (t==0) {
else if (t==0)
{
timeout=0.001;
std::cout << "CHANNELOPENPOLICY:setTimeout " << " A value of zero would block the ioc for ever! "<< std::endl;
std::cout << "CHANNELOPENPOLICY:setTimeout " << " Setting timeout to " << timeout << std::endl;
@@ -234,11 +273,13 @@ public:
double setDefaultTimeout(double t)
{
if (t<0) {
if (t<0)
{
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << t << " seconds is an illegal value!" << std::endl;
return defaultTimeout;
}
else if (t==0) {
else if (t==0)
{
defaultTimeout=0.001;
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " A value of zero would block the ioc for ever! "<< std::endl;
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " Setting timeout to " << defaultTimeout << std::endl;
@@ -254,16 +295,20 @@ public:
void setPolicy(ChannelWhenToFlushSendBufferPolicyKind w, ChannelFlushSendBufferPolicyKind f, double t)
{
if (f>=WITH_FLUSH_IO && f<=WITH_POLL) {
if (f>=WITH_FLUSH_IO && f<=WITH_POLL)
{
flushKind=f;
}
else {
else
{
std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << std::endl;
}
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT) {
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
{
whenKind=w;
}
else {
else
{
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
}
timeout = t;
@@ -277,16 +322,19 @@ public:
/**
* Define Policy to control datatype conversion for data transfer
*/
class ChannelRequestDataTypePolicy {
class ChannelRequestDataTypePolicy
{
private:
CAFENUM::ChannelRequestDataTypePolicyKind requestKind;
public:
void setRequestKind(CAFENUM::ChannelRequestDataTypePolicyKind rk)
{
if (rk>=CAFENUM::NATIVE_DATATYPE && rk<=CAFENUM::LOWEST_DATATYPE) {
if (rk>=CAFENUM::NATIVE_DATATYPE && rk<=CAFENUM::LOWEST_DATATYPE)
{
requestKind=rk;
}
else {
else
{
std::cout << rk << " is an INVALID ChannelDataTypePolicyKind" << std::endl;
}
};
@@ -308,16 +356,19 @@ public:
/**
* Define Policy to control wait/nowait strategy in getCache operations
*/
class ChannelGetCacheWaitPolicy {
class ChannelGetCacheWaitPolicy
{
private:
CAFENUM::ChannelGetCacheWaitPolicyKind getCacheWaitKind;
public:
void setWaitKind(CAFENUM::ChannelGetCacheWaitPolicyKind wk)
{
if (wk>=CAFENUM::GET_CACHE_NO_CHECK && wk<=CAFENUM::GET_CACHE_WAIT) {
if (wk>=CAFENUM::GET_CACHE_NO_CHECK && wk<=CAFENUM::GET_CACHE_WAIT)
{
getCacheWaitKind=wk;
}
else {
else
{
std::cout << wk << " is an INVALID ChannelGetCacheWaitKind" << std::endl;
}
};
@@ -327,7 +378,7 @@ public:
return getCacheWaitKind;
}
//Constructors
ChannelGetCacheWaitPolicy():getCacheWaitKind(CAFENUM::GET_CACHE_WAIT) {};
ChannelGetCacheWaitPolicy():getCacheWaitKind(CAFENUM::GET_CACHE_NO_CHECK) {};
ChannelGetCacheWaitPolicy(CAFENUM::ChannelGetCacheWaitPolicyKind wk)
{
getCacheWaitKind=wk;
@@ -339,16 +390,19 @@ public:
/**
* Define Policy to control whether the get operations targets the ioc or not when there is a monitor
*/
class ChannelGetActionWhenMonitorPolicy {
class ChannelGetActionWhenMonitorPolicy
{
private:
CAFENUM::ChannelGetActionWhenMonitorPolicyKind getActionWhenMonitorKind;
public:
void setActionKind(CAFENUM::ChannelGetActionWhenMonitorPolicyKind ak)
{
if (ak>=CAFENUM::GET_FROM_CACHE && ak<=CAFENUM::GET_FROM_IOC) {
if (ak>=CAFENUM::GET_FROM_CACHE && ak<=CAFENUM::GET_FROM_IOC)
{
getActionWhenMonitorKind=ak;
}
else {
else
{
std::cout << ak << " is an INVALID ChannelGetActionWhenMonitorKind" << std::endl;
}
};
@@ -373,7 +427,8 @@ public:
* event of an ECA_TIMEOUT error; deltaTimeout gives the
* increment in timeout for each additional attempt.
*/
class ChannelTimeoutPolicy {
class ChannelTimeoutPolicy
{
private:
bool selfGoverningTimeout;
double timeout;
@@ -440,7 +495,8 @@ public:
* Define Policy to get/set channels whether in blocking/non-blocking mode:
* Blocking can be achieved with or without callback
*/
class ChannelRequestPolicy {
class ChannelRequestPolicy
{
private:
ChannelWhenToFlushSendBufferPolicyKind whenKind; // used for set
@@ -450,7 +506,7 @@ private:
pCallback handler; // for blockingKind=WITH_CALLBACK_DEFAULT or WITH_CALLBACK_USER_SUPPLIED
int callbackStatus; // used by CAFE::waitForGetEvent() to record status of callback
void * cyCallback; // callback provide by python client
public:
ChannelWhenToFlushSendBufferPolicyKind getWhenToFlushSendBuffer() const
@@ -477,53 +533,71 @@ public:
return callbackStatus;
};
void setHandler(pCallback h)
{
if (h!=NULL) {
if (h!=NULL)
{
handler=h;
methodKind=WITH_CALLBACK_USER_SUPPLIED;
}
};
#if HAVE_PYTHON_H
void setPyHandlerGet()
void setPyHandlerGet(void * cythonCallback)
{
cyCallback=cythonCallback;
handler= CALLBACK_CAFE::PyHandlerGet;
methodKind=WITH_CALLBACK_USER_SUPPLIED;
}; //CAFE_CALLBACK::PyHandlerGet
void setPyHandlerPut()
};
//CAFE_CALLBACK::PyHandlerGet
void setPyHandlerPut(void * cythonCallback)
{
cyCallback=cythonCallback;
handler= CALLBACK_CAFE::PyHandlerPut;
methodKind=WITH_CALLBACK_USER_SUPPLIED;
}; //CAFE_CALLBACK::PyHandlerPut
};
//CAFE_CALLBACK::PyHandlerPut
void * getCyCallback() const
{
return cyCallback;
};
#endif
void setMethodKind(ChannelRequestPolicyKind m)
{
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED) {
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
{
methodKind=m;
}
else {
else
{
std::cout << m << " is an INVALID ChannelRequestPolicyKind" << std::endl;
}
};
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w)
{
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT) {
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
{
whenKind=w;
}
else {
else
{
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
}
};
void setWaitKind(ChannelWaitForResponsePolicyKind r)
{
if (r>=WAIT && r<=NO_WAIT) {
if (r>=WAIT && r<=NO_WAIT)
{
waitKind=r;
}
else {
else
{
std::cout << r << " is an INVALID ChannelWaitForResponsePolicyKind" << std::endl;
}
};
@@ -537,32 +611,39 @@ public:
ChannelWhenToFlushSendBufferPolicyKind w, ChannelWaitForResponsePolicyKind r,
ChannelRequestPolicyKind m)
{
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT) {
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
{
whenKind=w;
}
else {
else
{
std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;
std::cout << "Sticking to default value ChannelWhenToFlushSendBufferPolicyKind=" << whenKind << std::endl;
}
if (r>=WAIT && r<=NO_WAIT) {
if (r>=WAIT && r<=NO_WAIT)
{
waitKind=r;
}
else {
else
{
std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
std::cout << r<< " is an INVALID ChannelWaitForResponsePolicyKind" << std::endl;
std::cout << "Sticking to default value ChannelWaitForRespomsePolicyKind=" << waitKind << std::endl;
}
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED) {
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
{
methodKind=m;
}
else {
else
{
std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
std::cout << r<< " is an INVALID ChannelRequestPolicyKind" << std::endl;
std::cout << "Sticking to default value ChannelRequestPolicyKind=" << methodKind << std::endl;
}
if (methodKind==WITHOUT_CALLBACK && waitKind==NO_WAIT) {
if (methodKind==WITHOUT_CALLBACK && waitKind==NO_WAIT)
{
std::cout << "WARNING when setting ChannelRequestPolicy " << std::endl;
std::cout << "waitKind=NO_WAIT does not apply when methodKind=WITHOUT_CALLBACK " << std::endl;
@@ -572,7 +653,7 @@ public:
//Constructors
ChannelRequestPolicy():
whenKind(FLUSH_AFTER_EACH_MESSAGE),waitKind(WAIT),methodKind(WITH_CALLBACK_DEFAULT), //WITHOUT_CALLBACK),
callbackStatus(ICAFE_NORMAL)
callbackStatus(ICAFE_NORMAL), cyCallback(NULL)
{
handler=NULL;
@@ -580,13 +661,16 @@ public:
ChannelRequestPolicy(ChannelRequestPolicyKind b)
{
if (b>=WITHOUT_CALLBACK && b<=WITH_CALLBACK_USER_SUPPLIED) {
if (b>=WITHOUT_CALLBACK && b<=WITH_CALLBACK_USER_SUPPLIED)
{
methodKind=b;
}
else {
else
{
std::cout << b << " is anINVALID ChannelRequestPolicyKind" << std::endl;
}
handler=NULL;
cyCallback=NULL;
callbackStatus=ICAFE_NORMAL;
whenKind=FLUSH_AFTER_EACH_MESSAGE;
waitKind=WAIT;
@@ -595,6 +679,7 @@ public:
ChannelRequestPolicy(pCallback h)
{
handler=h;
cyCallback=NULL;
methodKind=WITH_CALLBACK_DEFAULT;
whenKind=FLUSH_AFTER_EACH_MESSAGE;
waitKind=WAIT;
@@ -613,7 +698,8 @@ public:
* The monitor is rather placed in a monitor_in_waiting
* pseudo-queue and only started upon connection
*/
class MonitorPolicy {
class MonitorPolicy
{
friend class Conduit;
friend class Connect;
private:
@@ -624,15 +710,20 @@ private:
unsigned int nelem; //2
//chid channelID; //3
unsigned int mask; //4
pCallback handler;//5
void * userArgs; //6
pCallback handler; //5
void * cyCallback;
unsigned short nCyCallbackParameters; // 1=handle, 2=handle,pv 3=handle,pv,pvdata
void * userArgs; //6 handle
evid eventID; //output
int status; //output
unsigned int id;
unsigned short notifyDeltaMilliSeconds; // Nov. 2020; push to Python Widgets
ptime lastUpdate;
static void PyCallbackHandlerMonitorData(struct event_handler_args args); //pushes handle, pvname, pvdata
static void PyCallbackHandlerMonitor(struct event_handler_args args); //pushes handle, pvname
//static void PyCallbackHandlerHandle(struct event_handler_args args); //pushes handle
static void PyCallbackHandlerMonitorData(struct event_handler_args args); //pushes pvd,handle,pvname
static void PyCallbackHandlerMonitor(struct event_handler_args args); //pushes handle
void setEventID(evid e)
{
@@ -644,11 +735,14 @@ public:
dbrDataType((CAFE_DATATYPE) CAFE_NOT_REQUESTED),
cafeDbrType((CAFENUM::DBR_TYPE) CAFENUM::DBR_TIME),
nelem(0), mask(DBE_VALUE | DBE_LOG | DBE_ALARM),
handler(callbackHandlerMonitor), userArgs(NULL), eventID(NULL),
status(ICAFE_NORMAL)
handler(callbackHandlerMonitor), cyCallback(NULL),
nCyCallbackParameters(1), userArgs(NULL), eventID(NULL),
status(ICAFE_NORMAL), notifyDeltaMilliSeconds(0)
{
++idNext;
id = idNext;
ptime timeNow(min_date_time);
lastUpdate = timeNow;
};
//Make public
static void callbackHandlerMonitor(struct event_handler_args args);
@@ -701,6 +795,17 @@ public:
(mask & DBE_ALARM) ? has=true : has=false;
return has;
}; //1
void * getCyCallback() const
{
return cyCallback;
};
unsigned short getNoCyCallbackParameters() const
{
return nCyCallbackParameters;
};
pCallback getHandler() const
{
return handler;
@@ -720,33 +825,85 @@ public:
{
return eventID;
};
unsigned int getMonitorID() const
{
return id;
};
int getStatus() const
{
return status;
};
unsigned int getID() const
{
return id;
};
unsigned int getMonitorID() const
{
return id;
};
ptime getLastUpdate() const
{
return lastUpdate;
};
unsigned short getNotifyDeltaMilliSeconds() const
{
return notifyDeltaMilliSeconds;
};
int getStatus() const
{
return status;
};
void setMask(unsigned int m)
{
mask=m;
};
void setNotifyDeltaMilliSeconds(unsigned short deltaMS)
{
notifyDeltaMilliSeconds = deltaMS;
};
void setLastUpdate(ptime new_ptime)
{
lastUpdate = new_ptime;
};
void setCyCallback(void * cythonCallback){
cyCallback=cythonCallback;
}
void setNoCyCallbackParameters(unsigned int nCyCbParam){
nCyCallbackParameters = nCyCbParam;
}
//void setPyCyHandlerHandle(void * cythonCallback)
//{
// handler= PyCallbackHandlerHandle;
// cyCallback=cythonCallback;
//};
void setPyCyHandler(void * cythonCallback)
{
handler= PyCallbackHandlerMonitor;
cyCallback=cythonCallback;
};
void setPyHandler()
{
handler= PyCallbackHandlerMonitor;
};
void setPyCyHandlerData(void * cythonCallback)
{
handler= PyCallbackHandlerMonitorData;
cyCallback=cythonCallback;
};
void setPyHandlerData()
{
handler= PyCallbackHandlerMonitorData;
};
void setDefaultHandler()
{
handler= callbackHandlerMonitor;
@@ -762,14 +919,17 @@ public:
};
void setDataType(chtype dt)
{
if (dt < DBR_PUT_ACKT) {
if (dt < DBR_PUT_ACKT)
{
dataType=dt%(LAST_TYPE+1);
}
else {
else
{
std::cout << "monitorPolicy FUNNY! " << dt << " is an INVALID DATATYPE! " << std::endl;
return;
}
switch(cafeDbrType) {
switch(cafeDbrType)
{
case CAFENUM::DBR_TIME:
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
break;
@@ -792,16 +952,19 @@ public:
void setCafeDbrType( CAFENUM::DBR_TYPE cdt)
{
if (cdt > DBR_PUT) {
if (cdt > DBR_PUT)
{
std::cout << "monitorPolicy FUNNY! " << cdt << " is an INVALID CAFENUM::DBR_TYPE! " << std::endl;
return;
}
else {
else
{
cafeDbrType=cdt;
}
//std::cout << "monitorPolicy Class: " << " cafeDbrType = " << cafeDbrType << std::endl;
//std::cout << "setDataType: " << dataType << std::endl;
switch(cafeDbrType) {
switch(cafeDbrType)
{
case CAFENUM::DBR_TIME:
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
break;
@@ -823,8 +986,6 @@ public:
//std::cout << "monitorPolicy Class: " << " dbrDataType = " << dbrDataType << std::endl;
}
void setUserArgs(void * u)
{
userArgs=u;

View File

@@ -5,20 +5,25 @@
/// \version CAFE 1.0.0
///
#include <config.h>
#if HAVE_LIBQTXML
#ifndef RESTOREPVGROUPXMLPARSER_H
#define RESTOREPVGROUPXMLPARSER_H
#include <config.h>
#if HAVE_LIBQTXML
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <PVGroup.h>
//include <QtXml/QXmlDefaultHandler>
#include <QXmlDefaultHandler>
#include <QtXml/QXmlDefaultHandler>
class restorePVGroupXMLParser : public QXmlDefaultHandler {
class restorePVGroupXMLParser : public QXmlDefaultHandler
{
public:
restorePVGroupXMLParser();
virtual ~restorePVGroupXMLParser();
@@ -29,7 +34,8 @@ public:
PVGroup group;
private:
enum {
enum
{
NotWaiting,
WaitingForConfig,
WaitingForNPV,

View File

@@ -33,6 +33,7 @@ const unsigned short ICAFE_STATUS_BASE = 600;
const unsigned short ICAFE_STATUS_CS = ICAFE_STATUS_BASE;
const unsigned short ICAFE_STATUS_CFT = 700; // ca_field_type
const unsigned short ICAFE_STATUS_CA_OP = 800;
const unsigned short ICAFE_STATUS_DAQ = 900; // for use in HLAs
const unsigned short ICAFE_STATUS_ERROR = 1000;
const unsigned short ICAFE_FILE_ERROR = 1100;
const unsigned short ICAFE_SERVICE_ERROR =1200;
@@ -44,7 +45,6 @@ const unsigned short ICAFE_SUCCESS = ECA_NORMAL;
const unsigned short ICAFE_NORMAL = ECA_NORMAL;
enum CAFE_CS_STATE { ICAFE_CS_NEVER_CONN=ICAFE_STATUS_CS,
ICAFE_CS_PREV_CONN,
ICAFE_CS_CONN,
@@ -75,6 +75,11 @@ enum CAFE_CC_STATE { ICAFE_CA_OP_GET=ICAFE_STATUS_CA_OP,
ICAFE_CA_OP_CONN_DOWN
};
enum CAFE_DAQ_STATE { ICAFE_DAQ_RUN= ICAFE_STATUS_DAQ,
ICAFE_DAQ_PAUSED,
ICAFE_DAQ_STOPPED
};
enum CAFE_ERROR_STATE { ECAFE_NODATA=ICAFE_STATUS_ERROR,
ECAFE_INVALID_TYPE,
ECAFE_BADCOUNT,
@@ -160,7 +165,8 @@ enum EPICS_GLOBAL_ALARM_CONDITION {STAT_NO_ALARM=0, STAT_READ, STAT_WRITE, STAT_
enum EPICS_GLOBAL_ALARM_SEVERITY {SEV_NO_ALARM=0, SEV_MINOR, SEV_MAJOR, SEV_INVALID};
class CAFEGlobalAlarmCondition {
class CAFEGlobalAlarmCondition
{
typedef std::map<int, std::string> mapIntString;
private:
@@ -201,12 +207,14 @@ public:
{
pos = mapAlarmCondition.find(i);
if (pos != mapAlarmCondition.end()) {
if (pos != mapAlarmCondition.end())
{
return pos->second;
}
std::ostringstream oss;
if (i == -1) {
if (i == -1)
{
oss << "NO_DATA" ;
return oss.str();
}
@@ -221,9 +229,9 @@ public:
int asInt (std::string message)
{
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos)
{
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
@@ -244,7 +252,8 @@ public:
vecI.clear();
vecI.reserve(mapAlarmCondition.size());
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos)
{
vecI.push_back(pos->first);
vecS.push_back(pos->second);
}
@@ -257,11 +266,14 @@ public:
std::cout << "-------------------" << std::endl;
std::cout << "EPICS GLOBAL ALARM CONDITION LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
if (pos->first < 10) {
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos)
{
if (pos->first < 10)
{
std::cout << " " << pos->first << " " << pos->second << std::endl;
}
else {
else
{
std::cout << pos->first << " " << pos->second << std::endl;
}
}
@@ -272,7 +284,8 @@ public:
class CAFEGlobalAlarmSeverity {
class CAFEGlobalAlarmSeverity
{
typedef std::map<int, std::string> mapIntString;
private:
@@ -294,13 +307,15 @@ public:
{
pos = mapAlarmSeverity.find(i);
if (pos != mapAlarmSeverity.end()) {
if (pos != mapAlarmSeverity.end())
{
return pos->second;
}
std::ostringstream oss;
if (i == -1) {
if (i == -1)
{
oss << "NO_DATA" ;
return oss.str();
}
@@ -316,7 +331,8 @@ public:
int asInt (std::string message)
{
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos)
{
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
@@ -337,7 +353,8 @@ public:
vecI.clear();
vecI.reserve(mapAlarmSeverity.size());
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos)
{
vecI.push_back(pos->first);
vecS.push_back(pos->second);
@@ -350,7 +367,8 @@ public:
std::cout << "-------------------" << std::endl;
std::cout << "EPICS GLOBAL ALARM SEVERITY LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "------------------" << std::endl;
@@ -414,6 +432,9 @@ public:
* 709 ICAFE_SET_AND_GET_MISMATCH \n
* 806 ICAFE_CA_OP_CONN_UP \n
* 807 ICAFE_CA_OP_CONN_DOWN \n
* 900 ICAFE_DAQ_RUN \n
* 901 ICAFE_DAQ_PAUSED \n
* 902 ICAFE_DAQ_STOPPED \n
* 1000 ECAFE_NODATA \n
* 1001 ECAFE_INVALID_TYPE \n
* 1002 ECAFE_BADCOUNT \n
@@ -463,13 +484,14 @@ public:
* 1502 ECAFE_BSREAD_PARSEFAIL_DATAHEADER \n
* 1503 ECAFE_BSREAD_ZMQSTREAM_NULL \n
* 5004 ERRNO_EINTR \n
* 5011 ERRNO_EGAIN \n
* 5011 ERRNO_EAGAIN \n
* 5014 ERRNO_EFAULT \n
* 5022 ERRNO_EINVAL Invalid argument \n
* 5088 ERRNO_ENOTSOCK \n
* 5093 ERRNO_EPROTONOSUPPORT \n
*/
class CAFEStatusInfo {
class CAFEStatusInfo
{
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapStatusInfo;
@@ -499,8 +521,11 @@ public:
mapStatusInfo.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "Channel disconnected. Monitor will be started on connection "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "Handle has monitor, hence data retrieved from cache "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "Set and Get values from SetAndGetMethod do not match"));
mapStatusInfo.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "Set and Get values from SetAndGetMethod do not match "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_DAQ_RUN, "HLA DAQ in progress " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_DAQ_PAUSED, "HLA DAQ has been paused " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_DAQ_STOPPED, "HLA DAQ has been stopped " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NODATA, "Requested data transfer is of zero length! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_TYPE, "Invalid data type! " ));
@@ -583,13 +608,16 @@ public:
std::string message (int i)
{
if (i<ICAFE_STATUS_BASE) {
if (i<ICAFE_STATUS_BASE)
{
std::string c= ca_message(i);
return c;
}
else {
else
{
posStatusInfo = mapStatusInfo.find(i);
if (posStatusInfo != mapStatusInfo.end()) {
if (posStatusInfo != mapStatusInfo.end())
{
return posStatusInfo->second;
}
@@ -609,7 +637,8 @@ public:
std::cout << "-----------------------" << std::endl;
std::cout << "CAFE ERROR MESSAGE LIST" << std::endl;
std::cout << "-----------------------" << std::endl;
for (posStatusInfo=mapStatusInfo.begin(); posStatusInfo != mapStatusInfo.end(); ++posStatusInfo) {
for (posStatusInfo=mapStatusInfo.begin(); posStatusInfo != mapStatusInfo.end(); ++posStatusInfo)
{
std::cout << posStatusInfo->first << " " << posStatusInfo->second << std::endl;
}
std::cout << "------------------" << std::endl;
@@ -620,7 +649,8 @@ public:
class CAFEStatusCode {
class CAFEStatusCode
{
typedef std::map<int, std::string> mapLongString;
private:
@@ -674,17 +704,21 @@ public:
mapStatusCode.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "CHANNEL FIELD TYPE: ICAFE_CFT_TYPENOTCONN"));
mapStatusCode.insert(std::make_pair((int) ICAFE_RULE_FALSE, "CAFE INFO: ICAFE_RULE_FALSE"));
mapStatusCode.insert(std::make_pair((int) ICAFE_BADCOUNT, "CAFE INFO: ICAFE_BADCOUNT"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "CAFE_INFO: ICAFE_CALLBACK_NOT_YET_INVOKED"));
mapStatusCode.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "CAFE_INFO: ICAFE_WAITING_FOR_PREV_CALLBACK"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "CAFE_INFO:ICAFE_CACHE_EMPTY"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "CAFE_INFO: ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "CHANNEL CONNECTION: ICAFE_CC_OP_CONN_UP" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_CC_OP_CONN_DOWN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "CAFE INFO: ICAFE_CALLBACK_NOT_YET_INVOKED"));
mapStatusCode.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "CAFE INFO: ICAFE_WAITING_FOR_PREV_CALLBACK"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "CAFE INFO:ICAFE_CACHE_EMPTY"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "CAFE INFO: ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "CHANNEL CONNECTION: ICAFE_CA_OP_CONN_UP" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_CA_OP_CONN_DOWN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_MONITOR_DELAYED_AS_CONN_DOWN"));
mapStatusCode.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "CAFE_INFO: ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE"));
mapStatusCode.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "CAFE INFO: ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE"));
mapStatusCode.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "CAFE_INFO: ICAFE_SET_AND_GET_MISMATCH"));
mapStatusCode.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "CAFE INFO: ICAFE_SET_AND_GET_MISMATCH"));
mapStatusCode.insert(std::make_pair((int) ICAFE_DAQ_RUN, "CAFE INFO: ICAFE_DAQ_RUN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_DAQ_PAUSED, "CAFE INFO: ICAFE_DAQ_PAUSED" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_DAQ_STOPPED, "CAFE INFO: ICAFE_DAQ_STOPPED" ));
mapStatusCode.insert(std::make_pair((int) ECAFE_NODATA, "CAFE ERROR: ECAFE_NODATA"));
mapStatusCode.insert(std::make_pair((int) ECAFE_BADCOUNT, "CAFE ERROR: ECAFE_BADCOUNT"));
@@ -756,7 +790,8 @@ public:
{
pos = mapStatusCode.find(i);
if (pos != mapStatusCode.end()) {
if (pos != mapStatusCode.end())
{
return pos->second;
}
@@ -776,13 +811,16 @@ public:
vecI.clear();
vecI.reserve(mapStatusCode.size());
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos)
{
std::size_t found = (pos->second).find(": ");
if (found!=std::string::npos) {
if (found!=std::string::npos)
{
vecS.push_back((pos->second).substr(found+2,(pos->second).length()));
}
else {
else
{
vecS.push_back(pos->second);
}
vecI.push_back(pos->first);
@@ -794,13 +832,16 @@ public:
{
pos = mapStatusCode.find(i);
if (pos != mapStatusCode.end()) {
if (pos != mapStatusCode.end())
{
std::size_t found = (pos->second).find(": ");
if (found!=std::string::npos) {
if (found!=std::string::npos)
{
return (pos->second).substr(found+2,(pos->second).length());
}
else {
else
{
return pos->second;
}
}
@@ -815,7 +856,8 @@ public:
int enumIs (std::string message)
{
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos)
{
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
@@ -826,10 +868,12 @@ public:
bool isTimeout(int statusCodeToCheck)
{
if (statusCodeToCheck==ECA_TIMEOUT || statusCodeToCheck==ECAFE_TIMEOUT) {
if (statusCodeToCheck==ECA_TIMEOUT || statusCodeToCheck==ECAFE_TIMEOUT)
{
return true;
}
else {
else
{
return false;
}
}
@@ -839,7 +883,8 @@ public:
std::cout << "-------------------" << std::endl;
std::cout << "CAFE ERROR CODE LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "------------------" << std::endl;
@@ -849,7 +894,8 @@ public:
class CAFEStatusSeverity {
class CAFEStatusSeverity
{
typedef std::map<int, std::string> mapLongString;
private:
@@ -874,7 +920,7 @@ public:
mapStatusSeverity.insert(std::make_pair(ECA_EVDISALLOW, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_BADMONID, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_BADMASK, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_IODONE, "INFO"));
mapStatusSeverity.insert(std::make_pair(ECA_IODONE, "INFO"));
mapStatusSeverity.insert(std::make_pair(ECA_IOINPROGRESS, "INFO"));
mapStatusSeverity.insert(std::make_pair(ECA_BADSYNCGRP, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_PUTCBINPROG, "ERROR"));
@@ -915,6 +961,10 @@ public:
mapStatusSeverity.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_DAQ_RUN, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_DAQ_PAUSED, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_DAQ_STOPPED, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NODATA, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADCOUNT, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADSTR, "ERROR"));
@@ -984,7 +1034,8 @@ public:
std::string message (int i)
{
pos = mapStatusSeverity.find(i);
if (pos != mapStatusSeverity.end()) {
if (pos != mapStatusSeverity.end())
{
return pos->second;
}
@@ -997,7 +1048,8 @@ public:
int enumIs (std::string message)
{
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos)
{
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
@@ -1011,7 +1063,8 @@ public:
std::cout << "-------------------" << std::endl;
std::cout << "CAFE STATUS SEVERITY LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "------------------" << std::endl;
@@ -1027,7 +1080,8 @@ public:
//code: SUCCESS: ECA_NORMAL
//info: Normal successful completion
//message: SUCCESS: ECA_NORMAL Normal successful completion
class CAFEStatus {
class CAFEStatus
{
public:
CAFEStatusSeverity css;

View File

@@ -11,7 +11,8 @@
#include <string>
#include <map>
enum TM_WDAY {
enum TM_WDAY
{
TM_SUNDAY = 0,
TM_MONDAY = 1,
TM_TUESDAY = 2,
@@ -22,7 +23,8 @@ enum TM_WDAY {
};
enum TM_MONTHP {
enum TM_MONTHP
{
TM_JAN = 1,
TM_FEB = 2,
TM_MAR = 3,
@@ -42,7 +44,8 @@ enum TM_MONTHP {
* Provides methods to convert between
* the TM_WDAY and text equivalent
*/
class TMwdayText {
class TMwdayText
{
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapDataType;
@@ -56,7 +59,7 @@ public:
mapDataType.insert(std::make_pair((int) TM_WEDNESDAY, "Wed" ));
mapDataType.insert(std::make_pair((int) TM_THURSDAY, "Thu" ));
mapDataType.insert(std::make_pair((int) TM_FRIDAY, "Fri" ));
mapDataType.insert(std::make_pair((int) TM_SATURDAY, "Sat" ));
mapDataType.insert(std::make_pair((int) TM_SATURDAY, "Sat" ));
};
~TMwdayText() {};
@@ -101,7 +104,8 @@ public:
std::cout << "------------------" << std::endl;
std::cout << "TM_WDAY LIST" << std::endl;
std::cout << "------------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "-----------------" << std::endl;
@@ -117,7 +121,8 @@ public:
* Provides methods to convert between
* the TM_WDAY and text equivalent
*/
class TMmonthpText {
class TMmonthpText
{
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapDataType;
@@ -137,7 +142,7 @@ public:
mapDataType.insert(std::make_pair((int) TM_OCT, "Oct" ));
mapDataType.insert(std::make_pair((int) TM_NOV, "Nov" ));
mapDataType.insert(std::make_pair((int) TM_DEC, "Dec" ));
};
~TMmonthpText() {};
@@ -182,7 +187,8 @@ public:
std::cout << "------------------" << std::endl;
std::cout << "TM_MONTH(+1) LIST" << std::endl;
std::cout << "------------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
{
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "-----------------" << std::endl;

View File

@@ -28,7 +28,7 @@
template <class CTYPE> class Transpose {
public:
Transpose () {};
Transpose () {useHandleHelper = true;};
~Transpose () {};
HandleHelper handleHelper;
@@ -109,6 +109,8 @@ private:
chtype _dataTypeClient;
char stig [MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
bool useHandleHelper; //instantiating global extern cs for use in pybind11
};
@@ -269,8 +271,15 @@ template <class CTYPE> int Transpose<CTYPE>::put(const unsigned int _handle,
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
cafeConduit_set_by_handle::iterator it_handle;
if (useHandleHelper) {
it_handle = handleHelper.getIterFromHandle(_handle);
}
else {
it_handle = handle_index.find(_handle);
}
it_handle = handle_index.find(_handle);
if (it_handle != handle_index.end()) {
@@ -711,7 +720,7 @@ template <class CTYPE> int Transpose<CTYPE>::put(const unsigned int _handle,
//long Transpose<CAFE_DATATYPE_UNION>::put( const unsigned int _handle,
// CAFE_DATATYPE_UNION_SEQ val, CAFE_DATATYPE cdt)
template <class CTYPE> int Transpose<CTYPE>::put( const unsigned int _handle,
template <class CTYPE> int Transpose<CTYPE>::put( const unsigned int _handle,
CAFE_DATATYPE_UNION_SEQ val, CAFE_DATATYPE cdt)
{
#define __METHOD__ "Transpose<CTYPE>::put()"
@@ -720,7 +729,13 @@ template <class CTYPE> int Transpose<CTYPE>::put( const unsigned int _handle,
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(_handle);
if (useHandleHelper) {
it_handle = handleHelper.getIterFromHandle(_handle);
}
else {
it_handle = handle_index.find(_handle);
}
if (it_handle != handle_index.end()) {
@@ -987,7 +1002,14 @@ template <class CTYPE> int Transpose<CTYPE>::putString
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(_handle);
if (useHandleHelper) {
it_handle = handleHelper.getIterFromHandle(_handle);
}
else {
it_handle = handle_index.find(_handle);
}
if (it_handle != handle_index.end()) {
@@ -1264,7 +1286,7 @@ template <class CTYPE> int Transpose<CTYPE>::putString
/**
* \brief Retrieves data transmitted by CA with dbrTypeRequest_DataBuffer
* and then converts to CTYPE i.e. _dataTypeClient
* and then converts to CTYPE i.e. _dataTypeClient
* \param _handle input: handle to Conduit object
* \param val output: CTYPE datatype
* \param alarmStatus output: dbr_short_t
@@ -1281,7 +1303,19 @@ template <class CTYPE> int Transpose<CTYPE>::get(
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(_handle);
//pybind11 fix
//cafeConduit_set_by_handle & handle_index = helper.getcsHandleIndex();
if (useHandleHelper) {
it_handle = handleHelper.getIterFromHandle(_handle);
}
else {
it_handle = handle_index.find(_handle);
}
//std::cout << __FILE__ << "//" << __METHOD__ << std::endl;
@@ -1345,14 +1379,23 @@ template <class CTYPE> int Transpose<CTYPE>::get(
dbrTypeRequest_DataBuffer = (*it_handle).getChannelRequestMetaData().getDbrDataType();
_dataTypeClient = (*it_handle).getChannelRequestMetaDataClient().getDataType();
//if (_handle==1) {
// _dataTypeClient=DBR_FLOAT;
//}
//std::cout << "WHAT IS ON THE DATA BUFFER = " << dbrTypeRequest_DataBuffer << std::endl;
//std::cout << "WHAT THE CLIENT WANTS = " << _dataTypeClient << std::endl;
////dbr_string_t * val2 = new dbr_string_t[nelem];
ts.secPastEpoch=0;
ts.nsec =0;
alarmStatus =-1;
alarmSeverity =-1;
//This will happen for DBF_NO_ACCESS = 7
// in which case do not use dbr_type_to_text !!
if (_dataTypeClient < DBR_STRING || _dataTypeClient > DBR_DOUBLE) {
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
@@ -1735,15 +1778,25 @@ template <class CTYPE> int Transpose<CTYPE>::get(
default:
switch(_dataTypeClient) {
case DBR_STRING:
memcpy( val, &(&((PVDataL)->strval))[offset], sizeof(dbr_string_t)*nelem);
//DEFINE stringf array then copy to CTYPE
memcpy( val, &(&((PVDataL)->tstrval.value))[offset], sizeof(dbr_string_t)*nelem);
//for (unsigned int i=0; i<nelem; ++i) {
// val[i]= (CTYPE) strtod( val2[i], NULL);
//}
break;
case DBR_SHORT:
case DBR_LONG:
case DBR_ENUM:
case DBR_CHAR:
for (unsigned int i=0; i<nelem; ++i) {
val[i]= (CTYPE) strtol( (*(&((PVDataL)->tstrval.value)+i+offset)), NULL, 0);
}
}
break;
case DBR_FLOAT:
case DBR_DOUBLE:
@@ -1767,6 +1820,7 @@ template <class CTYPE> int Transpose<CTYPE>::get(
handleHelper.setSTS(_handle, alarmStatus, alarmSeverity, ts);
}
////delete [] val2;
}
else {
cafeStatus.report(ECAFE_INVALID_HANDLE);
@@ -1820,7 +1874,14 @@ template <class CTYPE> int Transpose<CTYPE>::getCtrl (
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(_handle);
if (useHandleHelper) {
it_handle = handleHelper.getIterFromHandle(_handle);
}
else {
it_handle = handle_index.find(_handle);
}
if (it_handle != handle_index.end()) {

1416
include/zbsDataHolders.h Normal file

File diff suppressed because it is too large Load Diff

77
include/zbsHash.h Normal file
View File

@@ -0,0 +1,77 @@
///
/// \file zbsHash.h
/// \author Jan Chrin, PSI
/// \date Release: January 2018
/// \version CAFE 1.6
#ifndef ZBSHASH_H
#define ZBSHASH_H
// boost include
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/tokenizer.hpp>
using boost::multi_index_container;
using namespace boost::multi_index;
struct bsreadContainer
{
long by_bsID;
std::string by_bsName;
bsreadContainer(long _id, std::string _name):by_bsID(_id),by_bsName(_name) {};
friend std::ostream& operator<<(std::ostream& os, const bsreadContainer& m)
{
//os<<m.by_bsID << " " << m.by_bsName << std::endl;
os << m.by_bsName << std::endl;
return os;
}
};
struct by_bsID {};
struct by_bsName {};
typedef multi_index_container<
bsreadContainer,
indexed_by<
ordered_unique<
tag<by_bsName>, BOOST_MULTI_INDEX_MEMBER(bsreadContainer, std::string, by_bsName)>,
ordered_non_unique<
tag<by_bsID>, BOOST_MULTI_INDEX_MEMBER(bsreadContainer, long, by_bsID )> >
> bsreadContainer_set;
template<typename Tag,typename MultiIndexContainer>
void print_out_by(
const MultiIndexContainer& s,
Tag* =0
)
{
// obtain a reference to the index tagged by Tag
const typename boost::multi_index::index<MultiIndexContainer,Tag>::type& i=
get<Tag>(s);
typedef typename MultiIndexContainer::value_type value_type;
// dump the elements of the index to cout
std::cout << "--------------" << std::endl;
std::cout << " ENUMERATED LIST " << std::endl;
std::cout << "--------------" << std::endl;
std::copy(i.begin(),i.end(),std::ostream_iterator<value_type>(std::cout));
std::cout << "--------------------" << std::endl;
}
typedef bsreadContainer_set::index<by_bsID>::type bsreadContainer_set_by_id;
typedef bsreadContainer_set::index<by_bsName>::type bsreadContainer_set_by_name;
#endif

865
include/zbsdtHelper.h Normal file
View File

@@ -0,0 +1,865 @@
///
/// \file zbsdtHelper.h
/// \author Jan Chrin, PSI
/// \date Release: January 2018
/// \version CAFE 1.6
#ifndef ZBSDTHELPER_H
#define ZBSDTHELPER_H
#include <zbsHash.h>
#include <bitshuffle/bitshuffle.h>
namespace CAFE_BSHELPER
{
using boost::multi_index_container;
using namespace boost::multi_index;
bsreadContainer_set bsdt;
std::vector<BSChannel> bsrdV;
//Type maching is as follows:
// int8 [1 byte] to char
// uint8 [1] to unsigned char
// int16 [2] to short
// uint16 [2] to unsigned short
// int32 [4] to long
// uint32 [4] to unsigned long
// int64 [8] to long long
// uint64 [8] to unsigned long long
// float32[4] to float
// float64[8] to double
// bool [1] same as uint8; 0=false, !0 = true
// string to char (Byte order of strings are irrelevant - always big-endian). The String encoding is utf8; from bsread documentation
enum bsdtIndex {BS_INT8=0, BS_UINT8, BS_INT16, BS_UINT16,
BS_INT32, BS_UINT32, BS_INT64, BS_UINT64,
BS_FLOAT32, BS_FLOAT64, BS_BOOL, BS_STRING, BS_CHAR=BS_STRING
};
void bsdtInsert()
{
bsdt.insert(bsreadContainer(BS_INT8, "int8"));
bsdt.insert(bsreadContainer(BS_UINT8, "uint8"));
bsdt.insert(bsreadContainer(BS_INT16, "int16"));
bsdt.insert(bsreadContainer(BS_UINT16, "uint16"));
bsdt.insert(bsreadContainer(BS_INT32, "int32"));
bsdt.insert(bsreadContainer(BS_UINT32, "uint32"));
bsdt.insert(bsreadContainer(BS_INT64, "int64"));
bsdt.insert(bsreadContainer(BS_UINT64, "uint64"));
bsdt.insert(bsreadContainer(BS_FLOAT32,"float32"));
bsdt.insert(bsreadContainer(BS_FLOAT64,"float64"));
bsdt.insert(bsreadContainer(BS_BOOL, "bool"));
bsdt.insert(bsreadContainer(BS_STRING, "string"));
bsdt.insert(bsreadContainer(BS_CHAR, "string"));
}
int getByteSize(unsigned int dt)
{
#define __METHOD__ "getByteSize (unsigned int)"
switch(dt)
{
case BS_INT8:
return sizeof(int8_t);
case BS_UINT8:
case BS_BOOL:
return sizeof(uint8_t);
case BS_INT16:
return sizeof(int16_t);
case BS_UINT16:
return sizeof(uint16_t);
case BS_INT32:
return sizeof(int32_t);
case BS_UINT32:
return sizeof(uint32_t);
case BS_INT64:
return sizeof(int64_t);
case BS_UINT64:
return sizeof(uint64_t);
case BS_FLOAT32:
return sizeof(float);
case BS_FLOAT64:
return sizeof(double);
case BS_STRING: //is also BS_CHAR
return sizeof(char);
default:
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
std::cout << "Enumerated input value " << dt << " is outside allowed band: " << BS_INT8 << " and " << BS_STRING << std::endl;
print_out_by<by_bsID>(bsdt);
std::cout << "Returning byte size of 1" << std::endl;
return 1;
}
#undef __METHOD__
}
int getByteSize(std::string dt)
{
#define __METHOD__ "getByteSize (string)"
bsreadContainer_set_by_name & name_index = bsdt.get<by_bsName> ();
bsreadContainer_set_by_name::iterator it_name;
unsigned int bsdtIndex;
//Find enum of data type
it_name = name_index.find(dt);
if ( (it_name) != name_index.end() )
{
bsdtIndex=(*it_name).by_bsID;
return getByteSize(bsdtIndex);
}
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
std::cout << "string value " << dt << " is not recognized " << std::endl;
print_out_by<by_bsID>(bsdt);
std::cout << "Returning byte size of 1" << std::endl;
return 1;
#undef __METHOD__
}
//Easy show-error-and-bail function.
//void run_screaming(const char *message, const int code) {
// printf("%s\n", message);
// exit(code);
// return;
//}
/**
* \brief Generic function to display bits of a number
* used for testing in zmq stream
*/
void printBits(int const size, void const * const ptr)
{
unsigned char *b= (unsigned char *) ptr;
unsigned char byte;
int i, j;
for (i=size-1; i>=0; i--)
{
for (j=7; j>=0; j--)
{
byte =(b[i]>>j ) &1;
printf("%u", byte);
}
}
puts("");
return;
}
/**
* \brief Returns true if at least one bit within byte is set
* Used to test endianess of timestamp
*/
bool hasMinOneBitSet(int const size, void const * const ptr)
{
unsigned char *b= (unsigned char *) ptr;
unsigned char byte;
bool hasBit = false;
int i, j;
for (i=size-1; i>=0; i--)
{
for (j=7; j>=0; j--)
{
byte =(b[i]>>j ) &1;
if (byte) {
return true;
}
}
}
return false;
}
/**
* \brief Unfolds the two bytes that precede the blob
* See: https://git.psi.ch/sf_daq/ch.psi.daq.dispatcherrest
* and: https://git.psi.ch/sf_daq/bsread_specification
*/
int unfoldPreBlob(const char * data, long &uncompressedSize, int &blockSize)
{
//Check for -ve numbers
uncompressedSize = ( ((data[7] <<0) & 0x7f) | ((data[7]<<0) & 0x80) | (data[6]<<8) | (data[5]<<16) | (data[4]<<24)
| ((long long) data[3]<<32) | ((long long) data[2]<<40) | ((long long) data[1]<<48) | ((long long) data[0]<<56) ) ;
// printBits(2, &uncompressedSize);
//std::cout << "UNCOMPRESSED SIZE / " << uncompressedSizeL << " " << uncompressedSize << std::endl;
//uncompressedSize = ( ((data[7] <<0) & 0x7f) | ((data[7]<<0) & 0x80) | (data[6]<<8) | (data[5]<<16) | (data[4]<<24)
// | ((long long) data[3]<<32) | ((long long) data[2]<<40) | ((long long) data[1]<<48) | ((long long) data[0]<<56) ) ;
//std::cout << "UNCOMPRESSED SIZE // " << uncompressedSize << std::endl;
//All three give equivalent block size
//blockSize= ( (data[11]<<0) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24) );
//std::cout << "BLOCKSIZE " << blockSize << std::endl;
blockSize= ( ((data[11]<<0)) | ((data[11]<<0)& 0x80) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24) );
//std::cout << "BLOCKSIZE / " << blockSize << std::endl;
//blockSize= ( ((data[11]<<0) & 0x7f) | ((data[11]<<0)& 0x80) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24) );
//std::cout << "BLOCKSIZE // " << blockSize << std::endl;
return ICAFE_NORMAL;;
}
/**
* \brief DataBitset Template \n
* CTYPE is the integer type the data type is to be rendered to the client \n
* method unfold() will receive data and then convert to CTYPE
*/
template <class CTYPE> class DataBitset
{
public:
DataBitset () {};
~DataBitset () {};
CTYPE unfold(char * data, size_t start, size_t end, std::string encoding )
{
//std::cout << "encoding=" << encoding << std::endl;
if (encoding=="big")
{
//big endian
for (short n=start; n < end; n++)
{
i = (i << 8) + data[n];
}
}
else
{
//little endian
for (short n = end; n >= start; n--)
{
i = (i << 8) + data[n];
}
}
//std::cout << "Value = " << i << std::endl;
return i;
}
private:
CTYPE i;
};
/**
* \brief IntegerBitset Template \n
* CTYPE is the integer type the data type is to be rendered to the client \n
* method unfold() will receive data and then convert to vector<CTYPE>
*/
template <class CTYPE> class IntegerBitsetV
{
public:
IntegerBitsetV () {};
~IntegerBitsetV () {};
CTYPE unfold(char * data, unsigned int nelem, std::string encoding, std::vector<CTYPE> &valV )
{
valV.clear();
valV.reserve(nelem);
cSize=sizeof(CTYPE);
idx=0;
if (encoding=="big")
{
switch (cSize)
{
case 1:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= (data[idx+1]<<0) & 0xff;
valV.push_back(iVal);
}
break;
case 2:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= ( ((data[idx+1]<<0) & 0xff) | ((data[idx]<<8) & 0xffff));
valV.push_back(iVal);
}
break;
case 4:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= ( ((data[idx+3]<<0) & 0xff ) | ((data[idx+2]<<8) & 0xffff )
| ((data[idx+1]<<16) & 0xffffff) | ((data[idx]<<24) & 0xffffffff) );
valV.push_back(iVal);
}
break;
case 8:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= ( ((data[idx+7]<<0) & 0xff) | ((data[idx+6]<<8) & 0xffff )
| ((data[idx+5]<<16) & 0xffffff ) | ((data[idx+4]<<24) & 0xffffffff )
| (((long long) data[idx+3]<<32) & 0xffffffffff)
| (((long long) data[idx+2]<<40) & 0xffffffffffff)
| (((long long) data[idx+1]<<48) & 0xffffffffffffff)
| (((long long) data[idx]<<56) & 0xffffffffffffffff) ) ;
valV.push_back(iVal);
}
break;
default:
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
}
}
else //little endian
{
switch (cSize)
{
case 1:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= (data[idx]<<0) & 0xff;
valV.push_back(iVal);
}
break;
case 2:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= ( ( (data[idx]<<0) & 0xff ) | ( (data[idx+1]<<8) & 0xffff) );
valV.push_back(iVal);
}
break;
case 4:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal= ( ( (data[idx]<<0) & 0xff) | ( (data[idx+1]<<8) & 0xffff )
| ( (data[idx+2]<<16) & 0xffffff) | ((data[idx+3]<<24) & 0xffffffff ));
valV.push_back(iVal);
}
break;
case 8:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal = ( ( (data[idx]<<0) & 0xFF) | ( (data[idx+1]<<8) & 0xFFFF)
| ((data[idx+2]<<16) & 0xFFFFFF) | ( (data[idx+3]<<24) & 0xFFFFFFFF)
| (((long long) data[idx+4]<<32) & 0xFFFFFFFFFF )
| (((long long) data[idx+5]<<40) & 0xFFFFFFFFFFFF )
| (((long long) data[idx+6]<<48) & 0xFFFFFFFFFFFFFF )
| (((long long) data[idx+7]<<56) & 0xFFFFFFFFFFFFFFFF ) ) ;
valV.push_back(iVal);
}
break;
default:
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
}
}
return valV[0]; //scalar value
}
private:
unsigned int cSize;
unsigned int idx;
CTYPE iVal;
};
/**
* \brief IntegerBitset Template \n
* CTYPE is the integer type the data type is to be rendered to the client \n
* method unfold() will receive data and then convert to CTYPE *
*/
template <class CTYPE> class IntegerBitset
{
public:
IntegerBitset () {};
~IntegerBitset () {};
CTYPE * unfold(char * data, unsigned int nelem, std::string encoding )
{
//std::cout << sizeof(char) << " s+ " << sizeof(short) << " i+ " << sizeof(int) << " l+ " <<sizeof(long) << " ll+ " << sizeof(long long) << std::endl;
cSize=sizeof(CTYPE);
idx=0;
iVal=new CTYPE[nelem];
//std::cout << "cSize " << cSize << std::endl;
//std::cout << "nelem " << nelem << " encoding" << encoding << std::endl;
if (encoding=="big")
{
switch (cSize)
{
case 1:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]= data[idx]<<0 & 0xff;
}
break;
case 2:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]= ( ((data[idx+1]<<0) & 0xff) | ((data[idx]<<8) & 0xffff));
//char is=data[idx]; printBits(1,&is);
//is=data[idx+1]; printBits(1,&is);
//iVal[i]=( (data[idx+1]<<0) | (data[idx]<<8) );
//short ss=iVal[i];
//printBits(2, &ss);
//std::cout << iVal[i] << " [" << i << "] " ;
}
//std::cout << std::endl;
break;
case 4:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]=( ((data[idx+3]<<0) & 0xff ) | ((data[idx+2]<<8) & 0xffff )
| ((data[idx+1]<<16) & 0xffffff) | ((data[idx]<<24) & 0xffffffff) );
}
break;
case 8:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]= ( ((data[idx+7]<<0) & 0xff) | ((data[idx+6]<<8) & 0xffff )
| ((data[idx+5]<<16) & 0xffffff ) | ((data[idx+4]<<24) & 0xffffffff )
| (((long long) data[idx+3]<<32) & 0xffffffffff)
| (((long long) data[idx+2]<<40) & 0xffffffffffff)
| (((long long) data[idx+1]<<48) & 0xffffffffffffff)
| (((long long) data[idx]<<56) & 0xffffffffffffffff) ) ;
}
default:
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
}
}
else //little endian
{
switch (cSize)
{
case 1:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]= (data[idx]<<0) & 0xff;
}
break;
case 2:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]=( ( (data[idx]<<0) & 0xff ) | ( (data[idx+1]<<8) & 0xffff) );
}
break;
case 4:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]=( ( (data[idx]<<0) & 0xff) | ( (data[idx+1]<<8) & 0xffff )
| ( (data[idx+2]<<16) & 0xffffff) | ((data[idx+3]<<24) & 0xffffffff ));
}
break;
case 8:
for (unsigned int i=0; i<nelem; ++i)
{
idx=i*cSize;
iVal[i]=( ( (data[idx]<<0) & 0xFF) | ( (data[idx+1]<<8) & 0xFFFF)
| ((data[idx+2]<<16) & 0xFFFFFF) | ( (data[idx+3]<<24) & 0xFFFFFFFF)
| (((long long) data[idx+4]<<32) & 0xFFFFFFFFFF )
| (((long long) data[idx+5]<<40) & 0xFFFFFFFFFFFF )
| (((long long) data[idx+6]<<48) & 0xFFFFFFFFFFFFFF )
| (((long long) data[idx+7]<<56) & 0xFFFFFFFFFFFFFFFF ) ) ;
}
break;
default:
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
}
}
return iVal;
}
CTYPE unfoldScalar(char * data, std::string encoding )
{
cSize=sizeof(CTYPE);
idx=0;
if (encoding=="big")
{
switch (cSize)
{
case 1:
idx=0;
iValScalar = data[idx]<<0 & 0xff;
break;
case 2:
idx=0;
iValScalar=( ((data[idx+1]<<0) & 0xff) | ((data[idx]<<8) & 0xffff));
break;
case 4:
idx=0;
iValScalar=( ((data[idx+3]<<0) & 0xff) | ((data[idx+2]<<8) & 0xffff)
| ((data[idx+1]<<16) & 0xffffff) | ((data[idx]<<24) & 0xffffffff) );
break;
case 8:
idx=0;
iValScalar=( ((data[idx+7]<<0) & 0xff) | ((data[idx+6]<<8) & 0xffff )
| ((data[idx+5]<<16) & 0xffffff ) | ((data[idx+4]<<24) & 0xffffffff )
| (((long long) data[idx+3]<<32) & 0xffffffffff)
| (((long long) data[idx+2]<<40) & 0xffffffffffff)
| (((long long) data[idx+1]<<48) & 0xffffffffffffff)
| (((long long) data[idx]<<56) & 0xffffffffffffffff) ) ;
break;
default:
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
}
}
else //little endian
{
switch (cSize)
{
case 1:
idx=0;
iValScalar= (data[idx]<<0) & 0xff;
break;
case 2:
idx=0;
iValScalar=( ( (data[idx]<<0) & 0xff ) | ( (data[idx+1]<<8) & 0xffff) );
break;
case 4:
idx=0;
iValScalar=( ( (data[idx]<<0) & 0xff) | ( (data[idx+1]<<8) & 0xffff )
| ( (data[idx+2]<<16) & 0xffffff) | ((data[idx+3]<<24) & 0xffffffff ));
break;
case 8:
idx=0;
iValScalar=( ( (data[idx]<<0) & 0xFF) | ( (data[idx+1]<<8) & 0xFFFF)
| ((data[idx+2]<<16) & 0xFFFFFF) | ( (data[idx+3]<<24) & 0xFFFFFFFF)
| (((long long) data[idx+4]<<32) & 0xFFFFFFFFFF )
| (((long long) data[idx+5]<<40) & 0xFFFFFFFFFFFF )
| (((long long) data[idx+6]<<48) & 0xFFFFFFFFFFFFFF )
| (((long long) data[idx+7]<<56) & 0xFFFFFFFFFFFFFFFF ) ) ;
break;
default:
std::cout << "Cannot process element of size " << cSize << " bytes" << std::endl;
}
}
return iValScalar;
}
private:
unsigned int cSize;
unsigned int idx;
CTYPE * iVal;
CTYPE iValScalar;
};
// big endian
// int uc = ( ( (data[7]<<0) & 0x7f) | ((data[7]<<0) & 0x80) | (data[6]<<8) | (data[5]<<16) | (data[4]<<24) | ((long long) data[3]<<32)
// | ((long long) data[2]<<40) | ((long long) data[1]<<48) | ((long long) data[0]<<56) ) ;
//
// int bs = ( ( (data[11]<<0) & 0x7f) | ((data[11]<<0) & 0x80) | (data[10]<<8) | (data[9]<<16) | (data[8]<<24));
// big endian
// bs = ( ( (regen_buffer[n] <<24) ) | ( (regen_buffer[n+1] <<26) ) | ( (regen_buffer[n+2] <<8) )
// | ( (regen_buffer[n+3] <<0) & 0x7f) | (regen_buffer[n+3] <<0) & 0x80 ) ;
/**
* \brief FloatBitset Template \n
* CTYPE is the float type of the data type to be rendered to the client \n
* method unfold() will receive data and then convert to CTYPE
*/
template <class CTYPE> class FloatBitset
{
public:
FloatBitset () {};
~FloatBitset () {};
CTYPE * unfold(char * data, unsigned int nelem, std::string encoding)
{
cSize=sizeof(CTYPE);
val=new CTYPE[nelem];
//std::cout << "HELPER>H " << nelem << " " << encoding << " cSize " << cSize << std::endl;
if (encoding=="big")
{
for (unsigned int i=0; i<nelem; ++i)
{
start=i*cSize;
end=(i+1)*cSize;
//std::cout << start << " // " << end << std::endl;
inst=0;
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
{
idx=(nelem*cSize)-1-char_nbr;
//std::cout << inst << " " << idx << std::endl;
bar.c[inst]=data[idx];
++inst;
}
//std::cout << "i= " << i << " " << std::endl;
//std::cout << bar.v << " [" << i << "] " << std::endl;
val[nelem-1-i]=bar.v;
//std::cout << val[nelem-1-i] << " [" << (nelem-1-i) << "] " << std::endl;
}
}
// little endian
else
{
for (unsigned int i=0; i<nelem; ++i)
{
start=i*cSize;
end=(i+1)*cSize;
inst=0;
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
{
bar.c[inst]=data[char_nbr];
++inst;
}
val[i]=bar.v;
}
}
return val;
}
CTYPE unfoldScalar(char * data, std::string encoding)
{
cSize=sizeof(CTYPE);
if (encoding=="big")
{
start=0;
end=cSize;
inst=0;
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
{
idx=cSize-1-char_nbr;
bar.c[inst]=data[idx];
++inst;
}
}
// little endian
else
{
start=0;
end=cSize;
inst=0;
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
{
bar.c[inst]=data[char_nbr];
++inst;
}
}
return bar.v;
};
/*
CTYPE unfold(char * data, size_t start, size_t end, std::string encoding )
{
if (encoding=="big") {
// big endian
for (size_t char_nbr = start; char_nbr < end; char_nbr++) {
bar.c[char_nbr]=data[end-1-char_nbr];
}
} else {
// little endian
for (size_t char_nbr = start; char_nbr < end; char_nbr++) {
bar.c[char_nbr]=data[char_nbr];
}
}
//std::cout << "UNION D " << bar.v << std::endl;
return bar.v;
}
*/
private:
union dUnion
{
char c[sizeof(CTYPE)];
CTYPE v;
} bar;
CTYPE * val;
unsigned int cSize;
int start;
int end;
int inst;
int idx;
};
/**
* \brief FloatBitsetV Template \n
* CTYPE is the float type of the data type to be rendered to the client \n
* method unfold() will receive data and then convert to vector<CTYPE>
*/
template <class CTYPE> class FloatBitsetV
{
public:
FloatBitsetV () {};
~FloatBitsetV () {};
CTYPE unfold(char * data, unsigned int nelem, std::string encoding, std::vector<CTYPE> &valV)
{
//memory already allocated in zbsread.h
//valV.clear();
//valV.reserve(nelem);
cSize=sizeof(CTYPE);
//std::cout << "HELPER_H " << nelem << " " << encoding << " cSize " << cSize << std::endl;
if (encoding=="big")
{
for (unsigned int i=0; i<nelem; ++i)
{
start=i*cSize;
end=(i+1)*cSize;
std::cout << start << " // " << end << std::endl;
inst=0;
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
{
idx=(nelem*cSize)-1-char_nbr;
bar.c[inst]=data[idx];
++inst;
}
std::cout << bar.v << " [" << (nelem-1-i) << "] " ;
valV[nelem-1-i]=bar.v;
std::cout << valV[nelem-1-i] << " [" << (nelem-1-i) << "] " ;
//valV.push_back(bar.v);
}
}
else // little endian
{
for (unsigned int i=0; i<nelem; ++i)
{
start=i*cSize;
end=(i+1)*cSize;
inst=0;
for (size_t char_nbr = start; char_nbr < end ; char_nbr++)
{
bar.c[inst]=data[char_nbr];
++inst;
}
std::cout << bar.v << " [" << i << "] " ;
valV[i]=bar.v;
//valV.push_back(bar.v);
}
}
std::cout << std::endl;
return valV[0]; //scalar value
}
private:
union dUnion
{
char c[sizeof(CTYPE)];
CTYPE v;
} bar;
unsigned int cSize;
int start;
int end;
int inst;
int idx;
};
/**
* \brief Routine that decompresses the compressed WFs and other data
*/
int bitshuffleDecompress( const char * data, char* & regen_buffer, int sizeData, int dtByteSize)
{
#define __METHOD__ "bitshuffleDecompress"
long uncompressedSize=0;
int blockSize=0;
int localDebug=0;
int sizeBlob = sizeData-BSREAD_PREBLOB_BYTES;
if (sizeBlob <1)
{
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
std::cout << "WARNING: data size " << sizeData << " is less than BSREAD_PREBLOB_BYTES " << BSREAD_PREBLOB_BYTES << std::endl;
std::cout << "This should not happen. Probably we are trying to decompress uncompressed data! " << std::endl;
return ECAFE_BITSHUFF_BADCOUNT;
} //Should not happen
unfoldPreBlob(data, uncompressedSize, blockSize);
//std::cout << "Uncompressed/Block size: " << uncompressedSize << " / " << blockSize << std::endl;
//decompress
int dataNelem=uncompressedSize/dtByteSize;
//use bitshuffle terminology
regen_buffer = (char *) malloc(uncompressedSize);
if (regen_buffer == NULL)
{
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
std::cout << "FAILED TO ALLOC MEM of size: " << uncompressedSize << std::endl;
return ECAFE_BITSHUFF_ALLOCMEM;
}
char * dataBlob = new char[sizeBlob];
int ij=0;
if(localDebug) std::cout << " BSREAD_PREBLOB_BYTES " << BSREAD_PREBLOB_BYTES <<std::endl;
if(localDebug) std::cout << " sizeData " << sizeData <<std::endl;
if(localDebug) std::cout << " sizeBlob " << sizeBlob <<std::endl;
if(localDebug) std::cout << " dataNelem " << dataNelem <<std::endl;
if(localDebug) std::cout << " dtByteSize " << dtByteSize <<std::endl;
for (int char_nbr = BSREAD_PREBLOB_BYTES; char_nbr < sizeData; char_nbr++)
{
dataBlob[ij]=data[char_nbr];
++ij;
}
//Use 0 rather than given block size as is recommended
const int decompressed_size = bshuf_decompress_lz4((const char *) dataBlob, regen_buffer, dataNelem, dtByteSize, 0);
delete [] dataBlob;
if(localDebug) std::cout << " " << " decompressed_size " << decompressed_size << std::endl;
if (decompressed_size < 0)
{
return ECAFE_BITSHUFF_DECOMPRESS;
}
else if (decompressed_size == 0)
{
if(localDebug)std::cout << "0 decompressed size! Should have a positive number for successful deompression?" <<std::endl;
}
else
{
if(localDebug)std::cout << "We successfully decompressed some data!" <<std::endl;
}
// Not only does a positive return value mean success,
// value returned == number of bytes regenerated from compressed_data stream.
// We can use this to realloc() *regen_buffer to free up memory
// Did this at first to remove spurious trailing characters
// BUT AVOID AT ALL COSTS; screws up regen_buffer content!!
/*
regen_buffer = (char *)realloc(regen_buffer, decompressed_size);
if (regen_buffer == NULL) {
std::cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << std::endl;
std::cout << "WARNING with status code: " << ECAFE_BITSHUFF_REALLOCMEM << std::endl;
std::cout << "Failed to reallocate memory for compressed data. Not a show stopper" << std::endl;
}
*/
return ICAFE_NORMAL;
#undef __METHOD__
}
}
#endif

1766
include/zbsread.h Normal file

File diff suppressed because it is too large Load Diff

8463
libtool

File diff suppressed because it is too large Load Diff

476
makefile
View File

@@ -1,9 +1,8 @@
# makefile.in generated by automake 1.11.1 from makefile.am.
# makefile.in generated by automake 1.13.4 from makefile.am.
# makefile. Generated from makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,6 +15,51 @@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/cafe
pkgincludedir = $(includedir)/cafe
pkglibdir = $(libdir)/cafe
@@ -35,16 +79,22 @@ POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
subdir = .
DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
$(srcdir)/makefile.am $(srcdir)/makefile.in \
$(top_srcdir)/./include/config.in $(top_srcdir)/configure \
.//AUTHORS .//COPYING .//ChangeLog .//INSTALL .//NEWS \
.//README .//config.guess .//config.sub .//depcomp \
.//install-sh .//ltmain.sh .//missing AUTHORS COPYING \
ChangeLog INSTALL NEWS config.guess config.sub depcomp \
install-sh ltmain.sh missing
DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
$(srcdir)/makefile.in $(srcdir)/makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(top_srcdir)/./include/config.in $(include_HEADERS) \
.//AUTHORS COPYING .//COPYING .//ChangeLog .//INSTALL .//NEWS \
.//README config.guess .//config.guess config.sub \
.//config.sub depcomp .//depcomp install-sh .//install-sh \
missing .//missing ltmain.sh .//ltmain.sh \
$(top_srcdir)/./config.guess $(top_srcdir)/./config.sub \
$(top_srcdir)/./install-sh $(top_srcdir)/./ltmain.sh \
$(top_srcdir)/./missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -53,15 +103,33 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/./include/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_$(V))
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -83,23 +151,53 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(include_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
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
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -127,54 +225,61 @@ am__relativize = \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run aclocal-1.11
AMTAR = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run tar
AM_CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml -I$(top_srcdir)/include
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64 @CAFE_LIBS@
ACLOCAL = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing aclocal-1.13
AMTAR = $${TAR-tar}
AM_CPPFLAGS = -fexceptions -fPIC -std=c++1z -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/ioc/python/latest/include/python3.10 -I/ioc/python/latest/lib/python3.10/site-packages/numpy/core/include -I$(top_srcdir)/include
AM_DEFAULT_VERBOSITY = 1
AM_LDFLAGS = -L/usr/local/epics/base/lib/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/RHEL7-x86_64 -L/ioc/python/latest/lib -Wl,-rpath,/ioc/python/latest/lib @CAFE_LIBS@
AR = ar
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoconf
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoheader
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run automake-1.11
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing autoconf
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing autoheader
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing automake-1.13
AWK = gawk
CAFE_CPPFLAGS = -I$(top_srcdir)/include
CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
CC = /opt/psi/Programming/gcc/9.3.0/bin/gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc -E
CPPFLAGS = -fexceptions -fPIC -Wno-deprecated -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
CXX = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++
CXXCPP = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/g++ -E
CPP = /opt/psi/Programming/gcc/9.3.0/bin/gcc -E
CPPFLAGS = -fexceptions -fPIC -std=c++1z -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/ioc/python/latest/include/python3.10 -I/ioc/python/latest/lib/python3.10/site-packages/numpy/core/include
CXX = /opt/psi/Programming/gcc/9.3.0/bin/g++
CXXCPP = /opt/psi/Programming/gcc/9.3.0/bin/g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = false
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EGREP = /usr/bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
FGREP = /usr/bin/grep -F
GREP = /usr/bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
LDFLAGS = -L/usr/local/epics/base/lib/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/RHEL7-x86_64 -L/ioc/python/latest/lib -Wl,-rpath,/ioc/python/latest/lib
LIBOBJS =
LIBS = -lQtXml -lQtCore
LIBS = -lpython3.10
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
LT_SYS_LIBRARY_PATH =
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
@@ -184,28 +289,30 @@ OTOOL64 =
PACKAGE = cafe
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
PACKAGE_NAME = CAFE
PACKAGE_STRING = CAFE 1.8.0
PACKAGE_STRING = CAFE 1.14.4
PACKAGE_TARNAME = cafe
PACKAGE_VERSION = 1.8.0
PACKAGE_URL =
PACKAGE_VERSION = 1.14.4
PATH_SEPARATOR = :
RANLIB = ranlib
SED = /bin/sed
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 1.8.0
VERSION = 1.14.4
abs_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
abs_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
abs_top_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
abs_top_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
ac_ct_CC = /afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/6.3.0/bin/gcc
ac_ct_AR = ar
ac_ct_CC = /opt/psi/Programming/gcc/9.3.0/bin/gcc
ac_ct_CXX =
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
@@ -227,16 +334,15 @@ htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/install-sh
libdir = /opt/gfa/cafe/cpp/cafe-1.8.0-gcc-6.3.0/lib
libdir = /opt/gfa/cafe/cpp/cafe-1.14.4-py310-gcc-9.3.0/lib/RHEL7-x86_64
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
lt_ECHO = echo
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
mkdir_p = $(MKDIR_P)
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /opt/gfa/cafe/cpp/cafe-1.8.0-gcc-6.3.0
prefix = /opt/gfa/cafe/cpp/cafe-1.14.4-py310-gcc-9.3.0
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
@@ -253,7 +359,7 @@ ACLOCAL_AMFLAGS = -I m4
all: all-recursive
.SUFFIXES:
am--refresh:
am--refresh: makefile
@:
$(srcdir)/makefile.in: $(srcdir)/makefile.am $(am__configure_deps)
@for dep in $?; do \
@@ -289,10 +395,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
./include/config.h: ./include/stamp-h1
@if test ! -f $@; then \
rm -f ./include/stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) ./include/stamp-h1; \
else :; fi
@if test ! -f $@; then rm -f ./include/stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) ./include/stamp-h1; else :; fi
./include/stamp-h1: $(top_srcdir)/./include/config.in $(top_builddir)/config.status
@rm -f ./include/stamp-h1
@@ -315,8 +419,11 @@ distclean-libtool:
-rm -f libtool config.lt
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -330,27 +437,28 @@ uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@@ -365,57 +473,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -431,12 +494,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -448,15 +506,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -465,9 +519,31 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
@@ -503,13 +579,10 @@ distdir: $(DISTFILES)
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
@@ -538,36 +611,36 @@ distdir: $(DISTFILES)
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
$(am__post_remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
@@ -578,8 +651,8 @@ distcheck: dist
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
@@ -589,9 +662,9 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
@@ -599,6 +672,7 @@ distcheck: dist
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -622,13 +696,21 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
@@ -662,10 +744,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
@@ -747,25 +834,24 @@ ps-am:
uninstall-am: uninstall-includeHEADERS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-includeHEADERS install-info \
install-info-am install-man 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-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-includeHEADERS
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool 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-generic \
distclean-hdr distclean-libtool distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-includeHEADERS \
install-info install-info-am install-man 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-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@@ -1 +1 @@
PyCafe3.cpp
PyCafe_sls.cpp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

156764
src/PyCafe_sls.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

View File

@@ -0,0 +1,116 @@
bitshuffle/bitshuffle.lo: bitshuffle/bitshuffle.c \
/usr/include/stdc-predef.h bitshuffle/bitshuffle.h /usr/include/stdlib.h \
/usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stddef.h \
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/bits/byteswap.h /usr/include/bits/types.h \
/usr/include/bits/typesizes.h /usr/include/bits/byteswap-16.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h bitshuffle/bitshuffle_core.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdint.h \
/usr/include/stdint.h /usr/include/bits/wchar.h \
bitshuffle/bitshuffle_internals.h bitshuffle/iochain.h \
.././include/lz4.h /usr/include/stdio.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/string.h /usr/include/xlocale.h \
/usr/include/bits/string.h /usr/include/bits/string2.h
/usr/include/stdc-predef.h:
bitshuffle/bitshuffle.h:
/usr/include/stdlib.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/bits/wordsize.h:
/usr/include/gnu/stubs.h:
/usr/include/gnu/stubs-64.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stddef.h:
/usr/include/bits/waitflags.h:
/usr/include/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/bits/byteswap.h:
/usr/include/bits/types.h:
/usr/include/bits/typesizes.h:
/usr/include/bits/byteswap-16.h:
/usr/include/sys/types.h:
/usr/include/time.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/bits/stdlib-float.h:
bitshuffle/bitshuffle_core.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdint.h:
/usr/include/stdint.h:
/usr/include/bits/wchar.h:
bitshuffle/bitshuffle_internals.h:
bitshuffle/iochain.h:
.././include/lz4.h:
/usr/include/stdio.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdarg.h:
/usr/include/bits/stdio_lim.h:
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/string.h:
/usr/include/xlocale.h:
/usr/include/bits/string.h:
/usr/include/bits/string2.h:

View File

@@ -0,0 +1,123 @@
bitshuffle/bitshuffle_core.lo: bitshuffle/bitshuffle_core.c \
/usr/include/stdc-predef.h bitshuffle/bitshuffle_core.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdint.h \
/usr/include/stdint.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h /usr/include/bits/wchar.h \
/usr/include/stdlib.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stddef.h \
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/bits/byteswap.h /usr/include/bits/types.h \
/usr/include/bits/typesizes.h /usr/include/bits/byteswap-16.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h bitshuffle/bitshuffle_internals.h \
bitshuffle/iochain.h /usr/include/stdio.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/string.h /usr/include/xlocale.h \
/usr/include/bits/string.h /usr/include/bits/string2.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/emmintrin.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/xmmintrin.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/mmintrin.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/mm_malloc.h
/usr/include/stdc-predef.h:
bitshuffle/bitshuffle_core.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdint.h:
/usr/include/stdint.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/bits/wordsize.h:
/usr/include/gnu/stubs.h:
/usr/include/gnu/stubs-64.h:
/usr/include/bits/wchar.h:
/usr/include/stdlib.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stddef.h:
/usr/include/bits/waitflags.h:
/usr/include/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/bits/byteswap.h:
/usr/include/bits/types.h:
/usr/include/bits/typesizes.h:
/usr/include/bits/byteswap-16.h:
/usr/include/sys/types.h:
/usr/include/time.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/bits/stdlib-float.h:
bitshuffle/bitshuffle_internals.h:
bitshuffle/iochain.h:
/usr/include/stdio.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stdarg.h:
/usr/include/bits/stdio_lim.h:
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/string.h:
/usr/include/xlocale.h:
/usr/include/bits/string.h:
/usr/include/bits/string2.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/emmintrin.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/xmmintrin.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/mmintrin.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/mm_malloc.h:

View File

@@ -0,0 +1,68 @@
bitshuffle/iochain.lo: bitshuffle/iochain.c /usr/include/stdc-predef.h \
/usr/include/stdlib.h /usr/include/features.h /usr/include/sys/cdefs.h \
/usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
/usr/include/gnu/stubs-64.h \
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stddef.h \
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
/usr/include/endian.h /usr/include/bits/endian.h \
/usr/include/bits/byteswap.h /usr/include/bits/types.h \
/usr/include/bits/typesizes.h /usr/include/bits/byteswap-16.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/bits/stdlib-float.h bitshuffle/iochain.h
/usr/include/stdc-predef.h:
/usr/include/stdlib.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/bits/wordsize.h:
/usr/include/gnu/stubs.h:
/usr/include/gnu/stubs-64.h:
/afs/psi.ch/sys/psi.x86_64_slp6/Programming/gcc/7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/include/stddef.h:
/usr/include/bits/waitflags.h:
/usr/include/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/bits/byteswap.h:
/usr/include/bits/types.h:
/usr/include/bits/typesizes.h:
/usr/include/bits/byteswap-16.h:
/usr/include/sys/types.h:
/usr/include/time.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/bits/stdlib-float.h:
bitshuffle/iochain.h:

0
src/bitshuffle/.dirstamp Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

167
src/bitshuffle/bitshuffle.c Normal file
View File

@@ -0,0 +1,167 @@
/*
* Bitshuffle - Filter for improving compression of typed binary data.
*
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*
*/
#include "bitshuffle.h"
#include "bitshuffle_core.h"
#include "bitshuffle_internals.h"
#include "lz4.h"
#include <stdio.h>
#include <string.h>
// Constants.
// Use fast decompression instead of safe decompression for LZ4.
#define BSHUF_LZ4_DECOMPRESS_FAST
// Macros.
#define CHECK_ERR_FREE_LZ(count, buf) if (count < 0) { \
free(buf); return count - 1000; }
/* Bitshuffle and compress a single block. */
int64_t bshuf_compress_lz4_block(ioc_chain *C_ptr, \
const size_t size, const size_t elem_size) {
int64_t nbytes, count;
void *tmp_buf_bshuf;
void *tmp_buf_lz4;
size_t this_iter;
const void *in;
void *out;
tmp_buf_bshuf = malloc(size * elem_size);
if (tmp_buf_bshuf == NULL) return -1;
tmp_buf_lz4 = malloc(LZ4_compressBound(size * elem_size));
if (tmp_buf_lz4 == NULL){
free(tmp_buf_bshuf);
return -1;
}
in = ioc_get_in(C_ptr, &this_iter);
ioc_set_next_in(C_ptr, &this_iter, (void*) ((char*) in + size * elem_size));
count = bshuf_trans_bit_elem(in, tmp_buf_bshuf, size, elem_size);
if (count < 0) {
free(tmp_buf_lz4);
free(tmp_buf_bshuf);
return count;
}
nbytes = LZ4_compress((const char*) tmp_buf_bshuf, (char*) tmp_buf_lz4, size * elem_size);
free(tmp_buf_bshuf);
CHECK_ERR_FREE_LZ(nbytes, tmp_buf_lz4);
out = ioc_get_out(C_ptr, &this_iter);
ioc_set_next_out(C_ptr, &this_iter, (void *) ((char *) out + nbytes + 4));
bshuf_write_uint32_BE(out, nbytes);
memcpy((char *) out + 4, tmp_buf_lz4, nbytes);
free(tmp_buf_lz4);
return nbytes + 4;
}
/* Decompress and bitunshuffle a single block. */
int64_t bshuf_decompress_lz4_block(ioc_chain *C_ptr,
const size_t size, const size_t elem_size) {
int64_t nbytes, count;
void *out, *tmp_buf;
const void *in;
size_t this_iter;
int32_t nbytes_from_header;
in = ioc_get_in(C_ptr, &this_iter);
nbytes_from_header = bshuf_read_uint32_BE(in);
ioc_set_next_in(C_ptr, &this_iter,
(void*) ((char*) in + nbytes_from_header + 4));
out = ioc_get_out(C_ptr, &this_iter);
ioc_set_next_out(C_ptr, &this_iter,
(void *) ((char *) out + size * elem_size));
tmp_buf = malloc(size * elem_size);
if (tmp_buf == NULL) return -1;
#ifdef BSHUF_LZ4_DECOMPRESS_FAST
nbytes = LZ4_decompress_fast((const char*) in + 4, (char*) tmp_buf, size * elem_size);
CHECK_ERR_FREE_LZ(nbytes, tmp_buf);
if (nbytes != nbytes_from_header) {
free(tmp_buf);
return -91;
}
#else
nbytes = LZ4_decompress_safe((const char*) in + 4, (char *) tmp_buf, nbytes_from_header,
size * elem_size);
CHECK_ERR_FREE_LZ(nbytes, tmp_buf);
if (nbytes != size * elem_size) {
free(tmp_buf);
return -91;
}
nbytes = nbytes_from_header;
#endif
count = bshuf_untrans_bit_elem(tmp_buf, out, size, elem_size);
CHECK_ERR_FREE(count, tmp_buf);
nbytes += 4;
free(tmp_buf);
return nbytes;
}
/* ---- Public functions ----
*
* See header file for description and usage.
*
*/
size_t bshuf_compress_lz4_bound(const size_t size,
const size_t elem_size, size_t block_size) {
size_t bound, leftover;
if (block_size == 0) {
block_size = bshuf_default_block_size(elem_size);
}
if (block_size % BSHUF_BLOCKED_MULT) return -81;
// Note that each block gets a 4 byte header.
// Size of full blocks.
bound = (LZ4_compressBound(block_size * elem_size) + 4) * (size / block_size);
// Size of partial blocks, if any.
leftover = ((size % block_size) / BSHUF_BLOCKED_MULT) * BSHUF_BLOCKED_MULT;
if (leftover) bound += LZ4_compressBound(leftover * elem_size) + 4;
// Size of uncompressed data not fitting into any blocks.
bound += (size % BSHUF_BLOCKED_MULT) * elem_size;
return bound;
}
int64_t bshuf_compress_lz4(const void* in, void* out, const size_t size,
const size_t elem_size, size_t block_size) {
return bshuf_blocked_wrap_fun(&bshuf_compress_lz4_block, in, out, size,
elem_size, block_size);
}
int64_t bshuf_decompress_lz4(const void* in, void* out, const size_t size,
const size_t elem_size, size_t block_size) {
//printf("bshuf_decompress_lz4 called from within zbsread.h\n");
//return 0;
return bshuf_blocked_wrap_fun(&bshuf_decompress_lz4_block, in, out, size,
elem_size, block_size);
}

123
src/bitshuffle/bitshuffle.h Normal file
View File

@@ -0,0 +1,123 @@
/*
* Bitshuffle - Filter for improving compression of typed binary data.
*
* This file is part of Bitshuffle
* Author: Kiyoshi Masui <kiyo@physics.ubc.ca>
* Website: http://www.github.com/kiyo-masui/bitshuffle
* Created: 2014
*
* See LICENSE file for details about copyright and rights to use.
*
*
* Header File
*
* Worker routines return an int64_t which is the number of bytes processed
* if positive or an error code if negative.
*
* Error codes:
* -1 : Failed to allocate memory.
* -11 : Missing SSE.
* -12 : Missing AVX.
* -80 : Input size not a multiple of 8.
* -81 : block_size not multiple of 8.
* -91 : Decompression error, wrong number of bytes processed.
* -1YYY : Error internal to compression routine with error code -YYY.
*/
#ifndef BITSHUFFLE_H
#define BITSHUFFLE_H
#include <stdlib.h>
#include "bitshuffle_core.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ---- bshuf_compress_lz4_bound ----
*
* Bound on size of data compressed with *bshuf_compress_lz4*.
*
* Parameters
* ----------
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Process in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* Bound on compressed data size.
*
*/
size_t bshuf_compress_lz4_bound(const size_t size,
const size_t elem_size, size_t block_size);
/* ---- bshuf_compress_lz4 ----
*
* Bitshuffled and compress the data using LZ4.
*
* Transpose within elements, in blocks of data of *block_size* elements then
* compress the blocks using LZ4. In the output buffer, each block is prefixed
* by a 4 byte integer giving the compressed size of that block.
*
* Output buffer must be large enough to hold the compressed data. This could
* be in principle substantially larger than the input buffer. Use the routine
* *bshuf_compress_lz4_bound* to get an upper limit.
*
* Parameters
* ----------
* in : input buffer, must be of size * elem_size bytes
* out : output buffer, must be large enough to hold data.
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Process in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* number of bytes used in output buffer, negative error-code if failed.
*
*/
int64_t bshuf_compress_lz4(const void* in, void* out, const size_t size, const size_t
elem_size, size_t block_size);
/* ---- bshuf_decompress_lz4 ----
*
* Undo compression and bitshuffling.
*
* Decompress data then un-bitshuffle it in blocks of *block_size* elements.
*
* To properly unshuffle bitshuffled data, *size*, *elem_size* and *block_size*
* must patch the parameters used to compress the data.
*
* NOT TO BE USED WITH UNTRUSTED DATA: This routine uses the function
* LZ4_decompress_fast from LZ4, which does not protect against maliciously
* formed datasets. By modifying the compressed data, this function could be
* coerced into leaving the boundaries of the input buffer.
*
* Parameters
* ----------
* in : input buffer
* out : output buffer, must be of size * elem_size bytes
* size : number of elements in input
* elem_size : element size of typed data
* block_size : Process in blocks of this many elements. Pass 0 to
* select automatically (recommended).
*
* Returns
* -------
* number of bytes consumed in *input* buffer, negative error-code if failed.
*
*/
int64_t bshuf_decompress_lz4(const void* in, void* out, const size_t size,
const size_t elem_size, size_t block_size);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // BITSHUFFLE_H

Some files were not shown because too many files have changed in this diff Show More