00001 #ifndef _General_H
00002 #define _General_H 1
00003 #include <functional>
00004 namespace General{
00005
00006
00007 template <class TYPE>
00008 class sum_sqr
00009 : public std::binary_function<TYPE,TYPE, TYPE>{
00010 public:
00011
00012 inline TYPE operator() ( TYPE& s2 , TYPE obj ) const {
00013 return s2+= obj*obj;};
00014
00015 };
00016
00017 template <class TYPE, int tSize = 32>
00018 class sum_sqr_div32
00019 : public std::binary_function<TYPE,TYPE, TYPE>{
00020 public:
00021
00022 inline TYPE operator() ( TYPE& s2 , TYPE obj ) const {
00023 return s2+= obj*(obj/TYPE(tSize));}
00024
00025 };
00026
00027 template <class TYPE, int tSize = 32>
00028 class sum_div32
00029 : public std::binary_function<TYPE,TYPE, TYPE>{
00030 public:
00031
00032 inline TYPE operator() ( TYPE& s2 , TYPE obj ) const {
00033 return s2+= obj/TYPE(tSize);}
00034
00035 };
00036
00037 };
00038
00039 #endif