Salome HOME
ADD a end user module (services.py) to help the manipulation of SALOME KERNEL service...
[modules/kernel.git] / src / ModuleCatalog / SALOME_ModuleCatalog_impl.hxx
index d09e02da6ed8b189d3156852022e5f50a5332828..14a64271290e581c4f2e5f6df36af6733a62e8ac 100644 (file)
@@ -1,35 +1,36 @@
-//  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
+//  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
 //  File   : SALOME_ModuleCatalog_impl.hxx
 //  Author : Estelle Deville
 //  Module : SALOME
 //  $Header$
-
-
+//
 #ifndef MODULECATALOG_IMPL_H
 #define MODULECATALOG_IMPL_H
 
+#include "SALOME_ModuleCatalog.hxx"
+
 #include <string>
 #include <map>
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
 
-
-#if defined MODULECATALOG_EXPORTS
-#if defined WIN32
-#define MODULECATALOG_EXPORT __declspec( dllexport )
-#else
-#define MODULECATALOG_EXPORT
-#endif
-#else
-#if defined WNT
-#define MODULECATALOG_EXPORT __declspec( dllimport )
-#else
-#define MODULECATALOG_EXPORT
-#endif
+#ifdef WNT
+#pragma warning(disable:4275) // Disable warning interface non dll
+#pragma warning(disable:4290) // Warning Exception ...
 #endif
 
-class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog,
-                               public PortableServer::RefCountServantBase 
+class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog
 {
 public:
   //! standard constructor
@@ -69,6 +59,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 
@@ -114,12 +110,14 @@ 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(){};
+  CORBA::Long getPID();
+  void ShutdownWithExit();
 
-  void shutdown() { if (_orb) _orb->shutdown(1); };
+  void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };
 
 private:
   //! method to parse one module catalog
@@ -127,10 +125,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);
+                          ParserComponents & modulelist, 
+                          ParserPathPrefixes & pathlist,
+        ParserTypes& typeMap,
+        TypeList& typeList);
 
   //! method to find component in the parser list
   /*!
@@ -144,8 +145,8 @@ private:
     \param C_corba  Component argument
     \param C_parser const ParserComponent argument
   */
-  void duplicate(SALOME_ModuleCatalog::Component & C_corba,
-                const ParserComponent & C_parser);
+  void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba,
+                 const ParserComponent & C_parser);
     
   //! method to create a CORBA interface description from parser
   /*!
@@ -153,7 +154,7 @@ private:
     \param I_parser const ParserInterface argument
   */
   void duplicate(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
-                const ParserInterface & I_parser);
+                 const ParserInterface & I_parser);
   
   //! method to create a CORBA service description from parser
   /*!
@@ -161,7 +162,7 @@ private:
     \param S_parser const ParserService argument
   */
   void duplicate(SALOME_ModuleCatalog::Service & S_corba,
-                const ParserService & service);
+                 const ParserService & service);
   
   //! method to create a CORBA parameter description from parser
   /*!
@@ -169,7 +170,7 @@ private:
     \param P_parser const ParserParameter argument
   */
   void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_corba,
-                const ParserParameter & P_parser);
+                 const ParserParameter & P_parser);
   
   //! method to create a CORBA datastream parameter description from parser
   /*!
@@ -177,7 +178,7 @@ private:
     \param P_parser const ParserDataStreamParameter argument
   */
   void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
-                const ParserDataStreamParameter & P_parser);
+                 const ParserDataStreamParameter & P_parser);
   
   //! method to create the path prefix structures from the catalog parsing
   /*!
@@ -202,7 +203,7 @@ private:
     \return true if parsing is OK
   */
   virtual bool _parseArguments(int argc, char **argv, 
-                              char **_general, char** _personal);
+                               char **_general, char** _personal);
 
 
   // Theses variables will contain the path to the general and personal catalogs
@@ -213,14 +214,13 @@ 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 ;
   ParserPathPrefixes  _personal_path_list ; 
 
-  std::map <std::string, SALOME_ModuleCatalog::DataStreamType> 
-  DataStreamTypeConvert;
-
   std::map <std::string, SALOME_ModuleCatalog::DataStreamDependency> 
   DataStreamDepConvert;