1 // SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_ModuleCatalog_impl.hxx
25 // Author : Estelle Deville
30 #ifndef MODULECATALOG_IMPL_H
31 #define MODULECATALOG_IMPL_H
33 #include "utilities.h"
37 #include "SALOME_ModuleCatalog_Handler.hxx"
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
42 class SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog,
43 public PortableServer::RefCountServantBase
46 //! standard constructor
47 SALOME_ModuleCatalogImpl(int artgc, char** argv, CORBA::ORB_ptr orb = NULL);
49 //! standard destructor
50 virtual ~SALOME_ModuleCatalogImpl();
52 //! method to get a component list
54 \return a component list
56 virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
58 //! method to get the PathPrefix of a computer
59 /*! If the wanted computer doesn't exist, the Notfound exception is thrown
60 \param machinename const char* arguments
61 \return the prefix path
63 virtual char* GetPathPrefix(const char* machinename);
65 //! method to read a XML file and import new components into the component list
66 /*! If the XML file doesn't exist or is not readable, the Notfound exception is thrown
67 \param const char* xmlFileName
69 virtual void ImportXmlCatalogFile(const char* xmlFileName);
71 //! method to get a component list
73 \return a component list
75 virtual SALOME_ModuleCatalog::ListOfComponents* GetComponentList();
77 //! method to get a component list of component name and component icone
79 \return a list of couple (component name, component icone)
81 virtual SALOME_ModuleCatalog::ListOfIAPP_Affich* GetComponentIconeList();
83 //! method to get a component list of a wanted type
85 \return a component list
87 virtual SALOME_ModuleCatalog::ListOfComponents*
88 GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type);
90 //! method to get a component
92 \param componentname const char* arguments
93 \return the wanted component
95 virtual SALOME_ModuleCatalog::Acomponent_ptr
96 GetComponent(const char* componentname);
98 //! method to get a component description
100 \param componentname const char* arguments
101 \return the wanted component description
103 virtual SALOME_ModuleCatalog::Component *
104 GetComponentInfo(const char *name);
108 void shutdown() { if (_orb) _orb->shutdown(1); };
111 //! method to parse one module catalog
113 \param file const char* arguments
114 \param modulelist ParserComponents arguments
115 \param pathlist ParserPathPrefixes arguments
117 virtual void _parse_xml_file(const char* file,
118 ParserComponents & modulelist,
119 ParserPathPrefixes & pathlist);
121 //! method to find component in the parser list
123 \param name string argument
124 \return pointer on a component, NULL if not found
126 ParserComponent *findComponent(const string & name);
128 //! method to create a CORBA component description from parser
130 \param C_corba Component argument
131 \param C_parser const ParserComponent argument
133 void duplicate(SALOME_ModuleCatalog::Component & C_corba,
134 const ParserComponent & C_parser);
136 //! method to create a CORBA interface description from parser
138 \param I_corba DefinitionInterface argument
139 \param I_parser const ParserInterface argument
141 void duplicate(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
142 const ParserInterface & I_parser);
144 //! method to create a CORBA service description from parser
146 \param S_corba Service argument
147 \param S_parser const ParserService argument
149 void duplicate(SALOME_ModuleCatalog::Service & S_corba,
150 const ParserService & service);
152 //! method to create a CORBA parameter description from parser
154 \param P_corba ServicesParameter argument
155 \param P_parser const ParserParameter argument
157 void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_corba,
158 const ParserParameter & P_parser);
160 //! method to create a CORBA datastream parameter description from parser
162 \param P_corba ServicesDataStreamParameter argument
163 \param P_parser const ParserDataStreamParameter argument
165 void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
166 const ParserDataStreamParameter & P_parser);
168 //! method to create the path prefix structures from the catalog parsing
170 \param pathes ParserPathPrefixes arguments
173 void duplicate(ParserPathPrefixes & p_out, const ParserPathPrefixes & P_in);
175 //! method to verify path prefix content
177 \param pathlist ListOfParserPathPrefix arguments
178 \return true if verfication is OK
180 virtual bool _verify_path_prefix(ParserPathPrefixes & pathlist);
183 //! method to parse arguments to get general and personal catalog files
185 \param argc int arguments
186 \param argv char** arguments
187 \param _general char** arguments
188 \return true if parsing is OK
190 virtual bool _parseArguments(int argc, char **argv,
191 char **_general, char** _personal);
194 // Theses variables will contain the path to the general and personal catalogs
196 char* _personal_path;
199 // These variables will contain the informations on the general common catalog
200 ParserComponents _general_module_list ;
201 ParserPathPrefixes _general_path_list ;
203 // These variables will contain the informations on the personal catalog
204 ParserComponents _personal_module_list ;
205 ParserPathPrefixes _personal_path_list ;
207 std::map <std::string, SALOME_ModuleCatalog::DataStreamType>
208 DataStreamTypeConvert;
210 std::map <std::string, SALOME_ModuleCatalog::DataStreamDependency>
211 DataStreamDepConvert;
213 std::map <ParserComponentType, SALOME_ModuleCatalog::ComponentType>
214 ComponentTypeConvert;
219 #endif // MODULECATALOG_IMPL_H