1 #include <pv/reftrack.h>
15 REFTRACE_INCREMENT(num_instances);
17 snap_severity = INVALID_ALARM;
18 snap_time.secPastEpoch = 0;
33 lchan->links.erase(
this);
34 lchan->links_changed =
true;
36 bool new_debug =
false;
37 for(pvaLinkChannel::links_t::const_iterator it(lchan->links.begin()), end(lchan->links.end())
40 const pvaLink *pval = *it;
47 lchan->debug = new_debug;
50 REFTRACE_DECREMENT(num_instances);
54 pvd::StructureConstPtr monitorRequestType = pvd::getFieldCreate()->createFieldBuilder()
55 ->addNestedStructure(
"field")
57 ->addNestedStructure(
"record")
58 ->addNestedStructure(
"_options")
59 ->add(
"pipeline", pvd::pvBoolean)
60 ->add(
"atomic", pvd::pvBoolean)
61 ->add(
"queueSize", pvd::pvUInt)
66 pvd::PVStructurePtr pvaLink::makeRequest()
68 pvd::PVStructurePtr ret(pvd::getPVDataCreate()->createPVStructure(monitorRequestType));
69 ret->getSubFieldT<pvd::PVBoolean>(
"record._options.pipeline")->put(pipeline);
70 ret->getSubFieldT<pvd::PVBoolean>(
"record._options.atomic")->put(
true);
71 ret->getSubFieldT<pvd::PVUInt>(
"record._options.queueSize")->put(queueSize);
76 bool pvaLink::valid()
const
78 return lchan->connected_latched && lchan->op_mon.root;
82 pvd::PVField::const_shared_pointer pvaLink::getSubField(
const char *name)
84 pvd::PVField::const_shared_pointer ret;
88 ret = lchan->op_mon.root->getSubField(name);
92 ret = lchan->op_mon.root->getSubField(
fieldName);
95 }
else if(ret->getField()->getType()!=pvd::structure) {
97 if(strcmp(name,
"value")!=0) {
102 ret =
static_cast<const pvd::PVStructure*
>(ret.get())->getSubField(name);
110 void pvaLink::onDisconnect()
112 DEBUG(
this,<<plink->precord->name<<
" disconnect");
115 used_queue = used_scratch =
false;
118 void pvaLink::onTypeChange()
120 DEBUG(
this,<<plink->precord->name<<
" type change");
122 assert(lchan->connected_latched && !!lchan->op_mon.root);
124 fld_value = getSubField(
"value");
125 fld_seconds = std::tr1::dynamic_pointer_cast<
const pvd::PVScalar>(getSubField(
"timeStamp.secondsPastEpoch"));
126 fld_nanoseconds = std::tr1::dynamic_pointer_cast<
const pvd::PVScalar>(getSubField(
"timeStamp.nanoseconds"));
127 fld_severity = std::tr1::dynamic_pointer_cast<
const pvd::PVScalar>(getSubField(
"alarm.severity"));
128 fld_display = std::tr1::dynamic_pointer_cast<
const pvd::PVStructure>(getSubField(
"display"));
129 fld_control = std::tr1::dynamic_pointer_cast<
const pvd::PVStructure>(getSubField(
"control"));
130 fld_valueAlarm = std::tr1::dynamic_pointer_cast<
const pvd::PVStructure>(getSubField(
"valueAlarm"));
132 proc_changed.clear();
139 proc_changed.set(fld_value->getFieldOffset());
142 for(
const pvd::PVStructure* parent = fld_value->getParent(); parent; parent = parent->getParent()) {
143 proc_changed.set(parent->getFieldOffset());
146 if(fld_value->getField()->getType()==pvd::structure)
149 const pvd::PVStructure *val =
static_cast<const pvd::PVStructure*
>(fld_value.get());
150 for(
size_t i=val->getFieldOffset(), N=val->getNextFieldOffset(); i<N; i++)
std::string fieldName
sub-field within addressed PVStructure