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


C++ ChannelPtr类代码示例

本文整理汇总了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()));
}
开发者ID:TelepathyQt,项目名称:telepathy-qt,代码行数:14,代码来源:channel-factory.cpp

示例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";
    }
}
开发者ID:TelepathyQt,项目名称:telepathy-qt,代码行数:30,代码来源:simple-call-observer.cpp

示例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;
}
开发者ID:Maw-Fox,项目名称:fserv,代码行数:39,代码来源:lua_channel.cpp

示例4: logMsg

static void logMsg(Log&& msg)
{
	ChannelPtr channelLogCopy = channelLog;
	if (!channelLogCopy) return;

	msg.file("mccom");

	channelLogCopy->send(msg);
}
开发者ID:arwie,项目名称:mccom,代码行数:9,代码来源:ChannelLog.hpp

示例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;
}
开发者ID:nob13,项目名称:schneeflocke,代码行数:9,代码来源:Datagram.cpp

示例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);
                }
            }
        }
    }
}
开发者ID:41149512,项目名称:fserv,代码行数:15,代码来源:server_state.cpp

示例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;
}
开发者ID:f-list,项目名称:fserv,代码行数:16,代码来源:lua_testing.cpp

示例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());
}
开发者ID:ukaea,项目名称:epics,代码行数:7,代码来源:pvaDriver.cpp

示例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));
}
开发者ID:1suming,项目名称:cetty2,代码行数:8,代码来源:GearmanClientTest.cpp

示例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);
}
开发者ID:1suming,项目名称:cetty2,代码行数:51,代码来源:ClientBootstrap.cpp

示例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);
}
开发者ID:41149512,项目名称:fserv,代码行数:21,代码来源:server_state.cpp

示例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));
}
开发者ID:1suming,项目名称:cetty2,代码行数:12,代码来源:GearmanClientTest.cpp

示例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));
}
开发者ID:1suming,项目名称:cetty2,代码行数:12,代码来源:GearmanClientTest.cpp

示例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));
}
开发者ID:1suming,项目名称:cetty2,代码行数:13,代码来源:GearmanClientTest.cpp

示例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();
}
开发者ID:ukaea,项目名称:epics,代码行数:14,代码来源:pvaDriver.cpp


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