00001 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef __Util_h
00030 #define __Util_h
00031 
00032 #if HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 #include "Debug.hpp"
00037 #include <cstdlib>
00038 #include <iostream>
00039 
00041 
00043 
00044 namespace H {
00045 
00047 
00049         
00054 #define foreach BOOST_FOREACH
00055                 
00064 template<class Object, class Functor>
00065 inline Functor for_all(Object & object, Functor functor) {
00066         return std::for_each(object.begin(), object.end(), functor);
00067 }
00068 
00079 #define apply_func(object, functor, functee) \
00080         for_all(object, boost::bind(functor, functee, _1))
00081         
00093 #define apply_func_args(object, functor, functee, ...) \
00094         for_all(object, boost::bind(functor, functee, _1, ## __VA_ARGS__))
00095         
00106 #define apply_static_func_args(object, functor, ...) \
00107         for_all(object, boost::bind(functor, _1, ## __VA_ARGS__))
00108 
00114 #define sort_all(object) \
00115         sort(object.begin(), object.end())
00116 
00118 
00120         
00125 inline void dbg_print_item(std::string & object) {
00126         H::dbg0 << object << std::endl;
00127 }
00128         
00133 inline void print_item(std::string & object) {
00134         std::cout << object << std::endl;
00135 }
00136         
00138 
00140 
00149 class Util {
00150 public:
00151         
00152         
00153         
00154         Util();
00155         virtual ~Util();
00156 
00157 private:
00158         
00159 
00160         
00161 };
00162 
00163 } 
00164 
00165 #endif // __Util_h