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

C++ UtlLink类代码示例

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

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



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

示例1: take

UtlContainable* UtlHashBag::remove(const UtlContainable* object)
{
   UtlContainable* removed = NULL;

   if (object)
   {
      OsLock take(mContainerLock);

      UtlLink*  link;
      UtlChain* bucket;

      if ( lookup(object, bucket, link) )
      {
         removed = link->data;

         notifyIteratorsOfRemove(link);

         link->detachFromList(bucket);
         removed = link->data;
         link->release();

         mElements--;
      }
   }

   return removed;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:27,代码来源:UtlHashBag.cpp


示例2: index

// Return the list position of the designated object.
ssize_t UtlSList::index(const UtlContainable* containableToMatch) const
{
    ssize_t matchedIndex = UTL_NOT_FOUND;
    ssize_t currentIndex;
    UtlLink* listNode;
    UtlContainable* visitNode = NULL;

    OsLock take(mContainerLock);

    LIST_SANITY_CHECK;
    for(listNode = head(), currentIndex = 0;
        matchedIndex == UTL_NOT_FOUND && listNode;
        listNode = listNode->next()
        )
    {
        visitNode = (UtlContainable*) listNode->data;
        if(visitNode && visitNode->compareTo(containableToMatch) == 0)
        {
           matchedIndex = currentIndex;
        }
        else
        {
           currentIndex++;
        }
    }
    LIST_SANITY_CHECK;

    return matchedIndex;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:30,代码来源:UtlSList.cpp


示例3: takeContainer

// Find the next like-instance of the designated object .
UtlContainable* UtlSListIterator::findNext(const UtlContainable* containableToMatch) 
{
   UtlContainable* match = NULL;

   UtlContainer::acquireIteratorConnectionLock();
   OsLock takeContainer(mContainerRefLock);
   UtlSList* myList = static_cast<UtlSList*>(mpMyContainer);
   
   OsLock take(myList->mContainerLock);
   UtlContainer::releaseIteratorConnectionLock();

   // advance the iterator
   UtlLink* nextLink = (mpCurrentNode == NULL
                        ? myList->head()
                        : mpCurrentNode->next()
                        );

   // search for the next match forward
   while (nextLink && !match)
   {
      UtlContainable *candidate = (UtlContainable*)nextLink->data;
      if (candidate && candidate->compareTo(containableToMatch) == 0)
      {
         mpCurrentNode = nextLink;
         match = candidate;
      }
      else
      {
         nextLink = nextLink->next();
      }
   }
   
   return match;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:35,代码来源:UtlSListIterator.cpp


示例4: findNode

// Return the first UtlLink node to find.
UtlLink* UtlSortedList::findNode(UtlLink* start, MatchType match, const UtlContainable* obj) const
{
   UtlLink*        listNode;
   UtlLink*        foundNode;
   UtlContainable* listElement;
   int             comparison = 0;
   
   // the caller already holds the mContainerLock

   for (listNode = start, foundNode = NULL;
        !foundNode && listNode;
        listNode = listNode->next()
        )
   {
      listElement = (UtlContainable*)listNode->data;
      if (listElement)
      {
         // we can't use the hash as a shortcut here because we need the order too
         comparison = listElement->compareTo(obj);
         if ( comparison >= 0 )
         {
            foundNode = listNode;
         }
      }
   }

   if (foundNode && match == EXACTLY && comparison != 0) // match not exact
   {
      foundNode = NULL; 
   }
   return foundNode;
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:33,代码来源:UtlSortedList.cpp


示例5: find

// Find the first occurrence of the designated object by equality.
UtlContainable* UtlSList::find(const UtlContainable* containableToMatch) const
{
   UtlLink* listNode;
   UtlContainable* matchElement = NULL;
   UtlContainable* visitNode;

   unsigned targetHash = containableToMatch->hash();

   OsLock take(mContainerLock);

   LIST_SANITY_CHECK;
   for(listNode = head()->findNextHash(targetHash);
       listNode &&  matchElement == NULL;
       listNode = listNode->next()->findNextHash(targetHash)
       )
   {
      visitNode = (UtlContainable*) listNode->data;
      if(visitNode && visitNode->compareTo(containableToMatch) == 0)
      {
         matchElement = visitNode;
      }
   }
   LIST_SANITY_CHECK;

   return(matchElement);
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:27,代码来源:UtlSList.cpp


示例6: remove

// Remove the designated object by equality.
UtlContainable* UtlSList::remove(const UtlContainable* object)
{
   UtlLink* listNode;
   UtlLink* found;
   UtlContainable* foundObject = NULL;

   OsLock take(mContainerLock);

   LIST_SANITY_CHECK;
   for (listNode = head(), found = NULL; listNode && !found; listNode = listNode->next())
   {
      UtlContainable* visitNode = (UtlContainable*) listNode->data;
      if(visitNode && visitNode->compareTo(object) == 0)
      {
         found = listNode;
      }
   }

   if (found)
   {
      foundObject = (UtlContainable*)found->data;
      removeLink(found);
   }
   LIST_SANITY_CHECK;

   return foundObject;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:28,代码来源:UtlSList.cpp


示例7: notifyIteratorsOfRemove

void UtlHashBag::notifyIteratorsOfRemove(const UtlLink* link)
{
   UtlLink* listNode;
   UtlHashBagIterator* foundIterator;

   for (listNode = mIteratorList.head(); listNode; listNode = listNode->next())
   {
      foundIterator = (UtlHashBagIterator*)listNode->data;
      foundIterator->removing(link);
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:11,代码来源:UtlHashBag.cpp


示例8: NUM_HASHBAG_BUCKETS

/*
 * Allocate additional buckets and redistribute existing contents.
 * This should only be called through resizeIfNeededAndSafe.
 */
void UtlHashBag::resize()
{
   // already holding the mContainerLock
   UtlChain* newBucket;
   size_t    newBucketBits;

   // if an iterator had prevented resizing while many elements were added,
   // we might need to double more than once to restore the target ratio.
   for (newBucketBits = mBucketBits+1;
        mElements / NUM_HASHBAG_BUCKETS(newBucketBits) >= 3;
        newBucketBits++
        )
   {
   }

   // allocate the new buckets
   newBucket = new UtlChain[NUM_HASHBAG_BUCKETS(newBucketBits)];

   if (newBucket)
   {
      // save the old buckets until we move the entries out of them
      UtlChain* oldBucket     = mpBucket;
      size_t    numOldBuckets = numberOfBuckets();

      // put in the new buckets
      mBucketBits = newBucketBits;
      mpBucket = newBucket;

      // move all the entries to the new buckets
      size_t old;
      size_t toBeMoved;
      for (old = 0, toBeMoved = mElements;
           old < numOldBuckets && toBeMoved;
           old++
           )
      {
         while(!oldBucket[old].isUnLinked()) // old bucket is not empty yet
         {
            UtlLink* link = static_cast<UtlLink*>(oldBucket[old].head());
            link->detachFromList(&oldBucket[old]);
            insert(link, &mpBucket[bucketNumber(link->hash)]);
            toBeMoved--;
         }
      }

      delete [] oldBucket; // finished with the old empty buckets
   }
   else
   {
      assert(newBucket); // failed to allocate new buckets
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:56,代码来源:UtlHashBag.cpp


示例9: occurrencesOf

// Return the number of occurrences of the designated object.
size_t UtlSList::occurrencesOf(const UtlContainable* containableToMatch) const
{
   int count = 0;
   UtlLink* listNode;
   UtlContainable* visitNode = NULL;

   OsLock take(mContainerLock);

   LIST_SANITY_CHECK;
   for(listNode = head(); listNode; listNode = listNode->next())
   {
      visitNode = (UtlContainable*)listNode->data;
      if(visitNode && visitNode->compareTo(containableToMatch) == 0)
      {
         count++;
      }
   }
   LIST_SANITY_CHECK;

   return(count);
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:22,代码来源:UtlSList.cpp


示例10: occurrencesOf

// Return the number of occurrences of the designated object.
size_t UtlSortedList::occurrencesOf(const UtlContainable* containableToMatch) const 
{
   int count = 0;
   UtlLink* listNode;
   UtlContainable* visitNode = NULL;
   int             comparison;

   OsLock take(const_cast<OsBSem&>(mContainerLock));
   
   for (listNode = head(), comparison = 0;
        comparison <= 0 && listNode;
        listNode = listNode->next()
        )
   {
      visitNode = (UtlContainable*)listNode->data;
      if(visitNode && visitNode->compareTo(containableToMatch) == 0)
      {
         count++;
      }
   }

   return(count);
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:24,代码来源:UtlSortedList.cpp


示例11: index

// Return the list position of the designated object.
size_t UtlSortedList::index(const UtlContainable* obj) const 
{
   size_t          index = UTL_NOT_FOUND;
   size_t          thisIndex;
   UtlLink*        listNode;
   unsigned        keyHash = obj->hash();
   
   OsLock take(const_cast<OsBSem&>(mContainerLock));
   
   for (listNode = head(), thisIndex = 0;
        listNode && index == UTL_NOT_FOUND;
        listNode = listNode->next(), thisIndex++)
   {
      if (   listNode->data                      // there is an object (for safety sake)
          && listNode->hash == keyHash           // quick test for possible equality
          && listNode->data->compareTo(obj) == 0 // real (but slower) test for equality
          )
      {
         index = thisIndex;
      }
   }
    
   return index;
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:25,代码来源:UtlSortedList.cpp


示例12: take

// Insert at the designated position.
UtlContainable* UtlSList::insertAt(size_t N, UtlContainable* obj)
{
   // :NOTE: this method is deliberately not the same as g_list_insert in that
   //        the glib routine will accept a value of N > the length of the list
   //        but this routine treats that as an error.
   UtlContainable* inserted = NULL;

   OsLock take(mContainerLock);

   LIST_SANITY_CHECK;
   size_t n;
   UtlLink* link;
   for (n = 0, link = head(); link && n < N; link = link->next(), n++)
   {
   }
   if (n == N)
   {
      UtlLink::listBefore(this, link, obj);
      inserted = obj;
   }
   LIST_SANITY_CHECK;

   return inserted;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:25,代码来源:UtlSList.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ UtlMemCheck类代码示例发布时间:2022-05-31
下一篇:
C++ UtlInt类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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