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


C++ MessageDef::GetInterfaceMessageID方法代码示例

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


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

示例1: RegInfo

MessageDef* xTEDSCommand::RegInfo(const char* ItemName) const
{
	char DefinitionsBuf[MSG_DEF_SIZE] = "";
	char xTEDSPortionBuf[MSG_DEF_SIZE] = "";
	char VarPortionBuf[MSG_DEF_SIZE] = "";

	if (m_CommandMessage == NULL) return NULL;
	
	MessageDef* pCmdMsgDef = m_CommandMessage->RegInfo();
	if (NULL == pCmdMsgDef)
	  return NULL;

	VariableDef* pCmdVarDef = m_CommandMessage->GetVariableXtedsDefinitions();

	if(m_FaultMessage!=NULL)	// If there exists a fault message
	{
		MessageDef* pFltMsgDef = m_FaultMessage->RegInfo();
		if (NULL == pFltMsgDef)
		  {
		    free (pCmdMsgDef);
		    free (pCmdVarDef);
		    return NULL;
		  }
		VariableDef* pFltVarDef = m_FaultMessage->GetVariableXtedsDefinitions();
		
		snprintf(DefinitionsBuf,sizeof(DefinitionsBuf),"<Command>\n\t%s\n\t%s\n</Command>",
			 pCmdMsgDef->GetDefinitions(),
			 pFltMsgDef->GetDefinitions());
		
		// Get the full variable xTEDS definitions, into VarPortionBuf
		VariableDef::ToStringConcatVariableDefsIgnoreDuplicates ( VarPortionBuf,
				   sizeof(VarPortionBuf), pCmdVarDef, pFltVarDef );

		snprintf(xTEDSPortionBuf,sizeof(xTEDSPortionBuf),"%s\n<Command>\n\t%s\n\t%s\n</Command>",
			 VarPortionBuf, pCmdMsgDef->GetxTEDSPortion(), pFltMsgDef->GetxTEDSPortion());
		
		delete pFltMsgDef;
		pFltMsgDef = NULL;

		delete pFltVarDef;
		pFltVarDef = NULL;
	}
	else				// If this is only a command message
	{
		snprintf(DefinitionsBuf,sizeof(DefinitionsBuf),"<Command>\n\t%s\n</Command>",
			 pCmdMsgDef->GetDefinitions());

		VariableDef::ToStringConcatVariableDefs(VarPortionBuf, sizeof(VarPortionBuf),
							pCmdVarDef, NULL);

		snprintf(xTEDSPortionBuf,sizeof(xTEDSPortionBuf),"%s\n<Command>\n\t%s\n</Command>",
			 VarPortionBuf, pCmdMsgDef->GetxTEDSPortion());
	}
	
	MessageDef* ReturnDef = new MessageDef();
	
	//
	// Set the message id to the id of the requested item
	ReturnDef->SetInterfaceMessageID(pCmdMsgDef->GetInterfaceMessageID());
	if (ItemName != NULL)
	{
		if (m_FaultMessage != NULL && m_FaultMessage->NameEquals(ItemName))
			ReturnDef->SetInterfaceMessageID(m_FaultMessage->GetID());
	}
	
	delete(pCmdMsgDef);
	if (NULL != pCmdVarDef)
	  delete pCmdVarDef;

	ReturnDef->SetDefinitions(DefinitionsBuf);
	ReturnDef->SetxTEDSPortion(xTEDSPortionBuf);
	return ReturnDef;
}
开发者ID:NKSG,项目名称:vn-sdm,代码行数:73,代码来源:xTEDSCommand.cpp


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