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


C++ Purge函数代码示例

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


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


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