Salome HOME
Merge branch 'V9_7_BR'
[modules/shaper.git] / src / Model / Model_AttributeRefAttr.cpp
index 6456b68a8bd1b2fc98a3164beca9a2bdb6c5d0ea..61eae6d80900d4a80edf64acc40f3412599a74bd 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModelAPI_AttributeRefAttr.cxx
-// Created:     2 Apr 2014
-// Author:      Mikhail PONIKAROV
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+//
+// 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.
+//
+// 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
+//
 
 #include "Model_AttributeRefAttr.h"
 #include "Model_Application.h"
@@ -10,8 +23,6 @@
 #include "Model_Objects.h"
 #include <ModelAPI_Feature.h>
 
-using namespace std;
-
 bool Model_AttributeRefAttr::isObject()
 {
   return myID->Get().Length() == 0;
@@ -21,10 +32,11 @@ void Model_AttributeRefAttr::setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr
 {
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
       theAttr->owner()->data());
-  string anID = aData->id(theAttr);
-  if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
+  std::string anID = aData->id(theAttr);
+  ObjectPtr anObj = object();
+  if (myIsInitialized && anObj == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
     return;  // nothing is changed
-  REMOVE_BACK_REF(theAttr->owner());
+  REMOVE_BACK_REF(anObj);
   myRef->Set(aData->label().Father());
   myID->Set(aData->id(theAttr).c_str());
   ADD_BACK_REF(theAttr->owner());