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


C++ GmatCommand::GetTypeName方法代码示例

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


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

示例1: RenameRefObject

//------------------------------------------------------------------------------
bool BeginScript::RenameRefObject(const Gmat::ObjectType type,
                                  const wxString &oldName,
                                  const wxString &newName)
{   
   GmatCommand *current = next;
   
   while (current != NULL)
   {
      #if DEBUG_RENAME
      MessageInterface::ShowMessage
         (wxT("BeginScript::RenameRefObject() current=%s\n"),
          current->GetTypeName().c_str());
      #endif
      
      if (current->GetTypeName() != wxT("EndScript"))
      {
         current->RenameRefObject(type, oldName, newName);
         current = current->GetNext();
      }
      else
      {
         current = NULL;
      }
   }
   
   return true;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: while

//------------------------------------------------------------------------------
PropSetup *GetFirstPropagator(GmatCommand *cmd)
{
   static PropSetup *retval = NULL;
   GmatCommand *current = cmd;

   #ifdef DEBUG_ODE_SEARCH
      extraMsg = "Commands checked:\n";
   #endif
   while (current != NULL)
   {
      #ifdef DEBUG_ODE_SEARCH
            extraMsg += "   '" + current->GetTypeName() + "'\n";
      #endif
      if (current->GetTypeName() == "Propagate")
      {
         try
         {
            // Set all of the internal connections
//               current->TakeAction("PrepareToPropagate");
            current->Execute();
         }
         catch (BaseException &ex)
         {
            lastMsg = ex.GetFullMessage();
         }
         #ifdef DEBUG_ODE_SEARCH
            extraMsg += "      Checking in this command\n";
         #endif
         GmatBase *obj = current->GetRefObject(Gmat::PROP_SETUP, "", 0);

         #ifdef DEBUG_ODE_SEARCH
            if (obj != NULL)
               extraMsg += "      Found an object of type PROPSETUP\n";
            else
               extraMsg += "      Propagate command returns NULL PROPSETUP\n";
         #endif

         if (obj->IsOfType("PropSetup"))
         {
            retval = (PropSetup*)(obj);
            break;
         }
      }

      current = current->GetNext();
   }

   return retval;
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例3: PrintBranch

bool PrintUtility::PrintBranch(GmatCommand* brCmd, Integer level)
{
   GmatCommand* current = brCmd;
   Integer childNo = 0;
   GmatCommand* nextInBranch;
   GmatCommand* child;
   
   while((child = current->GetChildCommand(childNo))!=NULL)
   {
      nextInBranch = child;
      while ((nextInBranch != NULL) && (nextInBranch != current))
      {
         cout << _T("   ");
         for (int i = 0; i <= level ; i++)
            cout << _T("...");
         cout << _T(" branch ") << childNo << _T("::") << nextInBranch->GetTypeName() << endl;
         if (nextInBranch->GetChildCommand() != NULL)
         {
            PrintBranch(nextInBranch, level+1);
         }
         nextInBranch = nextInBranch->GetNext();
      }
      ++childNo;
   }
   
   return true;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例4: FindOdeModel

   //---------------------------------------------------------------------------
   int FindOdeModel(const char* modelName)
   {
      #ifdef DEBUG_INTERFACE_FROM_MATLAB
         fprintf(fp, "Looking for ODE model '%s'\n", modelName);
      #endif
      int retval = -1;
      ode = NULL;
      pSetup = NULL;
      lastMsg = "";

      // First see if it has been located before
      if (odeNameTable.find(modelName) != odeNameTable.end())
      {
         ode = odeTable[odeNameTable[modelName]];
         pSetup = setupTable[odeNameTable[modelName]];
         extraMsg = ode->GetName().c_str();

         lastMsg = "ODE Model \"";
         lastMsg += extraMsg;
         lastMsg += "\" was previously located";

         return odeNameTable[modelName];
      }
      else if ((odeTable.size() > 0) && (strcmp(modelName, "") == 0))
      {
         // If no name specified, return first one in table if there is an entry
         ode = odeTable.begin()->second;
         extraMsg = ode->GetName().c_str();
         pSetup = setupTable.begin()->second;

         lastMsg = "Unnamed model; using ODE Model \"";
         lastMsg += ode->GetName();
         lastMsg += "\" previously located";

         return 0;
      }

      Moderator *theModerator = Moderator::Instance();
      if (theModerator == NULL)
      {
         lastMsg = "Cannot find the Moderator";
         return retval;
      }

      GmatCommand *current = theModerator->GetFirstCommand(1);
      #ifdef DEBUG_INTERFACE_FROM_MATLAB
         fprintf(fp, "FirstCommand: <%p> of type %s\n", current,
               current->GetTypeName().c_str());
      #endif

      int modelIndex = GetODEModel(&current, modelName);

      if (ode != NULL)
         retval = modelIndex;
      else
         retval = -2;
   
      return retval;
   }
开发者ID:,项目名称:,代码行数:60,代码来源:

示例5: HasCommandSequenceChanged

//------------------------------------------------------------------------------
bool GmatCommandUtil:: HasCommandSequenceChanged(GmatCommand *cmd)
{
   if (cmd == NULL)
      return false;
   
   GmatCommand *current = cmd;
   std::string cmdstr = cmd->GetTypeName();
   
   #ifdef DEBUG_COMMAND_CHANGED
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::HasCommandSequenceChanged() entered, "
       "cmd=<%p><%s>\n", cmd, cmdstr.c_str());
   #endif
   
   
   while (current != NULL)
   {
      cmdstr = "--- " + current->GetTypeName() + "\n";
      
      #ifdef DEBUG_COMMAND_CHANGED
      MessageInterface::ShowMessage(cmdstr);
      #endif
      
      if (current->HasConfigurationChanged())
      {
         #ifdef DEBUG_COMMAND_CHANGED
         MessageInterface::ShowMessage
            ("CommandUtil::HasCommandSequenceChanged() returning true\n");
         #endif
         return true;
      }
      
      // go through sub commands
      if ((current->GetChildCommand(0)) != NULL)
      {
         if (HasBranchCommandChanged(current, 0))
         {
            #ifdef DEBUG_COMMAND_CHANGED
            MessageInterface::ShowMessage
               ("CommandUtil::HasCommandSequenceChanged() returning true\n");
            #endif
            
            return true;
         }
      }
      
      current = current->GetNext();
   }
   
   #ifdef DEBUG_COMMAND_CHANGED
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::HasCommandSequenceChanged() returning false\n");
   #endif
   return false;
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例6: 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;
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例7: HasBranchCommandChanged

//------------------------------------------------------------------------------
// bool SetBranchCommandChanged(GmatCommand *brCmd, Integer level)
//------------------------------------------------------------------------------
bool GmatCommandUtil::HasBranchCommandChanged(GmatCommand *brCmd, Integer level)
{
   GmatCommand* current = brCmd;
   Integer childNo = 0;
   GmatCommand* nextInBranch = NULL;
   GmatCommand* child;
   std::string cmdstr;
   
   while((child = current->GetChildCommand(childNo)) != NULL)
   {
      nextInBranch = child;
      
      while ((nextInBranch != NULL) && (nextInBranch != current))
      {         
         #ifdef DEBUG_COMMAND_CHANGED
         for (int i=0; i<=level; i++)
            cmdstr = "---" + cmdstr;         
         cmdstr = "--- " + nextInBranch->GetTypeName() + "\n";        
         MessageInterface::ShowMessage("%s", cmdstr.c_str());
         #endif
         
         if (nextInBranch->HasConfigurationChanged())
         {
            #ifdef DEBUG_COMMAND_CHANGED
            MessageInterface::ShowMessage
               ("CommandUtil::HasBranchCommandChanged() returning true\n");
            #endif
            return true;
         }
         
         if (nextInBranch->GetChildCommand() != NULL)
            if (HasBranchCommandChanged(nextInBranch, level+1))
            {
               #ifdef DEBUG_COMMAND_CHANGED
               MessageInterface::ShowMessage
                  ("CommandUtil::HasBranchCommandChanged() returning true\n");
               #endif
               return true;
            }
         nextInBranch = nextInBranch->GetNext();
      }
      
      ++childNo;
   }
   
   #ifdef DEBUG_COMMAND_CHANGED
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::HasBranchCommandChanged() returning false\n");
   #endif
   return false;
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例8: PrintEntireSequence

bool PrintUtility::PrintEntireSequence(GmatCommand* firstCmd)
{
   cout << _T(".................... Print out the whole sequence ........................................") << endl;
   GmatCommand *current = firstCmd;
   while (current != NULL)
   {
      cout << _T("   Command::") << current->GetTypeName() << endl;
      if ((current->GetChildCommand(0))!=NULL)
         PrintBranch(current, 0);
      current = current->GetNext();
   }
   cout << _T(".................... End sequence ........................................................") << endl;
   return true;
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例9: Finalize

//------------------------------------------------------------------------------
// void Finalize()
//------------------------------------------------------------------------------
void GmatFunction::Finalize()
{
   #ifdef DEBUG_TRACE
   static Integer callCount = 0;
   callCount++;      
   clock_t t1 = clock();
   ShowTrace(callCount, t1, wxT("GmatFunction::Finalize() entered"));
   #endif
   
   #ifdef DEBUG_FUNCTION_FINALIZE
   MessageInterface::ShowMessage
      (wxT("======================================================================\n")
       wxT("GmatFunction::Finalize() entered for '%s', FCS %s\n"),
       functionName.c_str(), fcsFinalized ? wxT("already finalized, so skp fcs") :
       wxT("NOT finalized, so call fcs->RunComplete"));
   #endif
   
   // Call RunComplete on each command in fcs
   if (!fcsFinalized)
   {
      fcsFinalized = true;
      GmatCommand *current = fcs;
      while (current)
      {
         #ifdef DEBUG_FUNCTION_FINALIZE
            if (!current)
               MessageInterface::ShowMessage
                  (wxT("   GmatFunction:Finalize() Current is NULL!!!\n"));
            else
               MessageInterface::ShowMessage
                  (wxT("   GmatFunction:Finalize() Now about to finalize ")
                   wxT("(call RunComplete on) command %s\n"),
                   (current->GetTypeName()).c_str());
         #endif
         current->RunComplete();
         current = current->GetNext();
      }
   }
   
   Function::Finalize();
   
   #ifdef DEBUG_FUNCTION_FINALIZE
   MessageInterface::ShowMessage(wxT("GmatFunction::Finalize() leaving\n"));
   #endif
   
   #ifdef DEBUG_TRACE
   ShowTrace(callCount, t1, wxT("GmatFunction::Finalize() exiting"), true, true);
   #endif
   
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例10: ResetBranchCommandChanged

//------------------------------------------------------------------------------
// void ResetBranchCommandChanged(GmatCommand *brCmd, Integer level)
//------------------------------------------------------------------------------
void GmatCommandUtil::ResetBranchCommandChanged(GmatCommand *brCmd, Integer level)
{
   GmatCommand* current = brCmd;
   Integer childNo = 0;
   GmatCommand* nextInBranch = NULL;
   GmatCommand* child;
   std::string cmdstr;
   
   while((child = current->GetChildCommand(childNo)) != NULL)
   {
      nextInBranch = child;
      
      while ((nextInBranch != NULL) && (nextInBranch != current))
      {         
         #ifdef DEBUG_COMMAND_CHANGED
         for (int i=0; i<=level; i++)
            cmdstr = "---" + cmdstr;         
         cmdstr = "--- " + nextInBranch->GetTypeName() + "\n";        
         MessageInterface::ShowMessage("%s", cmdstr.c_str());
         #endif
         
         nextInBranch->ConfigurationChanged(false);
         
         if (nextInBranch->GetChildCommand() != NULL)
            ResetBranchCommandChanged(nextInBranch, level+1);
         
         nextInBranch = nextInBranch->GetNext();
      }
      
      ++childNo;
   }
   
   #ifdef DEBUG_COMMAND_CHANGED
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::ResetBranchCommandChanged() leaving\n");
   #endif
}
开发者ID:,项目名称:,代码行数:40,代码来源:

示例11: ResetCommandSequenceChanged

//------------------------------------------------------------------------------
// void ResetCommandSequenceChanged(GmatCommand *cmd)
//------------------------------------------------------------------------------
void GmatCommandUtil::ResetCommandSequenceChanged(GmatCommand *cmd)
{
   if (cmd == NULL)
      return;
   
   GmatCommand *current = cmd;
   std::string cmdstr = cmd->GetTypeName();
   
   #ifdef DEBUG_COMMAND_CHANGED
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::ResetCommandSequenceChanged() entered, "
       "cmd=<%p><%s>\n", cmd, cmdstr.c_str());
   #endif
   
   while (current != NULL)
   {
      cmdstr = "--- " + current->GetTypeName() + "\n";
      
      #ifdef DEBUG_COMMAND_CHANGED
      MessageInterface::ShowMessage(cmdstr);
      #endif
      
      current->ConfigurationChanged(false);
      
      // go through sub commands
      if ((current->GetChildCommand(0)) != NULL)
         ResetBranchCommandChanged(current, 0);
      
      current = current->GetNext();
   }
   
   #ifdef DEBUG_COMMAND_CHANGED
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::ResetCommandSequenceChanged() leaving\n");
   #endif
}
开发者ID:,项目名称:,代码行数:39,代码来源:

示例12: FindObjectFromSubCommands

//------------------------------------------------------------------------------
bool GmatCommandUtil::FindObjectFromSubCommands(GmatCommand *brCmd, Integer level,
                         Gmat::ObjectType objType, const std::string &objName,
                         std::string &cmdName, GmatCommand **cmdUsing, bool checkWrappers)
{
   GmatCommand* current = brCmd;
   Integer      childNo = 0;
   GmatCommand* nextInBranch = NULL;
   GmatCommand* child;
   std::string  cmdstr;
   
   while((child = current->GetChildCommand(childNo)) != NULL)
   {
      nextInBranch = child;
      
      while ((nextInBranch != NULL) && (nextInBranch != current))
      {         
         #ifdef DEBUG_COMMAND_FIND_OBJECT
         for (int i=0; i<=level; i++)
            cmdstr = "---" + cmdstr;         
         cmdstr = "--- " + nextInBranch->GetTypeName() + "\n";        
         MessageInterface::ShowMessage("%s", cmdstr.c_str());
         #endif
         
         try
         {
            StringArray names = nextInBranch->GetRefObjectNameArray(objType);
            
            for (UnsignedInt i=0; i<names.size(); i++)
            {
               #ifdef DEBUG_COMMAND_FIND_OBJECT
               MessageInterface::ShowMessage("names[%d]=%s\n", i, names[i].c_str());
               #endif
               
               if (names[i] == objName)
               {
                  cmdName   = nextInBranch->GetTypeName();
                  *cmdUsing = nextInBranch;
                  #ifdef DEBUG_COMMAND_FIND_OBJECT
                  MessageInterface::ShowMessage
                     ("CommandUtil::FindObjectFromSubCommands() returning true, "
                      "cmdName='%s', cmdUsing=<%p>'%s'\n", cmdName.c_str(), *cmdUsing,
                      (*cmdUsing)->GetGeneratingString(Gmat::NO_COMMENTS).c_str());
                  #endif
                  return true;
               }
            }
         }
         catch (BaseException &e)
         {
            // Use exception to remove Visual C++ warning
            e.GetMessageType();
            #ifdef DEBUG_COMMAND_FIND_OBJECT
            MessageInterface::ShowMessage("*** INTERNAL WARNING *** " + e.GetFullMessage());
            #endif
         }
         
         if (nextInBranch->GetChildCommand() != NULL)
            if (FindObjectFromSubCommands(nextInBranch, level+1, objType, objName, cmdName,
                                          cmdUsing, checkWrappers))
            {
               #ifdef DEBUG_COMMAND_FIND_OBJECT
               MessageInterface::ShowMessage
                  ("CommandUtil::FindObjectFromSubCommands() returning true, "
                   "cmdName='%s', cmdUsing=<%p>'%s'\n", cmdName.c_str(), cmdUsing,
                   (*cmdUsing)->GetGeneratingString(Gmat::NO_COMMENTS).c_str());
               #endif
               return true;
            }

         // Check for references in the wrappers, if requested
         if (checkWrappers)
         {
            if (nextInBranch->HasOtherReferenceToObject(objName))
            {
               cmdName   = nextInBranch->GetTypeName();
               *cmdUsing = nextInBranch;
               #ifdef DEBUG_COMMAND_FIND_OBJECT
               MessageInterface::ShowMessage
                  ("CommandUtil::FindObjectFromSubCommands() returning true (for wrappers), cmdName='%s', "
                   "cmdUsing=<%p>'%s'\n", cmdName.c_str(), *cmdUsing,
                   (*cmdUsing)->GetGeneratingString(Gmat::NO_COMMENTS).c_str());
               #endif
               return true;
            }
         }
         nextInBranch = nextInBranch->GetNext();
      }
      
      ++childNo;
   }
   
   #ifdef DEBUG_COMMAND_FIND_OBJECT
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::FindObjectFromSubCommands() returning false\n");
   #endif
   return false;
}
开发者ID:,项目名称:,代码行数:98,代码来源:

示例13: ClearCommandSeq

//------------------------------------------------------------------------------
bool GmatCommandUtil::ClearCommandSeq(GmatCommand *seq, bool leaveFirstCmd,
                                      bool callRunComplete)
{
   #ifdef DEBUG_SEQUENCE_CLEARING
   MessageInterface::ShowMessage("CommandUtil::ClearCommandSeq() entered\n");
   #endif
   
   GmatCommand *cmd = seq, *removedCmd = NULL;
   
   if (cmd == NULL)
   {
      #ifdef DEBUG_SEQUENCE_CLEARING
      MessageInterface::ShowMessage
         ("CommandUtil::ClearCommandSeq() exiting, first command is NULL\n");
      #endif
      return true;
   }
   
   #ifdef DEBUG_SEQUENCE_CLEARING
   GmatCommand *current = cmd;
   MessageInterface::ShowMessage("\nClearing this command list:\n");
   while (current)
   {
      ShowCommand("   ", current);
      current = current->GetNext();
   }
   MessageInterface::ShowMessage("\n");
   #endif
   
   cmd = cmd->GetNext();
   while (cmd)
   {
      if (callRunComplete)
      {
         // Be sure we're in an idle state first
         #ifdef DEBUG_SEQUENCE_CLEARING
         MessageInterface::ShowMessage
            ("   Calling %s->RunComplete\n", cmd->GetTypeName().c_str());
         #endif
         
         cmd->RunComplete();
      }
      
      removedCmd = RemoveCommand(seq, cmd);
      
      if (removedCmd != NULL)
      {
         #ifdef DEBUG_MEMORY
         MemoryTracker::Instance()->Remove
            (removedCmd, removedCmd->GetTypeName(), "CommandUtil::ClearCommandSeq()");
         #endif
         delete removedCmd;
      }
      removedCmd = NULL;
      cmd = seq->GetNext();
   }
   
   // if first command is to be delete
   if (!leaveFirstCmd)
   {
      #ifdef DEBUG_SEQUENCE_CLEARING
      MessageInterface::ShowMessage("   seq=<%p>\n", seq);
      #endif
      
      #ifdef DEBUG_MEMORY
      MemoryTracker::Instance()->Remove
         (seq, seq->GetTypeName(), "CommandUtil::ClearCommandSeq()");
      #endif
      delete seq;
      seq = NULL;
   }
   
   #ifdef DEBUG_SEQUENCE_CLEARING
   MessageInterface::ShowMessage("CommandUtil::ClearCommandSeq() returning true\n");
   #endif
   
   return true;
}
开发者ID:,项目名称:,代码行数:79,代码来源:

示例14: 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;
   }
   
   //-------------------------------------------------------
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例15: 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;
   }
}
开发者ID:,项目名称:,代码行数:95,代码来源:


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