本文整理汇总了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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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 ;
}
示例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;
}
示例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 ;
}
示例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();
}
示例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;
}
示例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
}
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例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 ());
}
}
}
示例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 );
}