]> SALOME platform Git repositories - tools/hxx2salome.git/commitdiff
Salome HOME
Bug correction for multiple arguments of type std::vector
authorcrouzet <crouzet>
Tue, 25 Oct 2005 14:19:28 +0000 (14:19 +0000)
committercrouzet <crouzet>
Tue, 25 Oct 2005 14:19:28 +0000 (14:19 +0000)
scripts/parse3.awk

index 0d8a22b22eb760a9380ccefc85f85f7dff4ac449..c1f04581ad0829d224bea9b55de961f21a5669a2 100644 (file)
@@ -127,13 +127,13 @@ BEGIN {
   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
@@ -308,8 +308,7 @@ BEGIN {
 #  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
@@ -319,12 +318,14 @@ BEGIN {
   }
   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
@@ -343,6 +344,8 @@ BEGIN {
          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