Salome HOME
Helper methods, aliases for data()->method()
authorsbh <sergey.belash@opencascade.com>
Tue, 28 Oct 2014 16:43:54 +0000 (19:43 +0300)
committersbh <sergey.belash@opencascade.com>
Tue, 28 Oct 2014 16:43:54 +0000 (19:43 +0300)
23 files changed:
src/Model/Model_Data.cpp
src/Model/Model_Update.cpp
src/ModelAPI/ModelAPI_AttributeBoolean.h
src/ModelAPI/ModelAPI_AttributeDocRef.h
src/ModelAPI/ModelAPI_AttributeRefAttr.h
src/ModelAPI/ModelAPI_AttributeRefList.h
src/ModelAPI/ModelAPI_AttributeReference.h
src/ModelAPI/ModelAPI_Feature.cpp
src/ModelAPI/ModelAPI_Feature.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFeature.cpp
src/ModuleBase/ModuleBase_WidgetFileSelector.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
src/PartSetPlugin/PartSetPlugin_Remove.cpp
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Point.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp

index fe65a751d7719525fa0721b123a776b358241481..a3a1177410a933b240cda98348d735da7eff1481 100644 (file)
@@ -17,6 +17,7 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomData_Point.h>
 #include <GeomData_Point2D.h>
index ccdd45e77d1588a490b8edec85e784be4178a34c..c6a669718b51b5456b35293d41880af09acfee91 100644 (file)
@@ -17,6 +17,7 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_CompositeFeature.h>
+#include <ModelAPI_Session.h>
 #include <Events_Loop.h>
 #include <Events_LongOp.h>
 #include <Events_Error.h>
index dcd76efc7a9b7184de03fe8cbcf42c25899f0ab8..cf431322bf298de5b87f8aea74aa707746ad4c43 100644 (file)
@@ -45,4 +45,6 @@ class ModelAPI_AttributeBoolean : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeBoolean> AttributeBooleanPtr;
+
 #endif
index 7ee1ff1ca0477a790475474e05c6aea5bd620d54..cf7cc84f379c0f8cab8cb209312d4034fd8a3c06 100644 (file)
@@ -46,4 +46,6 @@ class ModelAPI_AttributeDocRef : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeDocRef> AttributeDocRefPtr;
+
 #endif
index dc862f3a63d37bda21f87d2fb6fcd6f1ecedfd24..a3bf80601bbac2ade06f79d8de8f621b32b2276b 100644 (file)
@@ -56,4 +56,6 @@ class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeRefAttr> AttributeRefAttrPtr;
+
 #endif
index abb39beb645cc8b9bb3cf6b58c54cb291406aa88..d8edfe8d0bfdb1a4d8411512cc6b1823e3fdabda 100644 (file)
@@ -51,4 +51,6 @@ class ModelAPI_AttributeRefList : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeRefList> AttributeRefListPtr;
+
 #endif
index 14d63ae32551893516dcd42ab8b0b3df4faf0fc9..5354e8af54a15214a9d8ee3d76873107b4a65286 100644 (file)
@@ -46,4 +46,6 @@ class ModelAPI_AttributeReference : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeReference> AttributeReferencePtr;
+
 #endif
index b3dc06045a0461975b881b84a58398613e2281ab..14a1e396f55f0ad3c252e315a7c2c8f93d1937d0 100644 (file)
@@ -7,6 +7,7 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Session.h>
 #include <Events_Loop.h>
 
 const std::list<boost::shared_ptr<ModelAPI_Result> >& ModelAPI_Feature::results()
index a6c51d0407958d4831cc29773cc8e127aec5e9d1..3dc6a3d5d956a1e6622a51cb37647b559a1f31c1 100644 (file)
@@ -5,13 +5,27 @@
 #ifndef ModelAPI_Feature_H_
 #define ModelAPI_Feature_H_
 
-#include "ModelAPI_Object.h"
-#include "ModelAPI_Session.h"
+#include <ModelAPI.h>
+#include <ModelAPI_Object.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeDocRef.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Result.h>
 
-#include <string>
-#include <list>
 #include <boost/shared_ptr.hpp>
 
+#include <list>
+#include <string>
+
 class ModelAPI_Data;
 class ModelAPI_Document;
 class ModelAPI_Result;
@@ -36,6 +50,12 @@ class ModelAPI_Feature : public ModelAPI_Object
     return MY_GROUP;
   }
 
+  /// Returns document this feature belongs to
+  virtual boost::shared_ptr<ModelAPI_Document> document()
+  {
+    return ModelAPI_Object::document();
+  }
+
   /// Returns the group identifier of this result
   virtual std::string groupName()
   {
@@ -84,9 +104,73 @@ class ModelAPI_Feature : public ModelAPI_Object
 
   MODELAPI_EXPORT static boost::shared_ptr<ModelAPI_Feature> feature(ObjectPtr theObject);
 
+ //
+ // Helper methods, aliases for data()->method()
+ // -----------------------------------------------------------------------------------------------
+  inline std::string name()
+  {
+    return data()->name();
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID)
+  {
+    return data()->boolean(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID)
+  {
+    return data()->document(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID)
+  {
+    return data()->real(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID)
+  {
+    return data()->integer(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID)
+  {
+    return data()->refattr(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
+  {
+    return data()->reference(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID)
+  {
+    return data()->reflist(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID)
+  {
+    return data()->selection(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeSelectionList> selectionList(const std::string& theID)
+  {
+    return data()->selectionList(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID)
+  {
+    return data()->string(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID)
+  {
+    return data()->attribute(theID);
+  }
+ // -----------------------------------------------------------------------------------------------
 };
 
 //! Pointer on feature object
 typedef boost::shared_ptr<ModelAPI_Feature> FeaturePtr;
 
 #endif
+
index 36bc9f6f3cc2fca75a21fcc5bc9911a018728a66..7236630ffa429f6e82e593d51bc119279f9d29a9 100644 (file)
@@ -21,6 +21,7 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt2d.h>
 
index cbe7503a8e7a43833324fc3c275308d389ebf3db..256a5b516538855badcf255eb1d5a268774ce5e1 100644 (file)
@@ -27,6 +27,7 @@
 #include <ModuleBase_WidgetMultiSelector.h>
 
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <Config_Keywords.h>
 #include <Config_WidgetAPI.h>
index fcc226b3ea4cc67660f9edd0dc78992a95c30f01..faf664fe53e9d48180ac7323988e5be4e256808f 100644 (file)
@@ -21,6 +21,7 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_ResultValidator.h>
 #include <ModelAPI_RefAttrValidator.h>
+#include <ModelAPI_Session.h>
 
 #include <QWidget>
 #include <QLineEdit>
index d2369702f9ec3f2e2a106f267fba9cb6b7cf680c..36191b141ad90918838b0122f2bacc47ccbc7fa0 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 #include <ModuleBase_WidgetFileSelector.h>
 #include <ModuleBase_Tools.h>
 
index b2f838d1a9a7d72038c3b586a9613c81c4cb8865..58476af8abb0ebdcf5abcbfe40f3007c01a03a07 100644 (file)
@@ -18,6 +18,7 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Data.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomDataAPI_Point2D.h>
 #include <GeomDataAPI_Point.h>
index 892f610a0d36e43ebc4511f884184f9c97cc98bb..1eb3f95f99c04b3c486c8340751475e10f1560cd 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Dir.h>
index a2f006fa42880133ca20e36835d2a5f534517cf3..8c6e8cc0ae117285373734155090805ffa58069d 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Session.h>
 
 using namespace std;
 
index 5494949d8337448b660da84d563b46943b42ff1a..d459d9753a76aa8e4bb3176279b186e2c7f3e4ac 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Session.h>
 
 void PartSetPlugin_Remove::execute()
 {
index ec9d227deec81d97d63e91b2eec985cee2d73a7b..ae0b225ecb25e93cf741d734f4555bffa62c44ee 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Circ2d.h>
 #include <GeomAPI_Pnt2d.h>
index 4828a0f7b91a7b247e6e833caa30d6abaf493664..e4d9d8e94411e5185246105a54ee92cf61a1a975 100644 (file)
@@ -8,6 +8,8 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt2d.h>
 #include <GeomDataAPI_Point2D.h>
@@ -15,7 +17,6 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAlgoAPI_EdgeBuilder.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
-#include <ModelAPI_AttributeDouble.h>
 
 SketchPlugin_Circle::SketchPlugin_Circle()
     : SketchPlugin_Feature()
index 72a20f8618db061541c325f0ca7162a8f8d992ff..ccefb4bec3aba9a144313b2a8842b55e11629a54 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Lin2d.h>
index c198e9b90fd22c44e7c066ea30ee88a022aa2df1..1ad78684f8ab806ea8676054956b1083aac3aa47 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt2d.h>
 
index 555f0abfeb50e3e2c0b05225e91e83e658fa2b93..b71d5adbd69b29d7baf6f03b3c0e9e924ebe2fc9 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_ResultValidator.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_Session.h>
 #include <GeomDataAPI_Point2D.h>
 
 bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
index 84bf0d7beaea67bbcafb0bb59a3ae0ea4f75740a..a9618988920f1a3df15eb3303d335e16bed1a827 100644 (file)
@@ -13,6 +13,7 @@
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Session.h>
 
 #include <QAction>
 #include <QContextMenuEvent>