示例#1
0
void ChannelPutLocal::put(
    PVStructurePtr const &pvStructure,BitSetPtr const &bitSet)
{
    ChannelPutRequester::shared_pointer requester = channelPutRequester.lock();
    if(!requester) return;
    if(isDestroyed) {
         requester->putDone(channelDestroyedStatus,getPtrSelf());
         return;
    }
    try {
        {   
            epicsGuard <PVRecord> guard(*pvRecord);
            pvRecord->beginGroupPut();
            pvCopy->updateMaster(pvStructure, bitSet);
            if(callProcess) {
                 pvRecord->process();
            }
            pvRecord->endGroupPut();
        }
        requester->putDone(Status::Ok,getPtrSelf());
        if(pvRecord->getTraceLevel()>1)
        {   
            cout << "ChannelPutLocal::put" << endl;
        }
    } catch(std::exception& ex) {
        Status status = Status(Status::STATUSTYPE_FATAL, ex.what());
        requester->putDone(status,getPtrSelf());
    }
}
示例#2
0
void ChannelPutLocal::get()
{
    ChannelPutRequester::shared_pointer requester = channelPutRequester.lock();
    if(!requester) return;
    if(isDestroyed) {
         requester->getDone(
             channelDestroyedStatus,getPtrSelf(),nullPVStructure,nullBitSet);
         return;
    }
    try {
        PVStructurePtr pvStructure = pvCopy->createPVStructure();
         BitSetPtr bitSet(new BitSet(pvStructure->getNumberFields()));
         bitSet->clear();
         bitSet->set(0);
         {
             epicsGuard <PVRecord> guard(*pvRecord);
             pvCopy->updateCopyFromBitSet(pvStructure, bitSet);
         }
         requester->getDone(
            Status::Ok,getPtrSelf(),pvStructure,bitSet);
         if(pvRecord->getTraceLevel()>1)
         {
             cout << "ChannelPutLocal::get" << endl;
         }
    } catch(std::exception& ex) {
        Status status = Status(Status::STATUSTYPE_FATAL, ex.what());
        PVStructurePtr pvStructure;
        BitSetPtr bitSet;
        requester->getDone(status,getPtrSelf(),pvStructure,bitSet);
    }
}
示例#3
0
ChannelPutLocalPtr ChannelPutLocal::create(
    ChannelLocalPtr const &channelLocal,
    ChannelPutRequester::shared_pointer const & channelPutRequester,
    PVStructurePtr const & pvRequest,
    PVRecordPtr const &pvRecord)
{
    PVCopyPtr pvCopy = PVCopy::create(
        pvRecord->getPVRecordStructure()->getPVStructure(),
        pvRequest,
        "");
    if(!pvCopy) {
        Status status(
            Status::STATUSTYPE_ERROR,
            "invalid pvRequest");
        ChannelPut::shared_pointer channelPut;
        PVStructurePtr pvStructure;
        BitSetPtr bitSet;
        channelPutRequester->channelPutConnect(
            status,
            channelPut,
            nullStructure);
        ChannelPutLocalPtr localPut;
        return localPut;
    }
    ChannelPutLocalPtr put(new ChannelPutLocal(
        getProcess(pvRequest,true),
        channelLocal,
        channelPutRequester,
        pvCopy,
        pvRecord));
    channelPutRequester->channelPutConnect(
        Status::Ok, put, pvCopy->getStructure());
    if(pvRecord->getTraceLevel()>0)
    {
        cout << "ChannelPutLocal::create";
        cout << " recordName " << pvRecord->getRecordName() << endl;
    }
    return put;
}
示例#4
0
ChannelPut::shared_pointer ChannelBase::createChannelPut(
        ChannelPutRequester::shared_pointer const &channelPutRequester,
        PVStructure::shared_pointer const &pvRequest)
{
    Status status(Status::STATUSTYPE_ERROR,
        String("ChannelPut not supported"));
    channelPutRequester->channelPutConnect(
        status,
        ChannelPut::shared_pointer(),
        PVStructure::shared_pointer(),
        BitSet::shared_pointer());
    return ChannelPut::shared_pointer();
}
示例#5
0
文件: dbPv.cpp 项目: dhickin/pvaSrv
ChannelPut::shared_pointer DbPv::createChannelPut(
        ChannelPutRequester::shared_pointer const &channelPutRequester,
        PVStructure::shared_pointer const &pvRequest)
{
    DbPvPut::shared_pointer dbPvPut(
          new DbPvPut(getPtrSelf(),channelPutRequester));
    if(!dbPvPut->init(pvRequest)) {
        Status createFailed(Status::STATUSTYPE_ERROR, "create dbPvPut failed");
        channelPutRequester->channelPutConnect(
            createFailed,
            dbPvPut,
            nullStructure);
    }
    return dbPvPut;
}