• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IsEmpty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getNumGeometries

OGRErr OGRMultiPoint::exportToWkt( char ** ppszDstText,
                                   OGRwkbVariant eWkbVariant ) const

{
    int         nMaxString = getNumGeometries() * 22 + 128;
    int         nRetLen = 0;

/* -------------------------------------------------------------------- */
/*      Return MULTIPOINT EMPTY if we get no valid points.              */
/* -------------------------------------------------------------------- */
    if( IsEmpty() )
    {
        if( getCoordinateDimension() == 3 && eWkbVariant == wkbVariantIso )
            *ppszDstText = CPLStrdup("MULTIPOINT Z EMPTY");
        else
            *ppszDstText = CPLStrdup("MULTIPOINT EMPTY");
        return OGRERR_NONE;
    }

    *ppszDstText = (char *) VSIMalloc( nMaxString );
    if( *ppszDstText == NULL )
        return OGRERR_NOT_ENOUGH_MEMORY;

    if( getCoordinateDimension() == 3 && eWkbVariant == wkbVariantIso )
        sprintf( *ppszDstText, "%s Z (", getGeometryName() );
    else
        sprintf( *ppszDstText, "%s (", getGeometryName() );

    int bMustWriteComma = FALSE;
    for( int i = 0; i < getNumGeometries(); i++ )
    {
        OGRPoint        *poPoint = (OGRPoint *) getGeometryRef( i );

        if (poPoint->IsEmpty())
        {
            CPLDebug( "OGR", "OGRMultiPoint::exportToWkt() - skipping POINT EMPTY.");
            continue;
        }

        if( bMustWriteComma )
            strcat( *ppszDstText + nRetLen, "," );
        bMustWriteComma = TRUE;

        nRetLen += strlen(*ppszDstText + nRetLen);

        if( nMaxString < nRetLen + 100 )
        {
            nMaxString = nMaxString * 2;
            *ppszDstText = (char *) CPLRealloc(*ppszDstText,nMaxString);
        }

        if( eWkbVariant == wkbVariantIso )
        {
            strcat( *ppszDstText + nRetLen, "(" );
            nRetLen ++;
        }

        OGRMakeWktCoordinate( *ppszDstText + nRetLen,
                              poPoint->getX(), 
                              poPoint->getY(),
                              poPoint->getZ(),
                              poPoint->getCoordinateDimension() );

        if( eWkbVariant == wkbVariantIso )
        {
            strcat( *ppszDstText + nRetLen, ")" );
            nRetLen ++;
        }
    }

    strcat( *ppszDstText+nRetLen, ")" );

    return OGRERR_NONE;
}
开发者ID:drownedout,项目名称:datamap,代码行数:74,代码来源:ogrmultipoint.cpp


示例2: ConvertRect

bool
TopographyFile::Update(const WindowProjection &map_projection)
{
  if (IsEmpty())
    return false;

  if (map_projection.GetMapScale() > scale_threshold)
    /* not visible, don't update cache now */
    return false;

  const GeoBounds screenRect =
    map_projection.GetScreenBounds();
  if (cache_bounds.inside(screenRect))
    /* the cache is still fresh */
    return false;

  cache_bounds = map_projection.GetScreenBounds().scale(fixed_two);

  rectObj deg_bounds = ConvertRect(cache_bounds);

  // Test which shapes are inside the given bounds and save the
  // status to file.status
  msShapefileWhichShapes(&file, dir, deg_bounds, 0);

  // If not a single shape is inside the bounds
  if (!file.status) {
    // ... clear the whole buffer
    ClearCache();
    return false;
  }

  // Iterate through the shapefile entries
  for (int i = 0; i < file.numshapes; i++) {
    if (!msGetBit(file.status, i)) {
      // If the shape is outside the bounds
      // delete the shape from the cache
      delete shapes[i].shape;
      shapes[i].shape = NULL;
    } else if (shapes[i].shape == NULL) {
      // If the shape is inside the bounds and if the
      // shape isn't cached yet -> cache the shape
      shapes[i].shape = new XShape(&file, i, label_field);
    }
  }

  ShapeList::NotNull not_null;
  XShapePointerArray::iterator end = shapes.end(), it = shapes.begin();
  it = std::find_if(it, end, not_null);
  if (it != shapes.end()) {
    ShapeList *current = &*it;
    first = current;

    while (true) {
      ++it;
      it = std::find_if(it, end, not_null);
      if (it == end) {
        current->next = NULL;
        break;
      }

      ShapeList *next = &*it;
      current->next = next;
      current = next;
    }
  } else
    first = NULL;

  return true;
}
开发者ID:macsux,项目名称:XCSoar,代码行数:69,代码来源:TopographyFile.cpp


示例3: IsEmpty

bool MyProduceConsume::ConsumeComplete() {
    return IsEmpty() && ProduceComplete();
}
开发者ID:CharellKing,项目名称:TimePass,代码行数:3,代码来源:my_produce_consume.cpp


示例4: storage

BOOLEAN
FxEventQueue::QueueToThreadWorker(
    VOID
    )
/*++

Routine Description:
    Generic worker function which encapsulates the logic of whether to enqueue
    onto a different thread if the thread has not already been queued to.

    NOTE: this function could have been virtual, or call a virtual worker function
          once we have determined that we need to queue to a thread.  But to save
          space on vtable storage (why have one unless you really need one?),
          we rearrange the code so that the derived class calls the worker function
          and this function indicates in its return value what the caller should
          do

Arguments:
    None

Return Value:
    TRUE if the caller should queue to a thread to do the work
    FALSE if the caller shoudl not queue to a thread b/c it has already been
          queued

  --*/
{
    KIRQL irql;
    BOOLEAN result;

    Lock(&irql);

    //
    // For one reason or another, we couldn't run the state machine on this
    // thread.  So queue a work item to do it.
    //
    if (IsEmpty()) {
        //
        // There is no work to do.  This means that the caller inserted the
        // event into the queue, dropped the lock, and then another thread came
        // in and processed the event.
        //
        // This check also helps in the rundown case when the queue is closing
        // and the following happens between 2 thread:
        // #1                       #2
        // insert event
        // drop lock
        //                          process event queue
        //                          queue goes to empty, so event is set
        // try to queue work item
        //
        result = FALSE;

        DoTraceLevelMessage(
            m_PkgPnp->GetDriverGlobals(), TRACE_LEVEL_INFORMATION, TRACINGPNP,
            "WDFDEVICE 0x%p !devobj 0x%p not queueing work item to process "
            "event queue", m_PkgPnp->GetDevice()->GetHandle(),
            m_PkgPnp->GetDevice()->GetDeviceObject());
    }
    else if ((m_QueueFlags & FxEventQueueFlagWorkItemQueued) == 0x00) {
        m_QueueFlags |= FxEventQueueFlagWorkItemQueued;
        result = TRUE;
    }
    else {
        //
        // Somebody is already in the process of enqueuing the work item.
        //
        result = FALSE;
    }

    Unlock(irql);

    return result;
}
开发者ID:Archer-sys,项目名称:Windows-Driver-Frameworks,代码行数:74,代码来源:eventqueue.cpp


示例5: SeqWrap

Prefix::Prefix( const struct PROJ_DB * pDB ) : SeqWrap()
{
//#define GetDBPrefix_PRINT_DEBUG_INFO

	int i = 0;
	int j = 0;
	int JMax = 1;
	bool Inter;
	SeqWrap * aSeqWrap = NULL;
	bool PrefixIsEmpty = true;

#ifdef GetDBPrefix_PRINT_DEBUG_INFO

	Sequence * aSeq = NULL;
	Sequence * tmpSeq = NULL;
	static int Cnt = 0;

	tmpSeq = new Sequence( pDB );
	printf( "  Original Prefix %dth Record ===> ", Cnt++ );
	(*tmpSeq).Print();
	delete tmpSeq;
#endif
	
	End = NULL;
	NumOfItemSets = 0;
	//Sup = 1;
	Sup = 0; 
	if( (*pDB).m_nSup > 0 )
	{
		// Find first none empty sequence.
		for( i=0; i<(*pDB).m_nSup; i++ )
		{
			for( j=0; j < (*pDB).m_pProjSeq[i].m_nProjCount; j++ )
			{
				aSeqWrap = new SeqWrap( GetStartPtr( pDB, i, j ) );

				if( !(*aSeqWrap).IsEmpty() )
				{
					Start = (*aSeqWrap).GetFirst();
					End = GetEndPtr( Start ) - 1;
					//TrimPrefix( Start ); //Trim it with itself.
					PrefixIsEmpty = false;
					#ifdef GetDBPrefix_PRINT_DEBUG_INFO
						aSeq = new Sequence( Start, End-Start, 0, true );
						printf( "  First Prefix %dth Record ===> ", i+1 );
						if( aSeq ) (*aSeq).Print();
						printf( "    Real First Start=%d End=%d Size=%d ===> ", Start, End, End-Start );
						Print();
					#endif

					delete aSeqWrap;
					break;
				}
				delete aSeqWrap;
			}
			if( Start != End )
				break;
		}
	}

	if( Start != End )
	{
		JMax = 1;
		if( *(Start) == -1 )
			Inter = true;
		else
			Inter = false;

		//for( i++; i<(*pDB).m_nSup; i++ ) // For every seq in DB
		for( i; i<(*pDB).m_nSup; i++ ) // For every seq in DB
		{
			if( !Inter )
				JMax = (*pDB).m_pProjSeq[i].m_nProjCount;

			//JMax = 1;
			for( j=0; j < JMax; j++ )
			{
				aSeqWrap = new SeqWrap( GetStartPtr( pDB, i, j ) );

#ifdef GetDBPrefix_PRINT_DEBUG_INFO
				tmpSeq = new Sequence( (*aSeqWrap).GetFirst(), true );
				printf( "  %dth Record ===> ", i+1 );
				(*tmpSeq).Print();
				delete tmpSeq;
#endif


				if( !(*aSeqWrap).IsEmpty() )
				{
					TrimPrefix( (*aSeqWrap).GetFirst() );
					Sup++;
#ifdef GetDBPrefix_PRINT_DEBUG_INFO
					if( Start != End )
					{
						aSeq = new Sequence( Start, End-Start, 0, true );
						printf( "     ++++++++++++++++ Remaining prefix is  " );
						(*aSeq).Print();
						printf( "        +++++Real Start=%d End=%d Size=%d prefix is ", Start, End, End-Start );
						Print();
					}
//.........这里部分代码省略.........
开发者ID:Symbolk,项目名称:CloneCodeMining,代码行数:101,代码来源:SeqTree.cpp


示例6: On_edtValue_Change

void CVkWallPostForm::On_edtValue_Change(CCtrlEdit*)
{
	m_btnShare.Enable(!IsEmpty(ptrT(m_edtMsg.GetText())) || !IsEmpty(ptrT(m_edtUrl.GetText())));
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:4,代码来源:vk_dialogs.cpp


示例7: PrintResult

void PrintResult( LineData * dest_lines, int comm_size, size_t linesize )
{
    LineData *	pline;
    char	nodelist[MAXNODELIST];
    char *	pnext;
    char *	ptoken;
    int	numc;
    int	i;

    /* Look for lines that survived the merge and print them*/
    for( pline = dest_lines, i = 0; i < comm_size;
            pline += linesize, i++ ) {
        if( !IsEmpty( pline+SET ) ) {
            /* Create a compact list of nodes for this string */
            int j, start = INVALID, end, firsttime = 1;
            int hasnodepattern = 0;
            pnext = nodelist;

            for( j = 0; j < comm_size; j++ ) {
                if( CheckSet( pline+SET, j ) ) {
                    STARTRANGE(start,end,j);
                } else if ( start != INVALID ) {
                    ENDRANGE(start,end,firsttime);
                }
            }
            if( start != INVALID ) {
                ENDRANGE(start,end,firsttime);
            }

            /* Reconvert the node list substitution and the
             * literal percent patterns.
             */
            for( ptoken = strchr( pline+TEXT, PERCENTSUB );
                    ptoken != NULL;
                    ptoken = strchr( ptoken + 2, PERCENTSUB ) ) {

                if( ptoken[1] == NODESUB ) {
                    /* Only allow one copy of the pattern;
                     * otherwise, make it a percent.
                     * (because we can't pass variable
                     * number of copies of the nodelist).
                     */
                    *ptoken = '%';
                    if( !hasnodepattern ) ptoken[1] = 's';
                    else ptoken[1] = '%';
                    hasnodepattern = 1;
                } else if( ptoken[1] == PERCENTSUB ) {
                    *ptoken = ptoken[1] = '%';
                }
            }

            if( !hasnodepattern ) {
                /* Use separate printfs so the output line
                 * will be processed by print once in either
                 * case.
                 */
                printf( "%s ", nodelist );
                printf( pline+TEXT );
            } else {
                printf( pline+TEXT, nodelist );
            }
        }
    }
}
开发者ID:Vbif,项目名称:mpi-ppf,代码行数:64,代码来源:PPF_Print.c


示例8: Pop

void Pop( Stack S ) {
    if (IsEmpty(S))
        Error("Stack is empty!");
    else
        --S->TopOfStack;
}
开发者ID:HeliZhu,项目名称:Workspaces,代码行数:6,代码来源:stackar.c


示例9: NS_PRECONDITION

nsresult
nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
                                  JSObject* aBoundNode,
                                  nsIURI* aBindingDocURI,
                                  bool* aDidInstall) const
{
  NS_PRECONDITION(aBoundNode,
                  "uh-oh, bound node should NOT be null or bad things will "
                  "happen");

  *aDidInstall = false;

  // Empty fields are treated as not actually present.
  if (IsEmpty()) {
    return NS_OK;
  }

  nsAutoMicroTask mt;

  // EvaluateString and JS_DefineUCProperty can both trigger GC, so
  // protect |result| here.
  nsresult rv;

  nsAutoCString uriSpec;
  aBindingDocURI->GetSpec(uriSpec);
  
  JSContext* cx = aContext->GetNativeContext();
  NS_ASSERTION(!::JS_IsExceptionPending(cx),
               "Shouldn't get here when an exception is pending!");
  
  // compile the literal string
  nsCOMPtr<nsIScriptContext> context = aContext;

  JSAutoRequest ar(cx);
  jsval result = JSVAL_NULL;

  JS::CompileOptions options(cx);
  options.setFileAndLine(uriSpec.get(), mLineNumber)
         .setVersion(JSVERSION_LATEST)
         .setUserBit(true); // Flag us as XBL
  rv = context->EvaluateString(nsDependentString(mFieldText,
                                                 mFieldTextLength),
                               *aBoundNode, options,
                               /* aCoerceToString = */ false,
                               &result);
  if (NS_FAILED(rv)) {
    return rv;
  }


  // Define the evaluated result as a JS property
  nsDependentString name(mName);
  if (!::JS_DefineUCProperty(cx, aBoundNode,
                             reinterpret_cast<const jschar*>(mName), 
                             name.Length(), result, nullptr, nullptr,
                             mJSAttributes)) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  *aDidInstall = true;
  return NS_OK;
}
开发者ID:bbondy,项目名称:mozilla-central,代码行数:62,代码来源:nsXBLProtoImplField.cpp


示例10:

SqlSet& SqlSet::Cat(const SqlVal& val) {
	if(!IsEmpty()) text.Cat(", ");
	text.Cat(~val);
	priority = SET;
	return *this;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:6,代码来源:SqlSet.cpp


示例11: CHECK_ERROR

result_t JSHandler::invoke(object_base *v, obj_ptr<Handler_base> &retVal,
                           AsyncEvent *ac)
{
    if (ac)
        return CHECK_ERROR(CALL_E_NOASYNC);

    v8::Local<v8::Object> o = v->wrap();
    Isolate* isolate = holder();

    obj_ptr<Message_base> msg = Message_base::getInstance(v);
    v8::Local<v8::Value> a = v8::Local<v8::Value>::New(isolate->m_isolate, o);
    v8::Local<v8::Value> hdlr = GetPrivate("handler");

    while (true)
    {
        v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(hdlr);
        obj_ptr<List_base> params;
        std::vector<v8::Local<v8::Value> > argv;
        v8::Local<v8::Value> *pargv;
        int32_t len = 0, i;

        if (msg != NULL)
        {
            msg->get_params(params);
            params->get_length(len);
        }

        if (len > 0)
        {
            argv.resize(len + 1);
            argv[0] = a;

            for (i = 0; i < len; i++)
            {
                Variant v;
                params->_indexed_getter(i, v);
                argv[i + 1] = v;
            }

            pargv = argv.data();
        }
        else
            pargv = &a;

        {
            TryCatch try_catch;
            hdlr = func->Call(v8::Undefined(isolate->m_isolate), len + 1, pargv);
            if (try_catch.HasCaught())
            {
                v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
                        isolate->m_isolate, 1, v8::StackTrace::kScriptId);
                if (stackTrace->GetFrameCount() > 0)
                {
                    try_catch.ReThrow();
                    return CALL_E_JAVASCRIPT;
                }
                else
                    return CHECK_ERROR(Runtime::setError(GetException(try_catch, 0)));
            }
        }

        if (IsEmpty (hdlr))
            return CALL_RETURN_NULL;

        if (!hdlr->IsFunction())
        {
            if (hdlr->IsObject())
                return JSHandler::New(hdlr, retVal);

            msg->set_result(hdlr);
            return CALL_RETURN_NULL;
        }
    }

    return 0;
}
开发者ID:ngot,项目名称:fibjs,代码行数:76,代码来源:JSHandler.cpp


示例12: operator

String SqlSet::operator()(int at) const {
	if(IsEmpty()) return "null";
	return at > priority ? '(' + text + ')' : text;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:4,代码来源:SqlSet.cpp


示例13: RenderDebug

void Chunk::RenderDebug()
{
	float l_length = (Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE) - 0.05f;
	float l_height = (Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE) - 0.05f;
	float l_width = (Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE) - 0.05f;

	m_pRenderer->SetRenderMode(RM_WIREFRAME);
	m_pRenderer->SetCullMode(CM_NOCULL);
	m_pRenderer->SetLineWidth(1.0f);

	m_pRenderer->PushMatrix();
		m_pRenderer->TranslateWorldMatrix(m_position.x, m_position.y, m_position.z);
		m_pRenderer->TranslateWorldMatrix(Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE, Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE, Chunk::CHUNK_SIZE*Chunk::BLOCK_RENDER_SIZE);
		m_pRenderer->TranslateWorldMatrix(-Chunk::BLOCK_RENDER_SIZE, -Chunk::BLOCK_RENDER_SIZE, -Chunk::BLOCK_RENDER_SIZE);

		m_pRenderer->ImmediateColourAlpha(1.0f, 1.0f, 0.0f, 1.0f);
		if (IsEmpty())
		{
			m_pRenderer->ImmediateColourAlpha(1.0f, 0.0f, 0.0f, 1.0f);
		}
		else if (IsSurrounded())
		{
			m_pRenderer->ImmediateColourAlpha(0.0f, 1.0f, 1.0f, 1.0f);
		}

		m_pRenderer->EnableImmediateMode(IM_QUADS);
			m_pRenderer->ImmediateNormal(0.0f, 0.0f, -1.0f);
			m_pRenderer->ImmediateVertex(l_length, -l_height, -l_width);
			m_pRenderer->ImmediateVertex(-l_length, -l_height, -l_width);
			m_pRenderer->ImmediateVertex(-l_length, l_height, -l_width);
			m_pRenderer->ImmediateVertex(l_length, l_height, -l_width);

			m_pRenderer->ImmediateNormal(0.0f, 0.0f, 1.0f);
			m_pRenderer->ImmediateVertex(-l_length, -l_height, l_width);
			m_pRenderer->ImmediateVertex(l_length, -l_height, l_width);
			m_pRenderer->ImmediateVertex(l_length, l_height, l_width);
			m_pRenderer->ImmediateVertex(-l_length, l_height, l_width);

			m_pRenderer->ImmediateNormal(1.0f, 0.0f, 0.0f);
			m_pRenderer->ImmediateVertex(l_length, -l_height, l_width);
			m_pRenderer->ImmediateVertex(l_length, -l_height, -l_width);
			m_pRenderer->ImmediateVertex(l_length, l_height, -l_width);
			m_pRenderer->ImmediateVertex(l_length, l_height, l_width);

			m_pRenderer->ImmediateNormal(-1.0f, 0.0f, 0.0f);
			m_pRenderer->ImmediateVertex(-l_length, -l_height, -l_width);
			m_pRenderer->ImmediateVertex(-l_length, -l_height, l_width);
			m_pRenderer->ImmediateVertex(-l_length, l_height, l_width);
			m_pRenderer->ImmediateVertex(-l_length, l_height, -l_width);

			m_pRenderer->ImmediateNormal(0.0f, -1.0f, 0.0f);
			m_pRenderer->ImmediateVertex(-l_length, -l_height, -l_width);
			m_pRenderer->ImmediateVertex(l_length, -l_height, -l_width);
			m_pRenderer->ImmediateVertex(l_length, -l_height, l_width);
			m_pRenderer->ImmediateVertex(-l_length, -l_height, l_width);

			m_pRenderer->ImmediateNormal(0.0f, 1.0f, 0.0f);
			m_pRenderer->ImmediateVertex(l_length, l_height, -l_width);
			m_pRenderer->ImmediateVertex(-l_length, l_height, -l_width);
			m_pRenderer->ImmediateVertex(-l_length, l_height, l_width);
			m_pRenderer->ImmediateVertex(l_length, l_height, l_width);
		m_pRenderer->DisableImmediateMode();
	m_pRenderer->PopMatrix();

	m_pRenderer->SetCullMode(CM_BACK);
}
开发者ID:CodeMason,项目名称:Vox,代码行数:66,代码来源:Chunk.cpp


示例14: OnClearUI

void NewBuildTab::OnClearUI(wxUpdateUIEvent& e) { e.Enable(!m_buildInProgress && !IsEmpty()); }
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:1,代码来源:new_build_tab.cpp


示例15: checkEmpty

int checkEmpty(finsQueue Q) {
	return (IsEmpty(Q));
}
开发者ID:c-ong,项目名称:FINS-Framework,代码行数:3,代码来源:finsqueue.c


示例16: locker

BOOLEAN KBinaryTree::Delete(VOID* data, ULONG dwCompareParam)
{
  BOOLEAN     bRet = FALSE;
  KBinaryTreeNode* item;
  KBinaryTreeNode* startitem;
  KBinaryTreeNode* y;
  KBinaryTreeNode* z;
  KLocker locker(&m_KSynchroObject);


  if (!IsEmpty())
  {
    item = m_pRootTree->SearchByNode(data, m_pCompare, dwCompareParam);
    if (item != NULL)
    {
      // if we want to delete the root item, we have to do some extra
      // operation the preserve some pointers...
      if (item == m_pRootTree)
      {
        // the root is the only one node in the tree
        if (item->m_pLeft == NULL && item->m_pRight == NULL)
        {
          delete m_pRootTree;
          m_pRootTree = NULL;
          return TRUE;
        }
      }

      // start node for restructuration
      startitem = NULL;
      // node to delete has no children
      if (item->m_pLeft == NULL && item->m_pRight == NULL)
      {
        if (item->IsLeftSibling())
          item->m_pParent->m_pLeft = NULL;
        else
          item->m_pParent->m_pRight = NULL;
        startitem = item->m_pParent;
        delete item;
        item = NULL;
      }
      // node to delete has only right son
      if (item != NULL && item->m_pLeft == NULL && item->m_pRight != NULL)
      {
        item->m_pData = item->m_pRight->m_pData;
        item->m_pRight->m_pData = NULL;

        delete item->m_pRight;

        item->m_pRight = NULL;
        startitem = item;
      }
      // node to delete has only left son
      if (item != NULL && item->m_pLeft != NULL && item->m_pRight == NULL)
      {
        item->m_pData = item->m_pLeft->m_pData;
        item->m_pLeft->m_pData = NULL;

        delete item->m_pLeft;

        item->m_pLeft = NULL;
        startitem = item;
      }
      // node to delete has both sons
      if (item != NULL && item->m_pLeft != NULL && item->m_pRight != NULL)
      {
        y = item->m_pLeft->GetLastNodeInOrder();
        z = y->m_pLeft;

        item->m_pData = y->m_pData;
        y->m_pData = NULL;
        /*
        if (y->IsLeftSibling())
            y->Parent->Left = z;
        else
            y->Parent->Right = z;
        */
        if (z != NULL)
        {
          y->m_pData = z->m_pData;
          z->m_pData = NULL;
          y->m_pLeft = NULL;
          delete z;
          startitem = y;
        }
        else
        {
          if (y->IsLeftSibling())
             y->m_pParent->m_pLeft = NULL;
          else
             y->m_pParent->m_pRight = NULL;
          startitem = y->m_pParent;
          delete y;
        }
      }

      if (startitem != NULL)
        startitem->RestructureDelete();

      m_pRootTree = m_pRootTree->GetRootByNode();
//.........这里部分代码省略.........
开发者ID:Artorios,项目名称:rootkit.com,代码行数:101,代码来源:KBinaryTree.cpp


示例17: PrintReduceOp

void PrintReduceOp(	void *		invec,
                    void *		inoutvec,
                    int *		len,
                    MPI_Datatype *	datatype )
{
    LineData *	src_data =
        (LineData *)((char*)invec + 2 * sizeof(int));
    LineData *	dest_data =
        (LineData *)((char*)inoutvec + 2 * sizeof(int));
    LineData *	psrcline, * pdestline;
    int		i, j;
    int		count = ((int *)invec)[0];
    int		linesize = ((int *)invec)[1];

    datatype = datatype;
    len = len;

    /* Run through each (valid) entry in dest_data and compare it with
     * each valid entry in src_data.
     */

    for( pdestline = dest_data, i = 0; i < count;
            pdestline += linesize, i++ ) {

        /* An empty set indicates that the string is blank; skip it */
        if( IsEmpty( pdestline+SET ) ) continue;

        /* We have a valid string; compare it with each of the
         * strings in the incoming vector.
         */
        for( psrcline = src_data, j = 0; j < count;
                psrcline += linesize, j++ ) {

            /* Skip blank entries */
            if( IsEmpty( psrcline+SET ) ) continue;

            /* If they match, remove this string (because it
             * won't match any other entries), and mark the
             * nodes where it appeared.  Once we've found a
             * match to this dest string, there won't be any
             * more in the source array because it should
             * contain only one copy of each string, so we
             * can quit this inner loop after the first match.
             */
            if( strcmp( pdestline+TEXT, psrcline+TEXT ) == 0 ) {
                UnionSet( pdestline+SET, psrcline+SET );
                ClearSet( psrcline+SET );
                /* We want to put the result in the
                 * lowest-numbered position in the destination
                 * array so items will come out in the order
                 * of the lowest-numbered node in the set when
                 * we print the sets out.
                 */
                if( j < i ) {
                    /* Move to lower-numbered position */
                    LineData * lower
                        = dest_data + (j * linesize);
                    UnionSet( lower+SET, pdestline+SET );
                    ClearSet( pdestline+SET );
                    strcpy( lower+TEXT, pdestline+TEXT );
                }
                break;
            }
        }
    }

    /* All the matching strings should now be copied into the source.
     * Those remaining are unique, so we can copy them all into the
     * dest array.  Since each node sends only one string, there's no
     * danger of overwriting an entry in dest when we copy an entry
     * from source.
     */

    for( pdestline = dest_data, psrcline = src_data, i = 0; i < count;
            pdestline += linesize,
            psrcline += linesize, i++ ) {

        /* If we find a string whose entry hasn't been cleared,
         * copy it and its list of nodes.
         */
        if( !IsEmpty( psrcline+SET ) ) {
            UnionSet( pdestline+SET, psrcline+SET );
            strcpy( pdestline+TEXT, psrcline+TEXT );
        }
    }

}
开发者ID:Vbif,项目名称:mpi-ppf,代码行数:87,代码来源:PPF_Print.c


示例18: OVR_ASSERT

 ~CircularBuffer()
 {
     // For ThreadCommands, we must consume everything before shutdown.
     OVR_ASSERT(IsEmpty());
     OVR_FREE_ALIGNED(pBuffer);
 }
开发者ID:123woodman,项目名称:minko,代码行数:6,代码来源:OVR_ThreadCommandQueue.cpp


示例19: main

int main()
{
	/*kamus*/
	Queue Q;
	int n,n2,i;
	int t = 0; // waktu masukan
	int pret = 0; // waktu sebelum t. cek pret<=t
	int tclose; // waktu tutup
	int visitor = 0;
	float srvtime = 0; // total waktu pelayanan
	float que = 0; // total antrian*waktu
	char input[6];
	boolean close;
	/*algoritma*/
	printf("Ukuran Queue : ");
	scanf("%d",&n);
	CreateEmpty(&Q,n);
	close = false;
	do {
		printf("Masukkan perintah: ");
		scanf("%d%s",&t,input);
		if(t<pret) printf("Waktu yang dimasukkan tidak valid, seharusnya >= %d\n",pret);
		else {
			switch(input[0]) {
				case 'a' : 
							if(IsFull(Q)) printf("Queue penuh, tidak bisa menerima pengunjung baru\n");
							else {
								que+=NBElmt(Q)*(t-pret);
								Add(&Q,t);
								printf("Q = ");
								PrintQueue(Q);
							}
							break;
				case 'c' :
							close = true;
							tclose = t;
							if (IsEmpty(Q)) 
								printf("Bank tutup, tidak ada pengunjung tersisa\n");
							else printf("Bank tutup, masih ada %d pengunjung tersisa\n",NBElmt(Q));
							break;
				case 'd' :
							if(IsEmpty(Q))
								printf("Queue kosong, tidak ada pengunjung yang akan dilayani\n");
							else {
								visitor++;
								Del(&Q,&n);
								if(!close) que+=NBElmt(Q)*(t-pret);
								printf("waktu kedatangan = %d, waktu tunggu = %d, Q = ",n,t-n);
								PrintQueue(Q);
								srvtime += t-n;
							}
			}
			pret=t;
		}
	}while(!close || !IsEmpty(Q));

	printf("\nBank tutup pada t = %d, layanan selesai pada t = %d\n",tclose,t);
	if(visitor) {
		printf("Jumlah pengunjung dilayani: %d orang\n",visitor);
		printf("Waktu tunggu rata-rata: %.0f satuan waktu\n",srvtime/visitor);
		printf("Panjang antrian rata-rata: %.3f orang\n",que/tclose);
	} else printf("Tidak ada pengunjung yang dilayani\n");
	
	return 0;	
}
开发者ID:miftahulmahfuzh,项目名称:ADT,代码行数:65,代码来源:mqueue.c


示例20: Consume

void MyProduceConsume::Consume() {
    if (!IsEmpty()) {
        printf("pop %d\n", Front());
        Pop();
    }
}
开发者ID:CharellKing,项目名称:TimePass,代码行数:6,代码来源:my_produce_consume.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IsEnabled函数代码示例发布时间:2022-05-30
下一篇:
C++ IsEffectInSpell函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap