From: ribes Date: Wed, 28 Feb 2007 14:59:16 +0000 (+0000) Subject: Doxygen documentation, C++ warning and english comments. X-Git-Tag: DSC_OK~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=83e441a975c47172afcc12f989b1f9e09da068b0;p=modules%2Fkernel.git Doxygen documentation, C++ warning and english comments. --- diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.cxx b/src/DSC/DSC_Basic/ConnectionManager_i.cxx index 4cfad2314..260c88c7f 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.cxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.cxx @@ -37,10 +37,6 @@ ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) { ConnectionManager_i::~ConnectionManager_i() {} -/* Cette méthode connecte deux ports ensembles. - * Elle permet de rendre plus simple l'utilisation du modèle de programmation - * à base de ports. - */ Engines::ConnectionManager::connectionId ConnectionManager_i::connect(Engines::DSC_ptr uses_component, const char* uses_port_name, @@ -55,15 +51,14 @@ throw (Engines::DSC::PortNotDefined, uses_component->connect_uses_port(uses_port_name, p_port); provides_component->connect_provides_port(provides_port_name); - // Ajout de l'id dans la map comme tout s'est bien passé - // - // Protection du current_id pour récupérer un id unique + // Creating a new connection id. + // We use a mutex for multithreaded applications. pthread_mutex_lock(&mutex); Engines::ConnectionManager::connectionId rtn_id = current_id; current_id += 1; pthread_mutex_unlock(&mutex); - // Creation de la structure et ajout dans la map + // Creating a new structure containing connection's infos. connection_infos * infos = new connection_infos(); infos->uses_component = Engines::DSC::_duplicate(uses_component); infos->uses_port_name = uses_port_name; @@ -71,7 +66,7 @@ throw (Engines::DSC::PortNotDefined, infos->provides_port_name = provides_port_name; infos->provides_port = Ports::Port::_duplicate(p_port); - // Ajout dans la map + // Adding the new connection into the map. ids[rtn_id] = infos; return rtn_id; @@ -82,19 +77,19 @@ ConnectionManager_i::disconnect(const Engines::ConnectionManager::connectionId i Engines::DSC::Message message) throw (Engines::ConnectionManager::BadId) { - // Verification que l'id existe + // Connection id exist ? ids_it = ids.find(id); if (ids_it == ids.end()) throw Engines::ConnectionManager::BadId(); - // Recuperation des infos + // TODO + // We need to catch exceptions if one of these disconnect operation fails. connection_infos * infos = ids[id]; infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(), message); infos->uses_component->disconnect_uses_port(infos->uses_port_name.c_str(), Ports::Port::_duplicate(infos->provides_port), message); - // Nettoyage delete infos; ids.erase(id); } diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.hxx b/src/DSC/DSC_Basic/ConnectionManager_i.hxx index 3b32af543..b0d03de36 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.hxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.hxx @@ -44,6 +44,7 @@ class ConnectionManager_i : ~ConnectionManager_i(); /*! + * CORBA method : connect two ports of two components. * \see Engines::ConnectionManager::connect */ Engines::ConnectionManager::connectionId connect(Engines::DSC_ptr uses_component, @@ -55,6 +56,9 @@ class ConnectionManager_i : Engines::DSC::NilPort); /*! + * CORBA method : releases a connection performed with + * ConnectionManager_i::connect. + * * \see Engines::ConnectionManager::disconnect */ void disconnect(const Engines::ConnectionManager::connectionId id, diff --git a/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx b/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx index 17b07ac44..1a7057e63 100644 --- a/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx +++ b/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx @@ -34,14 +34,18 @@ int main(int argc, char* argv[]) PortableServer::POA_var root_poa; PortableServer::POAManager_var pman; CORBA::Object_var obj; - CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ; + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); try{ obj = orb->resolve_initial_references("RootPOA"); if(!CORBA::is_nil(obj)) root_poa = PortableServer::POA::_narrow(obj); if(!CORBA::is_nil(root_poa)) pman = root_poa->the_POAManager(); - ConnectionManager_i * serv = new ConnectionManager_i(orb); + + // We create a ConnectionManager. + // It is automatically added to the RootPOA into its constructor. + new ConnectionManager_i(orb); + pman->activate(); orb->run(); }catch(CORBA::SystemException&){