Version: 9.15.0
DSC_interface.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File : DSC_interface.hxx
24 // Author : André RIBES (EDF)
25 // Module : KERNEL
26 //
27 #ifndef _DSC_INTERFACE_HXX_
28 #define _DSC_INTERFACE_HXX_
29 
30 #include <iostream>
31 #include <map>
32 #include <string.h>
33 #include <assert.h>
34 
35 #include "DSC_Callbacks.hxx"
36 
44  public DSC_Callbacks
45 {
46 public:
48  virtual ~Engines_DSC_interface();
49 
53  virtual void add_provides_port(Ports::Port_ptr ref,
54  const char* provides_port_name,
55  Ports::PortProperties_ptr port_prop);
56 
60  virtual void add_uses_port(const char* repository_id,
61  const char* uses_port_name,
62  Ports::PortProperties_ptr port_prop);
63 
67  virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
68  const CORBA::Boolean connection_error);
69 
73  virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name);
74 
83  virtual void connect_provides_port(const char* provides_port_name);
84 
91  virtual void connect_uses_port(const char* uses_port_name,
92  Ports::Port_ptr provides_port_ref);
93 
97  virtual CORBA::Boolean is_connected(const char* port_name);
98 
107  virtual void disconnect_provides_port(const char* provides_port_name,
108  const Engines::DSC::Message message);
109 
121  virtual void disconnect_uses_port(const char* uses_port_name,
122  Ports::Port_ptr provides_port_ref,
123  const Engines::DSC::Message message);
124 
128  virtual Ports::PortProperties_ptr get_port_properties(const char* port_name);
129 
130  static void writeEvent(const char* request,const std::string& containerName, const char* instance_name,
131  const char* port_name, const char* error, const char* message);
132 
133 protected:
134 
135  /*-------------------------------------------------*/
136  /* Definition des types pour le stockage des ports */
137 
139 
140  struct port_t {
143 
144  // Specifique aux uses port
146  std::string repository_id;
147 
148  // Specifique aux provides port;
149  Ports::Port_var provides_port_ref;
150 
151  Ports::PortProperties_var port_prop;
152  };
153 
154  typedef std::map<std::string, port_t *> ports;
155 
156  /*-------------------------------------------------*/
157  /*-------------------------------------------------*/
158 
160  ports::iterator my_ports_it;
161 };
162 
163 #endif
This is an abstract class that defines methods that the component uses to notify the component user c...
Definition: DSC_Callbacks.hxx:42
This class implements the interface Engines::DSC.
Definition: DSC_interface.hxx:45
virtual Ports::PortProperties_ptr get_port_properties(const char *port_name)
Definition: DSC_interface.cxx:362
virtual CORBA::Boolean is_connected(const char *port_name)
Definition: DSC_interface.cxx:252
virtual void add_uses_port(const char *repository_id, const char *uses_port_name, Ports::PortProperties_ptr port_prop)
Definition: DSC_interface.cxx:79
virtual void connect_provides_port(const char *provides_port_name)
Definition: DSC_interface.cxx:180
virtual void connect_uses_port(const char *uses_port_name, Ports::Port_ptr provides_port_ref)
Definition: DSC_interface.cxx:203
virtual ~Engines_DSC_interface()
Definition: DSC_interface.cxx:42
virtual Engines::DSC::uses_port * get_uses_port(const char *uses_port_name)
Definition: DSC_interface.cxx:142
virtual Ports::Port_ptr get_provides_port(const char *provides_port_name, const CORBA::Boolean connection_error)
Definition: DSC_interface.cxx:109
ports my_ports
Definition: DSC_interface.hxx:159
port_type
Definition: DSC_interface.hxx:138
@ provides
Definition: DSC_interface.hxx:138
@ uses
Definition: DSC_interface.hxx:138
@ none
Definition: DSC_interface.hxx:138
Engines_DSC_interface()
Definition: DSC_interface.cxx:40
std::map< std::string, port_t * > ports
Definition: DSC_interface.hxx:154
static void writeEvent(const char *request, const std::string &containerName, const char *instance_name, const char *port_name, const char *error, const char *message)
Write a record in the trace file.
Definition: DSC_interface.cxx:478
ports::iterator my_ports_it
Definition: DSC_interface.hxx:160
virtual void add_provides_port(Ports::Port_ptr ref, const char *provides_port_name, Ports::PortProperties_ptr port_prop)
Definition: DSC_interface.cxx:51
virtual void disconnect_provides_port(const char *provides_port_name, const Engines::DSC::Message message)
Definition: DSC_interface.cxx:271
virtual void disconnect_uses_port(const char *uses_port_name, Ports::Port_ptr provides_port_ref, const Engines::DSC::Message message)
Definition: DSC_interface.cxx:296
Message
This enumeration is used when the connection of a port (uses or provides) is changed.
Definition: DSC_Engines.idl:79
sequence< Ports::Port > uses_port
a uses port
Definition: DSC_Engines.idl:73
def error(message)
Definition: IDLparser.py:67
containerName
Definition: SALOME_ContainerPy.py:383
Definition: DSC_interface.hxx:140
std::string repository_id
Definition: DSC_interface.hxx:146
port_type type
Definition: DSC_interface.hxx:141
int connection_nbr
Definition: DSC_interface.hxx:142
Ports::PortProperties_var port_prop
Definition: DSC_interface.hxx:151
Engines::DSC::uses_port uses_port_refs
Definition: DSC_interface.hxx:145
Ports::Port_var provides_port_ref
Definition: DSC_interface.hxx:149