Salome HOME
Minor changes with classes renaming and virtual destructors declarations.
authormpv <mikhail.ponikarov@opencascade.com>
Thu, 10 Apr 2014 13:59:01 +0000 (17:59 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Thu, 10 Apr 2014 13:59:01 +0000 (17:59 +0400)
22 files changed:
src/Model/Model_Data.h
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_Attribute.h
src/ModelAPI/ModelAPI_AttributeDocRef.h
src/ModelAPI/ModelAPI_AttributeDouble.h
src/ModelAPI/ModelAPI_Data.h [new file with mode: 0644]
src/ModelAPI/ModelAPI_Document.h
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_Interface.h [deleted file]
src/ModelAPI/ModelAPI_Iterator.h
src/ModelAPI/ModelAPI_Object.h [deleted file]
src/ModelAPI/ModelAPI_Plugin.h
src/ModelAPI/ModelAPI_PluginManager.cxx
src/ModelAPI/ModelAPI_PluginManager.h
src/ModuleBase/ModuleBase_Operation.cpp
src/PartSetPlugin/PartSetPlugin_Part.cxx
src/PartSetPlugin/PartSetPlugin_Point.cxx
src/XGUI/XGUI_DocumentDataModel.cpp
src/XGUI/XGUI_PartDataModel.cpp
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index b634d935ab767ca726b7b3b722634935276f373f..d33819a8fb50ba6d8038e4ba6667b07e140440c1 100644 (file)
@@ -6,7 +6,7 @@
 #define Model_Data_HeaderFile
 
 #include "Model.h"
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
 #include <TDF_Label.hxx>
 
 #include <map>
@@ -19,7 +19,7 @@ class ModelAPI_Attribute;
  * to get/set attributes from the document and compute result of an operation.
  */
 
-class Model_Data: public ModelAPI_Object
+class Model_Data: public ModelAPI_Data
 {
   TDF_Label myLab; ///< label of the feature in the document
   /// All attributes of the object identified by the attribute ID
index c9afbc7aba1e478c6ccdab36278c575cfe887e44..4b15c44e34edd1aac6898b0b12082c48547531e4 100644 (file)
@@ -6,12 +6,11 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
 SET(PROJECT_HEADERS
     ModelAPI.h
-    ModelAPI_Interface.h
     ModelAPI_PluginManager.h
     ModelAPI_Plugin.h
     ModelAPI_Feature.h
     ModelAPI_Iterator.h
-    ModelAPI_Object.h
+    ModelAPI_Data.h
     ModelAPI_Document.h
     ModelAPI_Attribute.h
     ModelAPI_AttributeDouble.h
index 96d4414a9e9e37518e188fdc4dcf09f07da48c65..c0bcc3221d3c186a51164f82070c41ebce399ece 100644 (file)
@@ -5,7 +5,7 @@
   #include "ModelAPI_Document.h"
   #include "ModelAPI_PluginManager.h"
   #include "ModelAPI_Feature.h"
-  #include "ModelAPI_Object.h"
+  #include "ModelAPI_Data.h"
   #include "ModelAPI_Attribute.h"
   #include "ModelAPI_AttributeDocRef.h"
   #include "ModelAPI_AttributeDouble.h"
@@ -25,7 +25,7 @@
 %shared_ptr(ModelAPI_Document)
 %shared_ptr(ModelAPI_PluginManager)
 %shared_ptr(ModelAPI_Feature)
-%shared_ptr(ModelAPI_Object)
+%shared_ptr(ModelAPI_Data)
 %shared_ptr(ModelAPI_Attribute)
 %shared_ptr(ModelAPI_AttributeDocRef)
 %shared_ptr(ModelAPI_AttributeDouble)
@@ -35,7 +35,7 @@
 %include "ModelAPI_Document.h"
 %include "ModelAPI_PluginManager.h"
 %include "ModelAPI_Feature.h"
-%include "ModelAPI_Object.h"
+%include "ModelAPI_Data.h"
 %include "ModelAPI_Attribute.h"
 %include "ModelAPI_AttributeDocRef.h"
 %include "ModelAPI_AttributeDouble.h"
index cd7d36a549b2a384059494ca21d4ff64a538b4a6..1d4bf15e8b992db095952337e4cd4b04a4babea0 100644 (file)
@@ -20,10 +20,13 @@ public:
   /// Returns the type of this class of attributes, not static method
   virtual std::string attributeType() = 0;
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_Attribute() {}
+
 protected:
   /// Objects are created for features automatically
-  ModelAPI_Attribute()
-  {}
+  ModelAPI_Attribute(){}
+
 };
 
 #endif
index e9a602dccf8538eb786d95c7d18ee1341095052d..9b0a6c2956a592f7d0c321d0a9ee5ae87dd6aa0f 100644 (file)
@@ -28,6 +28,9 @@ public:
   /// Returns the type of this class of attributes, not static method
   virtual std::string attributeType() {return type();}
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_AttributeDocRef() {}
+
 protected:
   /// Objects are created for features automatically
   ModelAPI_AttributeDocRef()
index cc6a2dd261cf864484584e00ed3755ef1fc3eaf2..024da5ea51bea4746d6db7e357e2ad66f0f702ba 100644 (file)
@@ -27,6 +27,9 @@ public:
   /// Returns the type of this class of attributes, not static method
   virtual std::string attributeType() {return type();}
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_AttributeDouble() {}
+
 protected:
   /// Objects are created for features automatically
   ModelAPI_AttributeDouble()
diff --git a/src/ModelAPI/ModelAPI_Data.h b/src/ModelAPI/ModelAPI_Data.h
new file mode 100644 (file)
index 0000000..c8f006e
--- /dev/null
@@ -0,0 +1,55 @@
+// File:        ModelAPI_Data.hxx
+// Created:     21 Mar 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef ModelAPI_Data_HeaderFile
+#define ModelAPI_Data_HeaderFile
+
+#include "ModelAPI.h"
+#include <string>
+#include <memory>
+
+class ModelAPI_AttributeDocRef;
+class ModelAPI_AttributeDouble;
+class ModelAPI_Document;
+
+/**\class ModelAPI_Data
+ * \ingroup DataModel
+ * \brief General object of the application that allows
+ * to get/set attributes from the document and compute result of an operation.
+ */
+
+class MODELAPI_EXPORT ModelAPI_Data
+{
+public:
+
+  /// Returns the name of the feature visible by the user in the object browser
+  virtual std::string getName() = 0;
+
+  /// Defines the name of the feature visible by the user in the object browser
+  virtual void setName(std::string theName) = 0;
+
+  /// Returns the attribute that references to another document
+  virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
+  /// Returns the attribute that contains real value with double precision
+  virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
+
+  /// Initializes object by the attributes: must be called just after the object is created
+  /// for each attribute of the object
+  /// \param theID identifier of the attribute that can be referenced by this ID later
+  /// \param theAttrType type of the created attribute (received from the type method)
+  virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
+
+  /// Returns the document of this data
+  virtual std::shared_ptr<ModelAPI_Document> document() = 0;
+
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_Data() {}
+
+protected:
+  /// Objects are created for features automatically
+  ModelAPI_Data()
+  {}
+};
+
+#endif
index 50209d63ebfcbfecb31510da7dcc579b4ad11a11..546c5020a076eed5f23b9654f0e20e51ab2fe03e 100644 (file)
@@ -90,6 +90,9 @@ public:
   ///! Returns the vector of groups already added to the document
   MODELAPI_EXPORT virtual const std::vector<std::string>& getGroups() const = 0;
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_Document() {}
+
 protected:
   /// Only for SWIG wrapping it is here
   MODELAPI_EXPORT ModelAPI_Document()
index 1b166b600c1dfaa4116612b4904a832821435078..7cb9256a08874c3c8e609625020ba2c5bcec78b3 100644 (file)
@@ -11,7 +11,7 @@
 #include <string>
 #include <memory>
 
-class ModelAPI_Object;
+class ModelAPI_Data;
 class ModelAPI_Document;
 
 /**\class ModelAPI_Feature
@@ -21,7 +21,7 @@ class ModelAPI_Document;
  */
 class ModelAPI_Feature
 {
-  std::shared_ptr<ModelAPI_Object> myData; ///< manager of the data model of a feature
+  std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
 
 public:
   /// Returns the kind of a feature (like "Point")
@@ -37,13 +37,16 @@ public:
   MODELAPI_EXPORT virtual void execute() = 0;
 
   /// Returns the data manager of this feature
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Object> data() {return myData;}
+  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() {return myData;}
 
   /// Must return document where the new feature must be added to
   /// By default it is current document
   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd()
   {return ModelAPI_PluginManager::get()->currentDocument();}
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_Feature() {}
+
 protected:
   /// Use plugin manager for features creation: this method is 
   /// defined here only for SWIG-wrapping
@@ -51,7 +54,7 @@ protected:
   {}
 
   /// Sets the data manager of an object (document does)
-  MODELAPI_EXPORT void setData(std::shared_ptr<ModelAPI_Object> theData) {myData = theData;}
+  MODELAPI_EXPORT void setData(std::shared_ptr<ModelAPI_Data> theData) {myData = theData;}
   friend class Model_Document;
 };
 
diff --git a/src/ModelAPI/ModelAPI_Interface.h b/src/ModelAPI/ModelAPI_Interface.h
deleted file mode 100644 (file)
index 8535be8..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// File:        ModelAPI_Interface.hxx
-// Created:     20 Mar 2014
-// Author:      Mikhail PONIKAROV
-
-#ifndef ModelAPI_Interface_HeaderFile
-#define ModelAPI_Interface_HeaderFile
-
-#include <ModelAPI.h>
-
-/**\class ModelAPI_Interface
- * \ingroup DataModel
- * \brief General base class for all interfaces in this package
- */
-
-class MODELAPI_EXPORT ModelAPI_Interface
-{
-  void* myImpl; ///< pointer to the internal implementation object
-
-public:
-  /// None - constructor
-  virtual ModelAPI_Interface()
-  {
-    myImpl = 0;
-  }
-
-  /// Constructor by the implementation pointer (used for internal needs)
-  virtual ModelAPI_Interface(void* theImpl)
-  {
-    myImpl = theImpl;
-  }
-
-  /// Copy-constructor
-  virtual ModelAPI_Interface(ModelAPI_Interface& theOrig)
-  {
-    myImpl = theOrig.theImpl;
-    Duplicate();
-  }
-
-  virtual ModelAPI_Interface& operator=(ModelAPI_Interface& const theOrig)
-  { myImpl = theOrig.theImpl; Duplicate(); return *this;}
-
-  /// Duplicates the objet pointed by myImpl (loosing the old one)
-  virtual void Duplicate() = 0;
-
-};
-
-#endif
index 73187982f5e4269907a827353c924bbffc05a428..41032c2fbbf6a86d0399bb0f666a4ac52d059c74 100644 (file)
@@ -38,6 +38,9 @@ public:
   /// \returns true if given feature equals to the current one
   virtual bool is(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_Iterator() {}
+
 protected:
   /// Use plugin manager for features creation: this method is 
   /// defined here only for SWIG-wrapping
diff --git a/src/ModelAPI/ModelAPI_Object.h b/src/ModelAPI/ModelAPI_Object.h
deleted file mode 100644 (file)
index cf81f99..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// File:        ModelAPI_Object.hxx
-// Created:     21 Mar 2014
-// Author:      Mikhail PONIKAROV
-
-#ifndef ModelAPI_Object_HeaderFile
-#define ModelAPI_Object_HeaderFile
-
-#include "ModelAPI.h"
-#include <string>
-#include <memory>
-
-class ModelAPI_AttributeDocRef;
-class ModelAPI_AttributeDouble;
-class ModelAPI_Document;
-
-/**\class ModelAPI_Object
- * \ingroup DataModel
- * \brief General object of the application that allows
- * to get/set attributes from the document and compute result of an operation.
- */
-
-class MODELAPI_EXPORT ModelAPI_Object
-{
-public:
-
-  /// Returns the name of the feature visible by the user in the object browser
-  virtual std::string getName() = 0;
-
-  /// Defines the name of the feature visible by the user in the object browser
-  virtual void setName(std::string theName) = 0;
-
-  /// Returns the attribute that references to another document
-  virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
-  /// Returns the attribute that contains real value with double precision
-  virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
-
-  /// Initializes object by the attributes: must be called just after the object is created
-  /// for each attribute of the object
-  /// \param theID identifier of the attribute that can be referenced by this ID later
-  /// \param theAttrType type of the created attribute (received from the type method)
-  virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
-
-  /// Returns the document of this data
-  virtual std::shared_ptr<ModelAPI_Document> document() = 0;
-
-protected:
-  /// Objects are created for features automatically
-  ModelAPI_Object()
-  {}
-};
-
-#endif
index 0605d8b6f1997c5bedc6f5a18b965ec709dc5e71..fb084002ccf9aba58f93ab3326c6b6fba10e470e 100644 (file)
@@ -22,6 +22,9 @@ public:
   /// Creates the feature object of this plugin by the feature string ID
   virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_Plugin() {}
+
 protected:
   /// Is needed for python wrapping by swig
   ModelAPI_Plugin() {};
index 6f9834f6ad14c94d83f7e5dae40eabbe5bf453d4..47623f0915fc597532b889467e8b4299be88e808 100644 (file)
@@ -7,8 +7,8 @@
 #include <ModelAPI_Document.h>
 // to avoid unresolved ModelAPI_Feature()
 #include <ModelAPI_Feature.h>
-// to avoid unresolved ModelAPI_Object()
-#include <ModelAPI_Object.h>
+// to avoid unresolved ModelAPI_Data()
+#include <ModelAPI_Data.h>
 // to avoid unresolved ModelAPI_Plugin()
 #include <ModelAPI_Plugin.h>
 // to avoid unresolved ModelAPI_Iterator()
index 3250bea97894ae162f2266645a16dbbd2ad47c6c..8aab3f6f40d8525510612b61cad659634794ed61 100644 (file)
@@ -46,6 +46,9 @@ public:
   /// Is needed for python wrapping by swig, call Get to get an instance
   ModelAPI_PluginManager();
 
+  /// To virtually destroy the fields of successors
+  virtual ~ModelAPI_PluginManager() {}
+
 protected:
   /// Creates the feature object using plugins functionality
   virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
index c3a0bd6fec3cef5b19649dc6fc7ba1f7b22689a9..9def6b185607c528fcff46672bad7f21df07ecef 100644 (file)
@@ -10,7 +10,7 @@
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
 #include <ModelAPI_PluginManager.h>
 #include <ModelAPI_Document.h>
 
@@ -263,7 +263,7 @@ void ModuleBase_Operation::storeReal(double theValue)
     return;
   }
   QString anId = sender()->objectName();
-  std::shared_ptr<ModelAPI_Object> aData = myFeature->data();
+  std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
   std::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
   aReal->setValue(theValue);
 }
index 5dca088f8ebb3ee320f21072327b511c40f88612..440eb6f2596322c2ed2f98a6e840a6115904db14 100644 (file)
@@ -5,7 +5,7 @@
 #include "PartSetPlugin_Part.h"
 #include "ModelAPI_PluginManager.h"
 #include "ModelAPI_Document.h"
-#include "ModelAPI_Object.h"
+#include "ModelAPI_Data.h"
 #include "ModelAPI_Iterator.h"
 #include "ModelAPI_AttributeDocRef.h"
 
index be95256c0aac0f84aa6a4704e621c98c111c56e8..e9b0d2fe2faebe27e7c26b6232606ad421f0479a 100644 (file)
@@ -5,7 +5,7 @@
 #include "PartSetPlugin_Point.h"
 #include "ModelAPI_PluginManager.h"
 #include "ModelAPI_Document.h"
-#include "ModelAPI_Object.h"
+#include "ModelAPI_Data.h"
 #include "ModelAPI_AttributeDouble.h"
 
 using namespace std;
index c3f8a437b13e4050370883f217dbb7cc3b405c83..b7f65b746b688082973d6bbb776a807edd10385e 100644 (file)
@@ -5,7 +5,7 @@
 #include <ModelAPI_Iterator.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
 #include <Model_Events.h>
 
 #include <Event_Loop.h>
@@ -22,6 +22,7 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
   myDocument = aMgr->currentDocument();
 
   // Register in event loop
+  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_CREATED));
   Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_UPDATED));
 
   // Create a top part of data tree model
index 4f8423f467634fcd188ac81f492b49879251e2af..f68b5fc4a0bc80549363786452244953ecbde345 100644 (file)
@@ -4,7 +4,7 @@
 #include <ModelAPI_Iterator.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 
 #include <QIcon>
index c4c09491de67d2fe34635116cb1ee8888ef4fc70..cbff6377398b64164fa5c3d27defa3bfa5d0195d 100644 (file)
@@ -6,7 +6,7 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_PluginManager.h>
 #include <ModelAPI_AttributeDocRef.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
 
 
 
index 682a4eea7e39f8d89545a22924117ccfc07d51c8..0aa5bde710846343163a4df7c4d99633bf027d40 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <ModelAPI_PluginManager.h>
 #include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 
 #include <Event_Loop.h>