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


C++ Bundle::push_back方法代码示例

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


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

示例1: onDigest

    virtual void
    onDigest(const Feature & input)
    {
        if (_noPrint)
        {
            publish(input);
            return;
        }

        if (_eachStep)
        {
#ifdef __ANDROID_API__
            std::stringstream ss;
            ss << _label.c_str() << ": ";
            for (int j=0;j<input.size(); ++j)
                ss << input[j] << " ";
            LOGE("<Sample id=%d label=%s>%s</sample>", _onlySample, _label, ss.str().c_str());
#else
            print("<sample id=", _onlySample, " label=", _label ,">", input, "</sample>");
#endif
        }
        else
        {
            _bundle.push_back(input.data(), input.size());
        }

        publish(input);
    }
开发者ID:diegofps,项目名称:wup,代码行数:28,代码来源:show.hpp

示例2: callbackBundleReceived

		void EchoWorker::callbackBundleReceived(const Bundle &b)
		{
			try {
				const PayloadBlock &payload = b.find<PayloadBlock>();

				// generate a echo
				Bundle echo;

				// make a copy of the payload block
				ibrcommon::BLOB::Reference ref = payload.getBLOB();
				echo.push_back(ref);

				// set destination and mark the bundle as singleton destination
				echo.destination = b.source;
				echo.set(dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON, true);

				// set the source of the bundle
				echo.source = getWorkerURI();

				// set the lifetime to the same value as the received bundle
				echo.lifetime = b.lifetime;

				// sign the reply if the echo-request was signed too
				if (b.get(dtn::data::PrimaryBlock::DTNSEC_STATUS_VERIFIED))
					echo.set(dtn::data::PrimaryBlock::DTNSEC_REQUEST_SIGN, true);

				// encrypt the reply if the echo-request was encrypt too
				if (b.get(dtn::data::PrimaryBlock::DTNSEC_STATUS_CONFIDENTIAL))
					echo.set(dtn::data::PrimaryBlock::DTNSEC_REQUEST_ENCRYPT, true);

				try {
					const dtn::data::TrackingBlock &tracking = b.find<dtn::data::TrackingBlock>();
					dtn::data::TrackingBlock &target = echo.push_back<dtn::data::TrackingBlock>();

					// copy tracking block
					target = tracking;
				} catch (const dtn::data::Bundle::NoSuchBlockFoundException&) { };

				IBRCOMMON_LOGGER_DEBUG_TAG("EchoWorker", 5) << "echo request received, replying!" << IBRCOMMON_LOGGER_ENDL;

				// send it
				transmit( echo );
			} catch (const dtn::data::Bundle::NoSuchBlockFoundException&) {

			}
		}
开发者ID:SebastianSchildt,项目名称:ibrdtnBLETest,代码行数:46,代码来源:EchoWorker.cpp


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