use dbChannel* in builder
This commit is contained in:
@ -450,9 +450,9 @@ PDBProvider::PDBProvider(const epics::pvAccess::Configuration::const_shared_poin
|
||||
std::tr1::shared_ptr<PVIFBuilder> pvifbuilder(PVIFBuilder::create(mem.type, chan.chan));
|
||||
|
||||
if(!parts.empty())
|
||||
builder = pvifbuilder->dtype(builder, parts.back().name, chan);
|
||||
builder = pvifbuilder->dtype(builder, parts.back().name);
|
||||
else
|
||||
builder = pvifbuilder->dtype(builder, "", chan);
|
||||
builder = pvifbuilder->dtype(builder, "");
|
||||
|
||||
if(!parts.empty()) {
|
||||
for(size_t j=0; j<parts.size()-1; j++)
|
||||
@ -561,7 +561,7 @@ PDBProvider::PDBProvider(const epics::pvAccess::Configuration::const_shared_poin
|
||||
info.evt_VALUE.self = info.evt_PROPERTY.self = pv;
|
||||
assert(info.chan);
|
||||
|
||||
info.pvif.reset(info.builder->attach(info.chan, pv->complete, info.attachment));
|
||||
info.pvif.reset(info.builder->attach(pv->complete, info.attachment));
|
||||
|
||||
// TODO: don't need evt_PROPERTY for PVIF plain
|
||||
dbChannel *pchan = info.chan2.chan ? info.chan2.chan : info.chan.chan;
|
||||
|
@ -334,7 +334,7 @@ PDBGroupPut::PDBGroupPut(const PDBGroupChannel::shared_pointer& channel,
|
||||
{
|
||||
PDBGroupPV::Info& info = channel->pv->members[i];
|
||||
|
||||
pvif[i].reset(info.builder->attach(info.chan, pvf, info.attachment));
|
||||
pvif[i].reset(info.builder->attach(pvf, info.attachment));
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ void PDBGroupPut::put(pvd::PVStructure::shared_pointer const & value,
|
||||
PDBGroupPV::Info& info = channel->pv->members[i];
|
||||
if(!info.allowProc) continue;
|
||||
|
||||
putpvif[i].reset(info.builder->attach(info.chan, value, info.attachment));
|
||||
putpvif[i].reset(info.builder->attach(value, info.attachment));
|
||||
}
|
||||
|
||||
pvd::Status ret;
|
||||
|
@ -108,11 +108,11 @@ PDBSinglePV::PDBSinglePV(DBCH& chan,
|
||||
this->chan2.swap(temp);
|
||||
}
|
||||
this->chan.swap(chan);
|
||||
fielddesc = std::tr1::static_pointer_cast<const pvd::Structure>(builder->dtype(this->chan));
|
||||
fielddesc = std::tr1::static_pointer_cast<const pvd::Structure>(builder->dtype());
|
||||
|
||||
complete = pvd::getPVDataCreate()->createPVStructure(fielddesc);
|
||||
FieldName temp;
|
||||
pvif.reset(builder->attach(this->chan, complete, temp));
|
||||
pvif.reset(builder->attach(complete, temp));
|
||||
|
||||
epics::atomic::increment(num_instances);
|
||||
}
|
||||
@ -308,7 +308,7 @@ PDBSinglePut::PDBSinglePut(const PDBSingleChannel::shared_pointer &channel,
|
||||
,requester(requester)
|
||||
,changed(new pvd::BitSet(channel->fielddesc->getNumberFields()))
|
||||
,pvf(pvd::getPVDataCreate()->createPVStructure(channel->fielddesc))
|
||||
,pvif(channel->pv->builder->attach(channel->pv->chan, pvf, FieldName()))
|
||||
,pvif(channel->pv->builder->attach(pvf, FieldName()))
|
||||
,notifyBusy(0)
|
||||
,doProc(PVIF::ProcPassive)
|
||||
,doWait(false)
|
||||
@ -375,7 +375,7 @@ void PDBSinglePut::put(pvd::PVStructure::shared_pointer const & value,
|
||||
// TODO: dbNotify doesn't allow us for force processing
|
||||
|
||||
// assume value may be a different struct each time
|
||||
p2p::auto_ptr<PVIF> putpvif(channel->pv->builder->attach(channel->pv->chan, value, FieldName()));
|
||||
p2p::auto_ptr<PVIF> putpvif(channel->pv->builder->attach(value, FieldName()));
|
||||
unsigned mask = putpvif->dbe(*changed);
|
||||
|
||||
if(mask!=DBE_VALUE) {
|
||||
@ -397,7 +397,7 @@ void PDBSinglePut::put(pvd::PVStructure::shared_pointer const & value,
|
||||
return; // skip notification
|
||||
} else {
|
||||
// assume value may be a different struct each time
|
||||
p2p::auto_ptr<PVIF> putpvif(channel->pv->builder->attach(channel->pv->chan, value, FieldName()));
|
||||
p2p::auto_ptr<PVIF> putpvif(channel->pv->builder->attach(value, FieldName()));
|
||||
try{
|
||||
DBScanLocker L(chan);
|
||||
ret = putpvif->get(*changed, doProc);
|
||||
|
@ -775,7 +775,7 @@ short PVD2DBR(pvd::ScalarType pvt)
|
||||
}
|
||||
|
||||
epics::pvData::FieldConstPtr
|
||||
ScalarBuilder::dtype(dbChannel *channel)
|
||||
ScalarBuilder::dtype()
|
||||
{
|
||||
short dbr = dbChannelFinalFieldType(channel);
|
||||
const long maxelem = dbChannelFinalElements(channel);
|
||||
@ -830,7 +830,7 @@ ScalarBuilder::dtype(dbChannel *channel)
|
||||
}
|
||||
|
||||
PVIF*
|
||||
ScalarBuilder::attach(dbChannel *channel, const epics::pvData::PVStructurePtr& root, const FieldName& fldname)
|
||||
ScalarBuilder::attach(const epics::pvData::PVStructurePtr& root, const FieldName& fldname)
|
||||
{
|
||||
if(!channel)
|
||||
throw std::runtime_error("+type:\"scalar\" requires +channel:");
|
||||
@ -954,7 +954,7 @@ struct PlainBuilder : public PVIFBuilder
|
||||
virtual ~PlainBuilder() {}
|
||||
|
||||
// fetch the structure description
|
||||
virtual epics::pvData::FieldConstPtr dtype(dbChannel *channel) OVERRIDE FINAL {
|
||||
virtual epics::pvData::FieldConstPtr dtype() OVERRIDE FINAL {
|
||||
const short dbr = dbChannelFinalFieldType(channel);
|
||||
const long maxelem = dbChannelFinalElements(channel);
|
||||
const pvd::ScalarType pvt = DBR2PVD(dbr);
|
||||
@ -971,8 +971,7 @@ struct PlainBuilder : public PVIFBuilder
|
||||
// Attach to a structure instance.
|
||||
// must be of the type returned by dtype().
|
||||
// need not be the root structure
|
||||
virtual PVIF* attach(dbChannel *channel,
|
||||
const epics::pvData::PVStructurePtr& root,
|
||||
virtual PVIF* attach(const epics::pvData::PVStructurePtr& root,
|
||||
const FieldName& fldname) OVERRIDE FINAL
|
||||
{
|
||||
if(!channel)
|
||||
@ -995,7 +994,7 @@ struct AnyScalarBuilder : public PVIFBuilder
|
||||
virtual ~AnyScalarBuilder() {}
|
||||
|
||||
// fetch the structure description
|
||||
virtual epics::pvData::FieldConstPtr dtype(dbChannel *channel) OVERRIDE FINAL {
|
||||
virtual epics::pvData::FieldConstPtr dtype() OVERRIDE FINAL {
|
||||
(void)channel; //ignored
|
||||
return pvd::getFieldCreate()->createVariantUnion();
|
||||
}
|
||||
@ -1003,8 +1002,7 @@ struct AnyScalarBuilder : public PVIFBuilder
|
||||
// Attach to a structure instance.
|
||||
// must be of the type returned by dtype().
|
||||
// need not be the root structure
|
||||
virtual PVIF* attach(dbChannel *channel,
|
||||
const epics::pvData::PVStructurePtr& root,
|
||||
virtual PVIF* attach(const epics::pvData::PVStructurePtr& root,
|
||||
const FieldName& fldname) OVERRIDE FINAL
|
||||
{
|
||||
if(!channel)
|
||||
@ -1094,13 +1092,12 @@ struct MetaBuilder : public PVIFBuilder
|
||||
virtual ~MetaBuilder() {}
|
||||
|
||||
// fetch the structure description
|
||||
virtual epics::pvData::FieldConstPtr dtype(dbChannel *channel) OVERRIDE FINAL {
|
||||
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,
|
||||
dbChannel *channel)
|
||||
const std::string& fld) OVERRIDE FINAL
|
||||
{
|
||||
pvd::StandardFieldPtr std(pvd::getStandardField());
|
||||
if(fld.empty()) {
|
||||
@ -1117,8 +1114,7 @@ struct MetaBuilder : public PVIFBuilder
|
||||
// Attach to a structure instance.
|
||||
// must be of the type returned by dtype().
|
||||
// need not be the root structure
|
||||
virtual PVIF* attach(dbChannel *channel,
|
||||
const epics::pvData::PVStructurePtr& root,
|
||||
virtual PVIF* attach(const epics::pvData::PVStructurePtr& root,
|
||||
const FieldName& fldname) OVERRIDE FINAL
|
||||
{
|
||||
if(!channel)
|
||||
@ -1159,19 +1155,17 @@ struct ProcBuilder : public PVIFBuilder
|
||||
virtual ~ProcBuilder() {}
|
||||
|
||||
// fetch the structure description
|
||||
virtual epics::pvData::FieldConstPtr dtype(dbChannel *channel) OVERRIDE FINAL {
|
||||
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,
|
||||
dbChannel *channel) OVERRIDE FINAL
|
||||
const std::string& fld) OVERRIDE FINAL
|
||||
{
|
||||
// invisible
|
||||
return builder;
|
||||
}
|
||||
virtual PVIF* attach(dbChannel *channel,
|
||||
const epics::pvData::PVStructurePtr& root,
|
||||
virtual PVIF* attach(const epics::pvData::PVStructurePtr& root,
|
||||
const FieldName& fldname) OVERRIDE FINAL
|
||||
{
|
||||
if(!channel)
|
||||
@ -1222,13 +1216,12 @@ pvd::Status PVIF::get(const epics::pvData::BitSet& mask, proc_t proc, bool permi
|
||||
|
||||
epics::pvData::FieldBuilderPtr
|
||||
PVIFBuilder::dtype(epics::pvData::FieldBuilderPtr& builder,
|
||||
const std::string &fld,
|
||||
dbChannel *channel)
|
||||
const std::string &fld)
|
||||
{
|
||||
if(fld.empty())
|
||||
throw std::runtime_error("Can't attach this +type to root");
|
||||
throw std::runtime_error(SB()<<"Can't attach +type "<<typeid(*this).name()<<" to root");
|
||||
|
||||
epics::pvData::FieldConstPtr ftype(this->dtype(channel));
|
||||
epics::pvData::FieldConstPtr ftype(this->dtype());
|
||||
if(ftype)
|
||||
builder = builder->add(fld, ftype);
|
||||
|
||||
|
@ -397,16 +397,15 @@ struct QSRV_API PVIFBuilder
|
||||
virtual ~PVIFBuilder() {}
|
||||
|
||||
// fetch the structure description
|
||||
virtual epics::pvData::FieldConstPtr dtype(dbChannel *channel) =0;
|
||||
virtual epics::pvData::FieldConstPtr dtype() =0;
|
||||
|
||||
virtual epics::pvData::FieldBuilderPtr dtype(epics::pvData::FieldBuilderPtr& builder,
|
||||
const std::string& fld,
|
||||
dbChannel *channel);
|
||||
const std::string& fld);
|
||||
|
||||
// Attach to a structure instance.
|
||||
// must be of the type returned by dtype().
|
||||
// must be the root structure
|
||||
virtual PVIF* attach(dbChannel *channel, const epics::pvData::PVStructurePtr& root, const FieldName& fld) =0;
|
||||
virtual PVIF* attach(const epics::pvData::PVStructurePtr& root, const FieldName& fld) =0;
|
||||
|
||||
// entry point for Builder
|
||||
static PVIFBuilder* create(const std::string& mapname, dbChannel* chan);
|
||||
@ -422,8 +421,8 @@ struct QSRV_API ScalarBuilder : public PVIFBuilder
|
||||
explicit ScalarBuilder(dbChannel* chan) :PVIFBuilder(chan) {}
|
||||
virtual ~ScalarBuilder() {}
|
||||
|
||||
virtual epics::pvData::FieldConstPtr dtype(dbChannel *channel) OVERRIDE FINAL;
|
||||
virtual PVIF* attach(dbChannel *channel, const epics::pvData::PVStructurePtr& root, const FieldName& fld) OVERRIDE FINAL;
|
||||
virtual epics::pvData::FieldConstPtr dtype() OVERRIDE FINAL;
|
||||
virtual PVIF* attach(const epics::pvData::PVStructurePtr& root, const FieldName& fld) OVERRIDE FINAL;
|
||||
};
|
||||
|
||||
|
||||
|
@ -93,14 +93,14 @@ void testScalar()
|
||||
ScalarBuilder builder_ai_rval(chan_ai_rval);
|
||||
ScalarBuilder builder_mbbi(chan_mbbi);
|
||||
|
||||
pvd::FieldConstPtr dtype_li(builder_li.dtype(chan_li));
|
||||
pvd::FieldConstPtr dtype_li(builder_li.dtype());
|
||||
#ifdef USE_INT64
|
||||
pvd::FieldConstPtr dtype_i64(builder_i64.dtype(chan_i64));
|
||||
pvd::FieldConstPtr dtype_i64(builder_i64.dtype());
|
||||
#endif
|
||||
pvd::FieldConstPtr dtype_si(builder_si.dtype(chan_si));
|
||||
pvd::FieldConstPtr dtype_ai(builder_ai.dtype(chan_ai));
|
||||
pvd::FieldConstPtr dtype_ai_rval(builder_ai_rval.dtype(chan_ai_rval));
|
||||
pvd::FieldConstPtr dtype_mbbi(builder_mbbi.dtype(chan_mbbi));
|
||||
pvd::FieldConstPtr dtype_si(builder_si.dtype());
|
||||
pvd::FieldConstPtr dtype_ai(builder_ai.dtype());
|
||||
pvd::FieldConstPtr dtype_ai_rval(builder_ai_rval.dtype());
|
||||
pvd::FieldConstPtr dtype_mbbi(builder_mbbi.dtype());
|
||||
|
||||
pvd::StructureConstPtr dtype_root(pvd::getFieldCreate()->createFieldBuilder()
|
||||
->add("li", dtype_li)
|
||||
@ -115,14 +115,14 @@ void testScalar()
|
||||
|
||||
root = pvd::getPVDataCreate()->createPVStructure(dtype_root);
|
||||
|
||||
pvif_li.reset(builder_li.attach(chan_li, root, FieldName("li")));
|
||||
pvif_li.reset(builder_li.attach(root, FieldName("li")));
|
||||
#ifdef USE_INT64
|
||||
pvif_i64.reset(builder_i64.attach(chan_i64, root, FieldName("i64")));
|
||||
pvif_i64.reset(builder_i64.attach(root, FieldName("i64")));
|
||||
#endif
|
||||
pvif_si.reset(builder_si.attach(chan_si, root, FieldName("si")));
|
||||
pvif_ai.reset(builder_ai.attach(chan_ai, root, FieldName("ai")));
|
||||
pvif_ai_rval.reset(builder_ai_rval.attach(chan_ai_rval, root, FieldName("ai_rval")));
|
||||
pvif_mbbi.reset(builder_mbbi.attach(chan_mbbi, root, FieldName("mbbi")));
|
||||
pvif_si.reset(builder_si.attach(root, FieldName("si")));
|
||||
pvif_ai.reset(builder_ai.attach(root, FieldName("ai")));
|
||||
pvif_ai_rval.reset(builder_ai_rval.attach(root, FieldName("ai_rval")));
|
||||
pvif_mbbi.reset(builder_mbbi.attach(root, FieldName("mbbi")));
|
||||
}
|
||||
|
||||
testShow()<<"Entire structure\n"<<root;
|
||||
@ -453,10 +453,10 @@ void testPlain()
|
||||
p2p::auto_ptr<PVIFBuilder> builder_ai(PVIFBuilder::create("plain", chan_ai));
|
||||
p2p::auto_ptr<PVIFBuilder> builder_mbbi(PVIFBuilder::create("plain", chan_mbbi));
|
||||
|
||||
pvd::FieldConstPtr dtype_li(builder_li->dtype(chan_li));
|
||||
pvd::FieldConstPtr dtype_si(builder_si->dtype(chan_si));
|
||||
pvd::FieldConstPtr dtype_ai(builder_ai->dtype(chan_ai));
|
||||
pvd::FieldConstPtr dtype_mbbi(builder_mbbi->dtype(chan_mbbi));
|
||||
pvd::FieldConstPtr dtype_li(builder_li->dtype());
|
||||
pvd::FieldConstPtr dtype_si(builder_si->dtype());
|
||||
pvd::FieldConstPtr dtype_ai(builder_ai->dtype());
|
||||
pvd::FieldConstPtr dtype_mbbi(builder_mbbi->dtype());
|
||||
|
||||
pvd::StructureConstPtr dtype_root(pvd::getFieldCreate()->createFieldBuilder()
|
||||
->add("li", dtype_li)
|
||||
@ -467,10 +467,10 @@ void testPlain()
|
||||
|
||||
root = pvd::getPVDataCreate()->createPVStructure(dtype_root);
|
||||
|
||||
pvif_li.reset(builder_li->attach(chan_li, root, FieldName("li")));
|
||||
pvif_si.reset(builder_si->attach(chan_si, root, FieldName("si")));
|
||||
pvif_ai.reset(builder_ai->attach(chan_ai, root, FieldName("ai")));
|
||||
pvif_mbbi.reset(builder_mbbi->attach(chan_mbbi, root, FieldName("mbbi")));
|
||||
pvif_li.reset(builder_li->attach(root, FieldName("li")));
|
||||
pvif_si.reset(builder_si->attach(root, FieldName("si")));
|
||||
pvif_ai.reset(builder_ai->attach(root, FieldName("ai")));
|
||||
pvif_mbbi.reset(builder_mbbi->attach(root, FieldName("mbbi")));
|
||||
}
|
||||
|
||||
pvd::BitSet mask;
|
||||
|
Reference in New Issue
Block a user