Salome HOME
updated copyright message
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Reference.cpp
index 20a07f53b12dc9323c034eaf8c4c430bab101590..445490e8faf51b5f4e0442229406e0e194a1fd30 100644 (file)
@@ -1,10 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+// Copyright (C) 2014-2023  CEA, EDF
+//
+// 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
+//
 
-// File:        FeaturesAPI_Reference.cpp
-// Created:     04 August 2016
-// Author:      Mikhail Ponikarov
-
-//--------------------------------------------------------------------------------------
 #include "ModelHighAPI_Reference.h"
 
 #include <ModelAPI_AttributeReference.h>
@@ -25,6 +37,16 @@ ModelHighAPI_Reference::ModelHighAPI_Reference(
     const std::shared_ptr<ModelHighAPI_Interface> & theValue)
 : myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
 {
+  // the result is not constructed yet, forcibly do it
+  if (!myObject) {
+    theValue->execute(true);
+    myObject = std::shared_ptr<ModelAPI_Object>(theValue->defaultResult());
+    if (!myObject) {
+      // [bos #26534] EDF 24265 - Problem of recover in TUI
+      // Feature can have no results, store the feature itself
+      myObject = std::shared_ptr<ModelAPI_Object>(theValue->feature());
+    }
+  }
 }
 
 ModelHighAPI_Reference::~ModelHighAPI_Reference()