Salome HOME
updated copyright message
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_GenericAttribute_i.cxx
index c68177b5c1d5e2ef03b21696a7026e4148e79143..771a115a2301fcc8dbc61b94c98f705fedce8e7c 100644 (file)
@@ -1,30 +1,32 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : SALOMEDS_GenericAttribute_i.cxx
 //  Author : Sergey RUIN
 //  Module : SALOME
 //
 #include "utilities.h"
 #include "SALOMEDS_GenericAttribute_i.hxx"
+#include "SALOMEDS_Study_i.hxx"
 #include "SALOMEDS_Attributes.hxx"
 #include "SALOMEDS.hxx"
 #include "SALOMEDSImpl_SObject.hxx"
 #include <unistd.h>
 #endif
 
-using namespace std;
-
-UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection);
+UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection)
 
-SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb)
+SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb) :
+  GenericObj_i(SALOMEDS_Study_i::GetThePOA())
 {
   _orb = CORBA::ORB::_duplicate(theOrb);
   _impl = theImpl;
 }
 
-void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) 
+SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i()
+{
+}
+
+//============================================================================
+/*!
+  \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_GenericAttribute_i::_default_POA()
+{
+  myPOA = PortableServer::POA::_duplicate(SALOMEDS_Study_i::GetThePOA());
+  //MESSAGE("SALOMEDS_GenericAttribute_i::_default_POA: " << myPOA);
+  return PortableServer::POA::_duplicate(myPOA);
+}
+
+void SALOMEDS_GenericAttribute_i::CheckLocked()
 {
   SALOMEDS::Locker lock;
   Unexpect aCatch(GALockProtection);
@@ -79,22 +101,22 @@ char* SALOMEDS_GenericAttribute_i::Type()
 {
   SALOMEDS::Locker lock;
   if (_impl) {
-    string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl);
+    std::string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl);
     return CORBA::string_dup(type.c_str());
   }    
 
-  return (char*)"";
+  return CORBA::string_dup("");
 }
 
 char* SALOMEDS_GenericAttribute_i::GetClassType()
 {
   SALOMEDS::Locker lock;
   if (_impl) {
-    string class_type = SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl);
+    std::string class_type = SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl);
     return CORBA::string_dup(class_type.c_str());
   }
 
-  return (char*)"";
+  return CORBA::string_dup("");
 }
 
 
@@ -104,10 +126,11 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute
 {
   SALOMEDS::Locker lock;
 
-  string aClassType = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr)->GetClassType();
+  std::string aClassType = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr)->GetClassType();
   char* aTypeOfAttribute = (char*)aClassType.c_str();
   SALOMEDS::GenericAttribute_var anAttribute;
   SALOMEDS_GenericAttribute_i* attr_servant = NULL;
+  SALOME_UNUSED(attr_servant);
   __CreateGenericCORBAAttribute
 
   return anAttribute._retn();