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.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SALOME_ModuleCatalog_impl.hxx
25 // Author : Estelle Deville
30 #ifndef MODULECATALOG_IMPL_H
31 #define MODULECATALOG_IMPL_H
33 #include <SALOME_ModuleCatalog.hxx>
38 #include "SALOME_ModuleCatalog_Handler.hxx"
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
43 class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog
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 list of all types of the catalog
60 * \return the types list
62 virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes();
64 //! method to get the PathPrefix of a computer
65 /*! If the wanted computer doesn't exist, the Notfound exception is thrown
66 \param machinename const char* arguments
67 \return the prefix path
69 virtual char* GetPathPrefix(const char* machinename);
71 //! method to read a XML file and import new components into the component list
72 /*! If the XML file doesn't exist or is not readable, the Notfound exception is thrown
73 \param const char* xmlFileName
75 virtual void ImportXmlCatalogFile(const char* xmlFileName);
77 //! method to get a component list
79 \return a component list
81 virtual SALOME_ModuleCatalog::ListOfComponents* GetComponentList();
83 //! method to get a component list of component name and component icone
85 \return a list of couple (component name, component icone)
87 virtual SALOME_ModuleCatalog::ListOfIAPP_Affich* GetComponentIconeList();
89 //! method to get a component list of a wanted type
91 \return a component list
93 virtual SALOME_ModuleCatalog::ListOfComponents*
94 GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type);
96 //! method to get a component
98 \param componentname const char* arguments
99 \return the wanted component
101 virtual SALOME_ModuleCatalog::Acomponent_ptr
102 GetComponent(const char* componentname);
104 //! method to get a component description
106 \param componentname const char* arguments
107 \return the wanted component description
109 virtual SALOME_ModuleCatalog::ComponentDef *
110 GetComponentInfo(const char *name);
113 CORBA::Long getPID();
114 void ShutdownWithExit();
116 void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };
119 //! method to parse one module catalog
121 \param file const char* arguments
122 \param modulelist ParserComponents arguments
123 \param pathlist ParserPathPrefixes arguments
124 \param typeMap ParserTypes arguments
126 virtual void _parse_xml_file(const char* file,
127 ParserComponents & modulelist,
128 ParserPathPrefixes & pathlist,
129 ParserTypes& typeMap,
132 //! method to find component in the parser list
134 \param name string argument
135 \return pointer on a component, NULL if not found
137 ParserComponent *findComponent(const std::string & name);
139 //! method to create a CORBA component description from parser
141 \param C_corba Component argument
142 \param C_parser const ParserComponent argument
144 void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba,
145 const ParserComponent & C_parser);
147 //! method to create a CORBA interface description from parser
149 \param I_corba DefinitionInterface argument
150 \param I_parser const ParserInterface argument
152 void duplicate(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
153 const ParserInterface & I_parser);
155 //! method to create a CORBA service description from parser
157 \param S_corba Service argument
158 \param S_parser const ParserService argument
160 void duplicate(SALOME_ModuleCatalog::Service & S_corba,
161 const ParserService & service);
163 //! method to create a CORBA parameter description from parser
165 \param P_corba ServicesParameter argument
166 \param P_parser const ParserParameter argument
168 void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_corba,
169 const ParserParameter & P_parser);
171 //! method to create a CORBA datastream parameter description from parser
173 \param P_corba ServicesDataStreamParameter argument
174 \param P_parser const ParserDataStreamParameter argument
176 void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
177 const ParserDataStreamParameter & P_parser);
179 //! method to create the path prefix structures from the catalog parsing
181 \param pathes ParserPathPrefixes arguments
184 void duplicate(ParserPathPrefixes & p_out, const ParserPathPrefixes & P_in);
186 //! method to verify path prefix content
188 \param pathlist ListOfParserPathPrefix arguments
189 \return true if verfication is OK
191 virtual bool _verify_path_prefix(ParserPathPrefixes & pathlist);
194 //! method to parse arguments to get general and personal catalog files
196 \param argc int arguments
197 \param argv char** arguments
198 \param _general char** arguments
199 \return true if parsing is OK
201 virtual bool _parseArguments(int argc, char **argv,
202 char **_general, char** _personal);
205 // Theses variables will contain the path to the general and personal catalogs
207 char* _personal_path;
210 // These variables will contain the informations on the general common catalog
211 ParserComponents _general_module_list ;
212 ParserPathPrefixes _general_path_list ;
213 ParserTypes _typeMap;
216 // These variables will contain the informations on the personal catalog
217 ParserComponents _personal_module_list ;
218 ParserPathPrefixes _personal_path_list ;
220 std::map <std::string, SALOME_ModuleCatalog::DataStreamDependency>
221 DataStreamDepConvert;
223 std::map <ParserComponentType, SALOME_ModuleCatalog::ComponentType>
224 ComponentTypeConvert;
229 #endif // MODULECATALOG_IMPL_H