Salome HOME
Resolve crashes in the release mode under Debian Squeeze linux
authorsbh <sergey.belash@opencascade.com>
Mon, 12 Jan 2015 17:24:32 +0000 (20:24 +0300)
committersbh <sergey.belash@opencascade.com>
Mon, 12 Jan 2015 17:24:32 +0000 (20:24 +0300)
14 files changed:
src/Model/Model_ResultPart.cpp
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_Object.cpp
src/ModelAPI/ModelAPI_Object.h
src/ModelAPI/ModelAPI_Result.cpp
src/ModelAPI/ModelAPI_Result.h
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_ResultConstruction.cpp [new file with mode: 0644]
src/ModelAPI/ModelAPI_ResultConstruction.h
src/ModelAPI/ModelAPI_ResultGroup.h
src/ModelAPI/ModelAPI_ResultParameters.h
src/ModelAPI/ModelAPI_ResultPart.cpp [new file with mode: 0644]
src/ModelAPI/ModelAPI_ResultPart.h

index 1ec015c90c4d117a2c83468d615fbb35d383f6ef..0392787f3c7a2b7a44558b0b851a81a3914a5eb6 100644 (file)
@@ -42,8 +42,9 @@ void Model_ResultPart::activate()
       aDocRef->setValue(aDoc);
     }
   }
-  if (aDocRef->value())
+  if (aDocRef->value().get()) {
     ModelAPI_Session::get()->setActiveDocument(aDocRef->value());
+  }
 }
 
 bool Model_ResultPart::isActivated() 
index e30ddf142f04d85ffa7d5271d29ac62228068689..05fe6e971253aef473e35fa150300f207906c7f4 100644 (file)
@@ -45,6 +45,10 @@ SET(PROJECT_SOURCES
     ModelAPI_Feature.cpp
     ModelAPI_Session.cpp
     ModelAPI_Tools.cpp
+    ModelAPI_Object.cpp
+    ModelAPI_Result.cpp
+    ModelAPI_ResultPart.cpp
+    ModelAPI_ResultConstruction.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 452686cdb20906749a9c312f2a720c0a32121adc..a8ce3e94cda1384a69e36b844a3eacfcf6d0d80f 100644 (file)
@@ -31,7 +31,7 @@ class ModelAPI_Feature : public ModelAPI_Object
   virtual const std::string& getKind() = 0;
 
   /// Returns the group identifier of all features
-  static std::string group()
+  inline static std::string group()
   {
     static std::string MY_GROUP = "Features";
     return MY_GROUP;
index 26bc4681946fdd4665ee4432f3d35146148746b5..410c410c742f8d1f736aa8d646f6e7568b378784 100644 (file)
@@ -7,37 +7,46 @@
 #include "ModelAPI_Object.h"
 
 
-bool ModelAPI_Object::isInHistory() {
+bool ModelAPI_Object::isInHistory()
+{
   return true;
 }
 
-boost::shared_ptr<ModelAPI_Data> ModelAPI_Object::data() const {
+std::shared_ptr<ModelAPI_Data> ModelAPI_Object::data() const
+{
   return myData;
 }
 
-bool ModelAPI_Object::isSame(const boost::shared_ptr<ModelAPI_Object>& theObject) {
+bool ModelAPI_Object::isSame(const std::shared_ptr<ModelAPI_Object>& theObject)
+{
   return theObject.get() == this;
 }
 
-boost::shared_ptr<ModelAPI_Document> ModelAPI_Object::document() const {
+std::shared_ptr<ModelAPI_Document> ModelAPI_Object::document() const
+{
   return myDoc;
 }
 
-void ModelAPI_Object::attributeChanged() {
+void ModelAPI_Object::attributeChanged(const std::string& theID)
+{
 }
 
-ModelAPI_Object::~ModelAPI_Object() {
+ModelAPI_Object::~ModelAPI_Object()
+{
 }
 
-void ModelAPI_Object::setData(boost::shared_ptr<ModelAPI_Data> theData) {
+void ModelAPI_Object::setData(std::shared_ptr<ModelAPI_Data> theData)
+{
   myData = theData;
 }
 
-void ModelAPI_Object::setDoc(boost::shared_ptr<ModelAPI_Document> theDoc) {
+void ModelAPI_Object::setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
+{
   myDoc = theDoc;
 }
 
-void ModelAPI_Object::erase() {
+void ModelAPI_Object::erase()
+{
   if (myData) myData->erase();
   setData(DataPtr());
 }
index 6d8aeaec8f82869cf259908aacb9bbb8cdcdf779..45932c039e2046212dd9fa32b6e360d438127a02 100644 (file)
@@ -30,58 +30,37 @@ class ModelAPI_Object
   std::shared_ptr<ModelAPI_Document> myDoc;  ///< document this object belongs to
  public:
   /// By default object is displayed in the object browser.
-  virtual bool isInHistory()
-  {
-    return true;
-  }
+  MODELAPI_EXPORT virtual bool isInHistory();
 
   /// Returns the data manager of this object: attributes
-  virtual std::shared_ptr<ModelAPI_Data> data() const
-  {
-    return myData;
-  }
+  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() const;
 
   /// Returns true if object refers to the same data model instance
-  virtual bool isSame(const std::shared_ptr<ModelAPI_Object>& theObject)
-  {
-    return theObject.get() == this;
-  }
+  MODELAPI_EXPORT virtual bool isSame(const std::shared_ptr<ModelAPI_Object>& theObject);
 
   /// Returns document this feature belongs to
-  virtual std::shared_ptr<ModelAPI_Document> document() const
-  {
-    return myDoc;
-  }
+  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
 
   /// Returns the group identifier of this object
   virtual std::string groupName() = 0;
 
   /// Called on change of any argument-attribute of this object
   /// \param theID identifier of changed attribute
-  MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID) 
-  {}
+  // MODELAPI_EXPORT
+  MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID);
 
   /// To use virtuality for destructors
-  virtual ~ModelAPI_Object() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_Object();
 
  protected:
   /// Sets the data manager of an object (document does)
-  virtual void setData(std::shared_ptr<ModelAPI_Data> theData)
-  {
-    myData = theData;
-  }
+  MODELAPI_EXPORT virtual void setData(std::shared_ptr<ModelAPI_Data> theData);
 
   /// Sets the data manager of an object (document does)
-  virtual void setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
-  {
-    myDoc = theDoc;
-  }
+  MODELAPI_EXPORT virtual void setDoc(std::shared_ptr<ModelAPI_Document> theDoc);
 
   /// removes all fields from this feature
-  MODELAPI_EXPORT virtual void erase() {
-    if (myData) myData->erase();
-    setData(DataPtr());
-  }
+  MODELAPI_EXPORT virtual void erase();
 
   friend class Model_Document;
 
index 743c0367b43b3ea5e7dd7e4202768752f96d0e2d..aa5ddd227c9933c95e37adfd09c0c5195d1f18aa 100644 (file)
@@ -6,16 +6,12 @@
 
 #include "ModelAPI_Result.h"
 
-bool ModelAPI_Result::isConcealed() {
-  return myIsConcealed;
-}
-
-void ModelAPI_Result::setIsConcealed(const bool theValue) {
-  myIsConcealed = theValue;
-}
+ModelAPI_Result::~ModelAPI_Result()
+{
 
-ModelAPI_Result::ModelAPI_Result() {
 }
 
-ModelAPI_Result::~ModelAPI_Result() {
+std::shared_ptr<GeomAPI_Shape> ModelAPI_Result::shape()
+{
+  return std::shared_ptr<GeomAPI_Shape>();
 }
index c354ed3a3c2d821c4db457e006d6cbdd0d40122d..28ea36645dd080cc73b63acc41651706e59daa06 100644 (file)
@@ -23,18 +23,22 @@ class ModelAPI_Result : public ModelAPI_Object
   bool myIsConcealed; ///< the result is concealed from the data tree (referenced by other objects)
  public:
    /// Returns true if the result is concealed from the data tree (referenced by other objects)
-  inline bool isConcealed() {return myIsConcealed;}
+  inline bool isConcealed()
+  {
+    return myIsConcealed;
+  }
 
   /// Returns true if the result is concealed from the data tree (referenced by other objects)
-  inline void setIsConcealed(const bool theValue) {myIsConcealed = theValue;}
-
-  /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_Result()
+  inline void setIsConcealed(const bool theValue)
   {
+    myIsConcealed = theValue;
   }
 
+  /// To virtually destroy the fields of successors
+  MODELAPI_EXPORT virtual ~ModelAPI_Result();
+
   /// Returns the shape-result produced by this feature (or null if no shapes)
-  virtual std::shared_ptr<GeomAPI_Shape> shape() {return std::shared_ptr<GeomAPI_Shape>();}
+  MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
 };
 
 //! Pointer on feature object
index 61f90120c5ed07fedc37fa2f6a9e948d777b71cb..7fce7f512ce2ed80263219c2e01cead61fce0d2a 100644 (file)
@@ -32,7 +32,7 @@ public:
   }
 
   /// Returns the group identifier of this result
-  static std::string group()
+  inline static std::string group()
   {
     static std::string MY_GROUP = "Bodies";
     return MY_GROUP;
diff --git a/src/ModelAPI/ModelAPI_ResultConstruction.cpp b/src/ModelAPI/ModelAPI_ResultConstruction.cpp
new file mode 100644 (file)
index 0000000..5bf71d9
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        ModelAPI_ResultConstruction.cpp
+// Created:     07 Jul 2014
+// Author:      Mikhail PONIKAROV
+
+#include "ModelAPI_ResultConstruction.h"
+#include <string>
+
+std::string ModelAPI_ResultConstruction::groupName()
+{
+  return group();
+}
+
index 1092c4a9c1f20124ae9a2471dd40bf72e2bb0a65..85a8d81baa5df9534704a2471a1a1142f82df388 100644 (file)
@@ -23,13 +23,10 @@ class ModelAPI_ResultConstruction : public ModelAPI_Result
 {
  public:
   /// Returns the group identifier of this result
-  virtual std::string groupName()
-  {
-    return group();
-  }
+  MODELAPI_EXPORT virtual std::string groupName();
 
   /// Returns the group identifier of this result
-  static std::string group()
+  inline static std::string group()
   {
     static std::string MY_GROUP = "Construction";
     return MY_GROUP;
index 8e55134ef7feb0e34f7ea9612d7fe495d2938624..372cea121acec8920b0605e366df77211b96bfeb 100644 (file)
@@ -28,7 +28,7 @@ public:
   }
 
   /// Returns the group identifier of this result
-  static std::string group()
+  inline static std::string group()
   {
     static std::string MY_GROUP = "Groups";
     return MY_GROUP;
index f9ed62ecb62c8be72018bc9cb91ed137bd83d580..3b8bd1535e94112f2a4935ab32f1a00132988fb9 100644 (file)
@@ -26,7 +26,7 @@ class ModelAPI_ResultParameters : public ModelAPI_Result
   }
 
   /// Returns the group identifier of this result
-  static std::string group()
+  inline static std::string group()
   {
     static std::string MY_GROUP = "Parameters";
     return MY_GROUP;
diff --git a/src/ModelAPI/ModelAPI_ResultPart.cpp b/src/ModelAPI/ModelAPI_ResultPart.cpp
new file mode 100644 (file)
index 0000000..9790051
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        ModelAPI_ResultPart.cpp
+// Created:     12 Jan 2015
+// Author:      Sergey BELASH
+
+#include <ModelAPI_ResultPart.h>
+
+#include <string>
+
+std::string ModelAPI_ResultPart::groupName()
+{
+  return ModelAPI_ResultPart::group();
+}
index ce1ea03af1c9ad6c4a0a79b4670e0d96b39e02eb..11cae2bae8135e5063b311774cab7ecce8795003 100644 (file)
@@ -22,13 +22,10 @@ class ModelAPI_ResultPart : public ModelAPI_Result
 {
  public:
   /// Returns the group identifier of this result
-  virtual std::string groupName()
-  {
-    return group();
-  }
+  MODELAPI_EXPORT virtual std::string groupName();
 
   /// Returns the group identifier of this result
-  static std::string group()
+  inline static std::string group()
   {
     static std::string MY_GROUP = "Parts";
     return MY_GROUP;