本文整理汇总了C++中ChannelPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ChannelPtr类的具体用法?C++ ChannelPtr怎么用?C++ ChannelPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChannelPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: featuresFor
/**
* Return features as configured for the channel class given by the Channel::immutableProperties()
* of \a proxy.
*
* \param proxy The Channel proxy to determine the features for.
* \return A list of Feature objects.
*/
Features ChannelFactory::featuresFor(const DBusProxyPtr &proxy) const
{
ChannelPtr chan = ChannelPtr::qObjectCast(proxy);
Q_ASSERT(!chan.isNull());
return featuresFor(ChannelClassSpec(chan->immutableProperties()));
}
示例2: warning
void SimpleCallObserver::onChannelInvalidated(const ChannelPtr &channel,
const QString &errorName, const QString &errorMessage)
{
if (channel->channelType() == TP_QT_IFACE_CHANNEL_TYPE_CALL) {
CallChannelPtr callChannel = CallChannelPtr::qObjectCast(channel);
if (!callChannel) {
warning() << "Channel received to observe is not a subclass of "
"CallChannel. ChannelFactory set on this observer's account must "
"construct CallChannel subclasses for channels of type Call. "
"Ignoring channel";
return;
}
emit callEnded(callChannel, errorName, errorMessage);
} else if (channel->channelType() == TP_QT_IFACE_CHANNEL_TYPE_STREAMED_MEDIA) {
StreamedMediaChannelPtr smChannel = StreamedMediaChannelPtr::qObjectCast(channel);
if (!smChannel) {
warning() << "Channel received to observe is not a subclass of "
"StreamedMediaChannel. ChannelFactory set on this observer's account must "
"construct StreamedMediaChannel subclasses for channels of type StreamedMedia. "
"Ignoring channel";
return;
}
emit streamedMediaCallEnded(smChannel, errorName, errorMessage);
} else {
warning() << "Channel received to observe is not of type Call or StreamedMedia, "
"service confused. Ignoring channel";
}
}
示例3: luaL_checkany
/**
* Destroys a channel. This will send LCH messages to all channel participants if the channel exists.
* @param string channel name
* @returns Nothing.
*/
int LuaChannel::destroyChannel(lua_State* L) {
luaL_checkany(L, 1);
string name = luaL_checkstring(L, 1);
lua_pop(L, 1);
ChannelPtr chan = ServerState::getChannel(name);
if (chan) {
const ChannelType type = chan->getType();
const char* channame = chan->getName().c_str();
const chconlist_t particpants = chan->getParticipants();
for (chconlist_t::const_iterator i = particpants.begin(); i != particpants.end(); ++i) {
json_t* root = json_object();
json_object_set_new_nocheck(root, "channel",
json_string_nocheck(channame)
);
json_object_set_new_nocheck(root, "character",
json_string_nocheck((*i)->characterName.c_str())
);
const char* leavestr = json_dumps(root, JSON_COMPACT);
string msg = "LCH ";
msg += leavestr;
free((void*) leavestr);
json_decref(root);
MessagePtr outMessage(MessageBuffer::fromString(msg));
(*i)->send(outMessage);
chan->part((*i));
}
ServerState::removeChannel(name);
if (type == CT_PUBLIC)
ServerState::rebuildChannelOpList();
}
return 0;
}
示例4: logMsg
static void logMsg(Log&& msg)
{
ChannelPtr channelLogCopy = channelLog;
if (!channelLogCopy) return;
msg.file("mccom");
channelLogCopy->send(msg);
}
示例5: sendTo
sf::Error Datagram::sendTo (ChannelPtr channel) const {
if (channel->error()) return channel->error();
sf::ByteArrayPtr chunk = encode ();
if (!chunk) return error::TooMuch;
Error err = channel->write (chunk);
return err;
}
示例6: getChannels
void ServerState::rebuildChannelOpList() {
channelOpList.clear();
const chanptrmap_t chans = getChannels();
for (chanptrmap_t::const_iterator i = chans.begin(); i != chans.end(); ++i) {
if (i->second->getType() == CT_PUBLIC) {
ChannelPtr chan = i->second;
const chmodmap_t mods = chan->getModRecords();
for (chmodmap_t::const_iterator m = mods.begin(); m != mods.end(); ++m) {
if (m->first != "") {
channelOpList.insert(m->first);
}
}
}
}
}
示例7: luaL_checkany
int LuaTesting::killChannel(lua_State* L) {
luaL_checkany(L, 1);
string chanName = luaL_checkstring(L, 1);
lua_pop(L, 1);
ChannelPtr chan = ServerState::getChannel(chanName);
if (chan) {
const chconlist_t particpants = chan->getParticipants();
for (chconlist_t::const_iterator i = particpants.begin(); i != particpants.end(); ++i) {
chan->part(*i);
}
ServerState::removeChannel(chanName);
}
return 0;
}
示例8: channelCreated
void pvaDriver::channelCreated (const Status& status,
ChannelPtr const & channel)
{
asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
"%s::%s: %s created\n",
driverName, "channelCreated", channel->getChannelName().c_str());
}
示例9: test4GetStatus
void test4GetStatus(ChannelPtr& c)
{
const std::string jobHandle = "H:localhost.localdomain:4";
GearmanTaskPtr task(new GearmanTask);
task->request = GearmanMessage::createGetStatusMessage(jobHandle);
//writedown 往gearman写数据
c->write(UserEvent(task));
}
示例10: ChannelException
ChannelFuturePtr ClientBootstrap::connect(const InetAddress& remote,
const InetAddress& local) {
if (!remote) {
LOG_INFO << "the remote address is invalidated, then return a failed future.";
return NullChannel::instance()->newFailedFuture(
ChannelException("Failed to initialize a pipeline."));
}
ChannelPtr ch = newChannel();
if (!ch) {
LOG_INFO << "failed to create a new channel, then return a failed future.";
return NullChannel::instance()->newFailedFuture(
ChannelException("Failed to create a new channel."));
}
if (!initializer()) {
LOG_INFO << "has not set channel pipeline initializer.";
return NullChannel::instance()->newFailedFuture(
ChannelException("has not set channel pipeline initializer."));
}
ch->setInitializer(initializer());
ch->open();
ch->closeFuture()->addListener(boost::bind(
&ClientBootstrap::closeChannelBeforeDestruct,
this,
_1,
ch));
// Set the options.
ch->config().setOptions(options());
insertChannel(ch->id(), ch);
// Bind.
if (localAddress()) {
LOG_INFO << "bind the channel to local address" << local.toString();
ChannelFuturePtr future = ch->bind(local);
future->awaitUninterruptibly();
}
// ch->closeFuture()->addListener(
// boost::bind(&ClientBootstrap::onChannelClosed,
// this,
// _1));
// Connect.
return ch->connect(remote);
}
示例11: DLOG
void ServerState::saveChannels() {
DLOG(INFO) << "Saving channels.";
json_t* root = json_object();
json_t* publicarray = json_array();
json_t* privatearray = json_array();
for (chanptrmap_t::const_iterator i = channelMap.begin(); i != channelMap.end(); ++i) {
ChannelPtr chan = i->second;
if (chan->getType() == CT_PUBLIC) {
json_array_append_new(publicarray, chan->saveChannel());
} else if (chan->getType() == CT_PUBPRIVATE) {
json_array_append_new(privatearray, chan->saveChannel());
}
}
json_object_set_new_nocheck(root, "public", publicarray);
json_object_set_new_nocheck(root, "private", privatearray);
const char* chanstr = json_dumps(root, JSON_INDENT(4));
string contents = chanstr;
free((void*) chanstr);
json_decref(root);
fsaveFile("./channels.json", contents);
}
示例12: test4Echo
void test4Echo(ChannelPtr& c)
{
GearmanTaskPtr task(new GearmanTask);
ChannelBufferPtr buffer = Unpooled::buffer(1024, 64);
for (int i = 0; i < 20; ++i) {
buffer->writeByte('0');
}
task->request = GearmanMessage::createEchoReqMessage(buffer);
//writedown 往gearman写数据
c->write(UserEvent(task));
}
示例13: test4OptionReq
void test4OptionReq(ChannelPtr& c)
{
const std::string option = "exception";
GearmanTaskPtr task(new GearmanTask);
ChannelBufferPtr payload = Unpooled::buffer(1024, 64);
for (int i = 0; i < 10; ++i) {
payload->writeByte('0');
}
task->request = GearmanMessage::createOptionReqMessage(option);
//writedown 往gearman写数据
c->write(UserEvent(task));
}
示例14: test4submitJobHighBG
void test4submitJobHighBG(ChannelPtr& c)
{
const std::string functionName = "hello";
const std::string uniqueId = "123456";
GearmanTaskPtr task(new GearmanTask);
ChannelBufferPtr payload = Unpooled::buffer(1024, 64);
for (int i = 0; i < 10; ++i) {
payload->writeByte('0');
}
task->request = GearmanMessage::createsubmitJobHighBGMessage(functionName,uniqueId,payload);
//writedown 往gearman写数据
c->write(UserEvent(task));
}
示例15: channelStateChange
void pvaDriver::channelStateChange (ChannelPtr const & channel,
Channel::ConnectionState state)
{
const char *functionName = "channelStateChange";
lock();
asynPrint(pasynUserSelf, ASYN_TRACE_FLOW,
"%s::%s %s: %s\n",
driverName, functionName, channel->getChannelName().c_str(),
Channel::ConnectionStateNames[state]);
setIntegerParam(PVAPvConnectionStatus, state == Channel::CONNECTED);
callParamCallbacks();
unlock();
}