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

C++ Purge函数代码示例

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

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



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

示例1: create_link_list_from_string

static char *test_purge()
{
    LinkList l;
    char *ans;

    l = create_link_list_from_string("abc");
    Purge(&l);
    ans = link_list_to_string(l);
    mu_assert("purege 1", strcmp(ans, "abc") == 0);

    free(ans);
    destory_link_list(l);
    
    l = create_link_list_from_string("aaabbbcccc");
    Purge(&l);
    ans = link_list_to_string(l);
    mu_assert("purege 2", strcmp(ans, "abc") == 0);

    free(ans);
    destory_link_list(l);
    
    l = create_link_list_from_string("abcabc");
    Purge(&l);
    ans = link_list_to_string(l);
    mu_assert("purege 3", strcmp(ans, "abc") == 0);

    free(ans);
    destory_link_list(l);

    return 0;
}
开发者ID:bcho,项目名称:homework,代码行数:31,代码来源:test.c


示例2: Purge

void freettcn::TM::CTestManagement::Clear()
{
    Purge(_modParList);
    Purge(_tcList);

    _status = NOT_RUNNING;
}
开发者ID:mpusz,项目名称:FreeTTCN,代码行数:7,代码来源:tm.cpp


示例3: NS_LOG_FUNCTION

bool
PacketQueue::Enqueue (QueueEntry & entry)
{
  NS_LOG_FUNCTION ("Enqueing packet destined for" << entry.GetIpv4Header ().GetDestination ());
  Purge ();
  uint32_t numPacketswithdst;
  for (std::vector<QueueEntry>::const_iterator i = m_queue.begin (); i
       != m_queue.end (); ++i)
    {
      if ((i->GetPacket ()->GetUid () == entry.GetPacket ()->GetUid ())
          && (i->GetIpv4Header ().GetDestination ()
              == entry.GetIpv4Header ().GetDestination ()))
        {
          return false;
        }
    }
  numPacketswithdst = GetCountForPacketsWithDst (entry.GetIpv4Header ().GetDestination ());
  NS_LOG_DEBUG ("Number of packets with this destination: " << numPacketswithdst);
  /** For Brock Paper comparision*/
  if (numPacketswithdst >= m_maxLenPerDst || m_queue.size () >= m_maxLen)
    {
      NS_LOG_DEBUG ("Max packets reached for this destination. Not queuing any further packets");
      return false;
    }
  else
    {
      // NS_LOG_DEBUG("Packet size while enqueing "<<entry.GetPacket()->GetSize());
      entry.SetExpireTime (m_queueTimeout);
      m_queue.push_back (entry);
      return true;
    }
}
开发者ID:shuiziliuBUPT,项目名称:HelloWorld,代码行数:32,代码来源:dsdv-packet-queue.cpp


示例4: myLock

void Controller::GetUpdate()
{
	MMThreadGuard myLock(lock_);
	{
		string propName;

		Purge();
		Send("CSS?");
		do {
			ReceiveOneLine();
		} while (0 != buf_string_.compare(0, 3, "CSS", 0, 3));

		globalState_ = false;

		//Record intensities and first LED on
		for (unsigned int i = 0; i < 3; i++) {
			//Read the intensity
			channelIntensities_[i] = atol(buf_string_.substr(6 + i * 6, 3).c_str());
			string t = buf_string_.substr(4 + i * 6, 1);
			channelSelection_[i] = buf_string_.substr(4 + i * 6, 1) == "S" ? 1 : 0;
			propName = g_Keyword_Intensity;
			propName.push_back('A' + (char)i);
			intensityUpdated_[i] = true;;
			UpdateProperty(propName.c_str());

			propName = g_Keyword_Selection;
			propName.push_back('A' + (char)i);
			selectionUpdated_[i] = true;
			UpdateProperty(propName.c_str());

			globalState_ |= buf_string_.substr(5 + i * 6, 1) == "N";
			globalStateUpdated_ = true;
		}
	}
}
开发者ID:csachs,项目名称:micro-manager,代码行数:35,代码来源:pE300.cpp


示例5: assert

void Chunk::Free(void* ptr) {
  assert(is_chunk(ptr));
  assert(ptr_to_chunk(ptr) == this);

  unsigned int n = ptr_to_n(ptr);
  unsigned int i = n / 32;
  unsigned int bit = n % 32;

  assert(i < arraysize(free_bitmap_));
  assert(!(free_bitmap_[i] & (1U << bit)));
  free_bitmap_[i] |= 1U << bit;
  free_count_++;

  if (i < first_free_bitmap_) {
    first_free_bitmap_ = i;
  }

  if (free_count_ == 1) {
    heap_->MoveToFreeList(this, bucket_);
  } else {
    // TODO(ccross): move down free list if necessary
  }

  if (frees_since_purge_++ * allocation_size_ > 16 * kPageSize) {
    Purge();
  }
}
开发者ID:JustAkan,项目名称:android_system_core,代码行数:27,代码来源:Allocator.cpp


示例6: Element

inline void CUtlVector<T, A>::PurgeAndDeleteElements()
{
    for(int i = 0; i < m_Size; i++) {
        delete Element(i);
    }
    Purge();
}
开发者ID:GodLS,项目名称:math-homework,代码行数:7,代码来源:UtlVector.hpp


示例7: Purge

Texture*									ImageManager::LoadImage								(const std::string& aName, const std::string& aPath)
{
    if(!Utility::FileExists(aPath))
    {
        return 0;
    }

//HACK: Don't allow more than 100 images, make a less nuclear pruning routine!
    if(Images.size() >= 100)
    {
        Purge();
    }

    if(Images.find(aName) == Images.end())
    {
        Texture* output;

        ESSUB_LoadPNG(aPath, &output);

        if(output)
        {
            output->SetFilter(true);
            Images[aName] = output;
        }
    }

    return Images[aName];
}
开发者ID:kozarovv,项目名称:mednafen-ps3,代码行数:28,代码来源:ImageManager.cpp


示例8: Purge

int Controller::ReadChannelLabels()
{
   buf_tokens_.clear();
   string label;

   Purge();
   Send("LAMS");
   do {
      ReceiveOneLine();
      buf_tokens_.push_back(buf_string_);
   }
      while(! buf_string_.empty());
   
   
   for (unsigned int i=0;i<buf_tokens_.size();i++)
   {
      if (buf_tokens_[i].substr(0,3).compare("LAM")==0) {
         channelLetters_.push_back(buf_tokens_[i][4]); // Read 4th character
         string label = buf_tokens_[i].substr(6);
         StripString(label);
         channelLabels_.push_back(label);
      }
   }

   if (channelLabels_.size() == 0)
	   return DEVICE_ERR;
   else
	   return DEVICE_OK;
}
开发者ID:ckc7,项目名称:micromanager2,代码行数:29,代码来源:PrecisExcite.cpp


示例9: Purge

SmartPointer<RegistryObject> RegistryObjectReferenceMap::Get(int key) const
{
  Purge();
  ReferenceMapType::const_iterator entry = references.find(key);
  if (entry != references.end()) return entry.value()->GetValue();
  return RegistryObject::Pointer();
}
开发者ID:151706061,项目名称:MITK,代码行数:7,代码来源:berryRegistryObjectReferenceMap.cpp


示例10: if

int Controller::OnChannelWave(MM::PropertyBase* pProp, MM::ActionType eAct, long channel)
{
	string wavelength;

	if (eAct == MM::BeforeGet && waveUpdated_[channel]) {
		pProp->Set(channelWave_[channel].c_str());
		waveUpdated_[channel] = false;
	}
	else if (eAct == MM::AfterSet)
	{
		pProp->Get(wavelength);
		//LOAD:<wavelength> loads that particular wavelength in the channel
		stringstream msg;
		msg << "LOAD:" << wavelength;

		MMThreadGuard myLock(lock_);
		Purge();
		Send(msg.str());
		do {
			ReceiveOneLine();
		} while (buf_string_.size() == 0);
	}

	return HandleErrors();
}
开发者ID:csachs,项目名称:micro-manager,代码行数:25,代码来源:pE4000.cpp


示例11: NN_ASSERT

//============================================================================
//		NCache::SetValue : Set a value.
//----------------------------------------------------------------------------
void NCache::SetValue(const NCacheKey &theKey, NCacheValue *theValue)
{


	// Validate our parameters
	NN_ASSERT(theValue->GetCost() >= 0);



	// Prepare to set
	if (HasKey(theKey))
		RemoveKey(theKey);

	if (NeedsPurge())
		Purge();



	// Set the value
	mCache[theKey] = theValue;
	mCacheCost    += theValue->GetCost();

	theValue->SetAccessTime();
	theValue->Retain();
}
开发者ID:refnum,项目名称:nano,代码行数:28,代码来源:NCache.cpp


示例12: Purge

void freettcn::TE::CModule::Cleanup()
{
  Purge(_parameterArray);
  Purge(_allEntityStates);
  Purge(_behaviorList);
  Purge(_testCaseArray);
  Purge(_portTypeArray);
  
  if (_ctrlSrcData)
    delete _ctrlSrcData;
  
  // delete temporary variables
  if (__modParList)
    delete[] __modParList;
  if (__testCaseIdList)
    delete[] __testCaseIdList;
}
开发者ID:mpusz,项目名称:FreeTTCN,代码行数:17,代码来源:module.cpp


示例13: Assert

	void Texture::SetExternalMemory( void* pMemory )
	{
		Assert( pMemory && "nullptr external memory" );

		Purge();

		AddFlags( FL_EXTERNAL_MEMORY );
		m_pMemory = pMemory;
	}
开发者ID:kihx,项目名称:rasterizer,代码行数:9,代码来源:texture.cpp


示例14: while

BabelGlue::~BabelGlue()
{
	if(m_thread.GetActive()==true)
		m_thread.Close(false);
	
	/* might take a while to shutdown */
	while(m_asyncactive)
		kGUI::Sleep(1);
	Purge();
}
开发者ID:neolu,项目名称:gpsturbo,代码行数:10,代码来源:babelglue.cpp


示例15: Assert

void CUtlMemoryBase::Purge( int numElements, bool bRealloc )
{
	Assert( numElements >= 0 );

	if( numElements > m_nAllocationCount )
	{
		// Ensure this isn't a grow request in disguise.
		Assert( numElements <= m_nAllocationCount );
		return;
	}

	// If we have zero elements, simply do a purge:
	if( numElements == 0 )
	{
		Purge();
		return;
	}

	if ( IsExternallyAllocated() )
	{
		// Can't shrink a buffer whose memory was externally allocated, fail silently like purge 
		return;
	}

	// If the number of elements is the same as the allocation count, we are done.
	if( numElements == m_nAllocationCount )
	{
		return;
	}

	if( !m_pMemory )
	{
		// Allocation count is non zero, but memory is null.
		Assert( m_pMemory );
		return;
	}

	if ( bRealloc )
	{
		UTLMEMORY_TRACK_FREE();

		m_nAllocationCount = numElements;

		UTLMEMORY_TRACK_ALLOC();

		// Allocation count > 0, shrink it down.
		MEM_ALLOC_CREDIT_CLASS();
		m_pMemory = PvRealloc( m_pMemory, m_nAllocationCount * m_unSizeOfElements );
	}
	else
	{
		// Some of the tracking may be wrong as we are changing the size but are not reallocating.
		m_nAllocationCount = numElements;
	}
}
开发者ID:msinilo,项目名称:GameNetworkingSockets,代码行数:55,代码来源:utlmemory.cpp


示例16: Purge

void CUtlMemoryBase::SetExternalBuffer( const void* pMemory, int numElements )
{
	// Blow away any existing allocated memory
	Purge();

	m_pMemory = const_cast<void*>( pMemory );
	m_nAllocationCount = numElements;

	// Indicate that we don't own the memory
	m_nGrowSize = EXTERNAL_CONST_BUFFER_MARKER;
}
开发者ID:msinilo,项目名称:GameNetworkingSockets,代码行数:11,代码来源:utlmemory.cpp


示例17: Purge

DisplayError ResourceDefault::UnregisterDisplay(Handle display_ctx) {
  DisplayResourceContext *display_resource_ctx =
                          reinterpret_cast<DisplayResourceContext *>(display_ctx);
  Purge(display_ctx);

  hw_block_ctx_[display_resource_ctx->hw_block_id].is_in_use = false;

  delete display_resource_ctx;

  return kErrorNone;
}
开发者ID:MIPS,项目名称:hardware-qcom-display,代码行数:11,代码来源:resource_default.cpp


示例18: Purge

TriStatus freettcn::PA::CPlatformAdaptor::Reset()
{
  // stop all timers
  for(CTimerList::const_iterator it=_timerList.begin(); it!=_timerList.end(); ++it)
    if ((*it)->Running())
      (*it)->Stop();
  
  // clear timers list
  Purge(_timerList);
  
  return TRI_OK;
}
开发者ID:mpusz,项目名称:FreeTTCN,代码行数:12,代码来源:pa.cpp


示例19: string

void Controller::SetIntensity(long intensity, long index)
{
	stringstream msg;
	msg << "C" << string(1, 'A' + (char)index) << "I" << intensity;

	{
		MMThreadGuard myLock(lock_);
		Purge();
		Send(msg.str());
		ReceiveOneLine();
	}
}
开发者ID:csachs,项目名称:micro-manager,代码行数:12,代码来源:pE300.cpp


示例20: CPropertyAction

/////////////////////////////////////////////
// Property Generators
/////////////////////////////////////////////
void Controller::GeneratePropertyLockPod()
{
	CPropertyAction* pAct = new CPropertyAction(this, &Controller::OnLockPod);
	CreateProperty(g_Keyword_PodLock, "0", MM::Integer, false, pAct);
	AddAllowedValue(g_Keyword_PodLock, "0");
	AddAllowedValue(g_Keyword_PodLock, "1");

	MMThreadGuard myLock(lock_);
	Purge();
	Send("PORT:P=ON");
	ReceiveOneLine();
}
开发者ID:csachs,项目名称:micro-manager,代码行数:15,代码来源:pE300.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PushActiveSnapshot函数代码示例发布时间:2022-05-30
下一篇:
C++ PulseEvent函数代码示例发布时间: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