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


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

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


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

示例1: Initialize

//------------------------------------------------------------------------------
// bool Initialize()
//------------------------------------------------------------------------------
bool GmatFunction::Initialize()
{
   #ifdef DEBUG_TRACE
   static Integer callCount = 0;
   callCount++;      
   clock_t t1 = clock();
   ShowTrace(callCount, t1, wxT("GmatFunction::Initialize() entered"));
   #endif
   
   #ifdef DEBUG_FUNCTION_INIT
      MessageInterface::ShowMessage
         (wxT("======================================================================\n")
          wxT("GmatFunction::Initialize() entered for function '%s'\n"), functionName.c_str());
      MessageInterface::ShowMessage(wxT("   and FCS is %s set.\n"), (fcs? wxT("correctly") : wxT("NOT")));
      MessageInterface::ShowMessage(wxT("   Pointer for FCS is %p\n"), fcs);
      MessageInterface::ShowMessage(wxT("   First command in fcs is %s\n"),
            (fcs->GetTypeName()).c_str());
      MessageInterface::ShowMessage(wxT("   internalCS is %p\n"), internalCoordSys);
   #endif
   if (!fcs) return false;
   
   Function::Initialize();
   
   // Initialize the Validator - I think I need to do this each time - or do I?
   validator->SetFunction(this);
   validator->SetSolarSystem(solarSys);
   std::map<wxString, GmatBase *>::iterator omi;
   
   // add automatic objects such as sat.X to the FOS (well, actually, clones of them)
   for (omi = automaticObjectMap.begin(); omi != automaticObjectMap.end(); ++omi)
   {
      wxString autoObjName = omi->first;
      
      // if name not found, clone it and add to map (loj: 2008.12.15)
      if (objectStore->find(autoObjName) == objectStore->end())
      {
         GmatBase *autoObj = (omi->second)->Clone();
         #ifdef DEBUG_MEMORY
         MemoryTracker::Instance()->Add
            (autoObj, autoObjName, wxT("GmatFunction::Initialize()"),
             wxT("autoObj = (omi->second)->Clone()"));
         #endif
         
         #ifdef DEBUG_FUNCTION_INIT
         try
         {
            MessageInterface::ShowMessage
               (wxT("   autoObj->EvaluateReal() = %f\n"), autoObj->GetRealParameter(wxT("Value")));
         }
         catch (BaseException &e)
         {
            MessageInterface::ShowMessage(e.GetFullMessage());             
         }
         #endif
         
         autoObj->SetIsLocal(true);
         objectStore->insert(std::make_pair(autoObjName, autoObj));
      }
   }
   
   // first, send all the commands the object store, solar system, etc
   GmatCommand *current = fcs;
   
   while (current)
   {
      #ifdef DEBUG_FUNCTION_INIT
         if (!current)  MessageInterface::ShowMessage(wxT("Current is NULL!!!\n"));
         else MessageInterface::ShowMessage(wxT("   =====> Current command is %s <%s>\n"),
                 (current->GetTypeName()).c_str(),
                 current->GetGeneratingString(Gmat::NO_COMMENTS).c_str());
      #endif
      current->SetObjectMap(objectStore);
      current->SetGlobalObjectMap(globalObjectStore);
      current->SetSolarSystem(solarSys);
      current->SetInternalCoordSystem(internalCoordSys);
      current->SetTransientForces(forces);
      #ifdef DEBUG_FUNCTION_INIT
         MessageInterface::ShowMessage
            (wxT("   Now about to set object map of type %s to Validator\n"),
             (current->GetTypeName()).c_str());      
      #endif
      // (Re)set object map on Validator (necessary because objects may have been added to the 
      // Local Object Store or Global Object Store during initialization of previous commands)
      validatorStore.clear();
      for (omi = objectStore->begin(); omi != objectStore->end(); ++omi)
         validatorStore.insert(std::make_pair(omi->first, omi->second));
      for (omi = globalObjectStore->begin(); omi != globalObjectStore->end(); ++omi)
         validatorStore.insert(std::make_pair(omi->first, omi->second));
      validator->SetObjectMap(&validatorStore);
      
      #ifdef DEBUG_FUNCTION_INIT
      MessageInterface::ShowMessage
         (wxT("   Now about to call Validator->ValidateCommand() of type %s\n"),
          current->GetTypeName().c_str());
      #endif
      
      // Let's try to ValidateCommand here, this will validate the command
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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