#ifndef ___typedef_import_h__ #define ___typedef_import_h__ #ifdef SWIG %module template_typedef_cplx2; #endif #include typedef std::complex Complex; namespace vfncs { struct UnaryFunctionBase { int get_base_value() { return 0; } }; template struct UnaryFunction; template struct ArithUnaryFunction; template struct UnaryFunction : UnaryFunctionBase { int get_value() { return 1; } }; template struct ArithUnaryFunction : UnaryFunction { int get_arith_value() { return 2; } }; 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< double, double > { typedef double argument_type; typedef double result_type; static const char* const arg_type; static const char* const res_type; }; template<> struct arith_traits< Complex, Complex > { typedef Complex argument_type; typedef Complex result_type; static const char* const arg_type; static const char* const res_type; }; template<> struct arith_traits< Complex, double > { typedef double argument_type; typedef Complex result_type; static const char* const arg_type; static const char* const res_type; }; template<> struct arith_traits< double, Complex > { typedef double argument_type; typedef Complex 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< double, double >::arg_type = "double"; const char* const arith_traits< double, double >::res_type = "double"; const char* const arith_traits< Complex, Complex >::arg_type = "complex"; const char* const arith_traits< Complex, Complex >::res_type = "complex"; const char* const arith_traits< Complex, double >::arg_type = "double"; const char* const arith_traits< Complex, double >::res_type = "complex"; const char* const arith_traits< double, Complex >::arg_type = "double"; const char* const arith_traits< double, Complex >::res_type = "complex"; #endif } // end namespace vfncs #ifdef SWIG namespace vfncs { %template(UnaryFunction_double_double) UnaryFunction; %template(ArithUnaryFunction_double_double) ArithUnaryFunction; %template() unary_func_traits; %template() arith_traits; %template(make_Identity_double) make_Identity; %template(UnaryFunction_complex_complex) UnaryFunction; %template(ArithUnaryFunction_complex_complex) ArithUnaryFunction; %template() unary_func_traits; %template() arith_traits; %template(make_Identity_complex) make_Identity; /* [beazley] Added this part */ %template() unary_func_traits; %template(UnaryFunction_double_complex) UnaryFunction; %template(ArithUnaryFunction_double_complex) ArithUnaryFunction; /* */ %template() arith_traits; %template() arith_traits; %template(make_Multiplies_double_double_complex_complex) make_Multiplies; %template(make_Multiplies_double_double_double_double) make_Multiplies; %template(make_Multiplies_complex_complex_complex_complex) make_Multiplies; %template(make_Multiplies_complex_complex_double_double) make_Multiplies; } #endif #endif //___template_typedef_h__