#ifdef SWIGPYTHON %module("templatereduce") template_typedef #else %module template_typedef #endif // // Change this to #if 1 to test the 'test' // #if 0 #define reald double %{ #define reald double %} #else %inline %{ typedef double reald; %} #endif %inline %{ // typedef double reald; namespace vfncs { struct UnaryFunctionBase { }; template struct UnaryFunction; template struct ArithUnaryFunction; template struct UnaryFunction : UnaryFunctionBase { }; template struct ArithUnaryFunction : UnaryFunction { }; template struct unary_func_traits { typedef ArithUnaryFunction base; }; template inline typename unary_func_traits< ArgType, ArgType >::base make_Identity() { return typename unary_func_traits< ArgType, ArgType >::base(); } template struct arith_traits { }; template<> struct arith_traits< float, float > { typedef float argument_type; typedef float result_type; static const char* const arg_type; static const char* const res_type; }; template<> struct arith_traits< reald, reald > { typedef reald argument_type; typedef reald result_type; static const char* const arg_type; static const char* const res_type; }; template<> struct arith_traits< reald, float > { typedef float argument_type; typedef reald result_type; static const char* const arg_type; static const char* const res_type; }; template<> struct arith_traits< float, reald > { typedef float argument_type; typedef reald result_type; static const char* const arg_type; static const char* const res_type; }; template inline ArithUnaryFunction::argument_type, typename arith_traits< RF, RG >::result_type > make_Multiplies(const ArithUnaryFunction& f, const ArithUnaryFunction& g) { return ArithUnaryFunction::argument_type, typename arith_traits< RF, RG >::result_type>(); } #ifndef SWIG // Initialize these static class members const char* const arith_traits< float, float >::arg_type = "float"; const char* const arith_traits< float, float >::res_type = "float"; const char* const arith_traits< reald, reald >::arg_type = "reald"; const char* const arith_traits< reald, reald >::res_type = "reald"; const char* const arith_traits< reald, float >::arg_type = "float"; const char* const arith_traits< reald, float >::res_type = "reald"; const char* const arith_traits< float, reald >::arg_type = "float"; const char* const arith_traits< float, reald >::res_type = "reald"; #endif } %} namespace vfncs { %template(UnaryFunction_float_float) UnaryFunction; %template(ArithUnaryFunction_float_float) ArithUnaryFunction; %template() unary_func_traits; %template() arith_traits; %template(make_Identity_float) make_Identity; %template(UnaryFunction_reald_reald) UnaryFunction; %template(ArithUnaryFunction_reald_reald) ArithUnaryFunction; %template() unary_func_traits; %template() arith_traits; %template(make_Identity_reald) make_Identity; /* [beazley] Added this part */ %template() unary_func_traits; %template(UnaryFunction_float_reald) UnaryFunction; %template(ArithUnaryFunction_float_reald) ArithUnaryFunction; /* */ %template() arith_traits; %template() arith_traits; %template() arith_traits; %template(make_Multiplies_float_float_reald_reald) make_Multiplies; %template(make_Multiplies_float_float_float_float) make_Multiplies; %template(make_Multiplies_reald_reald_reald_reald) make_Multiplies; } #ifdef SWIGPYTHON swig_type_info *SWIG_TypeQuery(const char* name); #endif