]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: some debugs and more correct handle of maps in container
authorcaremoli <caremoli>
Mon, 11 Feb 2008 08:39:00 +0000 (08:39 +0000)
committercaremoli <caremoli>
Mon, 11 Feb 2008 08:39:00 +0000 (08:39 +0000)
salome_adm/unix/config_files/check_omniorb.m4
src/Container/Container_i.cxx
src/Container/SALOME_ContainerPy.py
src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx
src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx
src/Utils/Utils_ORB_INIT.cxx

index 0f6d198a9774eac396638902916e726f6abb4d42..7818bc85fc168b64aadd0c414b00f775943ab700 100644 (file)
@@ -17,7 +17,7 @@ AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 
 AC_PATH_PROG(OMNIORB_IDL, omniidl)
-if test "xOMNIORB_IDL" = "x"
+if test "x$OMNIORB_IDL" = "x"
 then
   omniORB_ok=no
   AC_MSG_RESULT(omniORB binaries not in PATH variable)
@@ -101,8 +101,6 @@ then
 
 fi
 
-dnl omniORB_ok=yes
-
 if test "x$omniORB_ok" = "xyes" 
 then
   if test "x$OMNIORB_LIB" = "x/usr/lib"
index 2f5692fdc3e5f59b4cffab18cf40c1688987faa7..ea1c23c116885daa9e07fcc12c127767a9016386 100644 (file)
@@ -336,8 +336,8 @@ Engines_Container_i::load_component_Library(const char* componentName)
   
   _numInstanceMutex.lock(); // lock to be alone 
   // (see decInstanceCnt, finalize_removal))
-  if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name);
-  if (_library_map[impl_name])
+  if (_toRemove_map.count(impl_name) != 0) _toRemove_map.erase(impl_name);
+  if (_library_map.count(impl_name) != 0)
     {
       MESSAGE("Library " << impl_name << " already loaded");
       _numInstanceMutex.unlock();
@@ -358,13 +358,6 @@ Engines_Container_i::load_component_Library(const char* componentName)
       _numInstanceMutex.unlock();
       return true;
   }
-  else
-  {
-      INFOS( "Can't load shared library: " << impl_name );
-#ifndef WNT
-      INFOS("error dlopen: " << dlerror());
-#endif
-  }
   _numInstanceMutex.unlock();
 
   // --- try import Python component
@@ -375,7 +368,7 @@ Engines_Container_i::load_component_Library(const char* componentName)
       INFOS("Supervision Container does not support Python Component Engines");
       return false;
     }
-  if (_library_map[aCompName])
+  if (_library_map.count(aCompName) != 0)
     {
       return true; // Python Component, already imported
     }
@@ -389,6 +382,7 @@ Engines_Container_i::load_component_Library(const char* componentName)
                                              "import_component",
                                              "s",componentName);
       int ret= PyInt_AsLong(result);
+      Py_XDECREF(result);
       SCRUTE(ret);
       Py_RELEASE_NEW_THREAD;
   
@@ -401,6 +395,9 @@ Engines_Container_i::load_component_Library(const char* componentName)
           return true;
         }
     }
+  INFOS( "Impossible to load component: " << componentName );
+  INFOS( "Can't load shared library: " << impl_name );
+  INFOS( "Can't import Python module: " << componentName );
   return false;
 }
 
@@ -429,7 +426,7 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName,
   Engines::Component_var iobject = Engines::Component::_nil() ;
 
   string aCompName = genericRegisterName;
-  if (_library_map[aCompName]) // Python component
+  if (_library_map.count(aCompName) != 0) // Python component
     {
       if (_isSupervContainer)
         {
@@ -478,14 +475,14 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName,
 #else
   string impl_name = genericRegisterName +string("Engine.dll");
 #endif
-  void* handle = _library_map[impl_name];
-  if ( !handle )
+  if (_library_map.count(impl_name) == 0) 
     {
-      INFOS("shared library " << impl_name <<"must be loaded before instance");
+      INFOS("shared library " << impl_name <<" must be loaded before creating instance");
       return Engines::Component::_nil() ;
     }
   else
     {
+      void* handle = _library_map[impl_name];
       iobject = createInstance(genericRegisterName,
                                handle,
                                studyId);
@@ -735,16 +732,16 @@ Engines_Container_i::find_or_create_instance(string genericRegisterName,
 {
   string aGenRegisterName = genericRegisterName;
   string impl_name = componentLibraryName;
-  void* handle = _library_map[impl_name];
-  if ( !handle )
+  if (_library_map.count(impl_name) == 0) 
     {
-      INFOS("shared library " << impl_name <<"must be loaded before instance");
+      INFOS("shared library " << impl_name <<" must be loaded before creating instance");
       return Engines::Component::_nil() ;
     }
   else
     {
       // --- find a registered instance in naming service, or create
 
+      void* handle = _library_map[impl_name];
       string component_registerBase =
         _containerName + "/" + aGenRegisterName;
       Engines::Component_var iobject = Engines::Component::_nil() ;
index 843fa794f49f7ff1e5584af6b6d4ac9bdf0ef9c0..1694bc79df93c5bf7e7adb2dc19949dec6712342 100755 (executable)
@@ -141,10 +141,10 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
         self._numInstance = self._numInstance +1
         instanceName = nameToRegister + "_inst_" + `self._numInstance`
 
-       component=__import__(componentName)
-       factory=getattr(component,componentName)
-       comp_i=factory(self._orb, self._poa, self._this(), self._containerName,
-                      instanceName, nameToRegister)
+        component=__import__(componentName)
+        factory=getattr(component,componentName)
+        comp_i=factory(self._orb, self._poa, self._this(), self._containerName,
+                       instanceName, nameToRegister)
 
         MESSAGE( "SALOME_ContainerPy_i::instance : component created")
         comp_o = comp_i._this()
@@ -172,7 +172,7 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
         ret=0
         try:
             if verbose(): print "try import ",componentName
-            __import__(componentName)
+            module=__import__(componentName)
             if verbose(): print "import ",componentName," successful"
             ret=1
         except:
index 71f157f163e43f7143545131872716ca17f2cd8d..8e8453c953e101e95a4160ef47678698b97b00f4 100644 (file)
@@ -224,7 +224,7 @@ namespace CalciumInterface {
         ( dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) ) 
       throw CalciumException(CalciumTypes::CPITVR,
                             LOC(OSS()<<"Le mode de dépendance de la variable " 
-                                << nomVar << " ne correspond pas au mode demandé."));
+                                << nomVar << ": " << portDependencyType << " ne correspond pas au mode demandé: " << dependencyType));
 
   
     if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
index 830bb21cdbb708d87a358dba235385f227266684..d429d0daa3f4f8b7727635434a848f87ba46d2c5 100644 (file)
@@ -112,7 +112,7 @@ public :
     typedef PortableServer::ServantBase TServant;
     if(_PtrObjet){
       if(dynamic_cast<TServant*>(_PtrObjet)){
-        std::cerr << "WARNING: automatic destruction for servant is no more used. It's too late in exit. Use explicit call" << std::endl;
+       // std::cerr << "WARNING: automatic destruction for servant is no more used. It's too late in exit. Use explicit call" << std::endl;
   /*
       if(TServant* aServant = dynamic_cast<TServant*>(_PtrObjet)){
        PortableServer::POA_var aPOA = aServant->_default_POA();
index e2649a580f656c416c6ed8170edc5d595ae705e3..7d7370e71ba13c9c0c5284c978ba3eafe799add1 100644 (file)
@@ -40,7 +40,7 @@ ORB_INIT::~ORB_INIT()
 {
   if ( ! CORBA::is_nil( _orb ) )
   {
-    std::cerr << "WARNING: orb destroy is no more called at exit. Use explicit call." << std::endl;
+    MESSAGE("WARNING: orb destroy is no more called at exit. Use explicit call.");
     //std::cerr << "appel _orb->destroy()" << std::endl;
     /*
     try {