yat  0.8.3pre
averager_traits.h
00001 #ifndef _theplu_yat_utility_averager_traits_
00002 #define _theplu_yat_utility_averager_traits_
00003 
00004 // $Id: averager_traits.h 2119 2009-12-12 23:11:43Z peter $
00005 
00006 /*
00007   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
00008 
00009   This file is part of the yat library, http://dev.thep.lu.se/yat
00010 
00011   The yat library is free software; you can redistribute it and/or
00012   modify it under the terms of the GNU General Public License as
00013   published by the Free Software Foundation; either version 3 of the
00014   License, or (at your option) any later version.
00015 
00016   The yat library is distributed in the hope that it will be useful,
00017   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00019   General Public License for more details.
00020 
00021   You should have received a copy of the GNU General Public License
00022   along with yat. If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #include "Averager.h"
00026 #include "AveragerWeighted.h"
00027 #include "AveragerPair.h"
00028 #include "AveragerPairWeighted.h"
00029 #include "yat/utility/iterator_traits.h"
00030 
00031 namespace theplu {
00032 namespace yat {
00033 namespace statistics {
00034 
00038   template <typename T>
00039   struct averager_traits{};
00040 
00044   template <>
00045   struct averager_traits<utility::unweighted_iterator_tag> 
00046   {
00050     typedef Averager type;
00054     typedef AveragerPair pair_type;
00055   };
00056 
00060   template <>
00061   struct averager_traits<utility::weighted_iterator_tag> 
00062   {
00066     typedef AveragerWeighted type;
00070     typedef AveragerPairWeighted pair_type;
00071   };
00072 
00077   template <typename Iterator>
00078   struct averager 
00079   {
00085     typedef typename averager_traits<typename utility::weighted_iterator_traits<Iterator>::type>::type type;
00086   };
00087 
00092   template <typename Iterator1, typename Iterator2>
00093   struct averager_pair 
00094   {
00100     typedef typename 
00101       averager_traits<
00102         typename utility::weighted_if_any2<Iterator1, Iterator2>::type
00103       >::pair_type type;
00104   };
00105 
00106 }}} // of namespace statistics, yat, and theplu
00107 
00108 #endif

Generated on Thu Dec 20 2012 03:12:58 for yat by  doxygen 1.8.0-20120409