/* * IdPool_policy.hpp * * Created on: Feb 7, 2012 * Author: heber */ #ifndef IDPOOL_POLICY_HPP_ #define IDPOOL_POLICY_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/Range.hpp" class uniqueId{ public: typedef void is_IdPool_policy; template T getNextId_impl(std::set > &pool, T&currId) { return currId++; } }; class continuousId{ public: typedef void is_IdPool_policy; template T getNextId_impl(std::set > &pool, T&currId) { // try to find an Id in the pool; if(!pool.empty()) { typename std::set >::iterator iter=pool.begin(); T id = iter->first; range newRange = makeRange(id+1,iter->last); // we wont use this iterator anymore, so we don't care about invalidating pool.erase(iter); if(newRange.first