本文整理汇总了C++中LLTemplateMessageReader::getU32方法的典型用法代码示例。如果您正苦于以下问题:C++ LLTemplateMessageReader::getU32方法的具体用法?C++ LLTemplateMessageReader::getU32怎么用?C++ LLTemplateMessageReader::getU32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLTemplateMessageReader
的用法示例。
在下文中一共展示了LLTemplateMessageReader::getU32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LLTemplateMessageReader
void LLTemplateMessageBuilderTestObject::test<43>()
// read past end of message -> default values (forward compatibility)
{
// build message with single block
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_U32, 4, MBT_SINGLE));
U32 outValue, outValue2, inValue = 0xbbbbbbbb;
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addU32(_PREHASH_Test0, inValue);
const U32 bufferSize = 1024;
U8 buffer[bufferSize];
memset(buffer, 0xaa, bufferSize);
memset(buffer, 0, LL_PACKET_ID_SIZE);
U32 builtSize = builder->buildMessage(buffer, bufferSize, 0);
delete builder;
// add block to reader template
messageTemplate.addBlock(createBlock(const_cast<char*>(_PREHASH_Test1), MVT_U32, 4, MBT_SINGLE));
// read message value and default value
numberMap[1] = &messageTemplate;
LLTemplateMessageReader* reader =
new LLTemplateMessageReader(numberMap);
reader->validateMessage(buffer, builtSize, LLHost());
reader->readMessage(buffer, LLHost());
reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue);
reader->getU32(_PREHASH_Test1, _PREHASH_Test0, outValue2);
ensure_equals("Ensure present value ", outValue, inValue);
ensure_equals("Ensure default value ", outValue2, 0);
delete reader;
}
示例2: LLTemplateMessageReader
void LLTemplateMessageBuilderTestObject::test<44>()
// read variable block past end of message -> 0 repeats
{
// build message with single block
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_U32, 4, MBT_SINGLE));
U32 outValue, outValue2, inValue = 0xbbbbbbbb;
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addU32(_PREHASH_Test0, inValue);
const U32 bufferSize = 1024;
U8 buffer[bufferSize];
memset(buffer, 0xaa, bufferSize);
memset(buffer, 0, LL_PACKET_ID_SIZE);
U32 builtSize = builder->buildMessage(buffer, bufferSize, 0);
delete builder;
// add variable block to reader template
messageTemplate.addBlock(createBlock(_PREHASH_Test1, MVT_U32, 4));
// read message value and check block repeat count
numberMap[1] = &messageTemplate;
LLTemplateMessageReader* reader =
new LLTemplateMessageReader(numberMap);
reader->validateMessage(buffer, builtSize, LLHost());
reader->readMessage(buffer, LLHost());
reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue);
outValue2 = reader->getNumberOfBlocks(_PREHASH_Test1);
ensure_equals("Ensure present value ", outValue, inValue);
ensure_equals("Ensure 0 repeats ", outValue2, 0);
delete reader;
}
示例3: defaultTemplate
void LLTemplateMessageBuilderTestObject::test<8>()
// U32
{
LLMessageTemplate messageTemplate = defaultTemplate();
messageTemplate.addBlock(defaultBlock(MVT_U32, 4));
U32 outValue, inValue = 88;
LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate);
builder->addU32(_PREHASH_Test0, inValue);
LLTemplateMessageReader* reader = setReader(messageTemplate, builder);
reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue);
ensure_equals("Ensure U32", inValue, outValue);
delete reader;
}