Back to index

salome-kernel  6.5.0
Functions
RegistryConnexion.cxx File Reference
#include "Utils_ORB_INIT.hxx"
#include "RegistryConnexion.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_Identity.hxx"
#include "Utils_SINGLETON.hxx"
#include "Utils_CommException.hxx"
#include "OpUtil.hxx"
#include "utilities.h"
#include <stdio.h>

Go to the source code of this file.

Functions

Registry::Components_var Connexion (int argc, char **argv, const char *ptrSessionName) throw ( CommException )

Function Documentation

Registry::Components_var Connexion ( int  argc,
char **  argv,
const char *  ptrSessionName 
) throw ( CommException )

Definition at line 43 of file RegistryConnexion.cxx.

{
        Registry::Components_var varComponents = 0 ;
        ASSERT(ptrSessionName) ;
        ASSERT(strlen(ptrSessionName)>0) ;
        const char *registryName = "Registry" ;

        try
        {
                ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
                ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
                CORBA::ORB_var &orb = init( argc , argv ) ;
        
                SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
                ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
                naming.init_orb( orb ) ;

                // Recuperation de la reference de l'objet
                CORBA::Object_var object = naming.Resolve( registryName ) ;
                if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;

                // Specialisation de l'objet generique
                varComponents = Registry::Components::_narrow( object ) ;
                ASSERT(! CORBA::is_nil(varComponents)) ;
        }
        catch( ... )
        {
                throw CommException ( "NamingService Connexion Error" ) ;
        }
        return varComponents ;
}

Here is the call graph for this function: