cpp_impl_a["MEDMEM::FIELD<double>*&"]="\tMEDMEM::FIELD<double>* _%s;\n"
cpp_impl_a["const MEDMEM::FIELD<double>*"]="\tstd::auto_ptr<MEDMEM::FIELD<double> > _%s ( new MEDMEM::FIELDClient<double>(%s) );\n"
cpp_impl_a["const MEDMEM::FIELD<double>&"]="\tMEDMEM::FIELDClient<double> _%s(%s);\n"
- cpp_impl_a["const std::vector<double>&"]="\tlong _size;\n\tdouble *_value = ReceiverFactory::getValue(%s,_size);\n"\
- "\tstd::vector<double> _%s(_value,_value+_size);\n\tdelete [] _value;"
+ cpp_impl_a["const std::vector<double>&"]="\tlong _%s_size;\n\tdouble *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\
+ "\tstd::vector<double> _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;"
cpp_impl_a["MEDMEM::FIELD<int>*&"]="\tMEDMEM::FIELD<int>* _%s;\n"
cpp_impl_a["const MEDMEM::FIELD<int>*"]="\tstd::auto_ptr<MEDMEM::FIELD<int> > _%s ( new MEDMEM::FIELDClient<int>(%s) );\n"
cpp_impl_a["const MEDMEM::FIELD<int>&"]="\tMEDMEM::FIELDClient<int> _%s(%s);\n"
- cpp_impl_a["const std::vector<int>&"]="\tlong _size;\n\tint *_value = ReceiverFactory::getValue(%s,_size);\n"\
- "\tstd::vector<int> _%s(_value,_value+_size);\n\tdelete [] _value;"
+ cpp_impl_a["const std::vector<int>&"]="\tlong _%s_size;\n\tint *_%s_value = ReceiverFactory::getValue(%s,_%s_size);\n"\
+ "\tstd::vector<int> _%s(_%s_value,_%s_value+_%s_size);\n\tdelete [] _%s_value;"
#
#
# table for c++ code generation : returned value processing
# generate the C++ implementation of component (cxx file)
#
{
-
-
+ # a) generate the function declaration + macro declarations
func_name=class_name"_i::"name[1]
printf "%s %s(",idl_impl_hxx[idl_rtn_type[type[1]]],func_name >> cxx_file
if ( NF >= 2 ){ # if there is arguments, print them
}
printf ")\n{\n\tbeginService(\"%s\");\n\tBEGIN_OF(\"%s\");\n",func_name,func_name >> cxx_file
+ # b) generate the argument processing part
if ( NF >= 2 ){
printf "//\tArguments processing\n" >> cxx_file
for (i=2; i<=NF; i++)
- printf cpp_impl_a[type[i]],name[i],name[i] >> cxx_file
+ printf cpp_impl_a[type[i]],name[i],name[i],name[i],name[i],name[i],name[i],name[i],name[i],name[i] >> cxx_file
}
+ # c) generate the call to the c++ component
if ( type[1] == "void" ) # if return type is void, the call syntax is different.
printf "//\tCall cpp component\n\tcppCompo_->%s(",name[1] >> cxx_file
else
printf " %s_%s%s",pre,name[i],post >> cxx_file
}
}
+
+ # d) generate the post_processing of returned and out parameters
printf ");\n//\tPost-processing & return\n" >> cxx_file
for (i=2; i<=NF; i++)
printf cpp_impl_c[type[i]],name[i],name[i],name[i],name[i] >> cxx_file # process for out parameters