C++11: convert ExternalFunctionType to a class enum

issue#70
Sébastien Villemot 2018-07-18 16:56:55 +02:00
parent 14948401e4
commit 04b6690d5a
2 changed files with 18 additions and 18 deletions

View File

@ -229,15 +229,15 @@ enum class TrinaryOpcode
normpdf
};
enum external_function_type
enum class ExternalFunctionType
{
ExternalFunctionWithoutDerivative,
ExternalFunctionWithFirstDerivative,
ExternalFunctionWithFirstandSecondDerivative,
ExternalFunctionNumericalFirstDerivative,
ExternalFunctionFirstDerivative,
ExternalFunctionNumericalSecondDerivative,
ExternalFunctionSecondDerivative
withoutDerivative,
withFirstDerivative,
withFirstAndSecondDerivative,
numericalFirstDerivative,
firstDerivative,
numericalSecondDerivative,
secondDerivative
};
enum class PriorDistributions
@ -1176,7 +1176,7 @@ class FCALL_ : public TagWithFourArguments<unsigned int, unsigned int, string, u
string func_name;
string arg_func_name;
unsigned int add_input_arguments, row, col;
external_function_type function_type;
ExternalFunctionType function_type;
public:
inline
FCALL_() : TagWithFourArguments<unsigned int, unsigned int, string, unsigned int>::TagWithFourArguments(FCALL)
@ -1185,7 +1185,7 @@ public:
add_input_arguments = 0;
row = 0;
col = 0;
function_type = ExternalFunctionWithoutDerivative;
function_type = ExternalFunctionType::withoutDerivative;
};
inline
FCALL_(unsigned int nb_output_arguments, unsigned int nb_input_arguments, string f_name, unsigned int indx) :
@ -1195,7 +1195,7 @@ public:
add_input_arguments = 0;
row = 0;
col = 0;
function_type = ExternalFunctionWithoutDerivative;
function_type = ExternalFunctionType::withoutDerivative;
func_name = f_name;
};
inline string
@ -1260,11 +1260,11 @@ public:
return col;
};
inline void
set_function_type(external_function_type arg_function_type)
set_function_type(ExternalFunctionType arg_function_type)
{
function_type = arg_function_type;
};
inline external_function_type
inline ExternalFunctionType
get_function_type()
{
return (function_type);

View File

@ -6631,13 +6631,13 @@ ExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCode, unsign
switch (nb_output_arguments)
{
case 1:
fcall.set_function_type(ExternalFunctionWithoutDerivative);
fcall.set_function_type(ExternalFunctionType::withoutDerivative);
break;
case 2:
fcall.set_function_type(ExternalFunctionWithFirstDerivative);
fcall.set_function_type(ExternalFunctionType::withFirstDerivative);
break;
case 3:
fcall.set_function_type(ExternalFunctionWithFirstandSecondDerivative);
fcall.set_function_type(ExternalFunctionType::withFirstAndSecondDerivative);
break;
}
fcall.write(CompileCode, instruction_number);
@ -7156,7 +7156,7 @@ FirstDerivExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCo
fcall.set_arg_func_name(datatree.symbol_table.getName(symb_id));
fcall.set_row(inputIndex);
fcall.set_nb_add_input_arguments(nb_add_input_arguments);
fcall.set_function_type(ExternalFunctionNumericalFirstDerivative);
fcall.set_function_type(ExternalFunctionType::numericalFirstDerivative);
fcall.write(CompileCode, instruction_number);
FSTPTEFD_ fstptefd(indx, inputIndex);
fstptefd.write(CompileCode, instruction_number);
@ -7171,7 +7171,7 @@ FirstDerivExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCo
unsigned int nb_output_arguments = 1;
FCALL_ fcall(nb_output_arguments, nb_add_input_arguments, datatree.symbol_table.getName(first_deriv_symb_id), indx);
fcall.set_function_type(ExternalFunctionFirstDerivative);
fcall.set_function_type(ExternalFunctionType::firstDerivative);
fcall.write(CompileCode, instruction_number);
FSTPTEFD_ fstptefd(indx, inputIndex);
fstptefd.write(CompileCode, instruction_number);