void ExampleLink::monitorEvent(epics::pvData::MonitorPtr const & monitor)
{
    cout << "ExampleLink::monitorEvent\n";
    lock();
    try {
        beginGroupPut();
        process();
        endGroupPut();
    } catch(...) {
        unlock();
        throw;
    }
    unlock();
    MonitorElementPtr monitorElement = monitor->poll();
    if(monitorElement) monitor->release(monitorElement);
}
示例#2
0
void ExampleLink::monitorEvent(epics::pvData::MonitorPtr const & monitor)
{
    while(true) {
        MonitorElementPtr monitorElement = monitor->poll();
        if(!monitorElement) break;
        PVStructurePtr pvStructurePtr = monitorElement->pvStructurePtr;
        PVDoubleArrayPtr pvDoubleArray = pvStructurePtr->getSubField<PVDoubleArray>("value");
        if(!pvDoubleArray) throw std::runtime_error("value is not a double array");

        lock();
        try {
            beginGroupPut();
            pvValue->replace(pvDoubleArray->view());
            process();
            endGroupPut();
        } catch(...) {
           unlock();
           throw;
        }
        unlock();
        monitor->release(monitorElement);
    }
}