Salome HOME
Do not over write CatalogResources for a job on localhost with SalomeLauncher.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_SObject_i.cxx
index 210e0fa68217ad2a69d83c4bf17afbe39d3ed9f5..0b660550e5ad9ec088e381a827884fc8c3605a06 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -26,9 +26,9 @@
 //
 #include "utilities.h"
 #include "SALOMEDS_SObject_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
 #include "SALOMEDS_SComponent_i.hxx"
 #include "SALOMEDS_GenericAttribute_i.hxx"
-#include "SALOMEDS_StudyManager_i.hxx"
 #include "SALOMEDS.hxx"
 #include "SALOMEDSImpl_GenericAttribute.hxx"
 #include "SALOMEDSImpl_SComponent.hxx"
@@ -58,7 +58,8 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImp
  *  Purpose  :
  */
 //============================================================================
-SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb)
+SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb) :
+  GenericObj_i(SALOMEDS_Study_i::GetThePOA())
 {
   _impl = 0;
   if(!impl.IsNull()) {
@@ -71,7 +72,6 @@ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::
      }
   }
   _orb = CORBA::ORB::_duplicate(orb);
-   //SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy());
 }
 
 
@@ -85,6 +85,23 @@ SALOMEDS_SObject_i::~SALOMEDS_SObject_i()
    if(_impl) delete _impl;    
 }
 
+//============================================================================
+/*!
+  \brief Get default POA for the servant object.
+
+  This function is implicitly called from "_this()" function.
+  Default POA can be set via the constructor.
+
+  \return reference to the default POA for the servant
+*/
+//============================================================================
+PortableServer::POA_ptr SALOMEDS_SObject_i::_default_POA()
+{
+  myPOA = PortableServer::POA::_duplicate(SALOMEDS_Study_i::GetThePOA());
+  //MESSAGE("SALOMEDS_SObject_i::_default_POA: " << myPOA);
+  return PortableServer::POA::_duplicate(myPOA);
+}
+
 //================================================================================
 /*!
  * \brief Returns true if the %SObject does not belong to any %Study
@@ -132,27 +149,6 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::GetFather()
   return so._retn();
 }
 
-//============================================================================
-/*! Function :
- *  Purpose  :
- */
-//============================================================================
-SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
-{
-  SALOMEDS::Locker lock;
-  SALOMEDSImpl_Study* aStudy = _impl->GetStudy();
-  if(!aStudy) {
-    MESSAGE("Problem GetStudy");
-    return SALOMEDS::Study::_nil();
-  }
-
-  std::string IOR = aStudy->GetTransientReference();
-  CORBA::Object_var obj = _orb->string_to_object(IOR.c_str());
-  SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ;
-  ASSERT(!CORBA::is_nil(Study));
-  return SALOMEDS::Study::_duplicate(Study);
-}
-
 //============================================================================
 /*! Function : FindAttribute
  *  Purpose  : Find attribute of given type on this SObject