LCOV - code coverage report
Current view: top level - ugbase/registry - function_traits.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 61 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 3355 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2010-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Authors: Sebastian Reiter, Andreas Vogel
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #ifndef __H__UG_BRIDGE__FUNCTION_TRAITS__
      34              : #define __H__UG_BRIDGE__FUNCTION_TRAITS__
      35              : 
      36              : #include "common/util/metaprogramming_util.h"
      37              : #include <type_traits>
      38              : 
      39              : /**
      40              :  * Maximum number of template arguments for a bridge traits class. These are
      41              :  * the maximal available function arguments.
      42              :  *
      43              :  * NOTE: IF YOU INCREASE THE NUMBER OF TEMPLATES BELOW, THIS NUMBER MUST BE
      44              :  *               ADJUSTED AS WELL.
      45              :  */
      46              : const int UG_REGISTRY_MAX_NUM_ARGS = 12;
      47              : 
      48              : namespace ug
      49              : {
      50              : namespace bridge
      51              : {
      52              : 
      53              : /// \addtogroup registry
      54              : /// \{
      55              : 
      56              : class CustomReturn {};
      57              : 
      58              : template <typename TFunc>
      59              : struct func_traits {};
      60              : 
      61              : ////////////////////////////////////////////////////////////////////////////////
      62              : // global function traits
      63              : ////////////////////////////////////////////////////////////////////////////////
      64              : 
      65              : template <typename TRet>
      66              : struct func_traits <TRet (*) ()>
      67              : {
      68              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
      69              :         typedef TRet return_type;
      70              :         typedef TypeList<> params_type;
      71              :         static TRet apply(TRet (*fp)(),  TypeValueList<params_type>& args)
      72              :         {
      73            0 :                 return fp();
      74              :         };
      75              : };
      76              : 
      77              : 
      78              : template <typename TRet, typename P1>
      79              : struct func_traits <TRet (*) (P1)>
      80              : {
      81              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
      82              :         typedef TRet return_type;
      83              :         typedef TypeList<P1> params_type;
      84            0 :         static TRet apply(TRet (*fp)(P1),  TypeValueList<params_type>& args)
      85              :         {
      86            0 :                 return fp(args.hd);
      87              :         };
      88              : };
      89              : 
      90              : 
      91              : template <typename TRet, typename T1, typename T2>
      92              : struct func_traits <TRet (*) (T1, T2)>
      93              : {
      94              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
      95              :         typedef TRet return_type;
      96              :         typedef TypeList<T1, T2> params_type;
      97            0 :         static TRet apply(TRet (*fp)(T1, T2),  TypeValueList<params_type>& args)
      98              :         {
      99            0 :                 return fp(args.hd, args.tl.hd);
     100              :         };
     101              : };
     102              : 
     103              : template <typename TRet, typename T1, typename T2, typename T3>
     104              : struct func_traits <TRet (*) (T1, T2, T3)>
     105              : {
     106              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     107              :         typedef TRet return_type;
     108              :         typedef TypeList<T1, T2, T3> params_type;
     109            0 :         static TRet apply(TRet (*fp)(T1, T2, T3),  TypeValueList<params_type>& args)
     110              :         {
     111            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd);
     112              :         };
     113              : };
     114              : 
     115              : template <typename TRet, typename T1, typename T2, typename T3,
     116              :                   typename T4>
     117              : struct func_traits <TRet (*) (T1, T2, T3, T4)>
     118              : {
     119              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     120              :         typedef TRet return_type;
     121              :         typedef TypeList<T1, T2, T3, T4> params_type;
     122            0 :         static TRet apply(TRet (*fp)(T1, T2, T3, T4),  TypeValueList<params_type>& args)
     123              :         {
     124            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd);
     125              :         };
     126              : };
     127              : 
     128              : template <typename TRet, typename T1, typename T2, typename T3,
     129              :                   typename T4, typename T5>
     130              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5)>
     131              : {
     132              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     133              :         typedef TRet return_type;
     134              :         typedef TypeList<T1, T2, T3, T4, T5> params_type;
     135            0 :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5),  TypeValueList<params_type>& args)
     136              :         {
     137            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     138            0 :                                  args.tl.tl.tl.tl.hd);
     139              :         };
     140              : };
     141              : 
     142              : template <typename TRet, typename T1, typename T2, typename T3,
     143              :                   typename T4, typename T5, typename T6>
     144              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6)>
     145              : {
     146              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     147              :         typedef TRet return_type;
     148              :         typedef TypeList<T1, T2, T3, T4, T5, T6> params_type;
     149            0 :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6),  TypeValueList<params_type>& args)
     150              :         {
     151            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     152            0 :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd);
     153              :         };
     154              : };
     155              : 
     156              : template <typename TRet, typename T1, typename T2, typename T3,
     157              :                   typename T4, typename T5, typename T6, typename T7>
     158              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6, T7)>
     159              : {
     160              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     161              :         typedef TRet return_type;
     162              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7> params_type;
     163            0 :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6, T7),  TypeValueList<params_type>& args)
     164              :         {
     165            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     166            0 :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd);
     167              :         };
     168              : };
     169              : 
     170              : template <typename TRet, typename T1, typename T2, typename T3,
     171              :                   typename T4, typename T5, typename T6, typename T7, typename T8>
     172              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6, T7, T8)>
     173              : {
     174              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     175              :         typedef TRet return_type;
     176              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8> params_type;
     177              :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6, T7, T8),  TypeValueList<params_type>& args)
     178              :         {
     179            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     180            0 :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd,
     181            0 :                                  args.tl.tl.tl.tl.tl.tl.tl.hd);
     182              :         };
     183              : };
     184              : 
     185              : template <typename TRet, typename T1, typename T2, typename T3,
     186              :                   typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
     187              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6, T7, T8, T9)>
     188              : {
     189              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     190              :         typedef TRet return_type;
     191              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8, T9> params_type;
     192              :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6, T7, T8, T9),  TypeValueList<params_type>& args)
     193              :         {
     194              :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     195              :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd,
     196              :                                  args.tl.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.tl.hd);
     197              :         };
     198              : };
     199              : 
     200              : template <typename TRet, typename T1, typename T2, typename T3,
     201              :                   typename T4, typename T5, typename T6, typename T7, typename T8, typename T9,
     202              :                   typename T10>
     203              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
     204              : {
     205              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     206              :         typedef TRet return_type;
     207              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> params_type;
     208            0 :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10),  TypeValueList<params_type>& args)
     209              :         {
     210            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     211              :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd,
     212              :                                  args.tl.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.tl.hd,
     213            0 :                                  args.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
     214              :         };
     215              : };
     216              : 
     217              : template <typename TRet, typename T1, typename T2, typename T3,
     218              :                   typename T4, typename T5, typename T6, typename T7, typename T8, typename T9,
     219              :                   typename T10, typename T11>
     220              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>
     221              : {
     222              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     223              :         typedef TRet return_type;
     224              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> params_type;
     225            0 :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11),  TypeValueList<params_type>& args)
     226              :         {
     227            0 :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     228              :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd,
     229              :                                  args.tl.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.tl.hd,
     230            0 :                                  args.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
     231              :         };
     232              : };
     233              : 
     234              : template <typename TRet, typename T1, typename T2, typename T3,
     235              :                   typename T4, typename T5, typename T6, typename T7, typename T8, typename T9,
     236              :                   typename T10, typename T11, typename T12>
     237              : struct func_traits <TRet (*) (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>
     238              : {
     239              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value;
     240              :         typedef TRet return_type;
     241              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> params_type;
     242              :         static TRet apply(TRet (*fp)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12),  TypeValueList<params_type>& args)
     243              :         {
     244              :                 return fp(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd,
     245              :                                  args.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd,
     246              :                                  args.tl.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.tl.hd,
     247              :                                  args.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd,
     248              :          args.tl.tl.tl.tl.tl.tl.tl.tl.tl.tl.tl.hd);
     249              :         };
     250              : };
     251              : 
     252              : ////////////////////////////////////////////////////////////////////////////////
     253              : // non-const method traits
     254              : ////////////////////////////////////////////////////////////////////////////////
     255              : 
     256              : #define FUNC_TRAITS_GENERAL_NON_CONST_MEMBER \
     257              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value; \
     258              :         static const bool const_method = false;\
     259              :         typedef TClass class_type;\
     260              :         typedef TRet return_type
     261              : 
     262              : 
     263              : template <typename TClass, typename TRet>
     264              : struct func_traits <TRet (TClass::*) ()>
     265              : {
     266              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     267              :         typedef TypeList<> params_type;
     268              :         static TRet apply(TRet (TClass::*fp)(), TClass* obj, TypeValueList<params_type>& args)
     269              :         {
     270            0 :                 return (obj->*fp)();
     271              :         };
     272              : };
     273              : 
     274              : 
     275              : template <typename TClass, typename TRet, typename P1>
     276              : struct func_traits <TRet (TClass::*) (P1)>
     277              : {
     278              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     279              :         typedef TypeList<P1> params_type;
     280            0 :         static TRet apply(TRet (TClass::*fp)(P1), TClass* obj, TypeValueList<params_type>& args)
     281              :         {
     282            0 :                 return (obj->*fp)(args.hd);
     283              :         };
     284              : };
     285              : 
     286              : 
     287              : template <typename TClass, typename TRet, typename T1, typename T2>
     288              : struct func_traits <TRet (TClass::*) (T1, T2)>
     289              : {
     290              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     291              :         typedef TypeList<T1, T2> params_type;
     292            0 :         static TRet apply(TRet (TClass::*fp)(T1, T2), TClass* obj, TypeValueList<params_type>& args)
     293              :         {
     294            0 :                 return (obj->*fp)(args.hd, args.tl.hd);
     295              :         };
     296              : };
     297              : 
     298              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3>
     299              : struct func_traits <TRet (TClass::*) (T1, T2, T3)>
     300              : {
     301              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     302              :         typedef TypeList<T1, T2, T3> params_type;
     303            0 :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3), TClass* obj, TypeValueList<params_type>& args)
     304              :         {
     305            0 :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd);
     306              :         };
     307              : };
     308              : 
     309              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     310              :                         typename T4>
     311              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4)>
     312              : {
     313              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     314              :         typedef TypeList<T1, T2, T3, T4> params_type;
     315            0 :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4), TClass* obj, TypeValueList<params_type>& args)
     316              :         {
     317            0 :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd);
     318              :         };
     319              : };
     320              : 
     321              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     322              :                         typename T4, typename T5>
     323              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5)>
     324              : {
     325              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     326              :         typedef TypeList<T1, T2, T3, T4, T5> params_type;
     327            0 :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5), TClass* obj, TypeValueList<params_type>& args)
     328              :         {
     329            0 :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd);
     330              :         };
     331              : };
     332              : 
     333              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     334              :                         typename T4, typename T5, typename T6>
     335              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6)>
     336              : {
     337              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     338              :         typedef TypeList<T1, T2, T3, T4, T5, T6> params_type;
     339            0 :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6), TClass* obj, TypeValueList<params_type>& args)
     340              :         {
     341            0 :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     342            0 :                                                         args.tl.tl.tl.tl.tl.hd);
     343              :         };
     344              : };
     345              : 
     346              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     347              :                         typename T4, typename T5, typename T6, typename T7>
     348              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6, T7)>
     349              : {
     350              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     351              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7> params_type;
     352              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6, T7), TClass* obj, TypeValueList<params_type>& args)
     353              :         {
     354              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     355              :                                                         args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd);
     356              :         };
     357              : };
     358              : 
     359              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     360              :                         typename T4, typename T5, typename T6, typename T7, typename T8>
     361              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6, T7, T8)>
     362              : {
     363              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     364              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8> params_type;
     365              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6, T7, T8), TClass* obj, TypeValueList<params_type>& args)
     366              :         {
     367              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     368              :                                                         args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.hd);
     369              :         };
     370              : };
     371              : 
     372              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     373              :                         typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
     374              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6, T7, T8, T9)>
     375              : {
     376              :         FUNC_TRAITS_GENERAL_NON_CONST_MEMBER;
     377              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8, T9> params_type;
     378              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6, T7, T8, T9), TClass* obj, TypeValueList<params_type>& args)
     379              :         {
     380              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     381              :                                                         args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.hd,
     382              :                                                         args.tl.tl.tl.tl.tl.tl.tl.tl.hd);
     383              :         };
     384              : };
     385              : 
     386              : ////////////////////////////////////////////////////////////////////////////////
     387              : // const method traits
     388              : ////////////////////////////////////////////////////////////////////////////////
     389              : 
     390              : #define FUNC_TRAITS_GENERAL_CONST_MEMBER \
     391              :         static const bool custom_return = std::is_same<TRet, CustomReturn>::value; \
     392              :         static const bool const_method = true;\
     393              :         typedef TClass class_type;\
     394              :         typedef TRet return_type
     395              : 
     396              : 
     397              : template <typename TClass, typename TRet>
     398              : struct func_traits <TRet (TClass::*) () const>
     399              : {
     400              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     401              :         typedef TypeList<> params_type;
     402              :         static TRet apply(TRet (TClass::*fp)() const, const TClass* obj, TypeValueList<params_type>& args)
     403              :         {
     404            0 :                 return (obj->*fp)();
     405              :         };
     406              : };
     407              : 
     408              : 
     409              : template <typename TClass, typename TRet, typename P1>
     410              : struct func_traits <TRet (TClass::*) (P1) const>
     411              : {
     412              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     413              :         typedef TypeList<P1> params_type;
     414            0 :         static TRet apply(TRet (TClass::*fp)(P1) const, const TClass* obj, TypeValueList<params_type>& args)
     415              :         {
     416            0 :                 return (obj->*fp)(args.hd);
     417              :         };
     418              : };
     419              : 
     420              : 
     421              : template <typename TClass, typename TRet, typename T1, typename T2>
     422              : struct func_traits <TRet (TClass::*) (T1, T2) const>
     423              : {
     424              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     425              :         typedef TypeList<T1, T2> params_type;
     426              :         static TRet apply(TRet (TClass::*fp)(T1, T2) const, const TClass* obj, TypeValueList<params_type>& args)
     427              :         {
     428            0 :                 return (obj->*fp)(args.hd, args.tl.hd);
     429              :         };
     430              : };
     431              : 
     432              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3>
     433              : struct func_traits <TRet (TClass::*) (T1, T2, T3) const>
     434              : {
     435              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     436              :         typedef TypeList<T1, T2, T3> params_type;
     437              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3) const, const TClass* obj, TypeValueList<params_type>& args)
     438              :         {
     439            0 :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd);
     440              :         };
     441              : };
     442              : 
     443              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     444              :                         typename T4>
     445              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4) const>
     446              : {
     447              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     448              :         typedef TypeList<T1, T2, T3, T4> params_type;
     449              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4) const, const TClass* obj, TypeValueList<params_type>& args)
     450              :         {
     451              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd);
     452              :         };
     453              : };
     454              : 
     455              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     456              :                         typename T4, typename T5>
     457              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5) const>
     458              : {
     459              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     460              :         typedef TypeList<T1, T2, T3, T4, T5> params_type;
     461              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5) const, const TClass* obj, TypeValueList<params_type>& args)
     462              :         {
     463              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd);
     464              :         };
     465              : };
     466              : 
     467              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     468              :                         typename T4, typename T5, typename T6>
     469              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6) const>
     470              : {
     471              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     472              :         typedef TypeList<T1, T2, T3, T4, T5, T6> params_type;
     473              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6) const, const TClass* obj, TypeValueList<params_type>& args)
     474              :         {
     475              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     476              :                                                  args.tl.tl.tl.tl.tl.hd);
     477              :         };
     478              : };
     479              : 
     480              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     481              :                         typename T4, typename T5, typename T6,  typename T7>
     482              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6, T7) const>
     483              : {
     484              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     485              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7> params_type;
     486              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6, T7) const, const TClass* obj, TypeValueList<params_type>& args)
     487              :         {
     488              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     489              :                                                  args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd);
     490              :         };
     491              : };
     492              : 
     493              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     494              :                         typename T4, typename T5, typename T6,  typename T7, typename T8>
     495              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6, T7, T8) const>
     496              : {
     497              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     498              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8> params_type;
     499              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6, T7, T8) const, const TClass* obj, TypeValueList<params_type>& args)
     500              :         {
     501              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     502              :                                                  args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.hd);
     503              :         };
     504              : };
     505              : 
     506              : template <typename TClass, typename TRet, typename T1, typename T2, typename T3,
     507              :                         typename T4, typename T5, typename T6,  typename T7, typename T8, typename T9>
     508              : struct func_traits <TRet (TClass::*) (T1, T2, T3, T4, T5, T6, T7, T8, T9) const>
     509              : {
     510              :         FUNC_TRAITS_GENERAL_CONST_MEMBER;
     511              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8, T9> params_type;
     512              :         static TRet apply(TRet (TClass::*fp)(T1, T2, T3, T4, T5, T6, T7, T8, T9) const, const TClass* obj, TypeValueList<params_type>& args)
     513              :         {
     514              :                 return (obj->*fp)(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     515              :                                                  args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.hd,
     516              :                                                  args.tl.tl.tl.tl.tl.tl.tl.tl.hd);
     517              :         };
     518              : };
     519              : 
     520              : ////////////////////////////////////////////////////////////////////////////////
     521              : // constructor function traits
     522              : ////////////////////////////////////////////////////////////////////////////////
     523              : 
     524              : template <typename T, typename TTypelist>
     525              : struct constructor_traits;
     526              : 
     527              : template <typename T>
     528              : struct constructor_traits <T, TypeList<> >
     529              : {
     530              :         typedef TypeList<> params_type;
     531            0 :         static T* apply(TypeValueList<params_type>& args)
     532              :         {
     533              :                 (void)args;
     534            0 :                 return new T();
     535              :         };
     536              : };
     537              : 
     538              : template <typename T, typename T1>
     539              : struct constructor_traits <T, TypeList<T1> >
     540              : {
     541              :         typedef TypeList<T1> params_type;
     542            0 :         static T* apply(TypeValueList<params_type>& args)
     543              :         {
     544            0 :                 return new T(args.hd);
     545              :         };
     546              : };
     547              : 
     548              : template <typename T, typename T1, typename T2>
     549              : struct constructor_traits <T, TypeList<T1, T2> >
     550              : {
     551              :         typedef TypeList<T1, T2> params_type;
     552            0 :         static T* apply(TypeValueList<params_type>& args)
     553              :         {
     554            0 :                 return new T(args.hd, args.tl.hd);
     555              :         };
     556              : };
     557              : 
     558              : template <typename T, typename T1, typename T2, typename T3>
     559              : struct constructor_traits <T, TypeList<T1, T2, T3> >
     560              : {
     561              :         typedef TypeList<T1, T2, T3> params_type;
     562            0 :         static T* apply(TypeValueList<params_type>& args)
     563              :         {
     564            0 :                 return new T(args.hd, args.tl.hd, args.tl.tl.hd);
     565              :         };
     566              : };
     567              : 
     568              : template <typename T, typename T1, typename T2, typename T3, typename T4>
     569              : struct constructor_traits <T, TypeList<T1, T2, T3, T4> >
     570              : {
     571              :         typedef TypeList<T1, T2, T3, T4> params_type;
     572            0 :         static T* apply(TypeValueList<params_type>& args)
     573              :         {
     574            0 :                 return new T(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd);
     575              :         };
     576              : };
     577              : 
     578              : template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
     579              : struct constructor_traits <T, TypeList<T1, T2, T3, T4, T5> >
     580              : {
     581              :         typedef TypeList<T1, T2, T3, T4, T5> params_type;
     582            0 :         static T* apply(TypeValueList<params_type>& args)
     583              :         {
     584            0 :                 return new T(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd);
     585              :         };
     586              : };
     587              : 
     588              : template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
     589              : struct constructor_traits <T, TypeList<T1, T2, T3, T4, T5, T6> >
     590              : {
     591              :         typedef TypeList<T1, T2, T3, T4, T5, T6> params_type;
     592              :         static T* apply(TypeValueList<params_type>& args)
     593              :         {
     594              :                 return new T(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     595              :                                 args.tl.tl.tl.tl.tl.hd);
     596              :         };
     597              : };
     598              : 
     599              : template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
     600              : struct constructor_traits <T, TypeList<T1, T2, T3, T4, T5, T6, T7> >
     601              : {
     602              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7> params_type;
     603            0 :         static T* apply(TypeValueList<params_type>& args)
     604              :         {
     605            0 :                 return new T(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     606            0 :                                 args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd);
     607              :         };
     608              : };
     609              : 
     610              : template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
     611              : struct constructor_traits <T, TypeList<T1, T2, T3, T4, T5, T6, T7, T8> >
     612              : {
     613              :         typedef TypeList<T1, T2, T3, T4, T5, T6, T7, T8> params_type;
     614              :         static T* apply(TypeValueList<params_type>& args)
     615              :         {
     616              :                 return new T(args.hd, args.tl.hd, args.tl.tl.hd, args.tl.tl.tl.hd, args.tl.tl.tl.tl.hd,
     617              :                                 args.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.hd, args.tl.tl.tl.tl.tl.tl.tl.hd);
     618              :         };
     619              : };
     620              : 
     621              : // end group registry
     622              : /// \}
     623              : 
     624              : } // end namespace bridge
     625              : } // end namespace ug
     626              : 
     627              : #endif /* __H__UG_BRIDGE__FUNCTION_TRAITS__ */
        

Generated by: LCOV version 2.0-1