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


C++ DEBUG_ASSERT函数代码示例

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


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

示例1: DEBUG_ASSERT

SINT SoundSourceWV::seekSampleFrame(SINT frameIndex) {
    DEBUG_ASSERT(isValidFrameIndex(m_curFrameIndex));

    if (frameIndex >= getMaxFrameIndex()) {
        // EOF reached
        m_curFrameIndex = getMaxFrameIndex();
        return m_curFrameIndex;
    }

    if (frameIndex == m_curFrameIndex) {
        return m_curFrameIndex;
    }

    if (WavpackSeekSample(m_wpc, frameIndex) == true) {
        m_curFrameIndex = frameIndex;
        return frameIndex;
    } else {
        kLogger.debug() << "could not seek to frame #" << frameIndex;
        return WavpackGetSampleIndex(m_wpc);
    }
}
开发者ID:PeteDevoy,项目名称:mixxx,代码行数:21,代码来源:soundsourcewv.cpp

示例2: DEBUG_ASSERT

void Foreman::initialize() {
  if (cpu_id_ >= 0) {
    // We can pin the foreman thread to a CPU if specified.
    ThreadUtil::BindToCPU(cpu_id_);
  }
  DEBUG_ASSERT(query_dag_ != nullptr);

  initializeState();

  // Collect all the workorders from all the relational operators in the DAG.
  const dag_node_index dag_size = query_dag_->size();
  for (dag_node_index index = 0; index < dag_size; ++index) {
    if (checkAllBlockingDependenciesMet(index)) {
      query_dag_->getNodePayloadMutable(index)->informAllBlockingDependenciesMet();
      processOperator(index, false);
    }
  }

  // Dispatch the WorkOrders generated so far.
  dispatchWorkerMessages(0, 0);
}
开发者ID:siddharthsmenon,项目名称:quickstep,代码行数:21,代码来源:Foreman.cpp

示例3: cbuf_write_char

size_t cbuf_write_char(cbuf_t *cbuf, char c, bool canreschedule)
{
	DEBUG_ASSERT(cbuf);

	enter_critical_section();

	size_t ret = 0;
	if (cbuf_space_avail(cbuf) > 0) {
		cbuf->buf[cbuf->head] = c;

		cbuf->head = INC_POINTER(cbuf, cbuf->head, 1);
		ret = 1;

		if (cbuf->head != cbuf->tail)
			event_signal(&cbuf->event, canreschedule);
	}

	exit_critical_section();

	return ret;
}
开发者ID:danscu,项目名称:lk,代码行数:21,代码来源:cbuf.c

示例4: DEBUG_ASSERT

// This removes |node| from the list whose first node is |list_head|.  This
// returns the new list head, or nullptr if the list has become empty.
FutexNode* FutexNode::RemoveNodeFromList(FutexNode* list_head,
                                         FutexNode* node) {
    if (node->queue_next_ == node) {
        DEBUG_ASSERT(node->queue_prev_ == node);
        // This list is a singleton, so after removing the node, the list
        // becomes empty.
        list_head = nullptr;
    } else {
        if (node == list_head) {
            // This node is the list head, so adjust the list head to be
            // the next node.
            list_head = node->queue_next_;
        }

        // Remove the node from the list.
        node->queue_next_->queue_prev_ = node->queue_prev_;
        node->queue_prev_->queue_next_ = node->queue_next_;
    }
    node->MarkAsNotInQueue();
    return list_head;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:23,代码来源:futex_node.cpp

示例5: DEBUG_ASSERT

HRESULT CUIElement::GetRoot(IUIElement** ppRoot)
{
	DEBUG_ASSERT(ppRoot) ;
	IF_RETURN(NULL == ppRoot, E_INVALIDARG) ;
	*ppRoot = NULL ;

	CComPtr<IUIElement> pParentTemp = GetEntity<IUIElement>() ;
	while (pParentTemp)
	{
		CComPtr<IUIElement> pElement ;
		pParentTemp->GetParent(&pElement) ;
		IF_BREAK(NULL == pElement) ;
		pParentTemp = pElement ;
	}

	if (pParentTemp)
	{
		return pParentTemp->QueryInterface(__uuidof(IUIElement), (VOID**)ppRoot) ;
	}
	return E_FAIL ;
}
开发者ID:jellychen,项目名称:windows_directui,代码行数:21,代码来源:CCUIElement.cpp

示例6: cbuf_write_char

size_t cbuf_write_char(cbuf_t* cbuf, char c) {
    DEBUG_ASSERT(cbuf);

    size_t ret = 0;
    {
        AutoSpinLock guard(&cbuf->lock);

        if (cbuf_space_avail(cbuf) > 0) {
            cbuf->buf[cbuf->head] = c;

            cbuf->head = inc_pointer(cbuf, cbuf->head, 1);
            ret = 1;
        }
    }

    if (ret > 0) {
        event_signal(&cbuf->event, true);
    }

    return ret;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:21,代码来源:cbuf.cpp

示例7: archi_variabledef_typecheck

archi_symtab_idlist* archi_variabledef_typecheck( archi_symtab *st, archi_ast_node *n, const char* id, archi_symtab_idlist *type_list )
{
  DEBUG_ASSERT( st && n && id && type_list ) ;

  while( type_list ){
    if( !strcmp(n->data_type, archi_symtab_idlist_id(type_list)) ){
      archi_ast_node *l = archi_symtab_lookup( st, id ) ;
      if( l != NULL ){  
        EMSG_REDECLARATION( n, id ) ;
        EMSG_PREVIOUS_DECLARATION( n, id, l->linenr ) ;
        break ;
      }
      else{ archi_symtab_insert( st, id, n ) ; break ;}    
    }
    type_list = archi_symtab_idlist_next(type_list) ;
  }

  if( !type_list ) EMSG_WRONG_TYPE( n, id, " " ) ;

  return type_list ;
}
开发者ID:phate,项目名称:Archi,代码行数:21,代码来源:typecheck.c

示例8: arm_mmu_init

void arm_mmu_init(void)
{
    /* unmap the initial mapings that are marked temporary */
    struct mmu_initial_mapping *map = mmu_initial_mappings;
    while (map->size > 0) {
        if (map->flags & MMU_INITIAL_MAPPING_TEMPORARY) {
            vaddr_t va = map->virt;
            size_t size = map->size;

            DEBUG_ASSERT(IS_SECTION_ALIGNED(size));

            while (size > 0) {
                arm_mmu_unmap_section(va);
                va += MB;
                size -= MB;
            }
        }
        map++;
    }
    arm_after_invalidate_tlb_barrier();
}
开发者ID:taphier,项目名称:lk,代码行数:21,代码来源:mmu.c

示例9: switch

std::string StageStart::GetClearAnimStr()
{
	const GameManager *pGameManager = GameRegister::GetInstance()->GetManagerGame();
	std::string retStr = "";

	switch( pGameManager->GetStageType() ){
	default:
		DEBUG_ASSERT( 0, "ゲームのクリア条件が想定外");
		break;
	case GameManager::TYPE_TIME:
		retStr = "time";
		break;
	case GameManager::TYPE_DESTROY:
		retStr = "destroy";
		break;
	case GameManager::TYPE_DESTROY_BOSS:
		retStr = "boss";
		break;
	}
	return retStr;
}
开发者ID:masarou,项目名称:2DActionSecond,代码行数:21,代码来源:FlowProcessStageStart.cpp

示例10: DEBUG_ASSERT

void Game::Start()
{
	DEBUG_ASSERT(m_CurrentScene.get() != NULL);
	
	Uint32 lastTime	= SDL_GetTicks();
	m_Quit = false;
	
	while(!m_Quit)
	{
		// CLEAR SCREEN
		m_DisplayContext.SetColor(Color::Black);
		m_DisplayContext.ClearScreen();

		// MANAGE INPUT DEVICES
		m_KeyboardDevice.Update();
		
		// MANAGE EVENTS
		ManageEvents();
		
		Uint32 currentTime = SDL_GetTicks();
		double deltaTime = (double)(currentTime - lastTime) / 1000.0;
		
		lastTime = currentTime;
		
		// MANAGE CURRENT SCENE
		m_CurrentScene->Update(deltaTime);
		m_Framerate.Update(deltaTime);
		
		// RENDER GAME OBJECTS
		m_CurrentScene->Render(&m_DisplayContext);
		m_Framerate.Render(&m_DisplayContext);
		
		// FLIP (SWAP) DISPLAY BUFFERS
		m_DisplayContext.Flip();
		
#ifdef USE_FRAMERATE_LIMITER
		m_Framerate.LimitFramerate();
#endif
	}
}
开发者ID:Fissuras,项目名称:mugenformation,代码行数:40,代码来源:Game.cpp

示例11: LTRACEF

void ProcessDispatcher::SetStateLocked(State s) {
    LTRACEF("process %p: state %u (%s)\n", this, static_cast<unsigned int>(s), StateToString(s));

    DEBUG_ASSERT(get_lock()->lock().IsHeld());

    // look for some invalid state transitions
    if (state_ == State::DEAD && s != State::DEAD) {
        panic("ProcessDispatcher::SetStateLocked invalid state transition from DEAD to !DEAD\n");
        return;
    }

    // transitions to your own state are okay
    if (s == state_)
        return;

    state_ = s;

    if (s == State::DYING) {
        // send kill to all of our threads
        KillAllThreadsLocked();
    }
}
开发者ID:saltstar,项目名称:smartnix,代码行数:22,代码来源:process_dispatcher.cpp

示例12: TrackPointer

TrackPointer BaseTrackPlayerImpl::unloadTrack() {
    if (!m_pLoadedTrack) {
        // nothing to do
        return TrackPointer();
    }

    // Save the loops that are currently set in a loop cue. If no loop cue is
    // currently on the track, then create a new one.
    double loopStart = m_pLoopInPoint->get();
    double loopEnd = m_pLoopOutPoint->get();
    if (loopStart != kNoTrigger && loopEnd != kNoTrigger && loopStart <= loopEnd) {
        CuePointer pLoopCue;
        QList<CuePointer> cuePoints(m_pLoadedTrack->getCuePoints());
        QListIterator<CuePointer> it(cuePoints);
        while (it.hasNext()) {
            CuePointer pCue(it.next());
            if (pCue->getType() == Cue::LOOP) {
                pLoopCue = pCue;
            }
        }
        if (!pLoopCue) {
            pLoopCue = m_pLoadedTrack->createAndAddCue();
            pLoopCue->setType(Cue::LOOP);
        }
        pLoopCue->setPosition(loopStart);
        pLoopCue->setLength(loopEnd - loopStart);
    }

    disconnectLoadedTrack();

    // Do not reset m_pReplayGain here, because the track might be still
    // playing and the last buffer will be processed.

    m_pPlay->set(0.0);

    TrackPointer pUnloadedTrack(std::move(m_pLoadedTrack));
    DEBUG_ASSERT(!m_pLoadedTrack);
    return pUnloadedTrack;
}
开发者ID:daschuer,项目名称:mixxx,代码行数:39,代码来源:basetrackplayer.cpp

示例13: device_init

status_t device_init(struct device *dev)
{
    if (!dev)
        return ERR_INVALID_ARGS;

    DEBUG_ASSERT(dev->driver);

    const struct driver_ops *ops = dev->driver->ops;

    if (ops && ops->init) {
        dprintf(INFO, "dev: initializing device %s:%s\n", dev->driver->type, dev->name);
        status_t err = ops->init(dev);
        if (err < 0) {
            dev->device_state = DEVICE_INITIALIZED_FAILED;
        } else {
            dev->device_state = DEVICE_INITIALIZED;
        }
        return err;
    } else {
        return ERR_NOT_SUPPORTED;
    }
}
开发者ID:littlekernel,项目名称:lk,代码行数:22,代码来源:driver.c

示例14: device

void svg_renderer::update_cache_item (const renderable_item *item, const render_cache_id &cache_id, const QTransform &transform,
                                      renderer_config &cfg, int total_x, int total_y)
{
  int block_size = rendered_items_cache::block_pixel_size ();
  SkBitmap bitmap;
  bitmap.setConfig (SkBitmap::kARGB_8888_Config, block_size * total_x, block_size * total_y);
  bitmap.allocPixels ();
  SkBitmapDevice device (bitmap);
  SkCanvas canvas (&device);
  canvas.drawColor (SK_ColorTRANSPARENT, SkXfermode::kSrc_Mode);

  QRectF local_rect = cache_id.pixel_rect (transform);
  QTransform last_inverted = transform.inverted ();
  QPointF last_pos_local = last_inverted.map (QPointF (0, 0));
  QPointF cur_pos_local = last_inverted.map (QPointF (local_rect.x (), local_rect.y ()));
  QPointF diff = -cur_pos_local + last_pos_local;

  QTransform pixmap_transform = QTransform (transform).translate (diff.x (), diff.y ());
  renderer_state state (QRect (0, 0, block_size * total_x, block_size * total_y), pixmap_transform);
  draw_item (item, canvas, state, cfg);

  if (m_queue->is_interrupted ())
    return;

  if (total_x == total_y && total_x == 1)
    m_cache->add_bitmap (cache_id, bitmap, cfg.use_new_cache ());
  else
    {
      for (int i = 0; i < total_x; i++)
        for (int j = 0; j < total_y; j++)
          {
            render_cache_id cur_id (cache_id.x () + i, cache_id.y () + j, cache_id.object_type ());
            SkBitmap bitmap_part;
            DEBUG_ASSERT (bitmap.extractSubset (&bitmap_part, SkIRect::MakeXYWH (i * block_size, j * block_size, block_size, block_size)));
            m_cache->add_bitmap (cur_id, bitmap_part, cfg.use_new_cache ());
          }
    }

}
开发者ID:telishev,项目名称:sneakPic,代码行数:39,代码来源:svg_renderer.cpp

示例15: RString

void InputHandler::Create( const RString &drivers_, vector<InputHandler *> &Add )
{
	const RString drivers = drivers_.empty()? RString(DEFAULT_INPUT_DRIVER_LIST):drivers_;
	vector<RString> DriversToTry;
	split( drivers, ",", DriversToTry, true );
	
	if( DriversToTry.empty() )
		RageException::Throw( "%s", INPUT_HANDLERS_EMPTY.GetValue().c_str() );
	
	FOREACH_CONST( RString, DriversToTry, s )
	{
		RageDriver *pDriver = InputHandler::m_pDriverList.Create( *s );
		if( pDriver == NULL )
		{
			LOG->Trace( "Unknown Input Handler name: %s", s->c_str() );
			continue;
		}

		InputHandler *ret = dynamic_cast<InputHandler *>( pDriver );
		DEBUG_ASSERT( ret );
		Add.push_back( ret );
	}
开发者ID:goofwear,项目名称:stepmania,代码行数:22,代码来源:InputHandler.cpp


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