From 50de6cc58ef3830e77280274fea769a66b1d46c9 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 19 Aug 2019 18:21:54 -0700 Subject: [PATCH] remove 3.14 compatibility --- pvtoolsSrc/pvcall.cpp | 10 +--------- pvtoolsSrc/pvput.cpp | 37 +++++-------------------------------- src/remote/pv/codec.h | 38 -------------------------------------- 3 files changed, 6 insertions(+), 79 deletions(-) diff --git a/pvtoolsSrc/pvcall.cpp b/pvtoolsSrc/pvcall.cpp index fdd331d..3ebaa53 100644 --- a/pvtoolsSrc/pvcall.cpp +++ b/pvtoolsSrc/pvcall.cpp @@ -9,13 +9,9 @@ #include #include +#include #include -#if EPICS_VERSION_INT>=VERSION_INT(3,15,0,1) -# include -# define USE_JSON -#endif - #include "pvutils.h" #ifndef EXECNAME @@ -59,13 +55,9 @@ arg_t parseArg(const std::string& raw) { value = V; } else if(sval.size()>=2 && sval[0]=='{' && sval[sval.size()-1]=='}') { -#ifdef USE_JSON std::istringstream strm(sval); value = pvd::parseJSON(strm); -#else - throw std::runtime_error("Not built with JSON support"); -#endif } else { pvd::PVStringPtr V(pvd::getPVDataCreate()->createPVScalar()); diff --git a/pvtoolsSrc/pvput.cpp b/pvtoolsSrc/pvput.cpp index 87c7f64..7020e79 100644 --- a/pvtoolsSrc/pvput.cpp +++ b/pvtoolsSrc/pvput.cpp @@ -20,14 +20,10 @@ #include #include #include +#include #include -#if EPICS_VERSION_INT>=VERSION_INT(3,15,0,1) -# include -# define USE_JSON -#endif - #include #include @@ -43,12 +39,8 @@ void usage (bool details=false) "Usage: pvput [options] \n" " pvput [options] [ ...]\n" " pvput [options] = ...\n" - " pvput [options] \n"); -#ifdef USE_JSON - fprintf (stderr, - " pvput [options] \n"); -#endif - fprintf (stderr, + " pvput [options] \n" + " pvput [options] \n" "\n" COMMON_OPTIONS " Deprecated options:\n" @@ -58,13 +50,7 @@ void usage (bool details=false) , request.c_str(), timeout, defaultProvider.c_str()); if(details) { fprintf (stderr, -#ifdef USE_JSON "\n JSON support is present\n" -#else - "\n no JSON support (needs EPICS Base >=3.15.0.1)\n" -#endif - ); - fprintf (stderr, "\nExamples:\n" "\n" " pvput double01 1.234 # shorthand\n" @@ -73,9 +59,6 @@ void usage (bool details=false) " pvput arr:pv X 1.0 2.0 # shorthand (X is arbitrary and ignored)\n" " pvput arr:pv \"[1.0, 2.0]\" # shorthand\n" " pvput arr:pv value=\"[1.0, 2.0]\"\n" - ); -#ifdef USE_JSON - fprintf (stderr, "\n" "Field values may be given with JSON syntax.\n" "\n" @@ -88,7 +71,6 @@ void usage (bool details=false) " pvput group:pv some='{\"value\":1.234}' other='{\"value\":\"a string\"}'\n" "\n" ); -#endif } } @@ -124,11 +106,8 @@ struct Putter : public pvac::ClientChannel::PutCallback if(bare.size()==1 && bare[0][0]=='{') { if(debugFlag) fprintf(stderr, "In JSON top mode\n"); -#ifdef USE_JSON std::istringstream strm(bare[0]); parseJSON(strm, root, &args.tosend); -#else -#endif } else if(pairs.empty()) { if(debugFlag) fprintf(stderr, "In plain value mode\n"); @@ -208,11 +187,8 @@ struct Putter : public pvac::ClientChannel::PutCallback } else if(it->second[0]=='{' || it->second[0]=='[') { std::istringstream strm(it->second); -#ifdef USE_JSON parseJSON(strm, fld, &args.tosend); -#else - throw std::runtime_error("JSON support not built"); -#endif + } else { pvd::PVScalarPtr sfld(std::tr1::dynamic_pointer_cast(fld)); if(!sfld) { @@ -365,21 +341,18 @@ int main (int argc, char *argv[]) size_t sep = values[i].find_first_of('='); if(sep==std::string::npos) { thework.bare.push_back(values[i]); -#ifndef USE_JSON if(!thework.bare.back().empty() && thework.bare.back()[0]=='{') { fprintf(stderr, "JSON syntax not supported by this build.\n"); return 1; } -#endif } else { thework.pairs.push_back(std::make_pair(values[i].substr(0, sep), values[i].substr(sep+1))); -#ifndef USE_JSON + if(!thework.pairs.back().second.empty() && thework.pairs.back().second[0]=='{') { fprintf(stderr, "JSON syntax not supported by this build.\n"); return 1; } -#endif } } diff --git a/src/remote/pv/codec.h b/src/remote/pv/codec.h index 39dd099..9f5fe60 100644 --- a/src/remote/pv/codec.h +++ b/src/remote/pv/codec.h @@ -16,13 +16,7 @@ #include #include #include - -#ifdef EPICS_VERSION_INT -#if EPICS_VERSION_INT>=VERSION_INT(3,15,1,0) #include -#define PVA_CODEC_USE_ATOMIC -#endif -#endif #include #include @@ -71,8 +65,6 @@ class ServerChannel; namespace detail { -#ifdef PVA_CODEC_USE_ATOMIC -#undef PVA_CODEC_USE_ATOMIC template class AtomicValue { @@ -107,36 +99,6 @@ public: } }; -#else -template -class AtomicValue -{ -public: - AtomicValue(): _value(0) {}; - - T getAndSet(T value) - { - mutex.lock(); - T tmp = _value; - _value = value; - mutex.unlock(); - return tmp; - } - - T get() { - mutex.lock(); - T tmp = _value; - mutex.unlock(); - return tmp; - } - -private: - T _value; - epics::pvData::Mutex mutex; -}; -#endif - - class io_exception: public std::runtime_error { public: