SALOME documentation central

src/DSC/DSC_Basic/DSC_i.hxx

00001 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 //  This library is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU Lesser General Public
00008 //  License as published by the Free Software Foundation; either
00009 //  version 2.1 of the License.
00010 //
00011 //  This library is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 //  Lesser General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU Lesser General Public
00017 //  License along with this library; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //  File   : DSC_i.hxx
00023 //  Author : André RIBES (EDF)
00024 //  Module : KERNEL
00025 //
00026 #ifndef _DSC_I_HXX_
00027 #define _DSC_I_HXX_
00028 
00029 #include "DSC_Basic.hxx"
00030 
00031 #include <iostream>
00032 #include <map>
00033 #include <string.h>
00034 #include <assert.h>
00035 
00036 #include "SALOME_Component_i.hxx"
00037 #include "DSC_interface.hxx"
00038 
00044 class DSC_BASIC_EXPORT Engines_DSC_i: 
00045   public Engines_Component_i, // keyword virtual is not use to be able to
00046                      // call the right Engines_Component_i constructor.
00047                      // If virtual is used, a derived class of Engines_DSC_i
00048                      // will have to call the right Engines_Component_i constructor.
00049   public virtual POA_Engines::DSC,
00050   public Engines_DSC_interface
00051 {
00052 public:
00053   Engines_DSC_i(CORBA::ORB_ptr orb,
00054                  PortableServer::POA_ptr poa,
00055                  PortableServer::ObjectId * contId,
00056                  const char *instanceName,
00057                  const char *interfaceName,
00058                  bool notif = false);
00059   Engines_DSC_i(CORBA::ORB_ptr orb,
00060                  PortableServer::POA_ptr poa,
00061                  Engines::Container_ptr container, 
00062                  const char *instanceName,
00063                  const char *interfaceName,
00064         bool notif = false,
00065         bool regist = true );
00066 
00067   virtual ~Engines_DSC_i();
00068 
00072   virtual void add_provides_port(Ports::Port_ptr ref, 
00073                      const char* provides_port_name,
00074                      Ports::PortProperties_ptr port_prop) 
00075     throw (Engines::DSC::PortAlreadyDefined,
00076         Engines::DSC::NilPort,
00077         Engines::DSC::BadProperty) {
00078       Engines_DSC_interface::add_provides_port(ref, 
00079                                 provides_port_name,
00080                                 port_prop);
00081     }
00082 
00086   virtual void add_uses_port(const char* repository_id, 
00087                     const char* uses_port_name,
00088                     Ports::PortProperties_ptr port_prop)
00089     throw (Engines::DSC::PortAlreadyDefined,
00090         Engines::DSC::BadProperty) {
00091       Engines_DSC_interface::add_uses_port(repository_id, 
00092                             uses_port_name,
00093                             port_prop);
00094     }
00095 
00099   virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
00100                              const CORBA::Boolean connection_error) 
00101     throw (Engines::DSC::PortNotDefined,
00102         Engines::DSC::PortNotConnected) {
00103       return Engines_DSC_interface::get_provides_port(provides_port_name,
00104                                     connection_error);
00105     }
00106 
00110   virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
00111     throw (Engines::DSC::PortNotDefined,
00112         Engines::DSC::PortNotConnected) {
00113       return Engines_DSC_interface::get_uses_port(uses_port_name);
00114     }
00115 
00119   virtual void connect_provides_port(const char* provides_port_name)
00120     throw (Engines::DSC::PortNotDefined) {
00121       Engines_DSC_interface::connect_provides_port(provides_port_name);
00122     }
00123 
00127   virtual void connect_uses_port(const char* uses_port_name,
00128                      Ports::Port_ptr provides_port_ref) 
00129   throw (Engines::DSC::PortNotDefined,
00130       Engines::DSC::BadPortType,
00131       Engines::DSC::NilPort) {
00132     Engines_DSC_interface::connect_uses_port(uses_port_name,
00133                               provides_port_ref);
00134   }
00135 
00139   virtual CORBA::Boolean is_connected(const char* port_name)
00140     throw (Engines::DSC::PortNotDefined) {
00141       return Engines_DSC_interface::is_connected(port_name);
00142     }
00143 
00147   virtual void disconnect_provides_port(const char* provides_port_name,
00148                          const Engines::DSC::Message message)
00149     throw (Engines::DSC::PortNotDefined,
00150         Engines::DSC::PortNotConnected) {
00151       Engines_DSC_interface::disconnect_provides_port(provides_port_name,
00152                                     message);
00153     }
00154 
00158   virtual void disconnect_uses_port(const char* uses_port_name,
00159                         Ports::Port_ptr provides_port_ref,
00160                         const Engines::DSC::Message message)
00161     throw (Engines::DSC::PortNotDefined,
00162         Engines::DSC::PortNotConnected,
00163         Engines::DSC::BadPortReference) {
00164       Engines_DSC_interface::disconnect_uses_port(uses_port_name,
00165                                 provides_port_ref,
00166                                 message);
00167     }
00168 
00172   virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
00173     throw (Engines::DSC::PortNotDefined) {
00174       return Engines_DSC_interface::get_port_properties(port_name);
00175     }
00176 };
00177 
00178 #endif