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


C++ pending_queue_t类代码示例

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


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

示例1: enqueue_ways

void output_multi_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id, size_t output_id, size_t& added) {
    //make sure we get the one passed in
    if(!ways_done_tracker->is_marked(id) && id_tracker::is_valid(id)) {
        job_queue.push(pending_job_t(id, output_id));
        added++;
    }

    //grab the first one or bail if its not valid
    osmid_t popped = ways_pending_tracker->pop_mark();
    if(!id_tracker::is_valid(popped))
        return;

    //get all the ones up to the id that was passed in
    while (popped < id) {
        if (!ways_done_tracker->is_marked(popped)) {
            job_queue.push(pending_job_t(popped, output_id));
            added++;
        }
        popped = ways_pending_tracker->pop_mark();
    }

    //make sure to get this one as well and move to the next
    if(popped == id) {
        popped = ways_pending_tracker->pop_mark();
    }
    if (!ways_done_tracker->is_marked(popped) && id_tracker::is_valid(popped)) {
        job_queue.push(pending_job_t(popped, output_id));
        added++;
    }
}
开发者ID:Kosmas,项目名称:osm2pgsql,代码行数:30,代码来源:output-multi.cpp

示例2: isRequestPending

	bool isRequestPending(const LLUUID& public_key)
	{
		bool isPending = false;
		const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;

		pending_queue_t::const_iterator it = sPendingQueue.find(public_key);

		if(it != sPendingQueue.end())
		{
			F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
			isPending = (it->second > expire_time);
		}

		return isPending;
	}
开发者ID:Belxjander,项目名称:Kirito,代码行数:15,代码来源:llexperiencecache.cpp

示例3: enqueue_ways

void output_pgsql_t::enqueue_ways(pending_queue_t &job_queue, osmid_t id, size_t output_id, size_t& added) {
    osmid_t const prev = ways_pending_tracker.last_returned();
    if (id_tracker::is_valid(prev) && prev >= id) {
        if (prev > id) {
            job_queue.push(pending_job_t(id, output_id));
        }
        // already done the job
        return;
    }

    //make sure we get the one passed in
    if(!ways_done_tracker->is_marked(id) && id_tracker::is_valid(id)) {
        job_queue.push(pending_job_t(id, output_id));
        added++;
    }

    //grab the first one or bail if its not valid
    osmid_t popped = ways_pending_tracker.pop_mark();
    if(!id_tracker::is_valid(popped))
        return;

    //get all the ones up to the id that was passed in
    while (popped < id) {
        if (!ways_done_tracker->is_marked(popped)) {
            job_queue.push(pending_job_t(popped, output_id));
            added++;
        }
        popped = ways_pending_tracker.pop_mark();
    }

    //make sure to get this one as well and move to the next
    if(popped > id) {
        if (!ways_done_tracker->is_marked(popped) && id_tracker::is_valid(popped)) {
            job_queue.push(pending_job_t(popped, output_id));
            added++;
        }
    }
}
开发者ID:openstreetmap,项目名称:osm2pgsql,代码行数:38,代码来源:output-pgsql.cpp

示例4: mapKeys

namespace LLExperienceCache
{

    typedef std::map<LLUUID, LLUUID> KeyMap;
    KeyMap privateToPublicKeyMap;

    void mapKeys(const LLSD& legacyKeys);

	std::string sLookupURL;

	typedef std::map<LLUUID, std::string> ask_queue_t;
	ask_queue_t sAskQueue;

	typedef std::map<LLUUID, F64> pending_queue_t;
	pending_queue_t sPendingQueue;

	cache_t sCache;
	int sMaximumLookups = 10;

	LLFrameTimer sRequestTimer;

	// Periodically clean out expired entries from the cache
	LLFrameTimer sEraseExpiredTimer;

	// May have multiple callbacks for a single ID, which are
	// represented as multiple slots bound to the signal.
	// Avoid copying signals via pointers.
	typedef std::map<LLUUID, callback_signal_t*> signal_map_t;
	signal_map_t sSignalMap;



	bool max_age_from_cache_control(const std::string& cache_control, S32 *max_age);
	void eraseExpired();

	void processExperience( const LLUUID& public_key, const LLSD& experience ) 
	{
		sCache[public_key]=experience;
		LLSD & row = sCache[public_key];

		if(row.has(EXPIRES))
		{
			row[EXPIRES] = row[EXPIRES].asReal() + LLFrameTimer::getTotalSeconds();
		}

		if(row.has(EXPERIENCE_ID))
		{
			sPendingQueue.erase(row[EXPERIENCE_ID].asUUID());
		}

		//signal
		signal_map_t::iterator sig_it =	sSignalMap.find(public_key);
		if (sig_it != sSignalMap.end())
		{
			callback_signal_t* signal = sig_it->second;
			(*signal)(experience);

			sSignalMap.erase(public_key);

			delete signal;
		}
	}

	void initClass( )
	{
	}

	const cache_t& getCached()
	{
		return sCache;
	}

	void setMaximumLookups( int maximumLookups)
	{
		sMaximumLookups = maximumLookups;
	}

	void bootstrap(const LLSD& legacyKeys, int initialExpiration)
	{
        mapKeys(legacyKeys);
		LLSD::array_const_iterator it = legacyKeys.beginArray();
		for(/**/; it != legacyKeys.endArray(); ++it)
		{
			LLSD experience = *it;
			if(experience.has(EXPERIENCE_ID))
			{
				if(!experience.has(EXPIRES))
				{
					experience[EXPIRES] = initialExpiration;
				}
				processExperience(experience[EXPERIENCE_ID].asUUID(), experience);
			}
			else
			{
				LL_WARNS("ExperienceCache") 
					<< "Skipping bootstrap entry which is missing " << EXPERIENCE_ID 
					<< LL_ENDL;
			}
		}		
	}
//.........这里部分代码省略.........
开发者ID:Belxjander,项目名称:Kirito,代码行数:101,代码来源:llexperiencecache.cpp

示例5: processExperience

	void processExperience( const LLUUID& public_key, const LLSD& experience ) 
	{
		sCache[public_key]=experience;
		LLSD & row = sCache[public_key];

		if(row.has(EXPIRES))
		{
			row[EXPIRES] = row[EXPIRES].asReal() + LLFrameTimer::getTotalSeconds();
		}

		if(row.has(EXPERIENCE_ID))
		{
			sPendingQueue.erase(row[EXPERIENCE_ID].asUUID());
		}

		//signal
		signal_map_t::iterator sig_it =	sSignalMap.find(public_key);
		if (sig_it != sSignalMap.end())
		{
			callback_signal_t* signal = sig_it->second;
			(*signal)(experience);

			sSignalMap.erase(public_key);

			delete signal;
		}
	}
开发者ID:Belxjander,项目名称:Kirito,代码行数:27,代码来源:llexperiencecache.cpp


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