]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: add types to component catalogs and corba interface to ModulCatalog to get...
authorcaremoli <caremoli>
Thu, 8 Nov 2007 17:54:10 +0000 (17:54 +0000)
committercaremoli <caremoli>
Thu, 8 Nov 2007 17:54:10 +0000 (17:54 +0000)
src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx

index 7e4409a5a352173b947bad2679baa298b9fbca7b..2e9b3160dc6f7151a7d79c3c51f36a384d105990 100644 (file)
@@ -50,7 +50,7 @@ static int MYDEBUG = 0;
 //            and the pathes prefixes for all computers
 //----------------------------------------------------------------------  
 SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
-(SALOME_ModuleCatalog::Component &C) : _Component(C)
+(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C)
 {
   if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
 
index c7b580a177ca6a405ea4101cb8fd4580f94175b4..943d5d02e2237ceb94e112264cc8c7caa0cb5c48 100644 (file)
@@ -40,7 +40,7 @@ class MODULECATALOG_EXPORT SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOM
 {
 public:
   //! standard constructor
-  SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::Component &C);
+  SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::ComponentDef &C);
 
   //! standard destructor
   virtual ~SALOME_ModuleCatalog_AcomponentImpl();
@@ -143,7 +143,7 @@ public:
 
 private :
 
-  SALOME_ModuleCatalog::Component _Component;
+  SALOME_ModuleCatalog::ComponentDef _Component;
 
  //! method to duplicate an interface
   /*!
index 5aa0ab5ab45cfe6fda4a96b6f36fb6c36b4ecdb4..02384368c754f3196b110b6e60db53ccf8420e13 100644 (file)
@@ -160,8 +160,6 @@ int main(int argc,char **argv)
 
 void PrintComponent(SALOME_ModuleCatalog::Acomponent_ptr C)
 {
-  const char *_name = C->componentname();
-
   MESSAGE("Name : " <<  C->componentname());
   MESSAGE("Type : " << C->component_type() << " multistudy : " << C->multistudy());
   MESSAGE("Constraint : " << C->constraint());
index c4104d9bdd6f06477c75abb2ff062f4c60b35881..97c257dedf538bf1161d02e5711b3d283886c7a8 100644 (file)
@@ -45,7 +45,12 @@ static int MYDEBUG = 0;
 // Function : SALOME_ModuleCatalog_Handler
 // Purpose  : Constructor
 //----------------------------------------------------------------------
-SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
+SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,
+                                                           ParserComponents& moduleList,
+                                                           ParserTypes& typeMap,
+                                                           TypeList& typeList):_typeMap(typeMap),_typeList(typeList),
+                                                                               _pathList(pathList),_moduleList(moduleList)
+
 {
   if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler");
 
@@ -145,7 +150,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
   // Processing the document nodes
   while(aCurNode != NULL)
   {
-    // Process path prefix list (tag test_path_prefix_list)
+    // Part 1: Process path prefix list (tag test_path_prefix_list)
     if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) )
     {
       xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
@@ -196,7 +201,199 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
       }
     }
 
-    //@ Process list of components (tag test_component_list)
+    //Part 2: Process list of types
+    if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)"type-list") )
+      {
+        xmlNodePtr aTypeNode = aCurNode->xmlChildrenNode;
+        while (aTypeNode != NULL)
+          {
+            //  match "type"
+            if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"type" )) 
+              {
+                // Here is a basic type description
+                ParserType aType;
+                xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+                if(name)
+                  {
+                    aType.name = (const char*)name;
+                    xmlFree(name);
+                  }
+                xmlChar *kind=xmlGetProp(aTypeNode,(const xmlChar*)"kind");
+                if(kind)
+                  {
+                    aType.kind = (const char*)kind;
+                    xmlFree(kind);
+                  }
+                if(aType.kind == "double" ||
+                   aType.kind == "int"    ||
+                   aType.kind == "bool"    ||
+                   aType.kind == "string")
+                  {
+                    if ( _typeMap.find(aType.name) == _typeMap.end() )
+                      {
+                        std::cerr << "Registered basic type: " << aType.name << " " << aType.kind << std::endl;
+                        _typeMap[aType.name]=aType;
+                        _typeList.push_back(aType);
+                      }
+                    else
+                      std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
+                  }
+                else
+                  std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." << std::endl;
+              }
+            else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"sequence" )) 
+              {
+                // Here is a sequence type description
+                ParserSequence aType;
+                xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+                if(name)
+                  {
+                    aType.name = (const char*)name;
+                    xmlFree(name);
+                  }
+                xmlChar *content=xmlGetProp(aTypeNode,(const xmlChar*)"content");
+                if(content)
+                  {
+                    aType.content = (const char*)content;
+                    xmlFree(content);
+                  }
+                if ( _typeMap.find(aType.content) != _typeMap.end() )
+                  {
+                    if ( _typeMap.find(aType.name) == _typeMap.end() )
+                      {
+                        std::cerr << "Registered sequence type: " << aType.name << " " << aType.content << std::endl;
+                        _typeMap[aType.name]=aType;
+                        _typeList.push_back(aType);
+                      }
+                    else
+                      std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
+                  }
+                else
+                  {
+                    std::cerr << "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." << std::endl;
+                  }
+              }
+            else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"objref" )) 
+              {
+                // Here is an objref type description
+                ParserObjref aType;
+                int error=0;
+                xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+                if(name)
+                  {
+                    aType.name = (const char*)name;
+                    xmlFree(name);
+                  }
+                xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id");
+                if(id)
+                  {
+                    aType.id = (const char*)id;
+                    xmlFree(id);
+                  }
+
+                xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode;
+                while (aTypeSubNode != NULL)
+                  {
+                    if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"base" )) 
+                      {
+                        //a base type
+                        xmlChar* content = xmlNodeGetContent(aTypeSubNode);
+                        if(content)
+                          {
+                            std::string base=(const char*)content;
+                            xmlFree(content);
+                            if ( _typeMap.find(base) != _typeMap.end() && _typeMap[base].kind == "objref")
+                              {
+                                aType.bases.push_back(base);
+                              }
+                            else
+                              {
+                                std::cerr << "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." << std::endl;
+                                error=1;
+                                break;
+                              }
+                          }
+                      }
+                    aTypeSubNode = aTypeSubNode->next;
+                  }
+                if(!error)
+                  {
+                    if ( _typeMap.find(aType.name) == _typeMap.end() )
+                      {
+                        std::cerr << "Registered objref type: " << aType.name << " " << aType.id << std::endl;
+                        _typeMap[aType.name]=aType;
+                        _typeList.push_back(aType);
+                      }
+                    else
+                      std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
+                  }
+              }
+            else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"struct" )) 
+              {
+                // Here is a struct type description
+                ParserStruct aType;
+                int error=0;
+                xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+                if(name)
+                  {
+                    aType.name = (const char*)name;
+                    xmlFree(name);
+                  }
+                xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id");
+                if(id)
+                  {
+                    aType.id = (const char*)id;
+                    xmlFree(id);
+                  }
+
+                xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode;
+                while (aTypeSubNode != NULL)
+                  {
+                    if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"member" )) 
+                      {
+                        std::pair<std::string,std::string> member;
+                        xmlChar * m_name=xmlGetProp(aTypeSubNode,(const xmlChar*)"name");
+                        if(m_name)
+                          {
+                            member.first=(const char*)m_name;
+                            xmlFree(m_name);
+                          }
+                        xmlChar * m_type=xmlGetProp(aTypeSubNode,(const xmlChar*)"type");
+                        if(m_type)
+                          {
+                            member.second=(const char*)m_type;
+                            xmlFree(m_type);
+                          }
+                        if ( _typeMap.find(member.second) != _typeMap.end() )
+                          {
+                            aType.members.push_back(member);
+                          }
+                        else
+                          {
+                            std::cerr << "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." << std::endl;
+                            error=1;
+                            break;
+                          }
+                      }
+                    aTypeSubNode = aTypeSubNode->next;
+                  }
+                if(!error)
+                  {
+                    if ( _typeMap.find(aType.name) == _typeMap.end() )
+                      {
+                        std::cerr << "Registered struct type: " << aType.name << " " << aType.id << std::endl;
+                        _typeMap[aType.name]=aType;
+                        _typeList.push_back(aType);
+                      }
+                    else
+                      std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored."  << std::endl;
+                  }
+              } // end of struct
+            aTypeNode = aTypeNode->next;
+          }
+      }
+
+    //Part 3: Process list of components (tag test_component_list)
     if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) )
     {
       xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode;
@@ -325,7 +522,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
                 xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode;
                 while(aCompServiceNode != NULL) {
                   // Tag test_service
-                  if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)test_interface_name) ) {
+                  if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)"component-service") ) {
                     xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode;
                     while(aCompServiceSubNode != NULL)
                     {
index d8c27c5a8380f040dd70835ed62bcd566a11021a..22f7c416af191ca84c653252947ec887a9848d80 100644 (file)
@@ -43,7 +43,7 @@ class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler
 {
 public:
   //! standard constructor
-  SALOME_ModuleCatalog_Handler();
+  SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,ParserComponents& moduleList,ParserTypes& typeMap,TypeList& typeList);
 
   //! standard destructor
   virtual ~SALOME_ModuleCatalog_Handler();
@@ -107,6 +107,8 @@ private:
   
   ParserComponent _aModule;
   
+  ParserPathPrefixes&  _pathList;
+  ParserComponents&    _moduleList;
   
   ParserInterfaces _interfaceList;
   ParserInterface  _aInterface;
@@ -126,6 +128,12 @@ private:
   ParserDataStreamParameters _outDataStreamParamList;
   ParserDataStreamParameter  _outDataStreamParam;
 
+  ParserTypes& _typeMap;
+  TypeList& _typeList;
+
+  ParserSequences _sequenceMap;
+  ParserObjrefs _objrefMap;
+  ParserStructs _structMap;
 };
 
 #endif // SALOME_CATALOG_HANDLER_H
index 6d797172a9474abf31a25fa72c38b5d00cceca0b..8369f99177c6934a68a3d418e5e7930604b791d6 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <string>
 #include <vector>
+#include <map>
 
 // Type Definitions
 struct ParserPathPrefix
@@ -102,16 +103,35 @@ struct ParserComponent
 
 typedef std::vector<ParserComponent> ParserComponents ;
 
-#ifdef WRITE_CATA_COMPONENT
-// contains all the paths and the computers defined in the catalog 
-       ParserPathPrefixes  _pathList;
-  
-// contains all the modules defined in the catalog
-       ParserComponents    _moduleList; 
-#else
-extern ParserPathPrefixes _pathList;
-extern ParserComponents   _moduleList; 
-#endif
+struct ParserType
+{
+  std::string         name;
+  std::string         kind;
+  std::string         id;
+  std::string         content;
+  std::vector<std::string> bases;
+  std::vector< std::pair<std::string,std::string> > members;
+};
+typedef std::map<std::string,ParserType> ParserTypes ;
+typedef std::map<std::string,ParserType&> RefTypes ;
+typedef std::vector<ParserType> TypeList ;
+
+struct ParserSequence:public ParserType
+{
+  ParserSequence(){kind="sequence";}
+};
+typedef std::map<std::string,ParserSequence> ParserSequences ;
 
+struct ParserObjref:public ParserType
+{
+  ParserObjref(){kind="objref";}
+};
+typedef std::map<std::string,ParserObjref> ParserObjrefs ;
+
+struct ParserStruct:public ParserType
+{
+  ParserStruct(){kind="struct";}
+};
+typedef std::map<std::string,ParserStruct> ParserStructs ;
 
 #endif // SALOME_CATALOG_PARSER_H
index 735ff5b13264ec8edaf57070e03758b6d19d66b7..892b2fbb86a001a44c37fe08b6cd5e818c08f922 100644 (file)
@@ -39,7 +39,7 @@ using namespace std;
 int main(int argc,char **argv)
 {
   // initialize the ORB
-  CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+  CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
   //  LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
   try 
     {
@@ -137,19 +137,19 @@ int main(int argc,char **argv)
   
       // Active catalog
 
-      SALOME_ModuleCatalogImpl Catalogue_i(argc, argv, orb);
-      poa->activate_object (&Catalogue_i);
+      SALOME_ModuleCatalogImpl* Catalogue_i=new SALOME_ModuleCatalogImpl(argc, argv, orb);
+      PortableServer::ObjectId_var cataid = poa->activate_object (Catalogue_i);
 
+      //activate POA manager
       mgr->activate();
-
   
-      CORBA::Object_ptr myCata = Catalogue_i._this();
+      CORBA::Object_var myCata = Catalogue_i->_this();
+      Catalogue_i->_remove_ref();
 
       // initialise Naming Service
-      SALOME_NamingService *_NS;
-      _NS = new SALOME_NamingService(orb);
+      SALOME_NamingService _NS(orb);
       // register Catalog in Naming Service
-      _NS->Register(myCata ,"/Kernel/ModulCatalog");
+      _NS.Register(myCata ,"/Kernel/ModulCatalog");
 
       MESSAGE("Running CatalogServer.");
 
@@ -161,6 +161,8 @@ int main(int argc,char **argv)
       timer.ShowAbsolute();
 #endif
       orb->run();
+      std::cerr << "server returned from orb->run()" << std::endl;
+      orb->destroy();
  
 //       mgr->deactivate(true,true);
 //       poa->destroy(1,1);
index 819e342b7bc54d93adb85b96bc82b9444619b46f..0eed8ce4f05891a8ece8e9a6ed996555c44c4769 100644 (file)
@@ -52,12 +52,19 @@ list<string> splitStringToList(const string& theString, const string& theSeparat
   int sepLen = theSeparator.length();
   int startPos = 0, sepPos = theString.find(theSeparator, startPos);
 
-  for ( ; (startPos < theString.length()) && (sepPos != string::npos); sepPos = theString.find(theSeparator, startPos))
+  while (1)
     {
-      string anItem = theString.substr(startPos, sepPos - startPos);
+      string anItem ;
+      if(sepPos != string::npos)
+        anItem = theString.substr(startPos, sepPos - startPos);
+      else
+        anItem = theString.substr(startPos);
       if (anItem.length() > 0)
        aList.push_back(anItem);
+      if(sepPos == string::npos)
+        break;
       startPos = sepPos + sepLen;
+      sepPos = theString.find(theSeparator, startPos);
     }
 
   return aList;
@@ -152,7 +159,9 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA:
 
       _parse_xml_file(aPath.c_str(), 
                      _general_module_list, 
-                     _general_path_list);
+                     _general_path_list,
+                      _typeMap,
+                      _typeList);
     }
     
     // Verification of _general_path_list content
@@ -169,7 +178,9 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA:
       // _personal_path_list members with the personal catalog files
       _parse_xml_file(_personal_path,
                      _personal_module_list, 
-                     _personal_path_list);
+                     _personal_path_list,
+                      _typeMap,
+                      _typeList);
       
       // Verification of _general_path_list content
       if(!_verify_path_prefix(_personal_path_list)){
@@ -195,6 +206,76 @@ SALOME_ModuleCatalogImpl::~SALOME_ModuleCatalogImpl()
 }
 
 
+//! Get the list of all types of the catalog
+/*!
+ *   \return  the list of types
+ */
+SALOME_ModuleCatalog::ListOfTypeDefinition* SALOME_ModuleCatalogImpl::GetTypes()
+{
+  SALOME_ModuleCatalog::ListOfTypeDefinition_var type_list = new SALOME_ModuleCatalog::ListOfTypeDefinition();
+  type_list->length(_typeList.size());
+
+  for (int ind = 0 ; ind < _typeList.size() ; ind++)
+    {
+      std::cerr << "name: " << _typeList[ind].name << std::endl;
+      //no real need to call string_dup, omniorb calls it on operator= (const char *) but it is safer
+      type_list[ind].name=CORBA::string_dup(_typeList[ind].name.c_str());
+      type_list[ind].kind=SALOME_ModuleCatalog::NONE;
+      if(_typeList[ind].kind=="double")
+        type_list[ind].kind=SALOME_ModuleCatalog::Dble;
+      else if(_typeList[ind].kind=="int")
+        type_list[ind].kind=SALOME_ModuleCatalog::Int;
+      else if(_typeList[ind].kind=="bool")
+        type_list[ind].kind=SALOME_ModuleCatalog::Bool;
+      else if(_typeList[ind].kind=="string")
+        type_list[ind].kind=SALOME_ModuleCatalog::Str;
+      else if(_typeList[ind].kind=="objref")
+        {
+          type_list[ind].kind=SALOME_ModuleCatalog::Objref;
+          type_list[ind].id=CORBA::string_dup(_typeList[ind].id.c_str());
+          //bases
+          type_list[ind].bases.length(_typeList[ind].bases.size());
+          std::vector<std::string>::const_iterator miter;
+          miter=_typeList[ind].bases.begin();
+          int n_memb=0;
+          while(miter != _typeList[ind].bases.end())
+            {
+              type_list[ind].bases[n_memb]=CORBA::string_dup(miter->c_str());
+              miter++;
+              n_memb++;
+            }
+        }
+      else if(_typeList[ind].kind=="sequence")
+        {
+          type_list[ind].kind=SALOME_ModuleCatalog::Seq;
+          type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str());
+        }
+      else if(_typeList[ind].kind=="array")
+        {
+          type_list[ind].kind=SALOME_ModuleCatalog::Array;
+          type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str());
+        }
+      else if(_typeList[ind].kind=="struct")
+        {
+          type_list[ind].kind=SALOME_ModuleCatalog::Struc;
+          //members
+          type_list[ind].members.length(_typeList[ind].members.size());
+
+          std::vector< std::pair<std::string,std::string> >::const_iterator miter;
+          miter=_typeList[ind].members.begin();
+          int n_memb=0;
+          while(miter != _typeList[ind].members.end())
+            {
+              type_list[ind].members[n_memb].name=CORBA::string_dup(miter->first.c_str());
+              type_list[ind].members[n_memb].type=CORBA::string_dup(miter->second.c_str());
+              n_memb++;
+              miter++;
+            }
+        }
+    }
+  return type_list._retn();
+}
+
 //----------------------------------------------------------------------
 // Function : GetComputerList
 // Purpose  : get a computer list
@@ -434,6 +515,9 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT
       if  (_personal_module_list[ind].type == _temp_component_type)
        {
          _list_typed_component->length(_j + 1); 
+         /* Is it an error ?
+           * _list_typed_component[_j] = _personal_module_list[ind].name.c_str();
+           */
          _list_typed_component[_j] = (_moduleList[ind].name).c_str();
          //if(MYDEBUG) SCRUTE(_list_typed_component[_j]);
          _j++;
@@ -509,7 +593,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name)
     
     //    DebugParserComponent(*C_parser);
 
-    SALOME_ModuleCatalog::Component C_corba;
+    SALOME_ModuleCatalog::ComponentDef C_corba;
     duplicate(C_corba, *C_parser);
 
     
@@ -528,7 +612,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name)
   return compo;
 }
 
-SALOME_ModuleCatalog::Component *
+SALOME_ModuleCatalog::ComponentDef *
 SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
 {
   std::string s(name);
@@ -537,8 +621,8 @@ SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
   
   if (C_parser) {
     
-    SALOME_ModuleCatalog::Component * C_corba 
-      = new SALOME_ModuleCatalog::Component; 
+    SALOME_ModuleCatalog::ComponentDef * C_corba 
+      = new SALOME_ModuleCatalog::ComponentDef
     duplicate(*C_corba, *C_parser);
     return C_corba;
   }
@@ -585,12 +669,18 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name)
 void 
 SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, 
                                          ParserComponents& modulelist, 
-                                         ParserPathPrefixes& pathList)
+                                         ParserPathPrefixes& pathList,
+                                          ParserTypes& typeMap,
+                                          TypeList& typeList)
 {
   if(MYDEBUG) BEGIN_OF("_parse_xml_file");
   if(MYDEBUG) SCRUTE(file);
 
-  SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
+  //Local path and module list for the file to parse
+  ParserPathPrefixes  _pathList;
+  ParserComponents    _moduleList;
+  SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(_pathList,_moduleList,typeMap,typeList);
 
   FILE* aFile = fopen(file, "r");
 
@@ -635,7 +725,7 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
 void 
 SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file)
 {
-  _parse_xml_file(file, _personal_module_list, _personal_path_list);
+  _parse_xml_file(file, _personal_module_list, _personal_path_list,_typeMap,_typeList);
 }
 
 
@@ -650,7 +740,7 @@ SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file)
 // Purpose  : create a component from the catalog parsing
 //----------------------------------------------------------------------
 void SALOME_ModuleCatalogImpl::duplicate
-(SALOME_ModuleCatalog::Component & C_corba, 
+(SALOME_ModuleCatalog::ComponentDef & C_corba, 
  const ParserComponent & C_parser)
 {
   C_corba.name = CORBA::string_dup(C_parser.name.c_str());
index 0768c5de776881a377c115885e9717ade830b5aa..05f0ad7d4ce1ffd070e3fb7a5eb26cd003185844 100644 (file)
@@ -55,6 +55,12 @@ public:
   */
   virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
 
+  //! method to get the list of all types of the catalog
+  /*!
+   * \return the types list
+   */
+  virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes();
+
   //! method to get the PathPrefix of a computer
  /*! If the wanted computer doesn't exist, the Notfound exception is thrown
    \param machinename const char* arguments 
@@ -100,7 +106,7 @@ public:
     \param componentname const char* arguments 
     \return the wanted component description
   */
-  virtual SALOME_ModuleCatalog::Component *
+  virtual SALOME_ModuleCatalog::ComponentDef *
     GetComponentInfo(const char *name);
 
   void ping(){};
@@ -113,10 +119,13 @@ private:
     \param file const char* arguments
     \param modulelist ParserComponents arguments
     \param pathlist ParserPathPrefixes arguments
+    \param typeMap ParserTypes arguments
   */
   virtual void _parse_xml_file(const char* file, 
                          ParserComponents & modulelist, 
-                         ParserPathPrefixes & pathlist);
+                         ParserPathPrefixes & pathlist,
+        ParserTypes& typeMap,
+        TypeList& typeList);
 
   //! method to find component in the parser list
   /*!
@@ -130,7 +139,7 @@ private:
     \param C_corba  Component argument
     \param C_parser const ParserComponent argument
   */
-  void duplicate(SALOME_ModuleCatalog::Component & C_corba,
+  void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba,
                 const ParserComponent & C_parser);
     
   //! method to create a CORBA interface description from parser
@@ -199,6 +208,8 @@ private:
   // These variables will contain the informations on the general common catalog
   ParserComponents    _general_module_list ;
   ParserPathPrefixes  _general_path_list ;
+  ParserTypes _typeMap;
+  TypeList _typeList;
 
   // These variables will contain the informations on the personal catalog
   ParserComponents    _personal_module_list ;