From b3d37e7f3966b137d5e27a7287e0a113e55a9b81 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 19 Oct 2021 11:05:17 -0700 Subject: [PATCH] Add +type:"structure" --- documentation/qsrvpage.dox | 4 +++ documentation/release_notes.dox | 3 +++ pdbApp/pvif.cpp | 43 +++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/documentation/qsrvpage.dox b/documentation/qsrvpage.dox index 5850368..8124fb9 100644 --- a/documentation/qsrvpage.dox +++ b/documentation/qsrvpage.dox @@ -108,6 +108,7 @@ record(...) { @li "any" @li "meta" @li "proc" +@li "structure" The "scalar" mapping places an NTScalar or NTScalarArray as a sub-structure. @@ -124,6 +125,9 @@ placed in the top-level structure. The "proc" mapping uses neither "value" nor meta-data. Instead the target record is processed during a put. +The "structure" mapping allows an "+id" to be attached without a "+channel". +So none of "+channel", "+trigger", nor "+putorder" are meaningful for a "structure" mapping. + @subsubsection qsrv_group_map_trig Field Update Triggers The field triggers define how changes to the consitutent field diff --git a/documentation/release_notes.dox b/documentation/release_notes.dox index e5d5530..627126e 100644 --- a/documentation/release_notes.dox +++ b/documentation/release_notes.dox @@ -5,6 +5,9 @@ Release 1.3.2 (UNRELEASED) ========================== +- Additions + - Add new "structure" to @ref qsrv_group_map_types + Release 1.3.1 (June 2021) ========================= diff --git a/pdbApp/pvif.cpp b/pdbApp/pvif.cpp index f3187d0..c9bfd5b 100644 --- a/pdbApp/pvif.cpp +++ b/pdbApp/pvif.cpp @@ -1175,6 +1175,47 @@ struct ProcBuilder : public PVIFBuilder } }; +struct PVIFNoOp : public PVIF +{ + PVIFNoOp(dbChannel *channel) :PVIF(channel) {} + + virtual void put(epics::pvData::BitSet& mask, unsigned dbe, db_field_log *pfl) OVERRIDE FINAL + {} + + virtual pvd::Status get(const epics::pvData::BitSet& mask, proc_t proc, bool permit) OVERRIDE FINAL + { + return pvd::Status(); + } + + virtual unsigned dbe(const epics::pvData::BitSet& mask) OVERRIDE FINAL + { + return 0; + } +}; + +struct IDBuilder : public PVIFBuilder +{ + explicit IDBuilder(dbChannel* chan) :PVIFBuilder(chan) {} + virtual ~IDBuilder() {} + + // fetch the structure description + virtual epics::pvData::FieldConstPtr dtype() OVERRIDE FINAL { + throw std::logic_error("Don't call me"); + } + + virtual epics::pvData::FieldBuilderPtr dtype(epics::pvData::FieldBuilderPtr& builder, + const std::string& fld) OVERRIDE FINAL + { + // caller has already done builder->setId(...) + return builder; + } + virtual PVIF* attach(const epics::pvData::PVStructurePtr& root, + const FieldName& fldname) OVERRIDE FINAL + { + return new PVIFNoOp(channel); + } +}; + }//namespace pvd::Status PVIF::get(const epics::pvData::BitSet& mask, proc_t proc, bool permit) @@ -1240,6 +1281,8 @@ PVIFBuilder* PVIFBuilder::create(const std::string& type, dbChannel* chan) return new MetaBuilder(chan); else if(type=="proc") return new ProcBuilder(chan); + else if(type=="structure") + return new IDBuilder(chan); else throw std::runtime_error(std::string("Unknown +type=")+type); }