]> SALOME platform Git repositories - modules/kernel.git/blob - src/DSC/DSC_Basic/ConnectionManager_i.hxx
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/kernel.git] / src / DSC / DSC_Basic / ConnectionManager_i.hxx
1 //  Copyright (C) 2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //
21 //
22 //  File   : ConnectionManager_i.hxx
23 //  Author : André RIBES (EDF)
24 //  Module : KERNEL
25
26 #ifndef _CONNECTION_MANAGER_I_HXX_
27 #define _CONNECTION_MANAGER_I_HXX_
28
29 #include <DSC_Basic.hxx>
30
31 #include <iostream>
32 #include <map>
33 #include <pthread.h>
34
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(DSC_Engines)
37
38 /*! \class ConnectionManager_i
39  *  \brief This class implements the interface Engines::ConnectionManager.
40  */
41 class DSC_BASIC_EXPORT ConnectionManager_i :
42   public virtual POA_Engines::ConnectionManager
43 {
44   public :
45     ConnectionManager_i(CORBA::ORB_ptr orb);
46     virtual ~ConnectionManager_i();
47
48     /*!
49      * CORBA method : connect two ports of two components.
50      * \see Engines::ConnectionManager::connect
51      */
52     Engines::ConnectionManager::connectionId connect(Engines::DSC_ptr uses_component, 
53                                                      const char* uses_port_name, 
54                                                      Engines::DSC_ptr provides_component, 
55                                                      const char* provides_port_name);
56
57     /*!
58      * CORBA method : releases a connection performed with 
59      * ConnectionManager_i::connect.
60      *
61      * \see Engines::ConnectionManager::disconnect
62      */
63     void disconnect(Engines::ConnectionManager::connectionId id,
64                     Engines::DSC::Message message);
65
66     /*!
67        Shutdown the ConnectionManager process.
68      */
69     void ShutdownWithExit();
70
71     /*!
72        Returns the PID of the connection manager
73      */
74     CORBA::Long getPID();
75
76   private :
77
78     struct connection_infos {
79       Engines::DSC_var uses_component; 
80       std::string uses_port_name;
81       Engines::DSC_var provides_component;
82       std::string provides_port_name;
83       Ports::Port_var provides_port;
84     };
85
86     typedef std::map<Engines::ConnectionManager::connectionId, 
87             connection_infos *> ids_type;
88     typedef std::map<Engines::ConnectionManager::connectionId, 
89             connection_infos *>::iterator ids_it_type;
90
91     ids_type ids;
92     ids_it_type ids_it;
93
94     int current_id;
95     pthread_mutex_t mutex;
96   protected:
97     CORBA::ORB_var _orb;
98 };
99
100 #endif