本文整理汇总了C++中GmatCommand::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatCommand::Remove方法的具体用法?C++ GmatCommand::Remove怎么用?C++ GmatCommand::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmatCommand
的用法示例。
在下文中一共展示了GmatCommand::Remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveCommand
//------------------------------------------------------------------------------
GmatCommand* GmatCommandUtil::RemoveCommand(GmatCommand *seq, GmatCommand *cmd)
{
#ifdef DEBUG_COMMAND_DELETE
ShowCommand("==========> CommandUtil::RemoveCommand() removing ", cmd,
" from ", seq);
#endif
if (cmd == NULL)
return NULL;
GmatCommand *remvCmd;
if (cmd->GetTypeName() != "BeginScript")
{
GmatCommand *remvCmd = seq->Remove(cmd);
#ifdef DEBUG_COMMAND_DELETE
ShowCommand(" Removed = ", remvCmd);
#endif
#ifdef DEBUG_COMMAND_DELETE
ShowCommand("==========> CommandUtil::RemoveCommand() Returning ", remvCmd);
#endif
return remvCmd;
}
//-------------------------------------------------------
// Remove commands inside Begin/EndScript block
//-------------------------------------------------------
// Check for previous command, it should not be NULL,
// since "NoOp" is the first command
GmatCommand *prevCmd = cmd->GetPrevious();
if (prevCmd == NULL)
{
MessageInterface::PopupMessage
(Gmat::ERROR_, "CommandUtil::RemoveCommand() *** INTERNAL ERROR *** \n"
"The previous command cannot be NULL.\n");
return NULL;
}
////GmatCommand *first = GetFirstCommand();
GmatCommand *first = seq;
#ifdef DEBUG_COMMAND_DELETE
std::string cmdString1 = GmatCommandUtil::GetCommandSeqString(first);
MessageInterface::ShowMessage(" ==> Current sequence:");
MessageInterface::ShowMessage(cmdString1);
#endif
GmatCommand *current = cmd->GetNext();
#ifdef DEBUG_COMMAND_DELETE
GmatCommand *nextCmd = GmatCommandUtil::GetNextCommand(cmd);
ShowCommand(" prevCmd = ", prevCmd, " nextCmd = ", nextCmd);
#endif
// Get matching EndScript for BeginScript
GmatCommand *endScript = GmatCommandUtil::GetMatchingEnd(cmd);
#ifdef DEBUG_COMMAND_DELETE
ShowCommand(" endScript = ", endScript);
#endif
GmatCommand* next;
while (current != NULL)
{
#ifdef DEBUG_COMMAND_DELETE
ShowCommand(" current = ", current);
#endif
if (current == endScript)
break;
next = current->GetNext();
#ifdef DEBUG_COMMAND_DELETE
ShowCommand(" removing and deleting ", current);
#endif
remvCmd = cmd->Remove(current);
// per kw report - check remvCmd first
if (remvCmd != NULL)
{
remvCmd->ForceSetNext(NULL);
#ifdef DEBUG_MEMORY
MemoryTracker::Instance()->Remove
(remvCmd, remvCmd->GetTypeName(), "CommandUtil::RemoveCommand()");
#endif
delete remvCmd;
}
current = next;
}
//-------------------------------------------------------
//.........这里部分代码省略.........