]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix problem with waiting SALOMEDS_Server:
authorimn <imn@opencascade.com>
Wed, 2 Nov 2016 14:14:17 +0000 (17:14 +0300)
committerimn <imn@opencascade.com>
Wed, 2 Nov 2016 14:14:17 +0000 (17:14 +0300)
- delete RegisterGenObj object

bin/runSalome.py
src/SALOMEDS/SALOMEDS.cxx
src/SALOMEDS/SALOMEDS_Server.cxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.hxx
src/SALOMEDS/SALOME_DriverPy.py
src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Callback.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index b547c3703b69e025e538fa587125469f1964888b..75a060437a889e2f3cca185fb1126bb636041adb 100755 (executable)
@@ -687,7 +687,7 @@ def useSalome(args, modules_list, modules_root_dir):
                     toopen = args['study_hdf']
                     if toopen:
                         import salome
-                        salome.salome_init(toopen)
+                        salome.salome_init()
                 if args.has_key('pyscript'):
                     toimport = args['pyscript']
         from salomeContextUtils import formatScriptsAndArgs
index 6199d4fed962029c3de95a30d2c3b6989b72031c..9d8112092dbe955994ac7f038265a3a116c4e805 100644 (file)
@@ -117,14 +117,9 @@ extern "C"
       PortableServer::ObjectId_var aStudy_iid =  root_poa->activate_object(aStudy_i);
       aStudy = aStudy_i->_this();
       namingService.Register(aStudy.in(), "/Study");
-
-      // Assign the value of the IOR in the study->root
-      CORBA::String_var IORStudy = orb->object_to_string(aStudy);
-      aStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in());
     }
-    SALOMEDS_Study* study = new SALOMEDS_Study(aStudy_i->GetImpl());
     aStudy_i->_remove_ref();
-    return study;
+    return NULL;
   }
 
   SALOMEDS_EXPORT
index a1e9a1af18d3ce17c064f16416a0fd56f9cc8d42..a9893daa2e1f2cfd3cf266107822186ac1b73569 100644 (file)
@@ -59,7 +59,7 @@ int main(int argc, char** argv)
 #else
       CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
 #endif
-      SALOME_NamingService NS;
+      SALOME_NamingService* NS;
       // Obtain a reference to the root POA.
       long TIMESleep = 500000000;
       int NumberOfTries = 40;
@@ -109,8 +109,8 @@ int main(int argc, char** argv)
                     if(EnvL==1)
                       {
                         CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
-                        NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
-                        NS.init_orb( orb1 ) ;
+                        NS = SINGLETON_<SALOME_NamingService>::Instance() ;
+                        NS->init_orb( orb1 ) ;
                         for(int j=1; j<=NumberOfTries; j++)
                           {
                             if (j!=1) 
@@ -161,7 +161,13 @@ int main(int argc, char** argv)
       // ready to accept requests.
       PortableServer::ObjectId_var myStudy_iid = poa->activate_object(myStudy_i);
       SALOMEDS::Study_var Study = myStudy_i->_this();
-      NS.Register(Study.in(), "/Study");
+
+      if (!NS)
+        {
+          NS = SINGLETON_<SALOME_NamingService>::Instance();
+          NS->init_orb( orb );
+        }
+      NS->Register(Study.in(), "/Study");
 
       // Assign the value of the IOR in the study->root
       CORBA::String_var IORStudy = orb->object_to_string(Study);
index 5c1337f1851906c3194881007a903f585a933227..d0eef1dd512d308974f3d46d82b0ecd03600c4ee 100644 (file)
@@ -179,50 +179,6 @@ namespace SALOMEDS
     CORBA::ORB_var                    _orb;
   };
 
-  class GenObjRegister: public SALOMEDSImpl_AbstractCallback
-  {
-  public:
-    GenObjRegister(CORBA::ORB_ptr orb)
-    {
-      _orb = CORBA::ORB::_duplicate(orb);
-    }
-    virtual void RegisterGenObj  (const std::string& theIOR)
-    {
-      try
-      {
-        CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str());
-        if ( obj->_non_existent() ) return;
-        SALOME::GenericObj_var gobj = SALOME::GenericObj::_narrow(obj);
-        if(! CORBA::is_nil(gobj) )
-        {
-          gobj->Register();
-        }
-      }
-      catch(const CORBA::Exception& e)
-      {
-      }
-    }
-    virtual void UnRegisterGenObj(const std::string& theIOR)
-    {
-      try
-      {
-        CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str());
-        if ( obj->_non_existent() ) return;
-        SALOME::GenericObj_var gobj = SALOME::GenericObj::_narrow(obj);
-        if(! CORBA::is_nil(gobj) )
-        {
-          gobj->UnRegister();
-        }
-      }
-      catch(const CORBA::Exception& e)
-      {
-      }
-    }
-
-  private:
-    CORBA::ORB_var _orb;
-  };
-
 } // namespace SALOMEDS
 
 //============================================================================
@@ -260,11 +216,9 @@ void SALOMEDS_Study_i::Init()
 {
   _builder        = new SALOMEDS_StudyBuilder_i(_impl->NewBuilder(), _orb);  
   _notifier       = new SALOMEDS::Notifier(_orb);
-  _genObjRegister = new SALOMEDS::GenObjRegister(_orb);
   _closed         = false;
 
   _impl->setNotifier(_notifier);
-  _impl->setGenObjRegister( _genObjRegister );
 
   // Notify GUI that study was created
   SALOME_NamingService *aNamingService = KERNEL::getNamingService();
@@ -296,7 +250,6 @@ void SALOMEDS_Study_i::Clear()
   _impl->Clear();
   _impl->setNotifier(0);
   delete _notifier;
-  delete _genObjRegister;
 
   SALOMEDS::Locker lock;
 
@@ -1072,23 +1025,6 @@ void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR, const char* anEntry)
   _impl->UpdateIORLabelMap(std::string((char*)anIOR), std::string((char*)anEntry));
 }
 
-SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb)
-{
-  SALOMEDS::Locker lock;
-
-  SALOMEDSImpl_AttributeIOR* Att = NULL;
-  if ((Att=(SALOMEDSImpl_AttributeIOR*)theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))){
-    char* IOR = CORBA::string_dup(Att->Value().c_str());
-    CORBA::Object_var obj = orb->string_to_object(IOR);
-    SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
-    ASSERT(!CORBA::is_nil(aStudy));
-    return SALOMEDS::Study::_duplicate(aStudy);
-  } else {
-    MESSAGE("GetStudy: Problem to get study");
-  }
-  return SALOMEDS::Study::_nil();
-}
-
 void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute) 
 {
   SALOMEDS::Locker lock; 
index 20b3bd6d2cb1f6f46dca2daf53f32fd961bfccf0..bfa702ddd73f1d4bb47c7bff64e986d3db394780 100644 (file)
@@ -54,7 +54,6 @@ private:
   SALOMEDSImpl_Study*            _impl;  
   SALOMEDS_StudyBuilder_i*       _builder;    
   SALOMEDSImpl_AbstractCallback* _notifier;
-  SALOMEDSImpl_AbstractCallback* _genObjRegister;
   SALOMEDS_DriverFactory_i*      _factory;
   bool                           _closed;
 
index c2e4cf58aa9aec836ba5566f430fdc5f3b3a1f91..9757721b6de3594a2a5dd9f9db7e1217e31bf54b 100644 (file)
@@ -70,7 +70,7 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
     def CanPublishInStudy(self, theIOR):
         return 1
 
-    def PublishInStudy(self, theStudy, theSObject, theObject, theName):
+    def PublishInStudy(self, theSObject, theObject, theName):
         return None
 
     def CanCopy(self, theObject):
index f5c8ec76464fdf2898f38a0164eb7d744b78b6af..8983f3d949dd03397a46faef21802ea2c18cdc2f 100644 (file)
@@ -65,19 +65,8 @@ void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue)
   CheckLocked();
 
   Backup();
-  //remove IOR entry in study
-  if(theValue != myString)
-    {
-      SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label());
-      study->RegisterGenObj(theValue, Label());
-      study->UnRegisterGenObj(myString, Label());
-      study->DeleteIORLabelMapItem(myString);
-    }
 
   myString = theValue;
-
-  //add IOR entry in study
-  SALOMEDSImpl_Study::IORUpdated(this);
   
   //Reason = 5 means that IOR attribute updated
   //Used in the gui module to detect that IOR attribure was assigned to the object
@@ -104,7 +93,6 @@ SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR()
 
 SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR()
 {
-  SALOMEDSImpl_Study::UnRegisterGenObj(myString, Label());
 }
 
 //=======================================================================
index 8c5ae3c645fc85c307e6fed7a74bf11fb487c1e3..0b935d0c2b6a081c1a1375052e66bda92a442659 100644 (file)
@@ -61,7 +61,5 @@ public:
   virtual bool removeSO_Notification(const SALOMEDSImpl_SObject& theSObject){return false;};
   virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject, int reason ){return false;};
   virtual bool modifyNB_Notification(const char* theVarName){return false;};
-  virtual void RegisterGenObj  (const std::string& theIOR) {}
-  virtual void UnRegisterGenObj(const std::string& theIOR) {}
 };
 #endif
index 4d26ae7a977bc47e39a8ab139949b7973bd61561..cbe8fc71ea52ed81c9e57558f479f907f1a54a27 100644 (file)
@@ -148,7 +148,6 @@ void SALOMEDSImpl_Study::Init()
   _builder = new SALOMEDSImpl_StudyBuilder(this);
   _cb = new SALOMEDSImpl_Callback(_useCaseBuilder);
   _notifier=0;
-  _genObjRegister=0;
   //Put on the root label a StudyHandle attribute to store the address of this object
   //It will be used to retrieve the study object by DF_Label that belongs to the study
   SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
@@ -3199,49 +3198,6 @@ void SALOMEDSImpl_Study::setNotifier(SALOMEDSImpl_AbstractCallback* notifier)
   _notifier=notifier;
 }
 
-static SALOMEDSImpl_AbstractCallback* & getGenObjRegister( DF_Document* doc )
-{
-  static std::vector< SALOMEDSImpl_AbstractCallback* > _genObjRegVec;
-  if ( doc->GetDocumentID() >= (int)_genObjRegVec.size() )
-    _genObjRegVec.resize( doc->GetDocumentID() + 1, 0 );
-  return _genObjRegVec[ doc->GetDocumentID() ];
-}
-
-//================================================================================
-/*!
- * \brief Stores theRegister
- */
-//================================================================================
-
-void SALOMEDSImpl_Study::setGenObjRegister(SALOMEDSImpl_AbstractCallback* theRegister)
-{
-  getGenObjRegister( _doc ) = theRegister;
-}
-
-//================================================================================
-/*!
- * \brief Indirectly invokes GenericObj_i::Register()
- */
-//================================================================================
-
-void SALOMEDSImpl_Study::RegisterGenObj  (const std::string& theIOR, DF_Label label)
-{
-  if ( SALOMEDSImpl_AbstractCallback* goRegister = getGenObjRegister( label.GetDocument() ))
-    goRegister->RegisterGenObj( theIOR );
-}
-
-//================================================================================
-/*!
- * \brief Indirectly invokes GenericObj_i::UnRegister()
- */
-//================================================================================
-
-void SALOMEDSImpl_Study::UnRegisterGenObj(const std::string& theIOR, DF_Label label)
-{
-  if ( SALOMEDSImpl_AbstractCallback* goRegister = getGenObjRegister( label.GetDocument() ))
-    goRegister->UnRegisterGenObj( theIOR );
-}
-
 //#######################################################################################################
 //#                                     STATIC PRIVATE FUNCTIONS
 //#######################################################################################################
index bd8f55faf9b491937c06c28a5e69d892c6adf346..ff30a54c1d72425d57d921425b48ffcc8585507e 100644 (file)
@@ -72,7 +72,6 @@ private:
   SALOMEDSImpl_StudyBuilder*   _builder;
   SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder;
   SALOMEDSImpl_AbstractCallback* _notifier;
-  SALOMEDSImpl_AbstractCallback* _genObjRegister;
 
   std::map<std::string, SALOMEDSImpl_SObject> _mapOfSO;
   std::map<std::string, SALOMEDSImpl_SComponent> _mapOfSCO;
@@ -361,10 +360,6 @@ public:
   virtual bool modifySO_Notification(const SALOMEDSImpl_SObject& theSObject, int reason);
   virtual void setNotifier(SALOMEDSImpl_AbstractCallback* notifier);
 
-  static void RegisterGenObj  (const std::string& theIOR, DF_Label label);
-  static void UnRegisterGenObj(const std::string& theIOR, DF_Label label);
-  void setGenObjRegister(SALOMEDSImpl_AbstractCallback* theRegister);
-
   friend class SALOMEDSImpl_GenericAttribute;
   friend class SALOMEDSImpl_GenericVariable;
 };
index f3e53011249236c44c56f3af48f99cefe94cbaf1..bf0c5ea0adc76ba8dd0231ce668fcf18b976a1c6 100644 (file)
@@ -1014,10 +1014,7 @@ static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* dr
                                                               persist_ref, 
                                                               isMultiFile, 
                                                               isASCII);
-      SALOMEDSImpl_AttributeIOR* iorAttr = SALOMEDSImpl_AttributeIOR::Set (current, ior_string);
-
-      // make myRefCounter of a loaded GenericObj == 1
-      SALOMEDSImpl_Study::UnRegisterGenObj( ior_string, iorAttr->Label());
+      SALOMEDSImpl_AttributeIOR::Set (current, ior_string);
     }
     Translate_persistentID_to_IOR (current, driver, isMultiFile, isASCII);
   }