本文整理汇总了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);
}
示例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&) {
}
}