libmoost
/home/mhx/git/github/libmoost/include/moost/algorithm/partitioner.hpp
Go to the documentation of this file.
00001 /* vim:set ts=3 sw=3 sts=3 et: */
00028 #ifndef MOOST_ALGORITHM_PARTITIONER_HPP__
00029 #define MOOST_ALGORITHM_PARTITIONER_HPP__
00030 
00031 namespace moost { namespace algorithm {
00032 
00038 template <typename T>
00039 class partitioner
00040 {
00041 private:
00042 
00043   size_t m_num_buckets;
00044 
00045 public:
00046 
00049   partitioner(size_t num_buckets)
00050   : m_num_buckets(num_buckets) {}
00051 
00052   virtual ~partitioner() {}
00053 
00056   virtual size_t partition(const T & key) const = 0;
00057 
00059   size_t num_buckets() const
00060   {
00061     return m_num_buckets;
00062   }
00063 };
00064 
00065 }} // moost::partition
00066 
00067 #endif // MOOST_ALGORITHM_PARTITIONER_HPP__