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


C++ Stage::getName方法代码示例

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


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

示例1: testMisc

void testMisc() {
    State s;
    s.setNumSubsystems(1);
    s.advanceSubsystemToStage(SubsystemIndex(0), Stage::Topology);

    // Can't ask for the time before Stage::Topology, but if you could it would be NaN.
    s.advanceSystemToStage(Stage::Topology);

    // Advancing to Stage::Topology sets t=0.
    cout << "AFTER ADVANCE TO TOPOLOGY, t=" << s.getTime() << endl;

    SimTK_TEST(s.getTime()==0);

    Vector v3(3), v2(2);
    QIndex q1 = s.allocateQ(SubsystemIndex(0), v3);
    QIndex q2 = s.allocateQ(SubsystemIndex(0), v2);

    EventTriggerByStageIndex e1 = s.allocateEventTrigger(SubsystemIndex(0), Stage::Position, 3);
    EventTriggerByStageIndex e2 = s.allocateEventTrigger(SubsystemIndex(0), Stage::Instance, 2);

    printf("q1,2=%d,%d\n", (int)q1, (int)q2);
    printf("e1,2=%d,%d\n", (int)e1, (int)e2);

    //cout << s;

    DiscreteVariableIndex dv = s.allocateDiscreteVariable(SubsystemIndex(0), Stage::Dynamics, new Value<int>(5));

    s.advanceSubsystemToStage(SubsystemIndex(0), Stage::Model);
        //long dv2 = s.allocateDiscreteVariable(SubsystemIndex(0), Stage::Position, new Value<int>(5));

    Value<int>::updDowncast(s.updDiscreteVariable(SubsystemIndex(0), dv)) = 71;
    cout << s.getDiscreteVariable(SubsystemIndex(0), dv) << endl;


    s.advanceSystemToStage(Stage::Model);

    cout << "AFTER ADVANCE TO MODEL, t=" << s.getTime() << endl;

    // Event triggers are available at Instance stage.
    s.advanceSubsystemToStage(SubsystemIndex(0), Stage::Instance);
    s.advanceSystemToStage(Stage::Instance);

    printf("ntriggers=%d, by stage:\n", s.getNEventTriggers());
    for (int j=0; j<Stage::NValid; ++j) {
        Stage g = Stage(j);
        cout << g.getName() << ": " << s.getNEventTriggersByStage(g) << endl;
    }

    printf("subsys 0 by stage:\n");
    for (int j=0; j<Stage::NValid; ++j) {
        Stage g = Stage(j);
        cout << g.getName() << ": " << s.getNEventTriggersByStage(SubsystemIndex(0),g) << endl;
    }
    //cout << "State s=" << s;

    s.clear();
    //cout << "after clear(), State s=" << s;
}
开发者ID:BrianZ1,项目名称:simbody,代码行数:58,代码来源:StateTest.cpp

示例2: assert

void CacheEntryInfo::
throwHelpfulOutOfDateMessage(const StateImpl& stateImpl,
                             const char* funcName) const {
    const PerSubsystemInfo& subsys = stateImpl.getSubsystem(m_myKey.first);
    assert(&subsys.getCacheEntryInfo(m_myKey.second) == this);
    const Stage current = subsys.getCurrentStage();
    SimTK_STAGECHECK_GE_ALWAYS(current, getDependsOnStage(), funcName);

    const StageVersion version = subsys.getStageVersion(m_dependsOnStage);

    SimTK_ERRCHK4_ALWAYS(version == m_dependsOnVersionWhenLastComputed,
                            funcName,
        "State Cache entry was out of date at Stage %s. This entry depends "
        "on version %lld of Stage %s but was last updated at version %lld.",
        current.getName().c_str(), version, 
        getDependsOnStage().getName().c_str(),
        m_dependsOnVersionWhenLastComputed);

    SimTK_ASSERT_ALWAYS(!m_isUpToDateWithPrerequisites,
    "CacheEntryInfo::throwHelpfulOutOfDateMessage(): not out of date???");

    SimTK_ERRCHK_ALWAYS(m_isUpToDateWithPrerequisites, funcName,
        "State Cache entry was out of date with respect to one of its "
        "explicit prerequisites.");
}
开发者ID:Cyberlusion,项目名称:CNS-OS-and-Biomechanics,代码行数:25,代码来源:State.cpp

示例3: mpEngine

Stage::Stage( const Stage& iS) :
  mpEngine( iS.mpEngine ),
	mName( iS.getName() ),
  mCellSize( iS.getCellSize() ), 
	mTerrainSize( iS.getTerrainSize() ),
	mTerrain( iS.getTerrain() ),
  mLayers(),
  mBackgroundToken( iS.getBackgroundToken() ),
  mActors()
{ 
	for( int i = 0; i < iS.getNumberOfLayers(); ++i )
  { mLayers.push_back( new Layer( *iS.mLayers[i] ) ); }
    
	for( int i = 0; i < iS.getNumberOfMonsters(); ++i )
  { add( new Monster( *iS.mMonsters[i] ) ); }
}
开发者ID:realisim,项目名称:realisim,代码行数:16,代码来源:Engine.cpp

示例4: stageOptions

Options PipelineManager::stageOptions(Stage& stage)
{
    Options opts;

    std::string tag = stage.tag();
    if (tag.size())
    {
        tag = "stage." + tag;
        auto oi = m_stageOptions.find(tag);
        if (oi != m_stageOptions.end())
            opts.add(oi->second);
    }
    // Tag-based options options override stagename-based options, so
    // we call addConditional.
    auto oi = m_stageOptions.find(stage.getName());
    if (oi != m_stageOptions.end())
        opts.addConditional(oi->second);
    return opts;
}
开发者ID:PDAL,项目名称:PDAL,代码行数:19,代码来源:PipelineManager.cpp

示例5: registerFields

void Support::registerFields(Stage& stage, Schema& schema, PointFormat format)
{
    std::ostringstream text;

    std::vector<pdal::Dimension> const& d = stage.getDefaultDimensions();

    Schema dimensions(d);

    schema.appendDimension(dimensions.getDimension("X", stage.getName()));
    schema.appendDimension(dimensions.getDimension("Y", stage.getName()));
    schema.appendDimension(dimensions.getDimension("Z", stage.getName()));

    schema.appendDimension(dimensions.getDimension("Intensity", stage.getName()));
    schema.appendDimension(dimensions.getDimension("ReturnNumber", stage.getName())); // 3 bits only
    schema.appendDimension(dimensions.getDimension("NumberOfReturns", stage.getName())); // 3 bits only
    schema.appendDimension(dimensions.getDimension("ScanDirectionFlag", stage.getName()));  // 1 bit only
    schema.appendDimension(dimensions.getDimension("EdgeOfFlightLine", stage.getName())); // 1 bit only

    schema.appendDimension(dimensions.getDimension("Classification", stage.getName()));
    schema.appendDimension(dimensions.getDimension("ScanAngleRank", stage.getName()));

    schema.appendDimension(dimensions.getDimension("UserData", stage.getName()));
    schema.appendDimension(dimensions.getDimension("PointSourceId", stage.getName()));

    if (hasTime(format))
    {
        schema.appendDimension(dimensions.getDimension("Time", stage.getName()));
    }

    if (hasColor(format))
    {
        schema.appendDimension(dimensions.getDimension("Red", stage.getName()));
        schema.appendDimension(dimensions.getDimension("Green", stage.getName()));
        schema.appendDimension(dimensions.getDimension("Blue", stage.getName()));
    }

    // if (hasWave(format))
    // {
    //
    //     schema.appendDimension(Dimension(DimensionId::Las_WavePacketDescriptorIndex));
    //     schema.appendDimension(Dimension(DimensionId::Las_WaveformDataOffset));
    //     schema.appendDimension(Dimension(DimensionId::Las_ReturnPointWaveformLocation));
    //     schema.appendDimension(Dimension(DimensionId::Las_WaveformXt));
    //     schema.appendDimension(Dimension(DimensionId::Las_WaveformYt));
    //     schema.appendDimension(Dimension(DimensionId::Las_WaveformZt));
    // }

    return;
}
开发者ID:xhy20070406,项目名称:PDAL,代码行数:49,代码来源:Support.cpp

示例6: main


//.........这里部分代码省略.........
    TeamResult *result = &(rankedTeams[x]->result);
    if (result->showResult) {
      std::cout << "    " << rankedTeams[x]->name << ":" << std::endl;
      std::cout << "        Rank: ";
      if (result->rank == 0) {
        std::cout << "-";
      } else {
        std::cout << result->rank;
      }
      std::cout << std::endl;
      if (hasScores) {
        std::cout << "        Score: " << round(result->score, 2) << std::endl;
      }

      for (int y = 0; y < numStats; y++) {
        char *key = statKeys[y];
        bool found = false;
        for (int z = 0; z < result->numStats; z++) {
        char *resultKey = result->stats[z]->key;
        if (strcmp(key, resultKey) == 0) {
          std::cout << "        " << key << ": "
              << round(result->stats[z]->value, 2) << std::endl;
          found = true;
          break;
        }
        }
        if (!found) {
        std::cout << "        " << key << ": -" << std::endl;
        }
      }
    }
  }

  std::cout << std::endl << "CPU time used per tick (microseconds):"
            << std::endl;
  for (int x = 0; x < engine->getNumTeams(); x++) {
    Team *team = engine->getTeam(x);
    if (!team->stageShip && !team->disabled) {
      std::cout << "  " << team->name << ": "
                << (team->totalCpuTime / team->totalCpuTicks) << std::endl;
    }
  }

  if (realSeconds > 0) {
    std::cout << std::endl << "TPS: "
              << (((double) engine->getGameTime()) / realSeconds) << std::endl;
  }

  if (saveReplay) {
    ReplayBuilder *replayBuilder = engine->getReplayBuilder();

    // TODO: move this into a function in the engine
    Team **rankedTeams = engine->getRankedTeams();
    replayBuilder->setResults(rankedTeams, engine->getNumTeams());

    char *filename = 0;
    char *absFilename = 0;
    do {
      if (filename != 0) {
        delete filename;
      }
      if (absFilename != 0) {
        delete absFilename;
      }
      filename = replayFilename(stage->getName());
      char *filePath = fileManager->getFilePath(REPLAYS_SUBDIR, filename);
      absFilename = fileManager->getAbsFilePath(filePath);
      delete filePath;
    } while (fileManager->fileExists(absFilename));
    replayBuilder->saveReplay(filename);
    std::cout << std::endl << "Saved replay to: " << REPLAYS_SUBDIR << "/"
              << filename << std::endl;
    delete filename;
    delete absFilename;
  }

  std::cout << std::endl;

  delete engine;
  for (int x = 0; x < numTeams; x++) {
    delete teams[x];
  }
  delete teams;
  delete rankedTeams;
  for (int x = 0; x < numStats; x++) {
    delete statKeys[x];
  }
  delete statKeys;
  delete printHandler;
  if (!nodisplay) {
    delete gfxManager;
  }
  delete packageReporter;
  delete fileManager;
  delete zipper;
  delete shipsBaseDir;
  delete stagesBaseDir;

  return 0;
}
开发者ID:qyqx,项目名称:BerryBots,代码行数:101,代码来源:bbsfmlmain.cpp

示例7: showPreview

void StagePreview::showPreview(sf::RenderWindow *window, const char *stageName,
                               int x, int y) {
  if (stageName_ != 0) {
    delete stageName_;
  }
  stageName_ = new char[strlen(stageName) + 1];
  strcpy(stageName_, stageName);

  SetPosition(wxPoint(x, y));
  infoSizer_->Clear(true);
  descSizer_->Clear(true);
  
  BerryBotsEngine *engine = new BerryBotsEngine(0, fileManager_, 0);
  Stage *stage = engine->getStage();
  try {
    engine->initStage(getStagesDir().c_str(), stageName, getCacheDir().c_str());
  } catch (EngineException *e) {
    wxMessageDialog errorMessage(NULL, e->what(), "Preview failure",
                                 wxOK | wxICON_EXCLAMATION);
    errorMessage.ShowModal();
    delete engine;
    delete e;
    return;
  }
  SetTitle(wxString::Format(wxT("%s"), stage->getName()));

  unsigned int targetWidth;
  unsigned int targetHeight;
  char *previewFilename =
      savePreviewImage(window, engine, targetWidth, targetHeight);
  wxImage previewImage(previewFilename);
  delete previewFilename;

  double backingScale = getBackingScaleFactor();
  if (backingScale > 1) {
    targetWidth /= backingScale;
    targetHeight /= backingScale;
  }
  visualPreview_->SetMinSize(wxSize(targetWidth, targetHeight));
  visualPreview_->SetMaxSize(wxSize(targetWidth, targetHeight));

#ifdef __WXOSX__
  int padding = 4;
#else
  int padding = 8;
#endif

  wxSizer *infoGrid = new wxFlexGridSizer(2, 0, padding);
  addInfo(infoGrid, "Name:", stage->getName());
  addInfo(infoGrid, "Size:",
      wxString::Format(wxT("%i x %i"), stage->getWidth(), stage->getHeight()));
  if (engine->getTeamSize() > 1) {
    addInfo(infoGrid, "Team size:", engine->getTeamSize());
  }
  addInfo(infoGrid, "Walls:", (stage->getWallCount() - 4));
  addInfo(infoGrid, "Zones:", stage->getZoneCount());
  addInfo(infoGrid, "Starts:", stage->getStartCount());
  int numStageShips = stage->getStageShipCount();
  if (numStageShips > 0) {
    char **stageShips = stage->getStageShips();
    for (int x = 0; x < numStageShips; x++) {
      const char *shipName = stageShips[x];
      if (shipName != 0) {
        int count = 1;
        for (int y = x + 1; y < numStageShips; y++) {
          const char *shipName2 = stageShips[y];
          if (shipName2 != 0 && strcmp(shipName, shipName2) == 0) {
            count++;
            stageShips[y] = 0;
          }
        }
        wxString wxShipName = (count == 1) ? wxString(stageShips[x])
            : wxString::Format(wxT("%s x%i"), shipName, count);
        addInfo(infoGrid, (x == 0 ? "Ships:" : ""), wxShipName);
      }
    }
  }
  infoSizer_->Add(infoGrid);

  char *description = fileManager_->getStageDescription(
      getStagesDir().c_str(), stageName, getCacheDir().c_str());
  if (description == 0) {
    std::string descstr("<No description>");
    description = new char[descstr.length() + 1];
    strcpy(description, descstr.c_str());
  }
  wxStaticText *descCtrl = new wxStaticText(mainPanel_, wxID_ANY, description);
  descSizer_->Add(descCtrl);
  delete description;

  mainPanel_->GetSizer()->SetSizeHints(mainPanel_);
  mainPanel_->Layout();
  Fit();
  mainPanel_->SetFocus();

  wxBitmap bitmap;
#ifdef __WINDOWS__
  bitmap = wxBitmap(previewImage);
#else
  bitmap.CreateScaled(targetWidth, targetHeight, wxBITMAP_SCREEN_DEPTH,
//.........这里部分代码省略.........
开发者ID:Voidious,项目名称:BerryBots,代码行数:101,代码来源:stagepreview.cpp


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