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