#include "SALOME_Container_i.hxx"
#include "RegistryConnexion.hxx"
#include "Basics_Utils.hxx"
-#include <stdio.h>
+#include "Utils_SINGLETON.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "SALOME_NamingService.hxx"
+
+#include <cstdio>
#ifndef WIN32
#include <dlfcn.h>
#endif
if(regist)
{
const CORBA::String_var ior = _orb->object_to_string(o);
- _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession",
- _instanceName.c_str());
+ _myConnexionToRegistry = new RegistryConnexion(ior,"theSession",
+ _instanceName.c_str(), getNS());
}
if(notif)
const CORBA::String_var ior = _orb->object_to_string(_container);
if(regist)
{
- _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str());
+ _myConnexionToRegistry = new RegistryConnexion(ior,"theSession", _instanceName.c_str(),getNS());
}
if(notif)
_notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
}
+SALOME_NamingService_Abstract *Engines_Component_i::getNS()
+{
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( 0 , 0 ) ;
+
+ SALOME_NamingService *naming = SINGLETON_<SALOME_NamingService>::Instance() ;
+ naming->init_orb( orb ) ;
+ return naming;
+}
//=============================================================================
/*!
class RegistryConnexion;
class Engines_Container_i;
+class SALOME_NamingService_Abstract;
class CONTAINER_EXPORT Engines_Component_i:
public virtual POA_Engines::EngineComponent,
virtual void configureSalome_file(std::string service_name,
std::string file_port_name,
Salome_file_i * file);
+
+protected:
+
+ SALOME_NamingService_Abstract *getNS();
protected:
static bool _isMultiInstance;
// Module : SALOME
// $Header$
//
-# 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"
-extern "C"
-{
-# include <stdio.h>
-}
+# include <cstdio>
-Registry::Components_var Connexion( int argc , char **argv , const char */*ptrSessionName*/ )
+Registry::Components_var Connexion(SALOME_NamingService_Abstract *naming)
{
Registry::Components_var varComponents = 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 ) ;
+ CORBA::Object_var object = naming->Resolve( registryName ) ;
if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
// Specialisation de l'objet generique
}
-RegistryConnexion::RegistryConnexion( int argc , char **argv , const char *ior , const char *ptrSessionName, const char *componentName ): \
- _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0)
+RegistryConnexion::RegistryConnexion(const char *ior , const char *ptrSessionName, const char *componentName, SALOME_NamingService_Abstract *ns ): \
+ _Ior(duplicate(ior)), _VarComponents( Connexion(ns) ), _SessionName(ptrSessionName),_Name(""), _Id(0)
{
this->add( componentName ) ;
}
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include <string>
+class SALOME_NamingService_Abstract;
+
class REGISTRY_EXPORT RegistryConnexion
{
protected :
RegistryConnexion( void );
public :
- RegistryConnexion( int argc , char **argv , const char *ior , const char *ptrSessionName, const char *componentName );
+ RegistryConnexion( const char *ior , const char *ptrSessionName, const char *componentName,
+ SALOME_NamingService_Abstract *ns );
~RegistryConnexion();
} ;