本文整理汇总了C++中DataSource::beginField方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSource::beginField方法的具体用法?C++ DataSource::beginField怎么用?C++ DataSource::beginField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSource
的用法示例。
在下文中一共展示了DataSource::beginField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pmap
void
Decoder::decodeNestedTemplate(
DataSource & source,
Messages::ValueMessageBuilder & messageBuilder,
Messages::FieldIdentityCPtr & identity)
{
Codecs::PresenceMap pmap(getTemplateRegistry()->presenceMapBits());
if(this->verboseOut_)
{
pmap.setVerbose(verboseOut_);
}
static const std::string pmp("PMAP");
source.beginField(pmp);
pmap.decode(source);
static const std::string tid("templateID");
source.beginField(tid);
if(pmap.checkNextField())
{
template_id_t id;
FieldInstruction::decodeUnsignedInteger(source, *this, id, tid);
setTemplateId(id);
}
if(verboseOut_)
{
(*verboseOut_) << "Nested Template ID: " << getTemplateId() << std::endl;
}
Codecs::TemplateCPtr templatePtr;
if(getTemplateRegistry()->getTemplate(getTemplateId(), templatePtr))
{
if(templatePtr->getReset())
{
reset(false);
}
Messages::ValueMessageBuilder & groupBuilder(
messageBuilder.startGroup(
identity,
templatePtr->getApplicationType(),
templatePtr->getApplicationTypeNamespace(),
templatePtr->fieldCount()));
decodeSegmentBody(source, pmap, templatePtr, groupBuilder);
messageBuilder.endGroup(identity, groupBuilder);
}
else
{
std::string error = "Unknown template ID:";
error += boost::lexical_cast<std::string>(getTemplateId());
reportError("[ERR D9]", error);
}
return;
}
示例2:
void
Decoder::decodeSegmentBody(
DataSource & source,
Codecs::PresenceMap & pmap,
const Codecs::SegmentBodyCPtr & segment,
Messages::ValueMessageBuilder & messageBuilder)
{
size_t instructionCount = segment->size();
for( size_t nField = 0; nField < instructionCount; ++nField)
{
PROFILE_POINT("decode field");
const Codecs::FieldInstructionCPtr & instruction = segment->getInstruction(nField);
if(verboseOut_)
{
(*verboseOut_) <<std::endl << "Decode instruction[" <<nField << "]: " << instruction->getIdentity()->name() << std::endl;
}
source.beginField(instruction->getIdentity()->name());
(void)instruction->decode(source, pmap, *this, messageBuilder);
}
}