Exemplo n.º 1
0
ChannelGetLocalPtr ChannelGetLocal::create(
    ChannelLocalPtr const &channelLocal,
    ChannelGetRequester::shared_pointer const & channelGetRequester,
    PVStructurePtr const & pvRequest,
    PVRecordPtr const &pvRecord)
{
    PVCopyPtr pvCopy = PVCopy::create(
        pvRecord->getPVRecordStructure()->getPVStructure(),
        pvRequest,
        "");
    if(!pvCopy) {
        Status status(
            Status::STATUSTYPE_ERROR,
            "invalid pvRequest");
        ChannelGet::shared_pointer channelGet;
        channelGetRequester->channelGetConnect(
            status,
            channelGet,
            nullStructure);
        ChannelGetLocalPtr localGet;
        return localGet;
    }
    PVStructurePtr pvStructure = pvCopy->createPVStructure();
    BitSetPtr   bitSet(new BitSet(pvStructure->getNumberFields()));
    ChannelGetLocalPtr get(new ChannelGetLocal(
        getProcess(pvRequest,false),
        channelLocal,
        channelGetRequester,
        pvCopy,
        pvStructure,
        bitSet,
        pvRecord));
    if(pvRecord->getTraceLevel()>0)
    {
        cout << "ChannelGetLocal::create";
        cout << " recordName " << pvRecord->getRecordName() << endl;
    }
    channelGetRequester->channelGetConnect(
        Status::Ok,get,pvStructure->getStructure());
    return get;
}
Exemplo n.º 2
0
void ChannelGetLocal::get()
{
    ChannelGetRequester::shared_pointer requester = channelGetRequester.lock();
    if(!requester) return;
    if(isDestroyed) {
         requester->getDone(
             channelDestroyedStatus,getPtrSelf(),nullPVStructure,nullBitSet);
         return;
    } 
    try {
        bitSet->clear();
        {
            epicsGuard <PVRecord> guard(*pvRecord);
            if(callProcess) {
                pvRecord->beginGroupPut();
                pvRecord->process();
                pvRecord->endGroupPut();
            }
            pvCopy->updateCopySetBitSet(pvStructure, bitSet);
        }
        if(firstTime) {
            bitSet->clear();
            bitSet->set(0);
            firstTime = false;
        } 
        requester->getDone(
            Status::Ok,
            getPtrSelf(),
            pvStructure,
            bitSet);
        if(pvRecord->getTraceLevel()>1)
        {
            cout << "ChannelGetLocal::get" << endl;
        }
    } catch(std::exception& ex) {
        Status status = Status(Status::STATUSTYPE_FATAL, ex.what());
        requester->getDone(status,getPtrSelf(),pvStructure,bitSet);
    }

}
Exemplo n.º 3
0
ChannelGet::shared_pointer ChannelBase::createChannelGet(
        ChannelGetRequester::shared_pointer const &channelGetRequester,
        PVStructure::shared_pointer const &pvRequest)
{
    Status status(Status::STATUSTYPE_ERROR,
        String("ChannelGet not supported"));
    channelGetRequester->channelGetConnect(
        status,
        ChannelGet::shared_pointer(),
        PVStructure::shared_pointer(),
        BitSet::shared_pointer());
    return ChannelGet::shared_pointer();
}
Exemplo n.º 4
0
ChannelGet::shared_pointer DbPv::createChannelGet(
        ChannelGetRequester::shared_pointer const &channelGetRequester,
        PVStructure::shared_pointer const &pvRequest)
{
    DbPvGet::shared_pointer dbPvGet(
        new DbPvGet(getPtrSelf(),channelGetRequester));
    if(!dbPvGet->init(pvRequest)) {
        Status createFailed(Status::STATUSTYPE_ERROR, "create dbPvGet failed");
        channelGetRequester->channelGetConnect(
            createFailed,
            dbPvGet,
            nullStructure);
    }
    return dbPvGet;
}