Salome HOME
Fix for the issue #593: do not remove naming attribute, but use TNaming_Builder for...
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeSelection.h
index 08f5f6e5d85248b1f32e7f4b029bc4d79b479c56..71c850e59830047483ded064f64885f76fd9bcd9 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        ModelAPI_AttributeSelection.h
 // Created:     2 Oct 2014
 // Author:      Mikhail PONIKAROV
@@ -18,39 +20,47 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
  public:
   /// Defines the result and its selected sub-shape
   virtual void setValue(
-    const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
+    const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
 
   /// Returns the selected subshape
-  virtual boost::shared_ptr<GeomAPI_Shape> value() = 0;
+  virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
 
   /// Returns the context of the selection (the whole shape owner)
   virtual ResultPtr context() = 0;
 
+  /// Updates the underlied selection due to the changes in the referenced objects
+  /// \returns false if update is failed
+  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
+  /// \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;
+
+
+  /// Selects sub-shape by the textual Name
+  virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 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
-typedef boost::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;
+typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;
 
 #endif