]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Move Events messages to boost pointers: SketchSolver
authormpv <mikhail.ponikarov@opencascade.com>
Mon, 15 Sep 2014 08:24:54 +0000 (12:24 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Mon, 15 Sep 2014 08:24:54 +0000 (12:24 +0400)
src/SketchSolver/SketchSolver_ConstraintManager.cpp
src/SketchSolver/SketchSolver_ConstraintManager.h

index 480fae603d3562e63e9d66be2d8a273983929895..45ead10f90573f29441694def0d530052c93cb13 100644 (file)
@@ -59,13 +59,14 @@ SketchSolver_ConstraintManager::~SketchSolver_ConstraintManager()
 //  Class:    SketchSolver_Session
 //  Purpose:  listen the event loop and process the message
 // ============================================================================
-void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessage)
+void SketchSolver_ConstraintManager::processEvent(
+  const boost::shared_ptr<Events_Message>& theMessage)
 {
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)
       || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)
       || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) {
-    const ModelAPI_ObjectUpdatedMessage* anUpdateMsg =
-        dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+    boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+        boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     std::set<ObjectPtr> aFeatures = anUpdateMsg->objects();
 
     bool isModifiedEvt = theMessage->eventID()
@@ -102,8 +103,8 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
     // Solve the set of constraints
     resolveConstraints();
   } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
-    const ModelAPI_ObjectDeletedMessage* aDeleteMsg =
-        dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+    boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleteMsg =
+        boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
     const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
 
     // Find SketchPlugin_Sketch::ID() in groups. The constraint groups should be updated when an object removed from Sketch
index 4101906ab743d4b869d87615c83c3899bdcb024c..11e610b63372ff0ce7d832eaba1001f63f6a6ec3 100644 (file)
@@ -42,7 +42,7 @@ class SketchSolver_ConstraintManager : public Events_Listener
   /** \brief Implementation of Event Listener method
    *  \param[in] theMessage the data of the event
    */
-  virtual void processEvent(const Events_Message* theMessage);
+  virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
 
  protected:
   SketchSolver_ConstraintManager();