Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeSelection.h
index fc7675f48b196a8ef2f8a5a251f6a521448e58d4..74802c858a77361e7bc691fa5a97e08701da7549 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModelAPI_AttributeSelection.h
-// Created:     2 Oct 2014
-// Author:      Mikhail PONIKAROV
+// Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef ModelAPI_AttributeSelection_H_
 #define ModelAPI_AttributeSelection_H_
@@ -19,8 +33,16 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
 {
  public:
   /// Defines the result and its selected sub-shape
+  /// \param theContext object where the sub-shape was selected
+  /// \param theSubShape selected sub-shape (if null, the whole context is selected)
+  /// \param theTemporarily if it is true, do not store and name the added in the data framework
+  ///           (used to remove immideately, without the following updates)
   virtual void setValue(
-    const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
+    const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
+    const bool theTemporarily = false) = 0;
+
+  /// Reset temporary stored values
+  virtual void removeTemporaryValues() = 0;
 
   /// Returns the selected subshape
   virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
@@ -33,37 +55,36 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   virtual bool update() = 0;
 
   /// Returns the type of this class of attributes
-  static std::string type()
+  static std::string typeId()
   {
     return "Selection";
   }
 
   /// Returns the type of this class of attributes, not static method
-  virtual std::string attributeType()
-  {
-    return type();
-  }
+  MODELAPI_EXPORT virtual std::string attributeType();
 
   /// Returns a textual string of the selection
-  virtual std::string namingName() = 0;
-  
+  /// \param theDefaultValue a value, which is used if the naming name can not be obtained
+  virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
+
   /// Returns an id of the selection
   virtual int Id() = 0;
 
+  /// Defines an id of the selection
+  virtual void setId(int theID) = 0;
 
   /// Selects sub-shape by the textual Name
   virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
 
+  /// Returns true if recompute of selection become impossible
+  virtual bool isInvalid() = 0;
+
   /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_AttributeSelection()
-  {
-  }
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
 
  protected:
   /// Objects are created for features automatically
-  MODELAPI_EXPORT ModelAPI_AttributeSelection()
-  {
-  }
+  MODELAPI_EXPORT ModelAPI_AttributeSelection();
 };
 
 //! Pointer on double attribute