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


C++ TEventBase::LowerBound方法代码示例

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


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

示例1: IterationInit

TDBTEventIterationHandle CEvents::IterationInit(TDBTEventIterFilter & Filter)
{
	CBlockManager::ReadTransaction trans(m_BlockManager);

	PEntityEventsRecord record = getEntityRecord(Filter.hEntity);

	if (!record)
		return DBT_INVALIDPARAM;

	std::queue<TEventBase * > q;
	q.push(record->RealTree);
	q.push(record->VirtualTree);

	TDBTEntityIterFilter f = {0,0,0,0};
	f.cbSize = sizeof(f);
	f.Options = Filter.Options;

	TDBTEntityIterationHandle citer = m_Entities.IterationInit(f, Filter.hEntity);
	if (citer != DBT_INVALIDPARAM)
	{
		m_Entities.IterationNext(citer);
		TDBTEntityHandle c = m_Entities.IterationNext(citer);
		while (c != 0)
		{
			record = getEntityRecord(c);
			if (record)
			{
				q.push(record->RealTree);
				q.push(record->VirtualTree);
			}

			c = m_Entities.IterationNext(citer);
		}

		m_Entities.IterationClose(citer);
	}

	for (unsigned j = 0; j < Filter.ExtraCount; ++j)
	{
		record = getEntityRecord(Filter.ExtraEntities[j]);
		if (record)
		{
			q.push(record->RealTree);
			q.push(record->VirtualTree);
		}
	}

	PEventIteration iter = new TEventIteration;
	iter->Filter = Filter;
	iter->LastEvent = 0;
	iter->Heap = NULL;

	TEventKey key;
	key.TimeStamp = Filter.tSince;
	key.Event = 0;

	while (!q.empty())
	{
		TEventBase * b = q.front();
		q.pop();

		TEventBase::iterator it = b->LowerBound(key);
		if (it)
		{
			TEventBase::iterator * it2 = new TEventBase::iterator(it);
			it2->setManaged();
			if (iter->Heap)
			{
				iter->Heap->Insert(*it2);
			} else {
				iter->Heap = new TEventsHeap(*it2, TEventsHeap::ITForward, true);
			}
		}
	}

	if (iter->Heap == NULL)
	{
		delete iter;
		iter = (PEventIteration)DBT_INVALIDPARAM;
	}
	
	return reinterpret_cast<TDBTEventIterationHandle>(iter);
}
开发者ID:BackupTheBerlios,项目名称:mgoodies-svn,代码行数:83,代码来源:Events.cpp


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