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


C++ PvaClientPtr::channel方法代码示例

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


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

示例1: exampleMonitor

static void exampleMonitor(PvaClientPtr const &pva,string provider)
{
    PvaClientMonitorPtr monitor = pva->channel("DBRdouble00",provider,2.0)->monitor("");
    PvaClientMonitorDataPtr monitorData = monitor->getData();
    PvaClientPutPtr put = pva->channel("DBRdouble00",provider,2.0)->put("");
    PvaClientPutDataPtr putData = put->getData();
    for(size_t ntimes=0; ntimes<5; ++ntimes)
    {
         double value = ntimes;
         cout << "put " << value << endl;
         putData->putDouble(value); put->put();
         if(!monitor->waitEvent(.1)) {
               cout << "waitEvent returned false. Why???";
               continue;
         } else while(true) {
             cout << "monitor " << monitorData->getDouble() << endl;
             cout << "changed\n";
             monitorData->showChanged(cout);
             cout << "overrun\n";
             monitorData->showOverrun(cout);
             monitor->releaseEvent();
             if(!monitor->poll()) break;
         }
     }
}
开发者ID:epics-base,项目名称:pvExampleTestCPP,代码行数:25,代码来源:examplePvaClientMonitor.cpp

示例2: 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

示例3: main

int main(int argc,char *argv[])
{
    string provider("pva");
    if(argc==2 && string(argv[1])==string("-help")) {
        cout << "provider" << endl;
        cout << "default" << endl;
        cout << provider  << endl;
        return 0;
    }
    if(argc>1) provider = argv[1];
    cout << "_____exampleLinkClient starting_______\n";
    PvaClientPtr pva = PvaClient::create();
    try {
        PvaClientPutPtr put = pva->channel("doubleArray",provider,5.0)->put();
        PvaClientPutDataPtr putData = put->getData();
        PvaClientMonitorPtr monitor = pva->channel("exampleLink")->monitor("");
        PvaClientMonitorDataPtr pvaData = monitor->getData();
        if(!monitor->waitEvent(0.0)) {
            cout << "waitEvent returned false. Why???\n";
        } else {
            cout << "exampleLink\n" << pvaData->getPVStructure() << endl;
            monitor->releaseEvent();
        }
        {
             size_t nElements = 5;
             shared_vector<double> value(nElements);
             for(size_t i=0; i< nElements; ++i) value[i] = 0.0;
             shared_vector<const double> data(freeze(value));
             putData->putDoubleArray(data); put->put();
        }
        if(!monitor->waitEvent(0.0)) {
            cout<< "waitEvent returned false. Why???\n";
        } else {
            cout << "exampleLink\n" << pvaData->getPVStructure() << endl;
            monitor->releaseEvent();
        }
        {
             size_t nElements = 5;
             shared_vector<double> value(nElements);
             for(size_t i=0; i< nElements; ++i) value[i] = .1*(i+1);
             shared_vector<const double> data(freeze(value));
             putData->putDoubleArray(data); put->put();
        }
        if(!monitor->waitEvent(0.0)) {
            cout<< "waitEvent returned false. Why???\n";
        } else {
            cout << "exampleLink\n" << pvaData->getPVStructure() << endl;
            monitor->releaseEvent();
        }
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
        return 1;
    }
    cout << "_____exampleLinkClient done_______\n";
    return 0;
}
开发者ID:anjohnson,项目名称:exampleCPP,代码行数:56,代码来源:exampleLinkClient.cpp

示例4: 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

示例5: exampleDouble

static void exampleDouble(PvaClientPtr const &pva,string const & channelName,string const & providerName)
{
    cout << "__exampleDouble__ 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();
    putData->putDouble(3.0); put->put();
    cout <<  channel->get("field(value)")->getData()->showChanged(cout) << endl;
    putData->putDouble(4.0); 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,代码行数:20,代码来源:examplePvaClientPut.cpp

示例6: init

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

    PVStructurePtr pvStructure = getPVRecordStructure()->getPVStructure();
    pvValue = pvStructure->getSubField<PVDoubleArray>("value");
    if(!pvValue) {
        return false;
    }
    pvaClientGet = pva->channel(channelName,providerName)->createGet();
    return true;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:12,代码来源:exampleGetLinkRecord.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: init

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

示例9: 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

示例10: examplePut

static void examplePut(PvaClientPtr const &pva)
{
    cout << "example put\n";
    PvaClientChannelPtr channel = pva->channel("exampleDouble");
    PvaClientPutPtr put = channel->put();
    PvaClientPutDataPtr putData = put->getData();
    PvaClientMonitorPtr monitor = pva->channel("exampleDouble")->monitor("");
    PvaClientMonitorDataPtr monitorData = monitor->getData();
    try {
        putData->putDouble(3.0); put->put();
        cout <<  channel->get("field()")->getData()->showChanged(cout) << endl;
        putData->putDouble(4.0); put->put();
        cout <<  channel->get("field()")->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;
        }
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
    }
}
开发者ID:MichaelRitzert,项目名称:pvaClientCPP,代码行数:24,代码来源:examplePvaClientPut.cpp

示例11: 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

示例12: main

int main(int argc,char *argv[])
{
    PvaClientPtr pva = PvaClient::create();
    try {
        PvaClientChannelPtr channel = pva->channel("helloPutGet");
        PvaClientPutGetPtr putGet = channel->createPutGet();
        putGet->connect();
        PvaClientPutDataPtr putData = putGet->getPutData();
        PVStructurePtr arg = putData->getPVStructure();
        PVStringPtr pvValue = arg->getSubField<PVString>("argument.value");
        pvValue->put("World");
        putGet->putGet();
        PvaClientGetDataPtr getData = putGet->getGetData();
        cout << getData->getPVStructure() << endl;
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
        return 1;
    }
    return 0;
}
开发者ID:anjohnson,项目名称:exampleCPP,代码行数:20,代码来源:helloPutGetClient.cpp

示例13: exampleCADoubleArray

static void exampleCADoubleArray(PvaClientPtr const &pva)
{
    cout << "__exampleCADoubleArray__\n";
    shared_vector<const double> value;
    try {
        cout << "short way\n";
        value =  pva->channel("DBRdoubleArray","ca",5.0)->get()->getData()->getDoubleArray();
        cout << "as doubleArray " << value << endl;
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
    }
    try {
        cout << "long way\n";
        PvaClientChannelPtr pvaChannel = pva->createChannel("DBRdoubleArray","ca");
        pvaChannel->connect(2.0);
        PvaClientGetPtr pvaGet = pvaChannel->createGet();
        PvaClientGetDataPtr pvaData = pvaGet->getData();
        value = pvaData->getDoubleArray();
        cout << "as doubleArray " << value << endl;
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
    }
}
开发者ID:ralphlange,项目名称:exampleCPP,代码行数:23,代码来源:examplePvaClientGet.cpp

示例14: exampleCADouble

static void exampleCADouble(PvaClientPtr const &pva)
{
    cout << "__exampleCADouble__\n";
    double value;
    try {
        cout << "short way\n";
        value =  pva->channel("DBRdouble00","ca",5.0)->get()->getData()->getDouble();
        cout << "as double " << value << endl;
    } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
    }
    cout << "long way\n";
    PvaClientChannelPtr pvaChannel = pva->createChannel("DBRdouble00","ca");
    pvaChannel->issueConnect();
    Status status = pvaChannel->waitConnect(2.0);
    if(!status.isOK()) {cout << " connect failed\n"; return;}
    PvaClientGetPtr pvaGet = pvaChannel->createGet();
    pvaGet->issueConnect();
    status = pvaGet->waitConnect();
    if(!status.isOK()) {cout << " createGet failed\n"; return;}
    PvaClientGetDataPtr pvaData = pvaGet->getData();
    value = pvaData->getDouble();
    cout << "as double " << value << endl;
}
开发者ID:ralphlange,项目名称:exampleCPP,代码行数:24,代码来源:examplePvaClientGet.cpp


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