1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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
23 // File : DSC_interface.hxx
24 // Author : André RIBES (EDF)
27 #ifndef _DSC_INTERFACE_HXX_
28 #define _DSC_INTERFACE_HXX_
35 #include "DSC_Callbacks.hxx"
37 /*! \class Engines_DSC_interface
38 * \brief This class implements the interface Engines::DSC
40 * This class is used by the sequential DSC implementation
41 * and the parallel DSC implementation.
43 class Engines_DSC_interface:
47 Engines_DSC_interface();
48 virtual ~Engines_DSC_interface();
51 * \see Engines::DSC::add_provides_port
53 virtual void add_provides_port(Ports::Port_ptr ref,
54 const char* provides_port_name,
55 Ports::PortProperties_ptr port_prop)
56 throw (Engines::DSC::PortAlreadyDefined,
57 Engines::DSC::NilPort,
58 Engines::DSC::BadProperty);
61 * \see Engines::DSC::add_uses_port
63 virtual void add_uses_port(const char* repository_id,
64 const char* uses_port_name,
65 Ports::PortProperties_ptr port_prop)
66 throw (Engines::DSC::PortAlreadyDefined,
67 Engines::DSC::BadProperty);
70 * \see Engines::DSC::get_provides_port
72 virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
73 const CORBA::Boolean connection_error)
74 throw (Engines::DSC::PortNotDefined,
75 Engines::DSC::PortNotConnected,
76 Engines::DSC::BadPortType);
79 * \see Engines::DSC::get_uses_port
81 virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
82 throw (Engines::DSC::PortNotDefined,
83 Engines::DSC::PortNotConnected,
84 Engines::DSC::BadPortType);
87 * \see Engines::DSC::connect_provides_port
89 * \note This method uses Callbacks mechanism to inform the provides
90 * port how much uses ports are connected with. Currently, the provides
91 * port doesn't know its uses ports references. It's framework or application role
92 * to manage connections between ports.
94 virtual void connect_provides_port(const char* provides_port_name)
95 throw (Engines::DSC::PortNotDefined);
98 * \see Engines::DSC::connect_uses_port
100 * \note This method uses Callbacks mechanism to inform the uses
101 * port how much provides ports are connected with.
103 virtual void connect_uses_port(const char* uses_port_name,
104 Ports::Port_ptr provides_port_ref)
105 throw (Engines::DSC::PortNotDefined,
106 Engines::DSC::BadPortType,
107 Engines::DSC::NilPort);
110 * \see Engines::DSC::is_connected
112 virtual CORBA::Boolean is_connected(const char* port_name)
113 throw (Engines::DSC::PortNotDefined);
116 * \see Engines::DSC::disconnect_provides_port
118 * \note This method uses Callbacks mechanism to inform the provides
119 * port how much uses ports are connected with. Currently, the provides
120 * port doesn't know its uses ports references. It's framework or application role
121 * to manage connections between ports.
123 virtual void disconnect_provides_port(const char* provides_port_name,
124 const Engines::DSC::Message message)
125 throw (Engines::DSC::PortNotDefined,
126 Engines::DSC::PortNotConnected);
129 * \see Engines::DSC::disconnect_uses_port
132 * \note This method uses Callbacks mechanism to inform the uses
133 * port how much provides ports are connected with.
135 * \warning The new sequence of the uses port is sended by the callback.
136 * The old sequence is not destoyed. Is uses port user's role to destroy
139 virtual void disconnect_uses_port(const char* uses_port_name,
140 Ports::Port_ptr provides_port_ref,
141 const Engines::DSC::Message message)
142 throw (Engines::DSC::PortNotDefined,
143 Engines::DSC::PortNotConnected,
144 Engines::DSC::BadPortReference);
147 * \see Engines::DSC::get_port_properties
149 virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
150 throw (Engines::DSC::PortNotDefined);
152 static void writeEvent(const char* request,const std::string& containerName, const char* instance_name,
153 const char* port_name, const char* error, const char* message);
157 /*-------------------------------------------------*/
158 /* Definition des types pour le stockage des ports */
160 enum port_type {uses, provides, none};
166 // Specifique aux uses port
167 Engines::DSC::uses_port uses_port_refs;
168 std::string repository_id;
170 // Specifique aux provides port;
171 Ports::Port_var provides_port_ref;
173 Ports::PortProperties_var port_prop;
176 typedef std::map<std::string, port_t *> ports;
178 /*-------------------------------------------------*/
179 /*-------------------------------------------------*/
182 ports::iterator my_ports_it;