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


C++ Universe::getType方法代码示例

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


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

示例1: findCell

/**
 * @brief Finds the Cell for which a LocalCoords object resides.
 * @details Finds the Cell that a LocalCoords object is located inside by
 *          checking each of this Universe's Cells. Returns NULL if the
 *          LocalCoords is not in any of the Cells.
 * @param coords a pointer to the LocalCoords of interest
 * @param universes a container of all of the Universes passed in by Geometry
 * @return a pointer the Cell where the LocalCoords is located
 */
Cell* Universe::findCell(LocalCoords* coords,
                         std::map<int, Universe*> universes) {

  Cell* return_cell = NULL;
  std::map<int, Cell*>::iterator iter;

  /* Sets the LocalCoord type to UNIV at this level */
  coords->setType(UNIV);

  /* Loop over all Cells in this Universe */
  for (iter = _cells.begin(); iter != _cells.end(); ++iter) {
    Cell* cell = iter->second;

    if (cell->cellContainsCoords(coords)) {

      /* Set the Cell on this level */
      coords->setCell(cell->getId());

      /* MATERIAL type Cell - lowest level, terminate search for Cell */
      if (cell->getType() == MATERIAL) {
        coords->setCell(cell->getId());
        return_cell = cell;
        return return_cell;
      }

      /* FILL type Cell - Cell contains a Universe at a lower level
       * Update coords to next level and continue search */
      else if (cell->getType() == FILL) {

        LocalCoords* next_coords;

        if (coords->getNext() == NULL)
          next_coords = new LocalCoords(coords->getX(), coords->getY());
        else
          next_coords = coords->getNext();

        CellFill* cell_fill = static_cast<CellFill*>(cell);
        int universe_id = cell_fill->getUniverseFillId();
        next_coords->setUniverse(universe_id);
        Universe* univ = universes.at(universe_id);
        coords->setCell(cell->getId());

        coords->setNext(next_coords);
        next_coords->setPrev(coords);
        if (univ->getType() == SIMPLE)
          return univ->findCell(next_coords, universes);
        else
          return static_cast<Lattice*>(univ)->findCell(next_coords, universes);
      }
    }
  }

  return return_cell;
}
开发者ID:AlexYou,项目名称:OpenMOC,代码行数:63,代码来源:Universe.cpp

示例2: query_venue_describe

// ----------------------------------------------------------------------------
//
void HttpRestServices::query_venue_describe( Venue* venue, DMXHttpSession* session, CString& response, LPCSTR data ) {
    JsonBuilder json( response );

    json.startObject();
    json.add( "name", venue->getName() );
    json.add( "description", venue->getDescription() );
    json.add( "auto_blackout", venue->getAutoBlackoutMS() );
    json.add( "audio_capture_device", venue->getAudioCaptureDevice() );
    json.add( "audio_sample_size", venue->getAudioSampleSize() );
    json.add( "audio_boost", venue->getAudioBoost() );
    json.add( "audio_boost_floor", venue->getAudioBoostFloor() );
    json.add( "track_fixtures", venue->isTrackFixtures() );

    json.startArray( "ports" );
    for ( int i=1; i <= 12; i++ ) {
        CString com_port;
        com_port.Format( "com%d", i );
        json.add( com_port );
    }
    json.endArray( "ports" );

    json.startArray("driver_types");
    json.add( "Enttec USB Pro");
    json.add( "Open DMX");
    json.add( "Philips Hue");
    json.endArray("driver_types");

    json.startArray( "universes" );
    UniversePtrArray universes = venue->getUniverses();
    for ( UniversePtrArray::iterator it=universes.begin(); it != universes.end(); ++it ) {
        Universe* universe = (*it);

        json.startObject( );
        json.add( "id", universe->getId() );
        json.add( "type", universe->getType() );
        json.add( "dmx_config", universe->getDmxConfig() );
        json.add( "packet_delay_ms", universe->getDmxPacketDelayMS() );
        json.add( "minimum_delay_ms", universe->getDmxMinimumDelayMS() );
        json.endObject( );
    }
    json.endArray( "universes" );

    json.startArray( "capture_devices" );
    for ( AudioCaptureDeviceArray::iterator it=AudioInputStream::audioCaptureDevices.begin();
            it != AudioInputStream::audioCaptureDevices.end(); ++it )
        json.add( (*it).m_friendly_name );

    json.endArray( "capture_devices" );

    json.endObject();
}
开发者ID:desantir,项目名称:DMXStudio,代码行数:53,代码来源:HttpRestVenue.cpp


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