diff options
Diffstat (limited to 'shared/loki/Function.h')
-rw-r--r-- | shared/loki/Function.h | 298 |
1 files changed, 149 insertions, 149 deletions
diff --git a/shared/loki/Function.h b/shared/loki/Function.h index f2badfe9..5f388d3c 100644 --- a/shared/loki/Function.h +++ b/shared/loki/Function.h @@ -54,7 +54,7 @@ struct Function<R()> : public Functor<R> Function(const Function& func) : FBase() { - if( !func.empty()) + if ( !func.empty()) FBase::operator=(func); } @@ -62,14 +62,14 @@ Function(const Function& func) : FBase() template<class R2> Function(Function<R2()> func) : FBase() { - if(!func.empty()) + if (!func.empty()) FBase::operator=(func); } // clear by '= 0' Function(const int i) : FBase() { - if(i==0) + if (i == 0) FBase::clear(); else throw std::runtime_error("Loki::Function(const int i): i!=0"); @@ -79,7 +79,7 @@ template<class Func> Function(Func func) : FBase(func) {} template<class Host, class Func> -Function(const Host& host, const Func& func) : FBase(host,func) {} +Function(const Host& host, const Func& func) : FBase(host, func) {} }; @@ -89,38 +89,38 @@ Function(const Host& host, const Func& func) : FBase(host,func) {} //////////////////////////////////////////////////////////////////////////////// #define LOKI_FUNCTION_BODY \ - \ - Function() : FBase() {} \ - \ - Function(const Function& func) : FBase() \ - { \ - if( !func.empty()) \ - FBase::operator=(func); \ - } \ - \ - Function(const int i) : FBase() \ - { \ - if(i==0) \ - FBase::clear(); \ - else \ - throw std::runtime_error( \ - "Loki::Function(const int i): i!=0"); \ - } \ - \ - template<class Func> \ - Function(Func func) : FBase(func) {} \ - \ - template<class Host, class Func> \ - Function(const Host& host, const Func& func): FBase(host,func) {} + \ + Function() : FBase() {} \ + \ + Function(const Function& func) : FBase() \ + { \ + if( !func.empty()) \ + FBase::operator=(func); \ + } \ + \ + Function(const int i) : FBase() \ + { \ + if(i==0) \ + FBase::clear(); \ + else \ + throw std::runtime_error( \ + "Loki::Function(const int i): i!=0"); \ + } \ + \ + template<class Func> \ + Function(Func func) : FBase(func) {} \ + \ + template<class Host, class Func> \ + Function(const Host& host, const Func& func): FBase(host,func) {} #define LOKI_FUNCTION_R2_CTOR_BODY \ - \ - : FBase() \ - { \ - if(!func.empty()) \ - FBase::operator=(func); \ - } + \ + : FBase() \ + { \ + if(!func.empty()) \ + FBase::operator=(func); \ + } //////////////////////////////////////////////////////////////////////////////// @@ -143,225 +143,225 @@ struct Function<> // or define LOKI_ENABLE_FUNCTION }; -template<class R,class P01> +template<class R, class P01> struct Function<R(P01)> : public Loki::Functor<R, Seq<P01> > { typedef Functor<R, Seq<P01> > FBase; - template<class R2,class Q01> + template<class R2, class Q01> Function(Function<R2(Q01)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R,class P01,class P02> -struct Function<R(P01,P02)> -: public Functor<R, Seq<P01,P02> > +template<class R, class P01, class P02> +struct Function<R(P01, P02)> +: public Functor<R, Seq<P01, P02> > { - typedef Functor<R, Seq<P01,P02> > FBase; + typedef Functor<R, Seq<P01, P02> > FBase; - template<class R2,class Q01, class Q02> - Function(Function<R2(Q01,Q02)> func) + template<class R2, class Q01, class Q02> + Function(Function<R2(Q01, Q02)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R,class P01,class P02, class P03> -struct Function<R(P01,P02,P03)> -: public Functor<R, Seq<P01,P02,P03> > +template<class R, class P01, class P02, class P03> +struct Function<R(P01, P02, P03)> +: public Functor<R, Seq<P01, P02, P03> > { - typedef Functor<R, Seq<P01,P02,P03> > FBase; + typedef Functor<R, Seq<P01, P02, P03> > FBase; - template<class R2,class Q01, class Q02,class Q03> - Function(Function<R2(Q01,Q02,Q03)> func) + template<class R2, class Q01, class Q02, class Q03> + Function(Function<R2(Q01, Q02, Q03)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R,class P01,class P02, class P03,class P04> -struct Function<R(P01,P02,P03,P04)> -: public Functor<R, Seq<P01,P02,P03,P04> > +template<class R, class P01, class P02, class P03, class P04> +struct Function<R(P01, P02, P03, P04)> +: public Functor<R, Seq<P01, P02, P03, P04> > { - typedef Functor<R, Seq<P01,P02,P03,P04> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04> > FBase; - template<class R2,class Q01,class Q02, class Q03,class Q04> - Function(Function<R2(Q01,Q02,Q03,Q04)> func) + template<class R2, class Q01, class Q02, class Q03, class Q04> + Function(Function<R2(Q01, Q02, Q03, Q04)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R,class P01,class P02, class P03,class P04,class P05> -struct Function<R(P01,P02,P03,P04,P05)> -: public Functor<R, Seq<P01,P02,P03,P04,P05> > +template<class R, class P01, class P02, class P03, class P04, class P05> +struct Function<R(P01, P02, P03, P04, P05)> +: public Functor<R, Seq<P01, P02, P03, P04, P05> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05> > FBase; - template<class R2,class Q01,class Q02, class Q03,class Q04,class Q05> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05)> func) + template<class R2, class Q01, class Q02, class Q03, class Q04, class Q05> + Function(Function<R2(Q01, Q02, Q03, Q04, Q05)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06> -struct Function<R(P01,P02,P03,P04,P05,P06)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06 > +struct Function<R(P01, P02, P03, P04, P05, P06)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07> -struct Function<R(P01,P02,P03,P04,P05,P06,P07)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09 > > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09 > > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09, class P10 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09, P10)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09, class Q10 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09, class P10, + class P11 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11> >FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11> >FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09, class Q10, + class Q11 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09, class P10, + class P11, class P12 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09, class Q10, + class Q11, class Q12 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11, Q12)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12, class P13> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09, class P10, + class P11, class P12, class P13 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12, class Q13> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09, class Q10, + class Q11, class Q12, class Q13 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11, Q12, Q13)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12, class P13,class P14> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09, class P10, + class P11, class P12, class P13, class P14 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12, class Q13,class Q14> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14)> func) + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14> > FBase; + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09, class Q10, + class Q11, class Q12, class Q13, class Q14 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11, Q12, Q13, Q14)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY }; -template<class R, class P01,class P02, class P03,class P04,class P05, - class P06,class P07, class P08,class P09,class P10, - class P11,class P12, class P13,class P14,class P15> -struct Function<R(P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15)> -: public Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > +template < class R, class P01, class P02, class P03, class P04, class P05, + class P06, class P07, class P08, class P09, class P10, + class P11, class P12, class P13, class P14, class P15 > +struct Function<R(P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14, P15)> +: public Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14, P15> > { - typedef Functor<R, Seq<P01,P02,P03,P04,P05,P06,P07,P08,P09,P10,P11,P12,P13,P14,P15> > FBase; + typedef Functor<R, Seq<P01, P02, P03, P04, P05, P06, P07, P08, P09, P10, P11, P12, P13, P14, P15> > FBase; - template<class R2, class Q01,class Q02, class Q03,class Q04,class Q05, - class Q06,class Q07, class Q08,class Q09,class Q10, - class Q11,class Q12, class Q13,class Q14,class Q15> - Function(Function<R2(Q01,Q02,Q03,Q04,Q05,Q06,Q07,Q08,Q09,Q10,Q11,Q12,Q13,Q14,Q15)> func) + template < class R2, class Q01, class Q02, class Q03, class Q04, class Q05, + class Q06, class Q07, class Q08, class Q09, class Q10, + class Q11, class Q12, class Q13, class Q14, class Q15 > + Function(Function<R2(Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11, Q12, Q13, Q14, Q15)> func) LOKI_FUNCTION_R2_CTOR_BODY LOKI_FUNCTION_BODY |