本文整理汇总了C++中channel::shared_pointer::getChannelName方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_pointer::getChannelName方法的具体用法?C++ shared_pointer::getChannelName怎么用?C++ shared_pointer::getChannelName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel::shared_pointer
的用法示例。
在下文中一共展示了shared_pointer::getChannelName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: channelCreated
void ChannelRequesterImpl::channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel)
{
qDebug() << "ChannelRequesterImpl channelCreated";
if (status.isSuccess()) {
// show warning
if (!status.isOK()) {
std::cout << "[" << channel->getChannelName() << "] channel create: " << status.toString() << std::endl;
}
} else {
std::cout << "[" << channel->getChannelName() << "] failed to create a channel: " << status.toString() << std::endl;
}
}
示例2: channelStateChange
void ChannelRequesterImpl::channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState)
{
Q_UNUSED(channel);
qDebug() << "ChannelRequesterImpl channelStateChange " << m_channelIndex;
if (connectionState == Channel::CONNECTED) {
std::cout << channel->getChannelName() << " CONNECTED: " << std::endl;
m_event.signal();
m_mutexData->SetMutexKnobDataConnected(m_channelIndex, true);
} else if (connectionState == Channel::DISCONNECTED) {
std::cout << channel->getChannelName() << " DISCONNECTED: " << std::endl;
m_event.signal();
m_mutexData->SetMutexKnobDataConnected(m_channelIndex, false);
} else {
std::cout << channel->getChannelName() << " " << Channel::ConnectionStateNames[connectionState] << std::endl;
}
}
示例3: channelCreated
virtual void channelCreated(const epics::pvData::Status& status,
Channel::shared_pointer const & channel)
{
if (status.isSuccess())
{
// show warning
if (!status.isOK())
{
std::cout << "[" << channel->getChannelName() << "] channel create: " << status << std::endl;
}
}
else
{
std::cout << "[" << channel->getChannelName() << "] failed to create a channel: " << status << std::endl;
}
}
示例4: 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));
}
示例5: channelStateChange
// always called from the same thread
virtual void channelStateChange(Channel::shared_pointer const & c, Channel::ConnectionState connectionState)
{
if (connectionState == Channel::CONNECTED)
{
cout << c->getChannelName() << " CONNECTED: " << (count+1) << endl;
if (static_cast<size_t>(++count) == total)
g_event.signal();
}
else if (connectionState == Channel::DISCONNECTED)
{
--count;
cout << c->getChannelName() << " DISCONNECTED: " << count << endl;
}
else
cout << c->getChannelName() << " " << Channel::ConnectionStateNames[connectionState] << endl;
}
示例6: channelCreated
virtual void channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel)
{
if (!status.isSuccess())
{
std::cout << "channelCreated(" << status << ", "
<< (channel ? channel->getChannelName() : "(0)") << ")" << std::endl;
}
}
示例7: channelStateChange
void MyChannelRequester::channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState)
{
cout << channel->getChannelName() << " state: "
<< Channel::ConnectionStateNames[connectionState]
<< " (" << connectionState << ")" << endl;
if (connectionState == Channel::CONNECTED)
connect_event.signal();
}
示例8: addChannel
void PvaClientChannelCache::addChannel(PvaClientChannelPtr const & pvaClientChannel)
{
Channel::shared_pointer channel = pvaClientChannel->getChannel();
string name = channel->getChannelName()
+ channel->getProvider()->getProviderName();
map<string,PvaClientChannelPtr>::iterator iter = pvaClientChannelMap.find(name);
if(iter!=pvaClientChannelMap.end()) {
throw std::runtime_error("pvaClientChannelCache::addChannel channel already cached");
}
pvaClientChannelMap.insert(std::pair<string,PvaClientChannelPtr>(
name,pvaClientChannel));
}
示例9: 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();
}
}
示例10: pvaClient
PvaClientMonitor::PvaClientMonitor(
PvaClientPtr const &pvaClient,
Channel::shared_pointer const & channel,
PVStructurePtr const &pvRequest)
: pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
isStarted(false),
connectState(connectIdle),
userPoll(false),
userWait(false)
{
if(PvaClient::getDebug()) {
cout<< "PvaClientMonitor::PvaClientMonitor()"
<< " channelName " << channel->getChannelName()
<< endl;
}
}
示例11: connectState
PvaClientRPC::PvaClientRPC(
PvaClientPtr const &pvaClient,
Channel::shared_pointer const & channel,
PVStructurePtr const &pvRequest)
:
connectState(connectIdle),
pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
rpcState(rpcIdle),
responseTimeout(0.0)
{
if(PvaClient::getDebug()) {
cout<< "PvaClientRPC::PvaClientRPC()"
<< " channelName " << channel->getChannelName()
<< endl;
}
}
示例12: channelCreated
void MyChannelRequester::channelCreated(const Status& status, Channel::shared_pointer const & channel)
{
cout << channel->getChannelName() << " created, " << status << endl;
}
示例13: runTest
void runTest()
{
reset();
if (verbose)
printf("%d channel(s) of double array size of %d element(s) (0==scalar), %d iteration(s) per run, %d run(s) (0==forever)\n", channels, arraySize, iterations, runs);
vector<string> channelNames;
char buf[64];
for (int i = 0; i < channels; i++)
{
if (arraySize > 0)
sprintf(buf, "testArray%d_%d", arraySize, i);
else
sprintf(buf, "test%d", i);
channelNames.push_back(buf);
}
vector<Channel::shared_pointer> channels;
for (vector<string>::const_iterator i = channelNames.begin();
i != channelNames.end();
i++)
{
TR1::shared_ptr<ChannelRequesterImpl> channelRequesterImpl(
new ChannelRequesterImpl()
);
Channel::shared_pointer channel = provider->createChannel(*i, channelRequesterImpl);
channels.push_back(channel);
}
bool differentConnectionsWarningIssued = false;
string theRemoteAddress;
for (vector<Channel::shared_pointer>::iterator i = channels.begin();
i != channels.end();
i++)
{
Channel::shared_pointer channel = *i;
TR1::shared_ptr<ChannelRequesterImpl> channelRequesterImpl =
TR1::dynamic_pointer_cast<ChannelRequesterImpl>(channel->getChannelRequester());
if (channelRequesterImpl->waitUntilConnected(5.0))
{
string remoteAddress = channel->getRemoteAddress();
if (theRemoteAddress.empty())
{
theRemoteAddress = remoteAddress;
}
else if (theRemoteAddress != remoteAddress)
{
if (!differentConnectionsWarningIssued)
{
std::cout << "not all channels are hosted by the same connection: " <<
theRemoteAddress << " != " << remoteAddress << std::endl;
differentConnectionsWarningIssued = true;
// we assumes same connection (thread-safety)
exit(2);
}
}
TR1::shared_ptr<ChannelMonitorRequesterImpl> getRequesterImpl(
new ChannelMonitorRequesterImpl(channel->getChannelName())
);
Monitor::shared_pointer monitor = channel->createMonitor(getRequesterImpl, pvRequest);
bool allOK = getRequesterImpl->waitUntilConnected(timeOut);
if (!allOK)
{
std::cout << "[" << channel->getChannelName() << "] failed to get all the monitors" << std::endl;
exit(1);
}
channelMonitorList.push_back(monitor);
}
else
{
std::cout << "[" << channel->getChannelName() << "] connection timeout" << std::endl;
exit(1);
}
}
if (verbose)
std::cout << "all connected" << std::endl;
{
Lock guard(waitLoopPtrMutex);
waitLoopEvent.reset(new Event());
}
epicsTimeGetCurrent(&startTime);
monitor_all();
waitLoopEvent->wait();
}
示例14: runTest
void runTest()
{
reset();
if (verbose)
printf("%d channel(s) of double array size of %d element(s) (0==scalar), %d iteration(s) per run, %d run(s) (0==forever)\n", channels, arraySize, iterations, runs);
/*
StringArray fieldNames;
fieldNames.push_back("strategy");
FieldConstPtrArray fields;
fields.push_back(getFieldCreate()->createScalar(pvInt));
PVStructure::shared_pointer configuration =
getPVDataCreate()->createPVStructure(getFieldCreate()->createStructure(fieldNames, fields));
configuration->getIntField("strategy")->put(bulkMode ? USER_CONTROLED : DELAYED);
provider->configure(configuration);
*/
vector<string> channelNames;
char buf[64];
for (int i = 0; i < channels; i++)
{
if (arraySize > 0)
sprintf(buf, "testArray%d_%d", arraySize, i);
else
sprintf(buf, "test%d", i);
channelNames.push_back(buf);
}
vector<Channel::shared_pointer> channels;
for (vector<string>::const_iterator i = channelNames.begin();
i != channelNames.end();
i++)
{
shared_ptr<ChannelRequesterImpl> channelRequesterImpl(
new ChannelRequesterImpl()
);
Channel::shared_pointer channel = provider->createChannel(*i, channelRequesterImpl);
channels.push_back(channel);
}
if (bulkMode) provider->flush();
bool differentConnectionsWarningIssued = false;
string theRemoteAddress;
for (vector<Channel::shared_pointer>::iterator i = channels.begin();
i != channels.end();
i++)
{
Channel::shared_pointer channel = *i;
shared_ptr<ChannelRequesterImpl> channelRequesterImpl =
dynamic_pointer_cast<ChannelRequesterImpl>(channel->getChannelRequester());
if (channelRequesterImpl->waitUntilConnected(5.0))
{
string remoteAddress = channel->getRemoteAddress();
if (theRemoteAddress.empty())
{
theRemoteAddress = remoteAddress;
}
else if (theRemoteAddress != remoteAddress)
{
if (!differentConnectionsWarningIssued)
{
std::cout << "not all channels are hosted by the same connection: " <<
theRemoteAddress << " != " << remoteAddress << std::endl;
differentConnectionsWarningIssued = true;
// we assumes same connection (thread-safety)
exit(2);
}
}
shared_ptr<ChannelGetRequesterImpl> getRequesterImpl(
new ChannelGetRequesterImpl(channel->getChannelName())
);
ChannelGet::shared_pointer channelGet = channel->createChannelGet(getRequesterImpl, pvRequest);
if (bulkMode) provider->flush();
bool allOK = getRequesterImpl->waitUntilConnected(timeOut);
if (!allOK)
{
std::cout << "[" << channel->getChannelName() << "] failed to get all the gets" << std::endl;
exit(1);
}
channelGetList.push_back(channelGet);
}
else
{
std::cout << "[" << channel->getChannelName() << "] connection timeout" << std::endl;
exit(1);
}
}
if (verbose)
std::cout << "all connected" << std::endl;
{
Lock guard(waitLoopPtrMutex);
waitLoopEvent.reset(new Event());
}
//.........这里部分代码省略.........
示例15: channelStateChange
virtual void channelStateChange(Channel::shared_pointer const & c, Channel::ConnectionState connectionState)
{
std::cout << "channelStateChange(" << c->getChannelName() << ", " << Channel::ConnectionStateNames[connectionState] << ")" << std::endl;
}