当前位置: 首页>>代码示例>>C++>>正文


C++ SymbolString::addAll方法代码示例

本文整理汇总了C++中SymbolString::addAll方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolString::addAll方法的具体用法?C++ SymbolString::addAll怎么用?C++ SymbolString::addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SymbolString的用法示例。


在下文中一共展示了SymbolString::addAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prepareMaster

result_t Message::prepareMaster(const unsigned char srcAddress, SymbolString& masterData, istringstream& input, char separator, const unsigned char dstAddress)
{
	if (m_isPassive)
		return RESULT_ERR_INVALID_ARG; // prepare not possible

	SymbolString master(false);
	result_t result = master.push_back(srcAddress, false, false);
	if (result != RESULT_OK)
		return result;
	if (dstAddress == SYN) {
		if (m_dstAddress == SYN)
			return RESULT_ERR_INVALID_ADDR;
		result = master.push_back(m_dstAddress, false, false);
	}
	else
		result = master.push_back(dstAddress, false, false);
	if (result != RESULT_OK)
		return result;
	result = master.push_back(m_id[0], false, false);
	if (result != RESULT_OK)
		return result;
	result = master.push_back(m_id[1], false, false);
	if (result != RESULT_OK)
		return result;
	unsigned char addData = m_data->getLength(pt_masterData);
	result = master.push_back((unsigned char)(m_id.size() - 2 + addData), false, false);
	if (result != RESULT_OK)
		return result;
	for (size_t i = 2; i < m_id.size(); i++) {
		result = master.push_back(m_id[i], false, false);
		if (result != RESULT_OK)
			return result;
	}
	result = m_data->write(input, pt_masterData, master, (unsigned char)(m_id.size() - 2), separator);
	if (result != RESULT_OK)
		return result;
	time(&m_lastUpdateTime);
	switch (master.compareMaster(m_lastMasterData)) {
	case 1: // completely different
		m_lastChangeTime = m_lastUpdateTime;
		m_lastMasterData = master;
		break;
	case 2: // only master address is different
		m_lastMasterData = master;
		break;
	}
	masterData.addAll(master);
	return result;
}
开发者ID:Giermann,项目名称:ebusd,代码行数:49,代码来源:message.cpp

示例2: prepareSlave

result_t Message::prepareSlave(SymbolString& slaveData)
{
	if (!m_isPassive || m_isWrite)
			return RESULT_ERR_INVALID_ARG; // prepare not possible

	SymbolString slave(false);
	unsigned char addData = m_data->getLength(pt_slaveData);
	result_t result = slave.push_back(addData, false, false);
	if (result != RESULT_OK)
		return result;
	istringstream input; // TODO create input from database of internal variables
	result = m_data->write(input, pt_slaveData, slave, 0);
	if (result != RESULT_OK)
		return result;
	time(&m_lastUpdateTime);
	if (slave != m_lastSlaveData) {
		m_lastChangeTime = m_lastUpdateTime;
		m_lastSlaveData = slave;
	}
	slaveData.addAll(slave);
	return result;
}
开发者ID:Giermann,项目名称:ebusd,代码行数:22,代码来源:message.cpp


注:本文中的SymbolString::addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。