本文整理汇总了C++中SymbolString::compareMaster方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolString::compareMaster方法的具体用法?C++ SymbolString::compareMaster怎么用?C++ SymbolString::compareMaster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolString
的用法示例。
在下文中一共展示了SymbolString::compareMaster方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode
result_t Message::decode(SymbolString& masterData, SymbolString& slaveData,
ostringstream& output, OutputFormat outputFormat,
bool leadingSeparator)
{
unsigned char offset = (unsigned char)(m_id.size() - 2);
size_t startPos = output.str().length();
result_t result = m_data->read(pt_masterData, masterData, offset, output, outputFormat, leadingSeparator, NULL, -1);
if (result < RESULT_OK)
return result;
bool empty = result == RESULT_EMPTY;
offset = 0;
leadingSeparator |= output.str().length() > startPos;
result = m_data->read(pt_slaveData, slaveData, offset, output, outputFormat, leadingSeparator, NULL, -1);
if (result < RESULT_OK)
return result;
if (result == RESULT_EMPTY && !empty)
result = RESULT_OK; // OK if at least one part was non-empty
time(&m_lastUpdateTime);
switch (masterData.compareMaster(m_lastMasterData)) {
case 1: // completely different
m_lastChangeTime = m_lastUpdateTime;
m_lastMasterData = masterData;
break;
case 2: // only master address is different
m_lastMasterData = masterData;
break;
}
if (slaveData != m_lastSlaveData) {
m_lastChangeTime = m_lastUpdateTime;
m_lastSlaveData = slaveData;
}
return result;
}