本文整理汇总了C++中Dump::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Dump::insert方法的具体用法?C++ Dump::insert怎么用?C++ Dump::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dump
的用法示例。
在下文中一共展示了Dump::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DecodeData
bool DecodeData()
{
const uint8_t* const rawData = static_cast<const uint8_t*>(Header.ID);
const std::size_t dataOffset = fromLE(Header.DataOffset);
const uint_t cylinders = fromLE(Header.Cylinders);
const uint_t sides = fromLE(Header.Sides);
Dump result;
result.reserve(FDI_MAX_SIZE);
std::size_t trackInfoOffset = sizeof(Header) + fromLE(Header.InfoSize);
std::size_t rawSize = dataOffset;
for (uint_t cyl = 0; cyl != cylinders; ++cyl)
{
for (uint_t sid = 0; sid != sides; ++sid)
{
if (trackInfoOffset + sizeof(RawTrack) > Limit)
{
return false;
}
const RawTrack* const trackInfo = safe_ptr_cast<const RawTrack*>(rawData + trackInfoOffset);
typedef std::vector<SectorDescr> SectorDescrs;
//collect sectors reference
SectorDescrs sectors;
sectors.reserve(trackInfo->SectorsCount);
for (std::size_t secNum = 0; secNum != trackInfo->SectorsCount; ++secNum)
{
const RawTrack::Sector* const sector = trackInfo->Sectors + secNum;
const std::size_t secSize = 128 << sector->Size;
//since there's no information about head number (always 0), do not check it
//assert(sector->Head == sid);
if (sector->Cylinder != cyl)
{
return false;
}
const std::size_t offset = dataOffset + fromLE(sector->Offset) + fromLE(trackInfo->Offset);
if (offset + secSize > Limit)
{
return false;
}
sectors.push_back(SectorDescr(sector->Number, rawData + offset, rawData + offset + secSize));
rawSize = std::max(rawSize, offset + secSize);
}
//sort by number
std::sort(sectors.begin(), sectors.end());
//and gather data
for (SectorDescrs::const_iterator it = sectors.begin(), lim = sectors.end(); it != lim; ++it)
{
result.insert(result.end(), it->Begin, it->End);
}
//calculate next track by offset
trackInfoOffset += sizeof(*trackInfo) + (trackInfo->SectorsCount - 1) * sizeof(trackInfo->Sectors);
}
}
UsedSize = rawSize;
Decoded.swap(result);
return true;
}