From 5ff4e7f569bc4b131ea1e573f0c54fd989624948 Mon Sep 17 00:00:00 2001 From: Sebastian Marsching Date: Sat, 2 Mar 2019 14:14:32 +0100 Subject: [PATCH] Add support for 64-bit integers. --- README.md | 9 ++++++--- .../EPICS/ArrayRecordDeviceSupport.h | 6 ++++++ .../src/ChimeraTK/EPICS/RecordDeviceSupport.h | 19 +++++++++++++++++++ .../ChimeraTK/EPICS/RecordDeviceSupportBase.h | 8 ++++++++ .../src/ControlSystemAdapterPVProvider.cpp | 2 ++ chimeraTKApp/src/DeviceAccessPVProvider.cpp | 2 ++ chimeraTKApp/src/Makefile | 1 + chimeraTKApp/src/RecordAddress.cpp | 4 ++++ chimeraTKApp/src/int64.dbd | 2 ++ chimeraTKApp/src/recordDefinitions.cpp | 14 ++++++++++++++ 10 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 chimeraTKApp/src/int64.dbd diff --git a/README.md b/README.md index ce3623c..df0b223 100644 --- a/README.md +++ b/README.md @@ -182,8 +182,8 @@ EPICS Records This device support supports the `aai`, `aao`, `ai`, `ao`, `bi`, `bo`, `longin`, `longout`, `mbbi`, `mbbo`, `mbbiDirect`, `mbboDirect`, `stringin`, and `stringout` -records. When using EPICS Base 3.16 or newer, the `lsi` and `lso` records are -supported as well. +records. When using EPICS Base 3.16 or newer, the `int64in`, `int64out`, `lsi` +and `lso` records are supported as well. The `DTYP` is `ChimeraTK` for all record types. @@ -207,7 +207,8 @@ process variables or registers exist. The *data-type* is optional and specifies the data type of the underlying process variable or register. In most cases, the best data-type is detected automatically. If explicitly specified, the data type must be `int8`, `uint8`, -`int16`, `uint16`, `int32`, `uint32`, `float`, `double`, or `string`. +`int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`, `float`, `double`, or +`string`. The *options* are optional and are a list of comma-separated strings. @@ -230,6 +231,8 @@ specifying the data type as part of the address. When using the ChimeraTK Control System Adapter, the data type of the PV is fixed and thus the record's data type must be set to match it. +The `aai` and `aao` records do not support the `int64` and `uint64` data-types. + #### `lsi` and `lso` record The `lsi` and `lso` record are only supported when using EPICS Base 3.16 or diff --git a/chimeraTKApp/src/ChimeraTK/EPICS/ArrayRecordDeviceSupport.h b/chimeraTKApp/src/ChimeraTK/EPICS/ArrayRecordDeviceSupport.h index 3d85bbb..2f1e4be 100644 --- a/chimeraTKApp/src/ChimeraTK/EPICS/ArrayRecordDeviceSupport.h +++ b/chimeraTKApp/src/ChimeraTK/EPICS/ArrayRecordDeviceSupport.h @@ -167,6 +167,12 @@ class ArrayRecordDeviceSupportTrait : public RecordDeviceSupportBase { checkFtvl(DBF_DOUBLE); } else if (this->valueType == typeid(std::string)) { checkFtvl(DBF_STRING); + } else if (this->valueType == typeid(std::int64_t)) { + throw std::invalid_argument( + "The value type int64 is not support by this record."); + } else if (this->valueType == typeid(std::uint64_t)) { + throw std::invalid_argument( + "The value type uint64 is not support by this record."); } else { throw std::logic_error( std::string("Unexpected value type: ") + valueType.name()); diff --git a/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupport.h b/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupport.h index 87dcf6e..0e2a8fb 100644 --- a/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupport.h +++ b/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupport.h @@ -27,6 +27,7 @@ extern "C" { } #if EPICS_VERSION > 3 || (EPICS_VERSION == 3 && EPICS_REVISION >= 16) +# define CHIMERATK_EPICS_INT64_SUPPORTED 1 # define CHIMERATK_EPICS_LONG_STRING_SUPPORTED 1 #endif @@ -37,6 +38,10 @@ extern "C" { #include #include #include +#ifdef CHIMERATK_EPICS_INT64_SUPPORTED +# include +# include +#endif // CHIMERATK_EPICS_INT64_SUPPORTED #include #include #ifdef CHIMERATK_EPICS_LONG_STRING_SUPPORTED @@ -103,6 +108,20 @@ struct RecordDeviceSupportTypeHelper<::boRecord> { FixedScalarRecordDeviceSupport<::boRecord>; }; +#ifdef CHIMERATK_EPICS_INT64_SUPPORTED +template<> +struct RecordDeviceSupportTypeHelper<::int64inRecord> { + using type = + FixedScalarRecordDeviceSupport<::int64inRecord>; +}; + +template<> +struct RecordDeviceSupportTypeHelper<::int64outRecord> { + using type = + FixedScalarRecordDeviceSupport<::int64outRecord>; +}; +#endif // CHIMERATK_EPICS_INT64_SUPPORTED + template<> struct RecordDeviceSupportTypeHelper<::longinRecord> { using type = diff --git a/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupportBase.h b/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupportBase.h index b0f43f7..f1d9ee0 100644 --- a/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupportBase.h +++ b/chimeraTKApp/src/ChimeraTK/EPICS/RecordDeviceSupportBase.h @@ -112,6 +112,10 @@ class RecordDeviceSupportBase { return F()(); } else if (this->valueType == typeid(std::uint32_t)) { return F()(); + } else if (this->valueType == typeid(std::int64_t)) { + return F()(); + } else if (this->valueType == typeid(std::uint64_t)) { + return F()(); } else if (this->valueType == typeid(float)) { return F()(); } else if (this->valueType == typeid(double)) { @@ -198,6 +202,10 @@ class RecordDeviceSupportBase { return F()(std::forward(args)...); } else if (valueType == typeid(std::uint32_t)) { return F()(std::forward(args)...); + } else if (valueType == typeid(std::int64_t)) { + return F()(std::forward(args)...); + } else if (valueType == typeid(std::uint64_t)) { + return F()(std::forward(args)...); } else if (valueType == typeid(float)) { return F()(std::forward(args)...); } else if (valueType == typeid(double)) { diff --git a/chimeraTKApp/src/ControlSystemAdapterPVProvider.cpp b/chimeraTKApp/src/ControlSystemAdapterPVProvider.cpp index a2d8f0b..c5b200f 100644 --- a/chimeraTKApp/src/ControlSystemAdapterPVProvider.cpp +++ b/chimeraTKApp/src/ControlSystemAdapterPVProvider.cpp @@ -45,6 +45,8 @@ ControlSystemAdapterPVProvider::ControlSystemAdapterPVProvider( this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); + this->insertCreatePVSupportFunc(); + this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); diff --git a/chimeraTKApp/src/DeviceAccessPVProvider.cpp b/chimeraTKApp/src/DeviceAccessPVProvider.cpp index dfb9f2a..6c473bc 100644 --- a/chimeraTKApp/src/DeviceAccessPVProvider.cpp +++ b/chimeraTKApp/src/DeviceAccessPVProvider.cpp @@ -41,6 +41,8 @@ DeviceAccessPVProvider::DeviceAccessPVProvider( this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); + this->insertCreatePVSupportFunc(); + this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); this->insertCreatePVSupportFunc(); diff --git a/chimeraTKApp/src/Makefile b/chimeraTKApp/src/Makefile index 1656cea..906f142 100644 --- a/chimeraTKApp/src/Makefile +++ b/chimeraTKApp/src/Makefile @@ -17,6 +17,7 @@ DBD += ChimeraTK-ControlSystemAdapter-EPICS.dbd ChimeraTK-ControlSystemAdapter-EPICS_DBD += common.dbd ifdef BASE_3_16 +ChimeraTK-ControlSystemAdapter-EPICS_DBD += int64.dbd ChimeraTK-ControlSystemAdapter-EPICS_DBD += longString.dbd endif diff --git a/chimeraTKApp/src/RecordAddress.cpp b/chimeraTKApp/src/RecordAddress.cpp index 13076bd..82d8c60 100644 --- a/chimeraTKApp/src/RecordAddress.cpp +++ b/chimeraTKApp/src/RecordAddress.cpp @@ -234,6 +234,10 @@ class Parser { return typeid(std::int32_t); } else if (accept("uint32")) { return typeid(std::uint32_t); + } else if (accept("int64")) { + return typeid(std::int64_t); + } else if (accept("uint64")) { + return typeid(std::uint64_t); } else if (accept("float")) { return typeid(float); } else if (accept("double")) { diff --git a/chimeraTKApp/src/int64.dbd b/chimeraTKApp/src/int64.dbd new file mode 100644 index 0000000..e63afd7 --- /dev/null +++ b/chimeraTKApp/src/int64.dbd @@ -0,0 +1,2 @@ +device(int64in,INST_IO,devInt64inChimeraTK,"ChimeraTK") +device(int64out,INST_IO,devInt64outChimeraTK,"ChimeraTK") diff --git a/chimeraTKApp/src/recordDefinitions.cpp b/chimeraTKApp/src/recordDefinitions.cpp index 169057d..1f103d5 100644 --- a/chimeraTKApp/src/recordDefinitions.cpp +++ b/chimeraTKApp/src/recordDefinitions.cpp @@ -292,6 +292,20 @@ epicsExportAddress(dset, devBiChimeraTK); auto devBoChimeraTK = deviceSupportStruct<::boRecord>(); epicsExportAddress(dset, devBoChimeraTK); +#ifdef CHIMERATK_EPICS_INT64_SUPPORTED +/** + * int64in record type. + */ +auto devInt64inChimeraTK = deviceSupportStruct<::int64inRecord>(); +epicsExportAddress(dset, devInt64inChimeraTK); + +/** + * int64out record type. + */ +auto devInt64outChimeraTK = deviceSupportStruct<::int64outRecord>(); +epicsExportAddress(dset, devInt64outChimeraTK); +#endif // CHIMERATK_EPICS_INT64_SUPPORTED + /** * longin record type. */