本文整理汇总了C++中BitArray::data方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::data方法的具体用法?C++ BitArray::data怎么用?C++ BitArray::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void FullContainerKey::serialize(util::StackAllocator &alloc,
const FullContainerKeyComponents &components,
const BitArray &upperCaseBit) {
try {
util::XArray<char8_t> buf(alloc);
buf.resize(static_cast<size_t>(components.getStringSize()), '\0');
util::XArray<uint8_t> binary(alloc);
util::XArrayOutStream<> arrayOut(binary);
ContainerKeyOutStream out(arrayOut);
const size_t flagPos = out.base().position();
uint8_t flag = 0;
out << flag;
if (components.dbId_ != GS_PUBLIC_DB_ID) {
flag |= DBID_EXISTS;
out << components.dbId_;
}
{
ValueProcessor::convertLowerCase(
components.baseName_, components.baseNameSize_, buf.data());
encodeString(out, buf.data(), components.baseNameSize_);
}
if (components.largeContainerId_ != UNDEF_LARGE_CONTAINERID) {
flag |= LARGE_CONTAINERID_EXISTS;
encodeVarLong(out, components.largeContainerId_);
}
if (components.affinityNumber_ != UNDEF_NODE_AFFINITY_NUMBER) {
flag |= NODE_AFFINITY_NUM;
encodeVarLong(out, components.affinityNumber_);
}
else if (components.affinityStringSize_ > 0) {
flag |= NODE_AFFINITY_STR;
ValueProcessor::convertLowerCase(
components.affinityString_, components.affinityStringSize_, buf.data());
encodeString(out, buf.data(), components.affinityStringSize_);
}
if (components.systemPartId_ != UNDEF_SYSTEM_PART_ID) {
flag |= SYSTEM_PART_ID_NUM;
encodeVarLong(out, components.systemPartId_);
}
else if (components.systemPartSize_ > 0) {
flag |= SYSTEM_PART_ID_STR;
ValueProcessor::convertLowerCase(
components.systemPart_, components.systemPartSize_, buf.data());
encodeString(out, buf.data(), components.systemPartSize_);
}
out.writeAll(upperCaseBit.data(), upperCaseBit.byteLength());
const size_t lastPos = out.base().position();
out.base().position(flagPos);
out << flag;
out.base().position(lastPos);
if (binary.size() >= static_cast<size_t>(UINT32_MAX)) {
GS_THROW_USER_ERROR(GS_ERROR_CM_LIMITS_EXCEEDED,
"size of serialized container/table name exceeds maximum size");
}
body_ = binary.data();
size_ = binary.size();
}
catch (std::exception &e) {
GS_RETHROW_USER_ERROR_CODED(GS_ERROR_DS_DS_CONTAINER_NAME_INVALID, e,
"failed to serialize container/table name");
}
}