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


C++ GmatCommand类代码示例

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


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

示例1: while

//------------------------------------------------------------------------------
const wxString BeginScript::GetChildString(const wxString &prefix,
                                              GmatCommand *cmd,
                                              GmatCommand *parent)
{
   #ifdef DEBUG_BEGINSCRIPT
      MessageInterface::ShowMessage(wxT("BeginScript::GetChildString entered\n"));
   #endif
   
   wxString sstr;
   wxString cmdstr;
   Integer whichOne, start;
   GmatCommand *current = cmd;
   
   while ((current != parent) && (current != NULL))
   {
      cmdstr = current->GetGeneratingString();
      start = 0;
      while (cmdstr[start] == wxT(' '))
         ++start;
      cmdstr = cmdstr.substr(start);
      sstr << prefix << cmdstr << wxT("\n");
      whichOne = 0;
      GmatCommand* child = current->GetChildCommand(whichOne);
      while ((child != NULL) && (child != cmd))
      {
         sstr << GetChildString(prefix + wxT("   "), child, current);
         ++whichOne;
         child = current->GetChildCommand(whichOne);
      }
      current = current->GetNext();
   }
   
   return sstr;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: 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,代码来源:

示例3: 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,代码来源:

示例4: 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,代码来源:

示例5: clock

//------------------------------------------------------------------------------
// 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,代码来源:

示例6: _T

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,代码来源:

示例7: GetMatchingEnd

//------------------------------------------------------------------------------
GmatCommand* GmatCommandUtil::GetNextCommand(GmatCommand *cmd)
{
   if (cmd == NULL)
      return NULL;
   
   if (cmd->GetTypeName() != "BeginScript")
      return cmd->GetNext();
   
   GmatCommand *endScript = GetMatchingEnd(cmd);
   
   if (endScript == NULL)
      return NULL;
   else
      return endScript->GetNext();
   
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例8: IsAfter

//------------------------------------------------------------------------------
bool GmatCommandUtil::IsAfter(GmatCommand *cmd1, GmatCommand *cmd2)
{
   if (cmd1 == NULL || cmd2 == NULL)
      return false;
   
   GmatCommand *current = cmd2;
   
   while (current != NULL)
   {
      if (current == cmd1)
         return true;
      
      current = current->GetNext();
   }
   
   return false;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例9: 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,代码来源:

示例10: 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,代码来源:

示例11: GetPreviousCommand

//------------------------------------------------------------------------------
GmatCommand* GmatCommandUtil::GetPreviousCommand(GmatCommand *from,
                                                 GmatCommand *cmd)
{
   GmatCommand *current = from;
   GmatCommand *prevCmd = NULL;
   GmatCommand *child = NULL;
   Integer branch = 0;
   
   while (current != NULL)
   {
      if (current == cmd)
         return prevCmd;
      
      // check branch commands
      while ((current->GetChildCommand(branch)) != NULL)
      {
         child = current->GetChildCommand(branch);
         
         while (child != NULL)
         {
            #ifdef DEBUG_PREV_COMMAND
            ShowCommand("   child = ", child);
            #endif
            
            if (child == cmd)
               return prevCmd;
            
            prevCmd = child;
            child = child->GetNext();
         }
         
         branch++;
      }
      
      prevCmd = current;
      current = current->GetNext();
      
   }
   
   return NULL;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例12: GetCommandSeqString

//------------------------------------------------------------------------------
std::string GmatCommandUtil::
GetCommandSeqString(GmatCommand *cmd, bool showAddr, bool showGenStr,
                    bool showSummaryName, const std::string &indentStr)
{
   char buf[13];
   GmatCommand *current = cmd;
   std::string cmdseq, cmdstr, genStr;
   cmdstr = "\n---------- Mission Sequence ----------\n";
   cmdseq.append(cmdstr);
   buf[0] = '\0';
   
   #ifdef DEBUG_COMMAND_SEQ_STRING
   MessageInterface::ShowMessage
      ("===> GmatCommandUtil::GetCommandSeqString(%p)\n", cmd);
   MessageInterface::ShowMessage("%s", cmdstr.c_str());
   #endif
   
   
   while (current != NULL)
   {
      if (showAddr)
         sprintf(buf, "(%p)", current);
      
      genStr = "";
      if (showGenStr)
      {
         if (current->GetTypeName() == "BeginScript")
            genStr = "<BeginScript>";
         else if (current->GetTypeName() == "EndScript")
            genStr = "<EndScript>";
         else
            genStr = " <" + current->GetGeneratingString(Gmat::NO_COMMENTS) + ">";
      }
		else if (showSummaryName)
		{
			// Show summary name
         genStr = "(" + current->GetSummaryName() + ")";
		}
		
      // if indentation string is not blank, use it from the first level
      if (indentStr.find(" ") == indentStr.npos)
         cmdstr = indentStr + " " + std::string(buf) + current->GetTypeName() + genStr + "\n";
      else
         cmdstr = std::string(buf) + current->GetTypeName() + genStr + "\n";
      
      cmdseq.append(cmdstr);
      
      #ifdef DEBUG_COMMAND_SEQ_STRING
      MessageInterface::ShowMessage("%s", cmdstr.c_str());
      #endif
      
      if ((current->GetChildCommand(0)) != NULL)
         GetSubCommandString(current, 0, cmdseq, showAddr, showGenStr, showSummaryName, indentStr);
      
      current = current->GetNext();
   }
   
   cmdseq.append("\n");
   
   return cmdseq;
}
开发者ID:,项目名称:,代码行数:62,代码来源:

示例13: GetCommentLine

//------------------------------------------------------------------------------
const wxString& BeginScript::GetGeneratingString(Gmat::WriteMode mode,
                                                    const wxString &prefix,
                                                    const wxString &useName)
{
   //Note: This method is called only once from the ScriptInterpreter::WriteScript()
   // So all nested ScriptEvent generating string should be handled here
   
   wxString gen;
   wxString indent;
   wxString commentLine = GetCommentLine();
   wxString inlineComment = GetInlineComment();
   wxString beginPrefix = prefix;

   if (mode != Gmat::GUI_EDITOR)
   {
      if (mode == Gmat::NO_COMMENTS)
      {
         gen << prefix << wxT("BeginScript") << wxT("\n");
      }
      else
      {
         IndentComment(gen, commentLine, prefix);
         gen << prefix << wxT("BeginScript");   
         
         if (inlineComment != wxT(""))
            gen << inlineComment << wxT("\n");
         else
            gen << wxT("\n");
      }
   }
   
   #if DBGLVL_GEN_STRING
   MessageInterface::ShowMessage
      (wxT("BeginScript::GetGeneratingString() this=(%p)%s, mode=%d, prefix='%s', ")
       wxT("useName='%s'\n"), this, this->GetTypeName().c_str(), mode, prefix.c_str(),
       useName.c_str());
   #endif
   
   if (mode == Gmat::GUI_EDITOR)
      indent = wxT("");
   else
      indent = wxT("   ");
   
   GmatCommand *current = next;
   while (current != NULL)
   {      
      #if DBGLVL_GEN_STRING > 1
      MessageInterface::ShowMessage
         (wxT("BeginScript::GetGeneratingString() current=(%p)%s\n"), current,
          current->GetTypeName().c_str());
      #endif
      
      if (current->GetTypeName() != wxT("EndScript"))
      {
         // Indent whole block within Begin/EndScript
         IndentChildString(gen, current, indent, mode, prefix, useName, false);
         
         // Get command after EndScript
         current = GmatCommandUtil::GetNextCommand(current);
         
         if (current == NULL)
            IndentChildString(gen, current, indent, mode, beginPrefix, useName, true);
      }
      else
      {
         if (mode != Gmat::GUI_EDITOR)
         {
            // Indent whole block within Begin/EndScript
            IndentChildString(gen, current, indent, mode, beginPrefix, useName, true);
         }
         current = NULL;
      }
   }
   
   generatingString = gen;
   
   #if DBGLVL_GEN_STRING
   MessageInterface::ShowMessage
      (wxT("BeginScript::GetGeneratingString() returnning generatingString\n"));
   MessageInterface::ShowMessage(wxT("<<<\n%s>>>\n\n"), generatingString.c_str());
   #endif
   
   return generatingString;
}
开发者ID:,项目名称:,代码行数:85,代码来源:

示例14: 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,代码来源:

示例15: wxT

//------------------------------------------------------------------------------
bool Target::Initialize()
{
    GmatBase *mapObj = NULL;
    cloneCount = 0;

    if ((mapObj = FindObject(solverName)) == NULL)
    {
        wxString errorString = wxT("Target command cannot find targeter \"");
        errorString += solverName;
        errorString += wxT("\"");
        throw CommandException(errorString, Gmat::ERROR_);
    }

    // Clone the targeter for local use
#ifdef DEBUG_TARGET_INIT
    MessageInterface::ShowMessage
    (wxT("Target::Initialize() cloning mapObj <%p>'%s'\n"), mapObj,
     mapObj->GetName().c_str());
    MessageInterface::ShowMessage
    (wxT("mapObj maxIter=%d\n"),
     mapObj->GetIntegerParameter(mapObj->GetParameterID(wxT("MaximumIterations"))));
#endif

    // Delete the old cloned solver
    if (theSolver)
    {
#ifdef DEBUG_MEMORY
        MemoryTracker::Instance()->Remove
        (theSolver, wxT("local solver", "Target::Initialize()"),
         wxT("deleting local cloned solver"));
#endif
        delete theSolver;
    }

    theSolver = (Solver *)(mapObj->Clone());
    if (theSolver != NULL)
        ++cloneCount;

#ifdef DEBUG_MEMORY
    MemoryTracker::Instance()->Add
    (theSolver, theSolver->GetName(), wxT("Target::Initialize()"),
     wxT("theSolver = (Solver *)(mapObj->Clone())"));
#endif

    theSolver->TakeAction(wxT("ResetInstanceCount"));
    mapObj->TakeAction(wxT("ResetInstanceCount"));

    theSolver->TakeAction(wxT("IncrementInstanceCount"));
    mapObj->TakeAction(wxT("IncrementInstanceCount"));

    if (theSolver->GetStringParameter(wxT("ReportStyle")) == wxT("Debug"))
        targeterInDebugMode = true;
    theSolver->SetStringParameter(wxT("SolverMode"),
                                  GetStringParameter(SOLVER_SOLVE_MODE));
    theSolver->SetStringParameter(wxT("ExitMode"),
                                  GetStringParameter(SOLVER_EXIT_MODE));

    // Set the local copy of the targeter on each node
    std::vector<GmatCommand*>::iterator node;
    GmatCommand *current;
    specialState = Solver::INITIALIZING;

    for (node = branch.begin(); node != branch.end(); ++node)
    {
        current = *node;

#ifdef DEBUG_TARGET_COMMANDS
        Integer nodeNum = 0;
#endif
        while ((current != NULL) && (current != this))
        {
#ifdef DEBUG_TARGET_COMMANDS
            MessageInterface::ShowMessage(
                wxT("   Target Command %d:  %s\n"), ++nodeNum,
                current->GetTypeName().c_str());
#endif
            if ((current->GetTypeName() == wxT("Vary")) ||
                    (current->GetTypeName() == wxT("Achieve")))
                current->SetRefObject(theSolver, Gmat::SOLVER, solverName);
            current = current->GetNext();
        }
    }

    bool retval = SolverBranchCommand::Initialize();

    if (retval == true) {
        // Targeter specific initialization goes here:
        if (FindObject(solverName) == NULL)
        {
            wxString errorString = wxT("Target command cannot find targeter \"");
            errorString += solverName;
            errorString += wxT("\"");
            throw CommandException(errorString);
        }

        retval = theSolver->Initialize();
    }

    targeterInFunctionInitialized = false;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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