本文整理汇总了C++中AllocatedArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ AllocatedArray::end方法的具体用法?C++ AllocatedArray::end怎么用?C++ AllocatedArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AllocatedArray
的用法示例。
在下文中一共展示了AllocatedArray::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fos
bool
FlarmDevice::DownloadFlight(Path path, OperationEnvironment &env)
{
FileOutputStream fos(path);
BufferedOutputStream os(fos);
if (env.IsCancelled())
return false;
env.SetProgressRange(100);
while (true) {
// Create header for getting IGC file data
FLARM::FrameHeader header = PrepareFrameHeader(FLARM::MT_GETIGCDATA);
// Send request
if (!SendStartByte() ||
!SendFrameHeader(header, env, 1000) ||
env.IsCancelled())
return false;
// Wait for an answer and save the payload for further processing
AllocatedArray<uint8_t> data;
uint16_t length;
bool ack = WaitForACKOrNACK(header.GetSequenceNumber(), data,
length, env, 10000) == FLARM::MT_ACK;
// If no ACK was received
if (!ack || length <= 3 || env.IsCancelled())
return false;
length -= 3;
// Read progress (in percent)
uint8_t progress = *(data.begin() + 2);
env.SetProgressPosition(std::min((unsigned)progress, 100u));
const char *last_char = (const char *)data.end() - 1;
bool is_last_packet = (*last_char == 0x1A);
if (is_last_packet)
length--;
// Read IGC data
const char *igc_data = (const char *)data.begin() + 3;
os.Write(igc_data, length);
if (is_last_packet)
break;
}
os.Flush();
fos.Commit();
return true;
}