From: caremoli Date: Mon, 28 Jan 2008 09:42:56 +0000 (+0000) Subject: CCAR: change the datastream types management (use string now as the dataflow types) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8bab64b2f7cbf2ddf43a6c76206b9c2d586e4078;p=modules%2Fkernel.git CCAR: change the datastream types management (use string now as the dataflow types) change the implementation type management (use an enum now : either SO, PY or EXE) and adds an implementation name that will be used with EXE implementation type as the executable name --- diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 2e9b3160d..3208d6e89 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -413,13 +413,22 @@ CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy() //---------------------------------------------------------------------- // Function : implementation type -// Purpose : define if a component is implemented in C++ or Python +// Purpose : return the implementation type : C++ (dyn lib), Python (module) or executable //---------------------------------------------------------------------- -CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::implementation_type() +SALOME_ModuleCatalog::ImplType SALOME_ModuleCatalog_AcomponentImpl::implementation_type() { return _Component.implementationType ; } +//---------------------------------------------------------------------- +// Function : implementation name +// Purpose : return the implementation name to exec if the default one is not convenient +//---------------------------------------------------------------------- +char* SALOME_ModuleCatalog_AcomponentImpl::implementation_name() +{ + return _Component.implname ; +} + //---------------------------------------------------------------------- // Function : component_type // Purpose : define the type of the component diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index 943d5d02e..e693d70f4 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -135,11 +135,17 @@ public: */ virtual char* component_icone(); - //! method to define if a component is implemented in C++ or Python + //! method to define if a component is implemented in a dyn lib a python module or an executable /*! - \return true if it's a C++ component + \return an enum SO or PY or EXE */ - virtual CORBA::Boolean implementation_type(); + virtual SALOME_ModuleCatalog::ImplType implementation_type(); + + //! method to obtain the implementation name of the component if the default one is not convenient + /*! + \return the implementation name to exec + */ + virtual char* implementation_name(); private : diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 97c257ded..bf3e99952 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -68,6 +68,7 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& p test_component_multistudy = "component-multistudy"; test_component_icon = "component-icone" ; test_component_impltype = "component-impltype"; + test_component_implname = "component-implname"; test_component_version = "component-version"; test_component_comment = "component-comment"; @@ -481,7 +482,11 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) // Tag test_component_impltype if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) ) - _aModule.implementationType = atoi(aContent.c_str()); + _aModule.implementationType = aContent; + + // Tag test_component_implname + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_implname) ) + _aModule.implementationName = aContent; // Tag test_component_icon if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) ) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx index 22f7c416a..50758d6a6 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -64,6 +64,7 @@ private: const char *test_component_multistudy ; const char *test_component_icon ; const char *test_component_impltype; + const char *test_component_implname; const char *test_component_version; const char *test_component_comment; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx index 8369f9917..4a330bf9d 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx @@ -96,7 +96,8 @@ struct ParserComponent std::string constraint; ParserInterfaces interfaces; ParserPathPrefixes prefixes; - bool implementationType; + std::string implementationType; + std::string implementationName; std::string version; std::string comment; }; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index e794b05a5..5e3760e22 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -96,20 +96,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: ComponentTypeConvert[OTHER] = SALOME_ModuleCatalog::OTHER; - // Conversion rules for datastream parameters type and dependency - DataStreamTypeConvert["UNKNOWN"] - = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - DataStreamTypeConvert["INTEGER"] - = SALOME_ModuleCatalog::DATASTREAM_INTEGER; - DataStreamTypeConvert["FLOAT"] - = SALOME_ModuleCatalog::DATASTREAM_FLOAT; - DataStreamTypeConvert["DOUBLE"] - = SALOME_ModuleCatalog::DATASTREAM_DOUBLE; - DataStreamTypeConvert["STRING"] - = SALOME_ModuleCatalog::DATASTREAM_STRING; - DataStreamTypeConvert["BOOLEAN"] - = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN; - + // Conversion rules for datastream parameters dependency DataStreamDepConvert["UNDEFINED"] = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED; DataStreamDepConvert["T"] @@ -759,7 +746,13 @@ void SALOME_ModuleCatalogImpl::duplicate C_corba.multistudy = C_parser.multistudy; C_corba.icon = CORBA::string_dup(C_parser.icon.c_str()); C_corba.type = ComponentTypeConvert[C_parser.type]; - C_corba.implementationType = C_parser.implementationType; + if(C_parser.implementationType == "EXE") + C_corba.implementationType=SALOME_ModuleCatalog::EXE; + else if(C_parser.implementationType == "PY") + C_corba.implementationType=SALOME_ModuleCatalog::PY; + else + C_corba.implementationType=SALOME_ModuleCatalog::SO; + C_corba.implname = CORBA::string_dup(C_parser.implementationName.c_str()); unsigned int _length = C_parser.interfaces.size(); C_corba.interfaces.length(_length); @@ -880,32 +873,12 @@ void SALOME_ModuleCatalogImpl::duplicate (SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba, const ParserDataStreamParameter & P_parser) { - std::map < std::string, - SALOME_ModuleCatalog::DataStreamType >::const_iterator it_type; - std::map < std::string, SALOME_ModuleCatalog::DataStreamDependency >::const_iterator it_dep; // duplicate parameter name P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str()); - // doesn't work ??? - // it_type = DataStreamTypeConvert.find(P_parser.type); - // P_corba.Parametertype - // = (it_type == DataStreamTypeConvert.end()) - // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - - if(MYDEBUG) SCRUTE(P_parser.type); - P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - for (it_type = DataStreamTypeConvert.begin(); - it_type != DataStreamTypeConvert.end(); - it_type++) - if (P_parser.type.compare(it_type->first) == 0) { - P_corba.Parametertype = it_type->second; - break; - } - if(MYDEBUG) SCRUTE(P_corba.Parametertype); - // duplicate parameter type // doesn't work ??? @@ -913,6 +886,10 @@ void SALOME_ModuleCatalogImpl::duplicate // P_corba.Parametertype // = (it_type == DataStreamTypeConvert.end()) // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; + + P_corba.Parametertype = CORBA::string_dup(P_parser.type.c_str()); + + // duplicate parameter dependency if(MYDEBUG) SCRUTE(P_parser.dependency); P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index fc4d269fe..40650ac9f 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -217,9 +217,6 @@ private: ParserComponents _personal_module_list ; ParserPathPrefixes _personal_path_list ; - std::map - DataStreamTypeConvert; - std::map DataStreamDepConvert;