本文整理汇总了C++中Alloc::round方法的典型用法代码示例。如果您正苦于以下问题:C++ Alloc::round方法的具体用法?C++ Alloc::round怎么用?C++ Alloc::round使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alloc
的用法示例。
在下文中一共展示了Alloc::round方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allocator
// variableLengthOffsetStart
// ^ _____________
// | | |
// |______________________||____________||______V___________________|
// int,date(long),float offsets strings/variable length
// |____________________________________|
// Fixed Length |
// V
// fixedSizedOffset
//
// offsets() creates a pair of arrays with offset at each index to its
// associated Attribute's offset in the returned serialized buffer
// It uses maxOffsetBuffer and lastOffsetOfWrittenBuffer as temporary
// holders to fill in the const members: fixedSizedOffset,
// variableLengthOffsetStart
//
RecordSerializer::RecordSerializer(srch2::instantsearch::Schema& schema,
Alloc& allocator) : allocator(allocator), schema(schema),
maxOffsetOfBuffer(0), lastOffsetOfWrittenBuffer(0),
offsets(initAttributeOffsetArray(schema, maxOffsetOfBuffer,
lastOffsetOfWrittenBuffer)),
fixedSizedOffset(maxOffsetOfBuffer),
variableLengthOffsetStart(lastOffsetOfWrittenBuffer) {
lastOffsetOfWrittenBuffer = fixedSizedOffset;
//rounds default size of the nearest allocation page size
maxOffsetOfBuffer = allocator.round(fixedSizedOffset +
DEFAULT_VARIBLE_ATTRIBUTE_LENGTH * (offsets.first.size()));
buffer = allocator.allocate(maxOffsetOfBuffer);
std::memset(buffer, 0x0, fixedSizedOffset);
}