本文整理汇总了C++中BinaryRefReader::get_BinaryData方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryRefReader::get_BinaryData方法的具体用法?C++ BinaryRefReader::get_BinaryData怎么用?C++ BinaryRefReader::get_BinaryData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryRefReader
的用法示例。
在下文中一共展示了BinaryRefReader::get_BinaryData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unserialize
void OutPoint::unserialize(BinaryRefReader & brr)
{
if (brr.getSizeRemaining() < 32)
throw BlockDeserializingException();
brr.get_BinaryData(txHash_, 32);
txOutIndex_ = brr.get_uint32_t();
}
示例2: readBlkDataKeyNoPrefix
BLKDATA_TYPE DBUtils::readBlkDataKeyNoPrefix(
BinaryRefReader & brr,
uint32_t & height,
uint8_t & dupID,
uint16_t & txIdx,
uint16_t & txOutIdx)
{
BinaryData hgtx = brr.get_BinaryData(4);
height = hgtxToHeight(hgtx);
dupID = hgtxToDupID(hgtx);
if (brr.getSizeRemaining() == 0)
{
txIdx = 0xffff;
txOutIdx = 0xffff;
return BLKDATA_HEADER;
}
else if (brr.getSizeRemaining() == 2)
{
txIdx = brr.get_uint16_t(BE);
txOutIdx = 0xffff;
return BLKDATA_TX;
}
else if (brr.getSizeRemaining() == 4)
{
txIdx = brr.get_uint16_t(BE);
txOutIdx = brr.get_uint16_t(BE);
return BLKDATA_TXOUT;
}
else
{
LOGERR << "Unexpected bytes remaining: " << brr.getSizeRemaining();
return NOT_BLKDATA;
}
}
示例3: deserialize
BinaryDataVector BinaryDataVector::deserialize(BinaryRefReader& brr)
{
auto type_code = brr.get_uint8_t();
if (type_code != BINARYDATAVECTOR_CODE)
BtcUtils::throw_type_error(BINARYDATAVECTOR_CODE, type_code);
auto size = brr.get_var_int();
if (size > brr.getSizeRemaining())
throw runtime_error("invalid bdvec size");
BinaryDataVector bdvec;
auto count = brr.get_var_int();
for (unsigned i = 0; i < count; i++)
{
auto bdsize = brr.get_var_int();
if (bdsize > brr.getSizeRemaining())
throw runtime_error("invalid bd size");
auto&& bdo = brr.get_BinaryData(bdsize);
bdvec.push_back(move(bdo));
}
return bdvec;
}