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
36 #include "SALOME_ModuleCatalog_Handler.hxx"
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
42 #if defined MODULECATALOG_EXPORTS
44 #define MODULECATALOG_EXPORT __declspec( dllexport )
46 #define MODULECATALOG_EXPORT
50 #define MODULECATALOG_EXPORT __declspec( dllimport )
52 #define MODULECATALOG_EXPORT
56 class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog,
57 public PortableServer::RefCountServantBase
60 //! standard constructor
61 SALOME_ModuleCatalogImpl(int artgc, char** argv, CORBA::ORB_ptr orb = NULL);
63 //! standard destructor
64 virtual ~SALOME_ModuleCatalogImpl();
66 //! method to get a component list
68 \return a component list
70 virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
72 //! method to get the PathPrefix of a computer
73 /*! If the wanted computer doesn't exist, the Notfound exception is thrown
74 \param machinename const char* arguments
75 \return the prefix path
77 virtual char* GetPathPrefix(const char* machinename);
79 //! method to read a XML file and import new components into the component list
80 /*! If the XML file doesn't exist or is not readable, the Notfound exception is thrown
81 \param const char* xmlFileName
83 virtual void ImportXmlCatalogFile(const char* xmlFileName);
85 //! method to get a component list
87 \return a component list
89 virtual SALOME_ModuleCatalog::ListOfComponents* GetComponentList();
91 //! method to get a component list of component name and component icone
93 \return a list of couple (component name, component icone)
95 virtual SALOME_ModuleCatalog::ListOfIAPP_Affich* GetComponentIconeList();
97 //! method to get a component list of a wanted type
99 \return a component list
101 virtual SALOME_ModuleCatalog::ListOfComponents*
102 GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type);
104 //! method to get a component
106 \param componentname const char* arguments
107 \return the wanted component
109 virtual SALOME_ModuleCatalog::Acomponent_ptr
110 GetComponent(const char* componentname);
112 //! method to get a component description
114 \param componentname const char* arguments
115 \return the wanted component description
117 virtual SALOME_ModuleCatalog::Component *
118 GetComponentInfo(const char *name);
122 void shutdown() { if (_orb) _orb->shutdown(1); };
125 //! method to parse one module catalog
127 \param file const char* arguments
128 \param modulelist ParserComponents arguments
129 \param pathlist ParserPathPrefixes arguments
131 virtual void _parse_xml_file(const char* file,
132 ParserComponents & modulelist,
133 ParserPathPrefixes & pathlist);
135 //! method to find component in the parser list
137 \param name string argument
138 \return pointer on a component, NULL if not found
140 ParserComponent *findComponent(const std::string & name);
142 //! method to create a CORBA component description from parser
144 \param C_corba Component argument
145 \param C_parser const ParserComponent argument
147 void duplicate(SALOME_ModuleCatalog::Component & C_corba,
148 const ParserComponent & C_parser);
150 //! method to create a CORBA interface description from parser
152 \param I_corba DefinitionInterface argument
153 \param I_parser const ParserInterface argument
155 void duplicate(SALOME_ModuleCatalog::DefinitionInterface & I_corba,
156 const ParserInterface & I_parser);
158 //! method to create a CORBA service description from parser
160 \param S_corba Service argument
161 \param S_parser const ParserService argument
163 void duplicate(SALOME_ModuleCatalog::Service & S_corba,
164 const ParserService & service);
166 //! method to create a CORBA parameter description from parser
168 \param P_corba ServicesParameter argument
169 \param P_parser const ParserParameter argument
171 void duplicate(SALOME_ModuleCatalog::ServicesParameter & P_corba,
172 const ParserParameter & P_parser);
174 //! method to create a CORBA datastream parameter description from parser
176 \param P_corba ServicesDataStreamParameter argument
177 \param P_parser const ParserDataStreamParameter argument
179 void duplicate(SALOME_ModuleCatalog::ServicesDataStreamParameter & P_corba,
180 const ParserDataStreamParameter & P_parser);
182 //! method to create the path prefix structures from the catalog parsing
184 \param pathes ParserPathPrefixes arguments
187 void duplicate(ParserPathPrefixes & p_out, const ParserPathPrefixes & P_in);
189 //! method to verify path prefix content
191 \param pathlist ListOfParserPathPrefix arguments
192 \return true if verfication is OK
194 virtual bool _verify_path_prefix(ParserPathPrefixes & pathlist);
197 //! method to parse arguments to get general and personal catalog files
199 \param argc int arguments
200 \param argv char** arguments
201 \param _general char** arguments
202 \return true if parsing is OK
204 virtual bool _parseArguments(int argc, char **argv,
205 char **_general, char** _personal);
208 // Theses variables will contain the path to the general and personal catalogs
210 char* _personal_path;
213 // These variables will contain the informations on the general common catalog
214 ParserComponents _general_module_list ;
215 ParserPathPrefixes _general_path_list ;
217 // These variables will contain the informations on the personal catalog
218 ParserComponents _personal_module_list ;
219 ParserPathPrefixes _personal_path_list ;
221 std::map <std::string, SALOME_ModuleCatalog::DataStreamType>
222 DataStreamTypeConvert;
224 std::map <std::string, SALOME_ModuleCatalog::DataStreamDependency>
225 DataStreamDepConvert;
227 std::map <ParserComponentType, SALOME_ModuleCatalog::ComponentType>
228 ComponentTypeConvert;
233 #endif // MODULECATALOG_IMPL_H