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


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

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


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

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

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

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

示例4: main

int main(int argc,char *argv[])
{
    cout << "_____examplePvaClientMultiDouble starting_______\n";
    try {
        PvaClientPtr pva = PvaClient::get("pva ca");
//PvaClient::setDebug(true);
        size_t num = 5;
        shared_vector<string> channelNames(num);
        channelNames[0] = "PVRdouble01";
        channelNames[1] = "PVRint";
        channelNames[2] = "PVRdouble03";
        channelNames[3] = "PVRdouble04";
        channelNames[4] = "PVRdouble05";
        shared_vector<const string> names(freeze(channelNames));
        example(pva,"pva",names);
        PvaClientChannelPtr pvaChannel = pva->createChannel("DBRdouble00","pva");
        pvaChannel->issueConnect();
        Status status = pvaChannel->waitConnect(1.0);
        if(status.isOK()) {
            channelNames = shared_vector<string>(num);
            channelNames[0] = "DBRdouble01";
            channelNames[1] = "DBRint01";
            channelNames[2] = "DBRdouble03";
            channelNames[3] = "DBRdouble04";
            channelNames[4] = "DBRdouble05";
            names = freeze(channelNames);
            example(pva,"pva",names);
            example(pva,"ca",names);
        } else {
            cout << "DBRdouble00 not found\n";
        }
        cout << "_____examplePvaClientMultiDouble done_______\n";
     } catch (std::runtime_error e) {
        cout << "exception " << e.what() << endl;
        return 1;
    }
    return 0;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:38,代码来源:examplePvaClientMultiDouble.cpp

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

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

示例7: exampleDouble

static void exampleDouble(PvaClientPtr const &pvaClient)
{
    testDiag("== exampleDouble ==");

    PvaClientChannelPtr pvaChannel;
    try {
        pvaChannel = pvaClient->createChannel("PVRdouble");
        pvaChannel->connect(2.0);
        testDiag("channel connected");
    } catch (std::runtime_error e) {
        testAbort("channel connection exception '%s'", e.what());
    }

    PvaClientPutPtr put;
    PvaClientPutDataPtr putData;
    try {
        put = pvaChannel->createPut();
        putData = put->getData();
        testDiag("put connected");
        if (!putData)
            testAbort("NULL data pointer from putGet");
    } catch (std::runtime_error e) {
        testAbort("put connection exception '%s'", e.what());
    }

    PvaClientGetPtr get;
    PvaClientGetDataPtr getData;
    try {
        get = pvaChannel->createGet();
        getData = get->getData();
        testDiag("get connected");
        if (!getData)
            testAbort("NULL data pointer from putGet");
    } catch (std::runtime_error e) {
        testAbort("get connection exception '%s'", e.what());
    }

    PvaClientMonitorRequesterPtr requester(new MyMonitor());
    PvaClientMonitorPtr monitor;
    expected.set(0);        // structure definition
    try {
        monitor = pvaChannel->monitor(requester);
        testDiag("monitor connected");
    } catch (std::runtime_error e) {
        testAbort("monitor connection exception '%s'", e.what());
    }
    epicsThreadSleep(0.1);  // Allow connection monitor event to fire

    expected.clear();       // FIXME: Magic numbers here...
    expected.set(1);        // value
    expected.set(6);        // timestamp

    try {
        for (int i=0; i<5; ++i) {
            testDiag("= put %d =", i);

            double out = i;
            putData->putDouble(out);
            put->put();

            get->get();
            double in = getData->getDouble();
            testOk(in == out, "get value matches put");
        }

        PvaClientProcessPtr process = pvaChannel->createProcess();
        process->connect();

        testDiag("= process =");
        expected.clear(1);  // no value change
        process->process();
    } catch (std::runtime_error e) {
        testAbort("exception '%s'", e.what());
    }
}
开发者ID:pheest,项目名称:exampleCPP,代码行数:75,代码来源:pvaClientTestPutGetMonitor.cpp


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