本文整理汇总了C++中CByteArray::ToCArray方法的典型用法代码示例。如果您正苦于以下问题:C++ CByteArray::ToCArray方法的具体用法?C++ CByteArray::ToCArray怎么用?C++ CByteArray::ToCArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CByteArray
的用法示例。
在下文中一共展示了CByteArray::ToCArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessInMsgs
void CBuzzController::ProcessInMsgs() {
/* Reset neighbor information */
buzzneighbors_reset(m_tBuzzVM);
/* Go through RAB messages and add them to the FIFO */
const CCI_RangeAndBearingSensor::TReadings& tPackets = m_pcRABS->GetReadings();
for(size_t i = 0; i < tPackets.size(); ++i) {
/* Copy packet into temporary buffer */
CByteArray cData = tPackets[i].Data;
/* Get robot id and update neighbor information */
UInt16 unRobotId = cData.PopFront<UInt16>();
buzzneighbors_add(m_tBuzzVM,
unRobotId,
tPackets[i].Range,
tPackets[i].HorizontalBearing.GetValue(),
tPackets[i].VerticalBearing.GetValue());
/* Go through the messages until there's nothing else to read */
UInt16 unMsgSize;
do {
/* Get payload size */
unMsgSize = cData.PopFront<UInt16>();
/* Append message to the Buzz input message queue */
if(unMsgSize > 0 && cData.Size() >= unMsgSize) {
buzzinmsg_queue_append(m_tBuzzVM,
unRobotId,
buzzmsg_payload_frombuffer(cData.ToCArray(), unMsgSize));
/* Get rid of the data read */
for(size_t i = 0; i < unMsgSize; ++i) cData.PopFront<UInt8>();
}
}
while(cData.Size() > sizeof(UInt16) && unMsgSize > 0);
}
/* Process messages */
buzzvm_process_inmsgs(m_tBuzzVM);
}