本文整理汇总了C++中GmatCommand::IsOfType方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatCommand::IsOfType方法的具体用法?C++ GmatCommand::IsOfType怎么用?C++ GmatCommand::IsOfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmatCommand
的用法示例。
在下文中一共展示了GmatCommand::IsOfType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsElseFoundInIf
//------------------------------------------------------------------------------
bool GmatCommandUtil::IsElseFoundInIf(GmatCommand *ifCmd)
{
if (ifCmd == NULL)
return false;
#ifdef DEBUG_IF_ELSE
ShowCommand
("===> GmatCommandUtil::IsElseFoundInIf() ifCmd = ", ifCmd);
#endif
if (!ifCmd->IsOfType("If"))
{
#ifdef DEBUG_IF_ELSE
MessageInterface::ShowMessage
("IsElseFoundInIf() returning false, it is not If command\n");
#endif
return false;
}
GmatCommand *current = ifCmd;
GmatCommand *child = NULL;
Integer branch = 0;
// Check only one level first branch
child = current->GetChildCommand(branch);
while (child != NULL)
{
#ifdef DEBUG_IF_ELSE
ShowCommand(" child = ", child);
#endif
if (child->IsOfType("BranchEnd"))
{
if (child->GetTypeName() == "Else")
{
#ifdef DEBUG_IF_ELSE
MessageInterface::ShowMessage("IsElseFoundInIf() returning true\n");
#endif
return true;
}
break;
}
child = child->GetNext();
}
#ifdef DEBUG_IF_ELSE
MessageInterface::ShowMessage("IsElseFoundInIf() returning false\n");
#endif
return false;
}
示例2: GetMatchingEnd
//------------------------------------------------------------------------------
GmatCommand* GmatCommandUtil::GetMatchingEnd(GmatCommand *cmd, bool getMatchingElse)
{
if (cmd == NULL)
return NULL;
#ifdef DEBUG_MATCHING_END
ShowCommand
("===> GmatCommandUtil::GetMatchingEnd() cmd = ", cmd);
#endif
if (cmd->GetTypeName() != "BeginScript" && !cmd->IsOfType("BranchCommand"))
return NULL;
GmatCommand *current = cmd;
if (cmd->GetTypeName() == "BeginScript")
{
Integer scriptEventCount = 0;
while (current != NULL)
{
if (current->GetTypeName() == "BeginScript")
scriptEventCount++;
if (current->GetTypeName() == "EndScript")
scriptEventCount--;
#ifdef DEBUG_MATCHING_END
MessageInterface::ShowMessage
(" scriptEventCount=%d, current=<%p><%s>\n", scriptEventCount, current,
current->GetTypeName().c_str());
#endif
if (scriptEventCount == 0)
break;
current = current->GetNext();
}
#ifdef DEBUG_MATCHING_END
ShowCommand("===> GmatCommandUtil::GetMatchingEnd() returning ", current);
#endif
return current;
}
else
{
GmatCommand *child = NULL;
Integer branch = 0;
bool elseFound = false;
while ((current->GetChildCommand(branch)) != NULL)
{
child = current->GetChildCommand(branch);
while (child != NULL)
{
#ifdef DEBUG_MATCHING_END
ShowCommand(" child = ", child);
#endif
if (child->IsOfType("BranchEnd"))
{
if (child->GetTypeName() == "Else")
{
elseFound = true;
if (getMatchingElse)
break;
branch++;
}
break;
}
child = child->GetNext();
}
if (elseFound && branch == 1)
{
elseFound = false;
continue;
}
else
break;
}
#ifdef DEBUG_MATCHING_END
ShowCommand("===> GmatCommandUtil::GetMatchingEnd() returning ", child);
#endif
return child;
}
}
示例3: Execute
//.........这里部分代码省略.........
MessageInterface::ShowMessage
(wxT("============================ Reinitializing LocalObjects at current\n")
wxT("%s\n"), current->GetGeneratingString(Gmat::NO_COMMENTS).c_str());
#endif
InitializeLocalObjects(objInit, current, false);
#ifdef DEBUG_FUNCTION_EXEC
MessageInterface::ShowMessage
(wxT("......Function re-executing <%p><%s> [%s]\n"), current,
current->GetTypeName().c_str(),
current->GetGeneratingString(Gmat::NO_COMMENTS).c_str());
#endif
if (!(current->Execute()))
return false;
}
catch (HardwareException &he)
{
// Ignore for hardware exception since spacecraft is associated with Thruster
// but Thruster binds with Tank later in the fcs
}
catch (BaseException &be)
{
throw FunctionException
(wxT("During initialization of local objects before \"") +
current->GetGeneratingString(Gmat::NO_COMMENTS) + wxT("\", ") +
e.GetFullMessage());
}
}
// If current command is BranchCommand and still executing, continue to next
// command in the branch (LOJ: 2009.03.24)
if (current->IsOfType(wxT("BranchCommand")) && current->IsExecuting())
{
#ifdef DEBUG_FUNCTION_EXEC
MessageInterface::ShowMessage
(wxT("In Function '%s', still executing current command is <%p><%s>\n"),
functionName.c_str(), current, current ? current->GetTypeName().c_str() : wxT("NULL"));
#endif
continue;
}
current = current->GetNext();
#ifdef DEBUG_FUNCTION_EXEC
MessageInterface::ShowMessage
(wxT("In Function '%s', the next command is <%p><%s>\n"), functionName.c_str(),
current, current ? current->GetTypeName().c_str() : wxT("NULL"));
#endif
}
// Set ObjectMap from the last command to Validator in order to create
// valid output wrappers (loj: 2008.11.12)
validator->SetObjectMap(last->GetObjectMap());
#ifdef DEBUG_FUNCTION_EXEC
MessageInterface::ShowMessage
(wxT(" Now about to create %d output wrapper(s) to set results, objectsInitialized=%d\n"),
outputNames.size(), objectsInitialized);
#endif
// create output wrappers and put into map
GmatBase *obj;
wrappersToDelete.clear();