]> SALOME platform Git repositories - tools/hxx2salome.git/commitdiff
Salome HOME
Portage pour SALOME V5/YACS.
authorcrouzet <crouzet>
Fri, 17 Jul 2009 12:07:03 +0000 (12:07 +0000)
committercrouzet <crouzet>
Fri, 17 Jul 2009 12:07:03 +0000 (12:07 +0000)
Replace Sender types by YACS types sequence<double> (dblevec) and dbleint

scripts/parse3.awk

index 6bd586756ab669503a595ebf8b0f5bbe38add52f..22d3daa17a9c516bc240565ecb9b28cb38085aa1 100644 (file)
@@ -42,14 +42,14 @@ BEGIN {
   idl_arg_type["const MEDMEM::FIELD<double>*"]="in SALOME_MED::FIELDDOUBLE"
   idl_arg_type["const MEDMEM::FIELD<double>&"]="in SALOME_MED::FIELDDOUBLE"
   idl_arg_type["MEDMEM::FIELD<double>*&"]="out SALOME_MED::FIELDDOUBLE"
-  idl_arg_type["const std::vector<double>&"]="in SALOME::SenderDouble"
+  idl_arg_type["const std::vector<double>&"]="in SALOME::vectorOfDouble"
   idl_arg_type["const std::vector<std::vector<double> >&"]="in SALOME::Matrix"
-  idl_arg_type["std::vector<double>*&"]="out SALOME::SenderDouble"
+  idl_arg_type["std::vector<double>*&"]="out SALOME::vectorOfDouble"
   idl_arg_type["const MEDMEM::FIELD<int>*"]="in SALOME_MED::FIELDINT"
   idl_arg_type["const MEDMEM::FIELD<int>&"]="in SALOME_MED::FIELDINT"
   idl_arg_type["MEDMEM::FIELD<int>*&"]="out SALOME_MED::FIELDINT"
-  idl_arg_type["const std::vector<int>&"]="in SALOME::SenderInt"
-  idl_arg_type["std::vector<int>*&"]="out SALOME::SenderInt"
+  idl_arg_type["const std::vector<int>&"]="in SALOME::vectorOfLong"
+  idl_arg_type["std::vector<int>*&"]="out SALOME::vectorOfLong"
 #
 #
 # mapping for returned types
@@ -73,13 +73,13 @@ BEGIN {
   idl_rtn_type["MEDMEM::FIELD<double>*"]="SALOME_MED::FIELDDOUBLE"
   idl_rtn_type["MEDMEM::FIELD<double>&"]="SALOME_MED::FIELDDOUBLE"
   idl_rtn_type["const MEDMEM::FIELD<double>&"]="SALOME_MED::FIELDDOUBLE"
-  idl_rtn_type["std::vector<double>*"]="SALOME::SenderDouble"
+  idl_rtn_type["std::vector<double>*"]="SALOME::vectorOfDouble"
   idl_rtn_type["std::vector<std::vector<double> >*"]="SALOME::Matrix"
   idl_rtn_type["const MEDMEM::FIELD<int>*"]="SALOME_MED::FIELDINT"
   idl_rtn_type["MEDMEM::FIELD<int>*"]="SALOME_MED::FIELDINT"
   idl_rtn_type["MEDMEM::FIELD<int>&"]="SALOME_MED::FIELDINT"
   idl_rtn_type["const MEDMEM::FIELD<int>&"]="SALOME_MED::FIELDINT"
-  idl_rtn_type["std::vector<int>*"]="SALOME::SenderInt"
+  idl_rtn_type["std::vector<int>*"]="SALOME::vectorOfLong"
 #
 #
 # Corba mapping table (for argument's types and returned types)
@@ -100,13 +100,13 @@ BEGIN {
   idl_impl_hxx["in SALOME_MED::SUPPORT"]="SALOME_MED::SUPPORT_ptr"
   idl_impl_hxx["in SALOME_MED::FIELDDOUBLE"]="SALOME_MED::FIELDDOUBLE_ptr"
   idl_impl_hxx["out SALOME_MED::FIELDDOUBLE"]="SALOME_MED::FIELDDOUBLE_out"
-  idl_impl_hxx["in SALOME::SenderDouble"]="SALOME::SenderDouble_ptr"
-  idl_impl_hxx["out SALOME::SenderDouble"]="SALOME::SenderDouble_out"
+  idl_impl_hxx["in SALOME::vectorOfDouble"]="const SALOME::vectorOfDouble&"
+  idl_impl_hxx["out SALOME::vectorOfDouble"]="SALOME::vectorOfDouble_out"
   idl_impl_hxx["in SALOME::Matrix"]="SALOME::Matrix_ptr"
   idl_impl_hxx["in SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_ptr"
   idl_impl_hxx["out SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_out"
-  idl_impl_hxx["in SALOME::SenderInt"]="SALOME::SenderInt_ptr"
-  idl_impl_hxx["out SALOME::SenderInt"]="SALOME::SenderInt_out"
+  idl_impl_hxx["in SALOME::vectorOfLong"]="const SALOME::vectorOfLong&"
+  idl_impl_hxx["out SALOME::vectorOfLong"]="SALOME::vectorOfLong_out"
   idl_impl_hxx["void"]="void"
   idl_impl_hxx["long"]="CORBA::Long"
   idl_impl_hxx["double"]="CORBA::Double"
@@ -115,10 +115,10 @@ BEGIN {
   idl_impl_hxx["SALOME_MED::MESH"]="SALOME_MED::MESH_ptr"
   idl_impl_hxx["SALOME_MED::SUPPORT"]="SALOME_MED::SUPPORT_ptr"
   idl_impl_hxx["SALOME_MED::FIELDDOUBLE"]="SALOME_MED::FIELDDOUBLE_ptr"
-  idl_impl_hxx["SALOME::SenderDouble"]="SALOME::SenderDouble_ptr"
+  idl_impl_hxx["SALOME::vectorOfDouble"]="SALOME::vectorOfDouble*"
   idl_impl_hxx["SALOME::Matrix"]="SALOME::Matrix_ptr"
   idl_impl_hxx["SALOME_MED::FIELDINT"]="SALOME_MED::FIELDINT_ptr"
-  idl_impl_hxx["SALOME::SenderInt"]="SALOME::SenderInt_ptr"
+  idl_impl_hxx["SALOME::vectorOfLong"]="SALOME::vectorOfLong*"
 #
 #
 # table for c++ code generation : argument's processing
@@ -145,8 +145,10 @@ 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,MEDMEM::FullInterlace>(%s) );\n"
   cpp_impl_a["const MEDMEM::FIELD<double>&"]="\tMEDMEM::FIELDClient<double,MEDMEM::FullInterlace> _%s(%s);\n"
-  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["const std::vector<double>&"]="\tlong _%s_size=%s.length();\n\tconst double *_%s_value = &%s[0];\n"\
+             "\tstd::vector<double> _%s(_%s_value,_%s_value+_%s_size);\n"
+#  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["std::vector<double>*&"]="\tstd::vector<double>* _%s;\n"
   cpp_impl_a["const std::vector<std::vector<double> >&"]="\tMatrixClient _%s_client;\n\tint _%s_nbRow;\n\tint _%s_nbCol;\n"\
              "\tdouble* _%s_tab = _%s_client.getValue(%s,_%s_nbCol,_%s_nbRow);\n\tstd::vector<std::vector<double> > _%s(_%s_nbRow);\n"\
@@ -155,8 +157,11 @@ BEGIN {
   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 _%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;"
+  cpp_impl_a["const std::vector<int>&"]="\tlong _%s_size=%s.length();\n"\
+                        "\tstd::vector<int> _%s(_%s_size);\n"\
+                        "\tfor (int i=0; i!=_%s_size; ++i)\n\t    _%s[i]=%s[i];"
+#  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;"
   cpp_impl_a["std::vector<int>*&"]="\tstd::vector<int>* _%s;\n"
 
 #
@@ -202,7 +207,12 @@ BEGIN {
              "\tMEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace> * _rtn_field_i = new MEDMEM::FIELDTEMPLATE_I<double,MEDMEM::FullInterlace>(const_cast<MEDMEM::FIELD<double>*>(&_rtn_cpp),false);\n"\
             "\tSALOME_MED::FIELDDOUBLE_ptr _rtn_ior = _rtn_field_i->_this();\n"
   cpp_impl_b["std::vector<double>*"]=\
-             "\tSALOME::SenderDouble_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
+             "\tSALOME::vectorOfDouble * _rtn_ior = new SALOME::vectorOfDouble;\n"\
+            "\tint _rtn_cpp_length=(*_rtn_cpp).size();\n"\
+            "\t_rtn_ior->length(_rtn_cpp_length);\n"\
+            "\tfor (int i=0; i<_rtn_cpp_length; ++i)\n\t    (*_rtn_ior)[i] = (*_rtn_cpp)[i];\n"
+#  cpp_impl_b["std::vector<double>*"]=\
+#             "\tSALOME::SenderDouble_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
   cpp_impl_b["std::vector<std::vector<double> >*"]=\
              "\tint _rtn_cpp_i=(*_rtn_cpp).size();\n\tint _rtn_cpp_j=(*_rtn_cpp)[0].size();\n"\
             "\tdouble* _rtn_tab = new double[_rtn_cpp_i*_rtn_cpp_j];\n"\
@@ -222,7 +232,12 @@ BEGIN {
              "\tMEDMEM::FIELDINT_i * _rtn_field_i = new MEDMEM::FIELDINT_i(const_cast<MEDMEM::FIELD<int>*>(&_rtn_cpp),false);\n"\
             "\tSALOME_MED::FIELDINT_ptr _rtn_ior = _rtn_field_i->_this();\n"
   cpp_impl_b["std::vector<int>*"]=\
-             "\tSALOME::SenderInt_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
+             "\tSALOME::vectorOfLong * _rtn_ior = new SALOME::vectorOfLong;\n"\
+            "\tint _rtn_cpp_length=(*_rtn_cpp).size();\n"\
+            "\t_rtn_ior->length(_rtn_cpp_length);\n"\
+            "\tfor (int i=0; i<_rtn_cpp_length; ++i)\n\t    (*_rtn_ior)[i] = (*_rtn_cpp)[i];\n"
+#  cpp_impl_b["std::vector<int>*"]=\
+#             "\tSALOME::SenderInt_ptr _rtn_ior = SenderFactory::buildSender(*this,&(*_rtn_cpp)[0],(*_rtn_cpp).size(),true);\n"
 
 #
 #
@@ -235,9 +250,15 @@ BEGIN {
              "\tMEDMEM::FIELDINT_i * %s_ior = new MEDMEM::FIELDINT_i(_%s, true);\n"\
             "\t%s = %s_ior->_this();\n"
   cpp_impl_c["std::vector<double>*&"]=\
-             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
+             "\t%s = new SALOME::vectorOfDouble;\n"\
+            "\t%s->length((*_%s).size());\n"\
+            "\tfor (int i=0; i<(*_%s).size(); ++i)\n\t    (*%s)[i] = (*_%s)[i];\n"
+#             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
   cpp_impl_c["std::vector<int>*&"]=\
-             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
+             "\t%s = new SALOME::vectorOfLong;\n"\
+            "\t%s->length((*_%s).size());\n"\
+            "\tfor (int i=0; i<(*_%s).size(); ++i)\n\t    (*%s)[i] = (*_%s)[i];\n"
+#             "\t%s = SenderFactory::buildSender(*this,&(*_%s)[0],(*_%s).size(),true);\n"
   cpp_impl_c["std::string&"]="\t%s = CORBA::string_dup(_%s.c_str());\n"
   cpp_impl_c["int&"]="\t%s = _%s;\n"
   cpp_impl_c["double&"]="\t%s = _%s;\n"
@@ -389,7 +410,7 @@ BEGIN {
   # 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
+      printf cpp_impl_c[type[i]],name[i],name[i],name[i],name[i],name[i],name[i] >> cxx_file  # process for out parameters
   printf cpp_impl_b[type[1]] >> cxx_file  # process for returned value
   printf "\tendService(\"%s\");\n\tEND_OF(\"%s\");\n",func_name,func_name >> cxx_file
   if ( type[1] != "void" )