本文整理汇总了C++中PvaClientChannelPtr::createPut方法的典型用法代码示例。如果您正苦于以下问题:C++ PvaClientChannelPtr::createPut方法的具体用法?C++ PvaClientChannelPtr::createPut怎么用?C++ PvaClientChannelPtr::createPut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PvaClientChannelPtr
的用法示例。
在下文中一共展示了PvaClientChannelPtr::createPut方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}