1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
22 // SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
23 // File : SALOME_ModuleCatalog_impl.hxx
24 // Author : Estelle Deville
28 #ifndef MODULECATALOG_IMPL_H
29 #define MODULECATALOG_IMPL_H
31 #include "SALOME_ModuleCatalog.hxx"
36 #include "SALOME_ModuleCatalog_Handler.hxx"
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
41 class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog
44 //! standard constructor
45 SALOME_ModuleCatalogImpl(int artgc, char** argv, CORBA::ORB_ptr orb = NULL);
47 //! standard destructor
48 virtual ~SALOME_ModuleCatalogImpl();
50 //! method to get a component list
52 \return a component list
54 virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
56 //! method to get the list of all types of the catalog
58 * \return the types list
60 virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes();
62 //! method to get the PathPrefix of a computer
63 /*! If the wanted computer doesn't exist, the Notfound exception is thrown
64 \param machinename const char* arguments
65 \return the prefix path
67 virtual char* GetPathPrefix(const char* machinename);
69 //! method to read a XML file and import new components into the component list
70 /*! If the XML file doesn't exist or is not readable, the Notfound exception is thrown
71 \param const char* xmlFileName
73 virtual void ImportXmlCatalogFile(const char* xmlFileName);
75 //! method to get a component list
77 \return a component list
79 virtual SALOME_ModuleCatalog::ListOfComponents* GetComponentList();
81 //! method to get a component list of component name and component icone
83 \return a list of couple (component name, component icone)
85 virtual SALOME_ModuleCatalog::ListOfIAPP_Affich* GetComponentIconeList();
87 //! method to get a component list of a wanted type
89 \return a component list
91 virtual SALOME_ModuleCatalog::ListOfComponents*
92 GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type);
94 //! method to get a component
96 \param componentname const char* arguments
97 \return the wanted component
99 virtual SALOME_ModuleCatalog::Acomponent_ptr
100 GetComponent(const char* componentname);
102 //! method to get a component description
104 \param componentname const char* arguments
105 \return the wanted component description
107 virtual SALOME_ModuleCatalog::ComponentDef *
108 GetComponentInfo(const char *name);
111 CORBA::Long getPID();
112 void ShutdownWithExit();
114 void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };
117 //! method to parse one module catalog
119 \param file const char* arguments
120 \param modulelist ParserComponents arguments
121 \param pathlist ParserPathPrefixes arguments
122 \param typeMap ParserTypes arguments
124 virtual void _parse_xml_file(const char* file,
125 ParserComponents & modulelist,
126 ParserPathPrefixes & pathlist,
127 ParserTypes& typeMap,
130 //! method to find component in the parser list
132 \param name string argument
133 \return pointer on a component, NULL if not found
135 ParserComponent *findComponent(const std::string & name);
137 //! method to create a CORBA component description from parser
139 \param C_corba Component argument
140 \param C_parser const ParserComponent argument
142 void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba,
143 const ParserComponent & C_parser);
145 //! method to create a CORBA interface description from parser
147 \param I_corba DefinitionInterface argument
148 \param I_parser const ParserInterface argument
150 void duplicate(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
151 const ParserInterface & I_parser);
153 //! method to create a CORBA service description from parser
155 \param S_corba Service argument
156 \param S_parser const ParserService argument
158 void duplicate(SALOME_ModuleCatalog::Service & S_corba,
159 const ParserService & service);
161 //! method to create a CORBA parameter description from parser
163 \param P_corba ServicesParameter argument
164 \param P_parser const ParserParameter argument
166 void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_corba,
167 const ParserParameter & P_parser);
169 //! method to create a CORBA datastream parameter description from parser
171 \param P_corba ServicesDataStreamParameter argument
172 \param P_parser const ParserDataStreamParameter argument
174 void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
175 const ParserDataStreamParameter & P_parser);
177 //! method to create the path prefix structures from the catalog parsing
179 \param pathes ParserPathPrefixes arguments
182 void duplicate(ParserPathPrefixes & p_out, const ParserPathPrefixes & P_in);
184 //! method to verify path prefix content
186 \param pathlist ListOfParserPathPrefix arguments
187 \return true if verfication is OK
189 virtual bool _verify_path_prefix(ParserPathPrefixes & pathlist);
192 //! method to parse arguments to get general and personal catalog files
194 \param argc int arguments
195 \param argv char** arguments
196 \param _general char** arguments
197 \return true if parsing is OK
199 virtual bool _parseArguments(int argc, char **argv,
200 char **_general, char** _personal);
203 // Theses variables will contain the path to the general and personal catalogs
205 char* _personal_path;
208 // These variables will contain the informations on the general common catalog
209 ParserComponents _general_module_list ;
210 ParserPathPrefixes _general_path_list ;
211 ParserTypes _typeMap;
214 // These variables will contain the informations on the personal catalog
215 ParserComponents _personal_module_list ;
216 ParserPathPrefixes _personal_path_list ;
218 std::map <std::string, SALOME_ModuleCatalog::DataStreamDependency>
219 DataStreamDepConvert;
221 std::map <ParserComponentType, SALOME_ModuleCatalog::ComponentType>
222 ComponentTypeConvert;
227 #endif // MODULECATALOG_IMPL_H