Salome HOME
updated copyright message
[modules/kernel.git] / src / ModuleCatalog / SALOME_ModuleCatalog_impl.hxx
1 // Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
24 //  File   : SALOME_ModuleCatalog_impl.hxx
25 //  Author : Estelle Deville
26 //  Module : SALOME
27 //  $Header$
28 //
29 #ifndef __SALOME_MODULECATALOG_IMPL_HXX__
30 #define __SALOME_MODULECATALOG_IMPL_HXX__
31 #pragma once
32
33 #include "SALOME_ModuleCatalog.hxx"
34 #include "SALOME_KernelServices.hxx"
35
36 #include <string>
37 #include <map>
38
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
41
42 #ifdef WIN32
43 #pragma warning(disable:4275) // Disable warning interface non dll
44 #pragma warning(disable:4290) // Warning Exception ...
45 #endif
46
47 namespace KERNEL
48 {
49   MODULECATALOG_EXPORT SALOME_ModuleCatalog::ModuleCatalog_ptr getModuleComponentServantSA(const char *listOfCatalogs = nullptr);
50 }
51
52 class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog
53 {
54   class Private;
55
56 public:
57   //! standard constructor
58   SALOME_ModuleCatalogImpl(int artgc, char** argv, CORBA::ORB_ptr orb = NULL);
59
60   //! standard destructor
61   virtual ~SALOME_ModuleCatalogImpl();
62
63   //! method to get a component list
64   /*!
65    * \return a component list 
66    */
67   virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
68
69   //! method to get the list of all types of the catalog
70   /*!
71    * \return the types list
72    */
73   virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes();
74
75   //! method to get the PathPrefix of a computer
76   /*! If the wanted computer doesn't exist, the Notfound exception is thrown
77    * \param machinename const char* arguments 
78    * \return the prefix path
79   */
80   virtual char* GetPathPrefix(const char* machinename);
81
82   //! method to read a XML file and import new components into the component list
83   /*! If the XML file doesn't exist or is not readable, the Notfound exception is thrown
84    * \param  const char* xmlFileName 
85    */
86   virtual void ImportXmlCatalogFile(const char* xmlFileName);
87
88   //! method to get a component list
89   /*!
90    * \return a component list 
91    */
92   virtual SALOME_ModuleCatalog::ListOfComponents* GetComponentList();
93
94   //! method to get a component list of component name and component icone
95   /*!
96    * \return a list of couple (component name, component icone) 
97    */
98   virtual SALOME_ModuleCatalog::ListOfIAPP_Affich* GetComponentIconeList();
99
100   //! method to get a component list of a wanted type
101   /*!
102    * \return a component list 
103    */
104   virtual SALOME_ModuleCatalog::ListOfComponents* 
105     GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type);
106
107   //! method to get a component
108   /*!
109    * \param componentname const char* arguments 
110    * \return the wanted component
111    */
112   virtual SALOME_ModuleCatalog::Acomponent_ptr 
113     GetComponent(const char* componentname);
114   
115   //! method to get a component description
116   /*!
117    * \param componentname const char* arguments 
118    * \return the wanted component description
119    */
120   virtual SALOME_ModuleCatalog::ComponentDef*
121     GetComponentInfo(const char *name);
122
123   //! method to check the server is alive
124   void ping();
125
126   //! get PID of the server
127   CORBA::Long getPID();
128
129   //! shutdown server and exit
130   void ShutdownWithExit();
131
132   //! shutdown server
133   void shutdown();
134
135   static const char ENTRY_IN_NS[];
136
137 private:
138   //! method to parse arguments to get general and personal catalog files
139   /*!
140    * \param argc int arguments
141    * \param argv char** arguments
142    * \param _general char** arguments
143    * \return true if parsing is OK
144    */
145   virtual bool _parseArguments(int argc, char **argv, 
146                                char **_general, char** _personal);
147
148
149   CORBA::ORB_ptr _orb;
150   Private* myPrivate;
151 };
152 #endif //__SALOME_MODULECATALOG_IMPL_HXX__