Salome HOME
sources v1.2
[modules/yacs.git] / src / ModuleCatalog / SALOME_ModuleCatalog_impl.hxx
1 //  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
2 //
3 //  Copyright (C) 2003  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. 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOME_ModuleCatalog_impl.hxx
25 //  Author : Estelle Deville
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef MODULECATALOG_IMPL_H
30 #define MODULECATALOG_IMPL_H
31
32 #include "utilities.h"
33 #include "SALOME_ModuleCatalog_Handler.hxx"
34 #include "PathPrefix.hxx"
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
37
38 class SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog,
39                                 public PortableServer::RefCountServantBase 
40 {
41 public:
42   //! standard constructor
43   SALOME_ModuleCatalogImpl(int artgc, char** argv);
44
45   //! standard destructor
46   virtual ~SALOME_ModuleCatalogImpl();
47
48   //! method to get a component list
49   /*!
50     \return a component list 
51   */
52   virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
53
54   //! method to get the PathPrefix of a computer
55  /*! If the wanted computer doesn't exist, the Notfound exception is thrown
56    \param machinename const char* arguments 
57    \return the prefix path
58  */
59   virtual char* GetPathPrefix(const char* machinename);
60
61   //! method to get a component list
62   /*!
63     \return a component list 
64   */
65   virtual SALOME_ModuleCatalog::ListOfComponents* GetComponentList();
66
67   //! method to get a component list of component name and component icone
68   /*!
69     \return a list of couple (component name, component icone) 
70   */
71   virtual SALOME_ModuleCatalog::ListOfIAPP_Affich* GetComponentIconeList();
72
73   //! method to get a component list of a wanted type
74   /*!
75     \return a component list 
76   */
77   virtual SALOME_ModuleCatalog::ListOfComponents* 
78     GetTypedComponentList(SALOME_ModuleCatalog::ComponentType component_type);
79
80   //! method to get a component
81   /*!
82     \param componentname const char* arguments 
83     \return the wanted component
84   */
85   virtual SALOME_ModuleCatalog::Acomponent_ptr 
86     GetComponent(const char* componentname);
87
88   void ping(){};
89
90 private:
91   //! method to parse one module catalog
92   /*! 
93     \param file const char* arguments
94     \param modulelist ListOfParserComponent arguments
95     \param pathlist ListOfParserPathPrefix arguments
96   */
97   virtual void _parse_xml_file(const char* file, 
98                           ListOfParserComponent& modulelist, 
99                           ListOfParserPathPrefix& pathlist);
100
101  //! method to create a list of interfaces from the parsing of the catalog
102   /*!
103     \param list_interface ListOfDefinitionInterface arguments
104     \return the interfaces list
105   */
106   virtual SALOME_ModuleCatalog::ListOfDefInterface 
107           duplicate_interfaces(ListOfDefinitionInterface list_interface);
108   
109  //! method to create the path prefix structures from the catalog parsing
110   /*!
111     \param pathes ListOfParserPathPrefix arguments
112     \return the pathes
113   */
114   virtual ListOfPathPrefix duplicate_pathes(ListOfParserPathPrefix pathes);
115
116  //! method to verify path prefix content
117   /*!
118     \param pathlist ListOfParserPathPrefix arguments
119     \return true if verfication is OK
120   */
121   virtual bool _verify_path_prefix(ListOfParserPathPrefix pathlist);
122
123
124  //! method to parse arguments to get general and personal catalog files
125   /*!
126     \param argc int arguments
127     \param argv char** arguments
128     \param _general char** arguments
129     \return true if parsing is OK
130   */
131   virtual bool _parseArguments(int argc, char **argv, 
132                                char **_general, char** _personal);
133
134
135   // Theses variables will contain the path to the general and personal catalogs
136   char* _general_path;
137   char* _personal_path;
138
139
140   // These variables will contain the informations on the general common catalog
141   ListOfParserComponent _general_module_list ;
142   ListOfParserPathPrefix _general_path_list ;
143
144   // These variables will contain the informations on the personal catalog
145   ListOfParserComponent _personal_module_list ;
146   ListOfParserPathPrefix _personal_path_list ; 
147
148 };
149
150 #endif // MODULECATALOG_IMPL_H