Esempio n. 1
0
ChannelRPCLocalPtr ChannelRPCLocal::create(
    ChannelLocalPtr const &channelLocal,
    ChannelRPCRequester::shared_pointer const & channelRPCRequester,
    PVStructurePtr const & pvRequest,
    PVRecordPtr const &pvRecord)
{
    Service::shared_pointer service = pvRecord->getService(pvRequest);
    if (!service)
    {
        Status status(Status::STATUSTYPE_ERROR,
            "ChannelRPC not supported");
            channelRPCRequester->channelRPCConnect(status,ChannelRPCLocalPtr());
        return ChannelRPCLocalPtr();
    }

    if (!channelRPCRequester)
        throw std::invalid_argument("channelRPCRequester == null");

    // TODO use std::make_shared
    ChannelRPCLocalPtr rpc(
        new ChannelRPCLocal(channelLocal, channelRPCRequester, service, pvRecord)
    );
    channelRPCRequester->channelRPCConnect(Status::Ok, rpc);
    if(pvRecord->getTraceLevel()>0)
    {
        cout << "ChannelRPCLocal::create";
        cout << " recordName " << pvRecord->getRecordName() << endl;
    }
    return rpc;
}
Esempio n. 2
0
ChannelRPC::shared_pointer ChannelBase::createChannelRPC(
        ChannelRPCRequester::shared_pointer const & channelRPCRequester,
        PVStructure::shared_pointer const & pvRequest)
{
    Status status(Status::STATUSTYPE_ERROR,
        String("ChannelRPC not supported"));
    channelRPCRequester->channelRPCConnect(status,ChannelRPC::shared_pointer());
    return ChannelRPC::shared_pointer();
}
Esempio n. 3
0
ChannelRPC::shared_pointer CAChannel::createChannelRPC(
        ChannelRPCRequester::shared_pointer const & channelRPCRequester,
        epics::pvData::PVStructure::shared_pointer const & /*pvRequest*/)
{
    Status errorStatus(Status::STATUSTYPE_ERROR, "not supported");
    ChannelRPC::shared_pointer nullChannelRPC;
    EXCEPTION_GUARD(channelRPCRequester->channelRPCConnect(errorStatus, nullChannelRPC));
    return nullChannelRPC;
}
Esempio n. 4
0
epics::pvAccess::ChannelRPC::shared_pointer ChannelImpl::createChannelRPC(
    ChannelRPCRequester::shared_pointer const &channelRPCRequester,
    PVStructure::shared_pointer const &pvRequest)
{
    ChannelRPC *channel = new ChannelRPCImpl(getPtrSelf(),channelRPCRequester,serviceRPC);
    ChannelRPC::shared_pointer channelRPC(channel);
    addChannelRPC(channelRPC);
    channelRPCRequester->channelRPCConnect(Status::Ok,channelRPC);
    return channelRPC;
}
Esempio n. 5
0
    virtual ChannelRPC::shared_pointer createChannelRPC(
        ChannelRPCRequester::shared_pointer const & channelRPCRequester,
        epics::pvData::PVStructure::shared_pointer const & /*pvRequest*/)
    {
        // nothing expected to be in pvRequest

        if (channelRPCRequester.get() == 0)
            throw std::invalid_argument("channelRPCRequester == null");

        if (m_destroyed.get())
        {
            ChannelRPC::shared_pointer nullPtr;
            channelRPCRequester->channelRPCConnect(epics::pvData::Status(epics::pvData::Status::STATUSTYPE_ERROR, "channel destroyed"), nullPtr);
            return nullPtr;
        }

        // TODO use std::make_shared
        std::tr1::shared_ptr<ChannelRPCServiceImpl> tp(
            new ChannelRPCServiceImpl(shared_from_this(), channelRPCRequester, m_rpcService)
        );
        ChannelRPC::shared_pointer channelRPCImpl = tp;
        channelRPCRequester->channelRPCConnect(Status::Ok, channelRPCImpl);
        return channelRPCImpl;
    }