helper functions used to extract handle_index in instant.h for pyvind11 compatability
This commit is contained in:
@@ -83,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);
|
||||
|
||||
@@ -93,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);
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#ifndef INSTANT_CPP
|
||||
#define INSTANT_CPP
|
||||
|
||||
//include <instant.h>
|
||||
|
||||
/**
|
||||
* \brief Set values of data type CTYPE
|
||||
* \param _handle input: handle to CAFEConduit object
|
||||
@@ -44,6 +46,8 @@ template <class CTYPE> int Instant<CTYPE>::set(const unsigned int _handle, con
|
||||
|
||||
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())
|
||||
@@ -139,12 +143,11 @@ template <class CTYPE> int Instant<CTYPE>::get(const unsigned int _handle,
|
||||
std::cout << "CAFE WILL THUS TAKE CONTROL OF ALLOCATING APPROPIATE DBR_TYPE" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -184,6 +187,8 @@ template <class CTYPE> int Instant<CTYPE>::get(const unsigned int _handle,
|
||||
else
|
||||
{
|
||||
std::cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << std::endl;
|
||||
const char * _pv = helper.getPVFromHandle(_handle);
|
||||
std::cout << "Failed to find handle " << _handle << " for pv " << _pv << std::endl;
|
||||
cafeStatus.report(ECAFE_INVALID_HANDLE);
|
||||
return ECAFE_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
4168
include/instant.h
4168
include/instant.h
File diff suppressed because it is too large
Load Diff
61
include/instantT.h
Normal file
61
include/instantT.h
Normal 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
|
||||
@@ -188,9 +188,9 @@ CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
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/opt/gfa/python-3.7/latest/include/qt -I/opt/gfa/python-3.7/latest/include/qt/QtCore -I/opt/gfa/python-3.7/latest/include/qt/QtXml
|
||||
AM_CPPFLAGS = -fexceptions -fPIC -std=c++1z -I/usr/local/epics/base-7/include/ -I/usr/local/epics/base-7/include/os/Linux -I/usr/local/epics/base-7/include/compiler/gcc -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/opt/gfa/python-3.7/latest/include/qt -I/opt/gfa/python-3.7/latest/include/qt/QtCore -I/opt/gfa/python-3.7/latest/include/qt/QtXml
|
||||
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/opt/gfa/python-3.7/latest/lib -Wl,-rpath,/opt/gfa/python-3.7/latest/lib
|
||||
AM_LDFLAGS = -L/usr/local/epics/base-7/lib/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base-7/lib/RHEL7-x86_64 -L/opt/gfa/python-3.7/latest/lib -Wl,-rpath,/opt/gfa/python-3.7/latest/lib
|
||||
AR = ar
|
||||
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing autoconf
|
||||
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing autoheader
|
||||
@@ -201,7 +201,7 @@ CC = /opt/psi/Programming/gcc/7.3.0/bin/gcc
|
||||
CCDEPMODE = depmode=gcc3
|
||||
CFLAGS = -g -O2
|
||||
CPP = /opt/psi/Programming/gcc/7.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/opt/gfa/python-3.7/latest/include/qt -I/opt/gfa/python-3.7/latest/include/qt/QtCore -I/opt/gfa/python-3.7/latest/include/qt/QtXml
|
||||
CPPFLAGS = -fexceptions -fPIC -std=c++1z -I/usr/local/epics/base-7/include/ -I/usr/local/epics/base-7/include/os/Linux -I/usr/local/epics/base-7/include/compiler/gcc -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/opt/gfa/python-3.7/latest/include/qt -I/opt/gfa/python-3.7/latest/include/qt/QtCore -I/opt/gfa/python-3.7/latest/include/qt/QtXml
|
||||
CXX = /opt/psi/Programming/gcc/7.3.0/bin/g++
|
||||
CXXCPP = /opt/psi/Programming/gcc/7.3.0/bin/g++ -E
|
||||
CXXDEPMODE = depmode=gcc3
|
||||
@@ -225,7 +225,7 @@ 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/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/RHEL7-x86_64 -L/opt/gfa/python-3.7/latest/lib -Wl,-rpath,/opt/gfa/python-3.7/latest/lib
|
||||
LDFLAGS = -L/usr/local/epics/base-7/lib/RHEL7-x86_64 -Wl,-rpath,/usr/local/epics/base-7/lib/RHEL7-x86_64 -L/opt/gfa/python-3.7/latest/lib -Wl,-rpath,/opt/gfa/python-3.7/latest/lib
|
||||
LIBOBJS =
|
||||
LIBS = -lQt5Xml -lQt5Core
|
||||
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||
@@ -245,17 +245,17 @@ OTOOL64 =
|
||||
PACKAGE = cafe
|
||||
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
|
||||
PACKAGE_NAME = CAFE
|
||||
PACKAGE_STRING = CAFE 1.14.1
|
||||
PACKAGE_STRING = CAFE 1.14.2
|
||||
PACKAGE_TARNAME = cafe
|
||||
PACKAGE_URL =
|
||||
PACKAGE_VERSION = 1.14.1
|
||||
PACKAGE_VERSION = 1.14.2
|
||||
PATH_SEPARATOR = :
|
||||
RANLIB = ranlib
|
||||
SED = /usr/bin/sed
|
||||
SET_MAKE =
|
||||
SHELL = /bin/sh
|
||||
STRIP = strip
|
||||
VERSION = 1.14.1
|
||||
VERSION = 1.14.2
|
||||
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
|
||||
@@ -290,7 +290,7 @@ 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.14.1-gcc-7.3.0/lib/RHEL7-x86_64
|
||||
libdir = /opt/gfa/cafe/cpp/cafe-1.14.2-sls2-gcc-7.3.0/lib/RHEL7-x86_64
|
||||
libexecdir = ${exec_prefix}/libexec
|
||||
localedir = ${datarootdir}/locale
|
||||
localstatedir = ${prefix}/var
|
||||
@@ -298,7 +298,7 @@ mandir = ${datarootdir}/man
|
||||
mkdir_p = $(MKDIR_P)
|
||||
oldincludedir = /usr/include
|
||||
pdfdir = ${docdir}
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.14.1-gcc-7.3.0
|
||||
prefix = /opt/gfa/cafe/cpp/cafe-1.14.2-sls2-gcc-7.3.0
|
||||
program_transform_name = s,x,x,
|
||||
psdir = ${docdir}
|
||||
sbindir = ${exec_prefix}/sbin
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1840,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()) {
|
||||
|
||||
Reference in New Issue
Block a user