当前位置: 首页>>代码示例>>C++>>正文


C++ PvaClientChannelPtr类代码示例

本文整理汇总了C++中PvaClientChannelPtr的典型用法代码示例。如果您正苦于以下问题:C++ PvaClientChannelPtr类的具体用法?C++ PvaClientChannelPtr怎么用?C++ PvaClientChannelPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PvaClientChannelPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc,char *argv[])
{
    cout << "_____examplePvaClientMonitor starting_______\n";
    try {
        PvaClientPtr pva = PvaClient::get("pva ca");
//PvaClient::setDebug(true);
        exampleMonitor(pva,"PVRdouble","pva");
        PvaClientChannelPtr pvaChannel = pva->createChannel("DBRdouble00","ca");
        pvaChannel->issueConnect();
        Status status = pvaChannel->waitConnect(1.0);
        if(status.isOK()) {
            cout << "exampleMonitor pva\n";
            exampleMonitor(pva,"DBRdouble00","pva");
            cout << "exampleMonitor ca\n";
            exampleMonitor(pva,"DBRdouble00","ca");
        } else {
             cout << "DBRdouble00 not found\n";
        }
        cout << "_____examplePvaClientMonitor done_______\n";
    } catch (std::runtime_error e) {
            cerr << "exception " << e.what() << endl;
            return 1;
    }
    return 0;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:25,代码来源:examplePvaClientMonitor.cpp

示例2: main

int main(int argc,char *argv[])
{
    cout << "_____examplePvaClientPut starting_______\n";
    try {
        PvaClientPtr pva = PvaClient::get("pva ca");
        exampleDouble(pva,"PVRdouble","pva");
        exampleDoubleArray(pva,"PVRdoubleArray","pva");
        examplePVFieldPut(pva,"PVRint","pva");
        PvaClientChannelPtr pvaChannel = pva->createChannel("DBRdouble00","ca");
        pvaChannel->issueConnect();
        Status status = pvaChannel->waitConnect(1.0);
        if(status.isOK()) {
            exampleDouble(pva,"DBRdouble00","pva");
            exampleDouble(pva,"DBRdouble00","ca");
            exampleDoubleArray(pva,"DBRdoubleArray","pva");
            exampleDoubleArray(pva,"DBRdoubleArray","ca");
            examplePVFieldPut(pva,"DBRint00","pva");
            examplePVFieldPut(pva,"DBRint00","ca");
        } else {
             cout << "DBRdouble00 not found\n";
        }
        cout << "_____examplePvaClientPut done_______\n";
    } catch (std::runtime_error e) {
        cerr << "exception " << e.what() << endl;
        return 1;
    }
    return 0;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:28,代码来源:examplePvaClientPut.cpp

示例3: main

int main(int argc,char *argv[])
{
    cout << "_____examplePvaClientNTMulti starting_______\n";
    PvaClientPtr pva = PvaClient::create();
    size_t num = 4;
    shared_vector<string> channelNames(num);
    channelNames[0] = "PVRdouble";
    channelNames[1] = "PVRstring";
    channelNames[2] = "PVRdoubleArray";
    channelNames[3] = "PVRstringArray";
    shared_vector<const string> names(freeze(channelNames));
    example(pva,"pva",names);
    PvaClientChannelPtr pvaChannel = pva->createChannel("DBRdouble00","ca");
    pvaChannel->issueConnect();
    Status status = pvaChannel->waitConnect(1.0);
    if(status.isOK()) {
        channelNames = shared_vector<string>(num);
        channelNames[0] = "DBRdouble01";
        channelNames[1] = "DBRstring01";
        channelNames[2] = "DBRdoubleArray01";
        channelNames[3] = "DBRstringArray01";
        names = freeze(channelNames);
        example(pva,"pva",names);
        example(pva,"ca",names);
    } else {
         cout << "DBRdouble00 not found\n";
    }
    cout << "_____examplePvaClientNTMulti done_______\n";
    return 0;
}
开发者ID:anjohnson,项目名称:exampleCPP,代码行数:30,代码来源:examplePvaClientNTMulti.cpp

示例4: exampleDoubleArray

static void exampleDoubleArray(PvaClientPtr const &pva,string const & channelName,string const & providerName)
{
    cout << "__exampleDoubleArray__ channelName " << channelName << " providerName " << providerName << endl;
    PvaClientChannelPtr channel = pva->channel(channelName,providerName,2.0);
    PvaClientPutPtr put = channel->put();
    PvaClientPutDataPtr putData = put->getData();
    PvaClientMonitorPtr monitor = pva->channel(channelName,providerName,2.0)->monitor("value");
    PvaClientMonitorDataPtr monitorData = monitor->getData();
    size_t num = 5;
    shared_vector<double> data(num,0);
    for(size_t i=0; i<num; ++i) data[i] = .1*i;
    putData->putDoubleArray(freeze(data)); put->put();
    cout <<  channel->get("field(value)")->getData()->showChanged(cout) << endl;
    data = shared_vector<double>(num,0);
    for(size_t i=0; i<num; ++i) data[i] = .1*(i + 1);
    putData->putDoubleArray(freeze(data)); put->put();
    cout <<  channel->get("field(value)")->getData()->showChanged(cout) << endl;
    if(!monitor->waitEvent()) {
           cout << "waitEvent returned false. Why???";
    } else while(true) {
         cout << "monitor changed\n" << monitorData->showChanged(cout);
         monitor->releaseEvent();
         if(!monitor->poll()) break;
    }
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:25,代码来源:examplePvaClientPut.cpp

示例5: exampleProcess

static void exampleProcess(PvaClientPtr const &pva)
{
    cout << "example process\n";
    PvaClientChannelPtr channel = pva->channel("PVRdouble");
    PvaClientProcessPtr process = channel->createProcess();
    process->process();
    cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
    process->process();
    cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:10,代码来源:examplePvaClientProcess.cpp

示例6: connectionChange

bool PvaClientMultiChannel::connectionChange()
{
    for(size_t i=0; i<numChannel; ++i) {
         PvaClientChannelPtr pvaClientChannel = pvaClientChannelArray[i];
         Channel::shared_pointer channel = pvaClientChannel->getChannel();
         Channel::ConnectionState stateNow = channel->getConnectionState();
         bool connectedNow = stateNow==Channel::CONNECTED ? true : false;
         if(connectedNow!=isConnected[i]) return true;
    }
    return false;
}
开发者ID:epics-base,项目名称:pvaClientCPP,代码行数:11,代码来源:pvaClientMultiChannel.cpp

示例7: examplePVFieldPut

static void examplePVFieldPut(PvaClientPtr const &pva,string const & channelName,string const & providerName)
{
    cout << "__examplePVFieldPut__ channelName " << channelName << " providerName " << providerName << endl;
    PvaClientChannelPtr channel = pva->channel(channelName,providerName,2.0);
    PvaClientPutPtr put = channel->put();
    PvaClientPutDataPtr putData = put->getData();
    PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(putData->getValue());
    convert->fromDouble(pvScalar,1.0); put->put();
    cout <<  channel->get("field(value)")->getData()->showChanged(cout) << endl;
    convert->fromDouble(pvScalar,2.0); put->put();
    cout <<  channel->get("field(value)")->getData()->showChanged(cout) << endl;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:12,代码来源:examplePvaClientPut.cpp

示例8: connectionChange

bool PvaClientMultiChannel::connectionChange()
{
    if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
    for(size_t i=0; i<numChannel; ++i) {
         PvaClientChannelPtr pvaClientChannel = pvaClientChannelArray[i];
         Channel::shared_pointer channel = pvaClientChannel->getChannel();
         Channel::ConnectionState stateNow = channel->getConnectionState();
         bool connectedNow = stateNow==Channel::CONNECTED ? true : false;
         if(connectedNow!=isConnected[i]) return true;
    }
    return false;
}
开发者ID:mdavidsaver,项目名称:easyPVACPP,代码行数:12,代码来源:pvaClientMultiChannel.cpp

示例9: channel

PvaClientChannelPtr PvaClient::channel(
        std::string const & channelName,
        std::string const & providerName,
        double timeOut)
{
    PvaClientChannelPtr pvaClientChannel = 
        pvaClientChannelCache->getChannel(channelName,providerName);
    if(pvaClientChannel) return pvaClientChannel;
    pvaClientChannel = createChannel(channelName,providerName);
    pvaClientChannel->connect(timeOut);
    pvaClientChannelCache->addChannel(pvaClientChannel);
    return pvaClientChannel;
}
开发者ID:MichaelRitzert,项目名称:pvaClientCPP,代码行数:13,代码来源:pvaClient.cpp

示例10: showCache

void PvaClientChannelCache::showCache()
{
    map<string,PvaClientChannelPtr>::iterator iter;
    for(iter = pvaClientChannelMap.begin(); iter != pvaClientChannelMap.end(); ++iter)
    {
         PvaClientChannelPtr pvaChannel = iter->second;
         Channel::shared_pointer channel = pvaChannel->getChannel();
         string channelName = channel->getChannelName();
         string providerName = channel->getProvider()->getProviderName();
         cout << "channel " << channelName << " provider " << providerName << endl;
         pvaChannel->showCache();
    } 
}
开发者ID:epics-base,项目名称:pvaClientCPP,代码行数:13,代码来源:pvaClient.cpp

示例11: initPVRecord

bool ExampleMonitorLinkRecord::init(PvaClientPtr const & pva,string const & channelName,string const & providerName)
{
    initPVRecord();

    PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
    pvValue = pvStructure->getSubField<PVDoubleArray>("value");
    if(!pvValue) {
        return false;
    }
    PvaClientChannelPtr pvaClientChannel = pva->channel(channelName,providerName,0.0);
    monitorRequester = dynamic_pointer_cast<PvaClientMonitorRequester>(getPtrSelf());
    pvaClientMonitor = pvaClientChannel->monitor("value",monitorRequester);
    return true;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:14,代码来源:exampleMonitorLinkRecord.cpp

示例12:

epics::pvData::shared_vector<epics::pvData::boolean>  PvaClientMultiChannel::getIsConnected()
{
    for(size_t i=0; i<numChannel; ++i) {
         PvaClientChannelPtr pvaClientChannel = pvaClientChannelArray[i];
         if(!pvaClientChannel) {
              isConnected[i] = false;
              continue;
         }
         Channel::shared_pointer channel = pvaClientChannel->getChannel();
         Channel::ConnectionState stateNow = channel->getConnectionState();
         isConnected[i] = (stateNow==Channel::CONNECTED) ? true : false;
    }
    return isConnected;
}
开发者ID:epics-base,项目名称:pvaClientCPP,代码行数:14,代码来源:pvaClientMultiChannel.cpp

示例13: exampleProcess

static void exampleProcess(PvaClientPtr const &pva)
{
    cout << "example process\n";
    PvaClientChannelPtr channel = pva->channel("PVRdouble");
    PvaClientProcessPtr process = channel->createProcess();
    try {
        process->process();
        cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
        process->process();
        cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
    }
}
开发者ID:epics-base,项目名称:pvExampleTestCPP,代码行数:14,代码来源:examplePvaClientProcess.cpp

示例14: addChannel

void PvaClientChannelCache::addChannel(PvaClientChannelPtr const & pvaClientChannel)
{
     Channel::shared_pointer channel = pvaClientChannel->getChannel();
     string name = channel->getChannelName()
         + channel->getProvider()->getProviderName();
     pvaClientChannelMap.insert(std::pair<string,PvaClientChannelPtr>(
         name,pvaClientChannel));
}
开发者ID:MichaelRitzert,项目名称:pvaClientCPP,代码行数:8,代码来源:pvaClient.cpp

示例15: examplePVFieldPut

static void examplePVFieldPut(PvaClientPtr const &pva)
{
    cout << "example put\n";
    PvaClientChannelPtr channel = pva->channel("exampleDouble");
    PvaClientPutPtr put = channel->put();
    PvaClientPutDataPtr putData = put->getData();
    PVFieldPtr pvField = putData->getValue();
    PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
    try {
        convert->fromDouble(pvScalar,1.0); put->put();
        cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
        convert->fromDouble(pvScalar,2.0); put->put();
        cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
    }
}
开发者ID:MichaelRitzert,项目名称:pvaClientCPP,代码行数:17,代码来源:examplePvaClientPut.cpp


注:本文中的PvaClientChannelPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。