Ejemplo n.º 1
0
ChannelFind::shared_pointer DbPvProvider::channelFind(
    string const & channelName,
    ChannelFindRequester::shared_pointer const &channelFindRequester)
{
    struct dbAddr dbAddr;
    long result = dbNameToAddr(channelName.c_str(),&dbAddr);
    if(result==0) {
        channelFindRequester->channelFindResult(
            Status::Ok,
            channelFinder,
            true);
    } else {
        Status notFoundStatus(Status::STATUSTYPE_ERROR,"pv not found");
        channelFindRequester.get()->channelFindResult(
            notFoundStatus,
            channelFinder,
            false);
    }
    return channelFinder;
}
ChannelFind::shared_pointer ChannelProviderLocal::channelFind(
    string const & channelName,
    ChannelFindRequester::shared_pointer  const &channelFindRequester)
{
    Lock xx(mutex);
    PVRecordPtr pvRecord = pvDatabase->findRecord(channelName);
    if(pvRecord) {
        channelFindRequester->channelFindResult(
            Status::Ok,
            channelFinder,
            true);
        
    } else {
        Status notFoundStatus(Status::STATUSTYPE_ERROR,"pv not found");
        channelFindRequester->channelFindResult(
            notFoundStatus,
            channelFinder,
            false);
    }
    return channelFinder;
}
Ejemplo n.º 3
0
 virtual ChannelFind::shared_pointer channelFind(std::string const & channelName,
         ChannelFindRequester::shared_pointer const & channelFindRequester)
 {
     bool found;
     {
         Lock guard(m_mutex);
         found = (m_services.find(channelName) != m_services.end()) ||
                 findWildService(channelName);
     }
     ChannelFind::shared_pointer thisPtr(shared_from_this());
     channelFindRequester->channelFindResult(Status::Ok, thisPtr, found);
     return thisPtr;
 }
Ejemplo n.º 4
0
ChannelFind::shared_pointer CAChannelProvider::channelFind(
        epics::pvData::String const & channelName,
        ChannelFindRequester::shared_pointer const & channelFindRequester)
{
    if (channelName.empty())
        throw std::invalid_argument("empty channel name");

    if (!channelFindRequester)
        throw std::invalid_argument("null requester");

    Status errorStatus(Status::STATUSTYPE_ERROR, "not implemented");
    ChannelFind::shared_pointer nullChannelFind;
    EXCEPTION_GUARD(channelFindRequester->channelFindResult(errorStatus, nullChannelFind, false));
    return nullChannelFind;
}